diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/pica.h | 33 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.h | 10 |
2 files changed, 23 insertions, 20 deletions
diff --git a/src/video_core/pica.h b/src/video_core/pica.h index c63d87a36..1808d4396 100644 --- a/src/video_core/pica.h +++ b/src/video_core/pica.h | |||
| @@ -715,26 +715,29 @@ struct Regs { | |||
| 715 | union { | 715 | union { |
| 716 | BitField< 4, 4, u32> config; | 716 | BitField< 4, 4, u32> config; |
| 717 | BitField<27, 1, u32> clamp_highlights; | 717 | BitField<27, 1, u32> clamp_highlights; |
| 718 | } light_env; | 718 | }; |
| 719 | 719 | ||
| 720 | union { | 720 | union { |
| 721 | // Each bit specifies whether distance attenuation should be applied for the | 721 | // Each bit specifies whether distance attenuation should be applied for the |
| 722 | // corresponding light | 722 | // corresponding light |
| 723 | 723 | ||
| 724 | BitField<24, 1, u32> light_0; | 724 | BitField<24, 1, u32> dist_atten_enable_light_0; |
| 725 | BitField<25, 1, u32> light_1; | 725 | BitField<25, 1, u32> dist_atten_enable_light_1; |
| 726 | BitField<26, 1, u32> light_2; | 726 | BitField<26, 1, u32> dist_atten_enable_light_2; |
| 727 | BitField<27, 1, u32> light_3; | 727 | BitField<27, 1, u32> dist_atten_enable_light_3; |
| 728 | BitField<28, 1, u32> light_4; | 728 | BitField<28, 1, u32> dist_atten_enable_light_4; |
| 729 | BitField<29, 1, u32> light_5; | 729 | BitField<29, 1, u32> dist_atten_enable_light_5; |
| 730 | BitField<30, 1, u32> light_6; | 730 | BitField<30, 1, u32> dist_atten_enable_light_6; |
| 731 | BitField<31, 1, u32> light_7; | 731 | BitField<31, 1, u32> dist_atten_enable_light_7; |
| 732 | 732 | }; | |
| 733 | bool IsEnabled(unsigned index) const { | 733 | |
| 734 | const unsigned enable[] = { light_0, light_1, light_2, light_3, light_4, light_5, light_6, light_7 }; | 734 | bool IsDistAttenEnabled(unsigned index) const { |
| 735 | return enable[index] == 0; | 735 | const unsigned enable[] = { dist_atten_enable_light_0, dist_atten_enable_light_1, |
| 736 | } | 736 | dist_atten_enable_light_2, dist_atten_enable_light_3, |
| 737 | } dist_atten_enable; | 737 | dist_atten_enable_light_4, dist_atten_enable_light_5, |
| 738 | dist_atten_enable_light_6, dist_atten_enable_light_7 }; | ||
| 739 | return enable[index] == 0; | ||
| 740 | } | ||
| 738 | 741 | ||
| 739 | union { | 742 | union { |
| 740 | BitField<0, 8, u32> index; ///< Index at which to set data in the LUT | 743 | BitField<0, 8, u32> index; ///< Index at which to set data in the LUT |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index b50542701..17bda2d1d 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h | |||
| @@ -80,16 +80,16 @@ struct PicaShaderConfig { | |||
| 80 | unsigned num = regs.lighting.light_enable.GetNum(light_index); | 80 | unsigned num = regs.lighting.light_enable.GetNum(light_index); |
| 81 | const auto& light = regs.lighting.light[num]; | 81 | const auto& light = regs.lighting.light[num]; |
| 82 | res.light_src[light_index].num = num; | 82 | res.light_src[light_index].num = num; |
| 83 | res.light_src[light_index].directional = light.w; | 83 | res.light_src[light_index].directional = light.w != 0; |
| 84 | res.light_src[light_index].two_sided_diffuse = light.two_sided_diffuse; | 84 | res.light_src[light_index].two_sided_diffuse = light.two_sided_diffuse != 0; |
| 85 | res.light_src[light_index].dist_atten_enabled = regs.lighting.dist_atten_enable.IsEnabled(num); | 85 | res.light_src[light_index].dist_atten_enabled = regs.lighting.IsDistAttenEnabled(num); |
| 86 | res.light_src[light_index].dist_atten_bias = Pica::float20::FromRawFloat20(light.dist_atten_bias).ToFloat32(); | 86 | res.light_src[light_index].dist_atten_bias = Pica::float20::FromRawFloat20(light.dist_atten_bias).ToFloat32(); |
| 87 | res.light_src[light_index].dist_atten_scale = Pica::float20::FromRawFloat20(light.dist_atten_scale).ToFloat32(); | 87 | res.light_src[light_index].dist_atten_scale = Pica::float20::FromRawFloat20(light.dist_atten_scale).ToFloat32(); |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | res.lighting_lut.d0_abs = (regs.lighting.abs_lut_input.d0 == 0); | 90 | res.lighting_lut.d0_abs = regs.lighting.abs_lut_input.d0 == 0; |
| 91 | res.lighting_lut.d0_type = (Pica::Regs::LightingLutInput)regs.lighting.lut_input.d0.Value(); | 91 | res.lighting_lut.d0_type = (Pica::Regs::LightingLutInput)regs.lighting.lut_input.d0.Value(); |
| 92 | res.clamp_highlights = regs.lighting.light_env.clamp_highlights; | 92 | res.clamp_highlights = regs.lighting.clamp_highlights != 0; |
| 93 | 93 | ||
| 94 | return res; | 94 | return res; |
| 95 | } | 95 | } |