Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
VertexShaderGen: Fix a potential bug where vertex shader uids don't c…
…hange when

pixel lighting is toggled.

Same as revision f524312 but done properly (why is our shader gen code this dumb?).
  • Loading branch information
neobrain committed Jun 30, 2013
1 parent b8b5427 commit c34c82e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/Core/VideoCommon/Src/VertexShaderGen.cpp
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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<T>(out, uid_data.lighting, components, I_MATERIALS, I_LIGHTS, "color", "o.colors_");
GenerateLightingShader<T>(out, uid_data.lighting, components, I_MATERIALS, I_LIGHTS, "color", "o.colors_");

if (xfregs.numChan.numColorChans < 2)
{
Expand Down
1 change: 1 addition & 0 deletions Source/Core/VideoCommon/Src/VertexShaderGen.h
Expand Up @@ -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 {
Expand Down

0 comments on commit c34c82e

Please sign in to comment.