From c34c82e7ae3209c083c18573f0494057828290ed Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Sun, 30 Jun 2013 14:27:04 +0200 Subject: [PATCH] VertexShaderGen: Fix a potential bug where vertex shader uids don't change when pixel lighting is toggled. Same as revision f524312fd17e but done properly (why is our shader gen code this dumb?). --- Source/Core/VideoCommon/Src/VertexShaderGen.cpp | 4 ++-- Source/Core/VideoCommon/Src/VertexShaderGen.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp index 758012f972..63b752b838 100644 --- a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp @@ -114,6 +114,7 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type) uid_data.numTexGens = xfregs.numTexGen.numTexGens; uid_data.components = components; + uid_data.pixel_lighting = (g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting); if(api_type == API_OPENGL) { @@ -279,8 +280,7 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type) out.Write("o.colors_0 = float4(1.0f, 1.0f, 1.0f, 1.0f);\n"); } - if (!(g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)) - GenerateLightingShader(out, uid_data.lighting, components, I_MATERIALS, I_LIGHTS, "color", "o.colors_"); + GenerateLightingShader(out, uid_data.lighting, components, I_MATERIALS, I_LIGHTS, "color", "o.colors_"); if (xfregs.numChan.numColorChans < 2) { diff --git a/Source/Core/VideoCommon/Src/VertexShaderGen.h b/Source/Core/VideoCommon/Src/VertexShaderGen.h index 797fe7d108..a28f4758fa 100644 --- a/Source/Core/VideoCommon/Src/VertexShaderGen.h +++ b/Source/Core/VideoCommon/Src/VertexShaderGen.h @@ -76,6 +76,7 @@ struct vertex_shader_uid_data u32 numTexGens : 4; u32 dualTexTrans_enabled : 1; + u32 pixel_lighting : 1; u32 texMtxInfo_n_projection : 16; // Stored separately to guarantee that the texMtxInfo struct is 8 bits wide struct {