diff options
author | bunnei <bunneidev@gmail.com> | 2015-11-19 04:55:24 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2016-02-05 23:17:33 +0100 |
commit | 6878ba7608b14b6508f8de8f0070acdba6bb1837 (patch) | |
tree | c3855c19480d363fb15b609a0c89eb712e010bcc /src/video_core | |
parent | gl_shader_gen: Reorganize and cleanup lighting code. (diff) | |
download | yuzu-6878ba7608b14b6508f8de8f0070acdba6bb1837.tar yuzu-6878ba7608b14b6508f8de8f0070acdba6bb1837.tar.gz yuzu-6878ba7608b14b6508f8de8f0070acdba6bb1837.tar.bz2 yuzu-6878ba7608b14b6508f8de8f0070acdba6bb1837.tar.lz yuzu-6878ba7608b14b6508f8de8f0070acdba6bb1837.tar.xz yuzu-6878ba7608b14b6508f8de8f0070acdba6bb1837.tar.zst yuzu-6878ba7608b14b6508f8de8f0070acdba6bb1837.zip |
Diffstat (limited to 'src/video_core')
-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 { union { BitField< 4, 4, u32> config; BitField<27, 1, u32> clamp_highlights; - } light_env; + }; union { // Each bit specifies whether distance attenuation should be applied for the // corresponding light - BitField<24, 1, u32> light_0; - BitField<25, 1, u32> light_1; - BitField<26, 1, u32> light_2; - BitField<27, 1, u32> light_3; - BitField<28, 1, u32> light_4; - BitField<29, 1, u32> light_5; - BitField<30, 1, u32> light_6; - BitField<31, 1, u32> light_7; - - bool IsEnabled(unsigned index) const { - const unsigned enable[] = { light_0, light_1, light_2, light_3, light_4, light_5, light_6, light_7 }; - return enable[index] == 0; - } - } dist_atten_enable; + BitField<24, 1, u32> dist_atten_enable_light_0; + BitField<25, 1, u32> dist_atten_enable_light_1; + BitField<26, 1, u32> dist_atten_enable_light_2; + BitField<27, 1, u32> dist_atten_enable_light_3; + BitField<28, 1, u32> dist_atten_enable_light_4; + BitField<29, 1, u32> dist_atten_enable_light_5; + BitField<30, 1, u32> dist_atten_enable_light_6; + BitField<31, 1, u32> dist_atten_enable_light_7; + }; + + bool IsDistAttenEnabled(unsigned index) const { + const unsigned enable[] = { dist_atten_enable_light_0, dist_atten_enable_light_1, + dist_atten_enable_light_2, dist_atten_enable_light_3, + dist_atten_enable_light_4, dist_atten_enable_light_5, + dist_atten_enable_light_6, dist_atten_enable_light_7 }; + return enable[index] == 0; + } union { 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 { unsigned num = regs.lighting.light_enable.GetNum(light_index); const auto& light = regs.lighting.light[num]; res.light_src[light_index].num = num; - res.light_src[light_index].directional = light.w; - res.light_src[light_index].two_sided_diffuse = light.two_sided_diffuse; - res.light_src[light_index].dist_atten_enabled = regs.lighting.dist_atten_enable.IsEnabled(num); + res.light_src[light_index].directional = light.w != 0; + res.light_src[light_index].two_sided_diffuse = light.two_sided_diffuse != 0; + res.light_src[light_index].dist_atten_enabled = regs.lighting.IsDistAttenEnabled(num); res.light_src[light_index].dist_atten_bias = Pica::float20::FromRawFloat20(light.dist_atten_bias).ToFloat32(); res.light_src[light_index].dist_atten_scale = Pica::float20::FromRawFloat20(light.dist_atten_scale).ToFloat32(); } - res.lighting_lut.d0_abs = (regs.lighting.abs_lut_input.d0 == 0); + res.lighting_lut.d0_abs = regs.lighting.abs_lut_input.d0 == 0; res.lighting_lut.d0_type = (Pica::Regs::LightingLutInput)regs.lighting.lut_input.d0.Value(); - res.clamp_highlights = regs.lighting.light_env.clamp_highlights; + res.clamp_highlights = regs.lighting.clamp_highlights != 0; return res; } |