diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index 4187c44d0f..1bf4ca25d8 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -254,7 +254,7 @@ const char *WriteLocation(API_TYPE ApiType) } template -void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType, u32 components) +static void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType, u32 components) { // Non-uid template parameters will write to the dummy data (=> gets optimized out) pixel_shader_uid_data dummy_data; @@ -333,9 +333,9 @@ void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType, u if (ApiType == API_OPENGL) { - out.Write("COLOROUT(ocol0);\n"); + out.Write("COLOROUT(ocol0)\n"); if (dstAlphaMode == DSTALPHA_DUAL_SOURCE_BLEND) - out.Write("COLOROUT(ocol1);\n"); + out.Write("COLOROUT(ocol1)\n"); if (per_pixel_depth) out.Write("#define depth gl_FragDepth\n"); @@ -572,7 +572,7 @@ void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType, u if (Pretest == AlphaTest::UNDETERMINED) WriteAlphaTest(out, uid_data, ApiType, dstAlphaMode, per_pixel_depth); - + // the screen space depth value = far z + (clip z / clip w) * z range if(ApiType == API_OPENGL || ApiType == API_D3D11) out.Write("float zCoord = rawpos.z;\n"); @@ -584,7 +584,7 @@ void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType, u } // Note: depth textures are disabled if early depth test is enabled - uid_data.ztex.op = bpmem.ztex2.op; + uid_data.ztex_op = bpmem.ztex2.op; uid_data.per_pixel_depth = per_pixel_depth; uid_data.fog.fsel = bpmem.fog.c_proj_fsel.fsel; diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.h b/Source/Core/VideoCommon/Src/PixelShaderGen.h index 024bc170b5..783f50a301 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.h +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.h @@ -86,7 +86,7 @@ struct pixel_shader_uid_data u32 bc3 : 3; u32 bi4 : 3; u32 bc4 : 3; - void SetValues(int index, u32 texcoord, u32 texmap) + inline void SetValues(int index, u32 texcoord, u32 texmap) { if (index == 0) { bc0 = texcoord; bi0 = texmap; } else if (index == 1) { bc1 = texcoord; bi1 = texmap; } @@ -180,7 +180,6 @@ struct pixel_shader_uid_data u32 comp0 : 3; u32 comp1 : 3; u32 logic : 2; - // TODO: ref??? u32 use_zcomploc_hack : 1; } alpha_test; @@ -194,12 +193,7 @@ struct pixel_shader_uid_data u32 hex : 4; } fog; - union { - struct { - u32 op : 2; - }; - u32 hex : 2; - } ztex; + u32 ztex_op : 2; u32 per_pixel_depth : 1; u32 bHasIndStage : 16; diff --git a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp index eac041d5c9..81b8c79553 100644 --- a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp @@ -80,11 +80,6 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type) _assert_(bpmem.genMode.numcolchans == xfregs.numChan.numColorChans); bool is_d3d = (api_type & API_D3D9 || api_type == API_D3D11); - u32 lightMask = 0; - if (xfregs.numChan.numColorChans > 0) - lightMask |= xfregs.color[0].GetFullLightMask() | xfregs.alpha[0].GetFullLightMask(); - if (xfregs.numChan.numColorChans > 1) - lightMask |= xfregs.color[1].GetFullLightMask() | xfregs.alpha[1].GetFullLightMask(); // uniforms if (g_ActiveConfig.backend_info.bSupportsGLSLUBO) @@ -112,7 +107,7 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type) { out.Write("ATTRIN float4 rawpos; // ATTR%d,\n", SHADER_POSITION_ATTRIB); if (components & VB_HAS_POSMTXIDX) - out.Write("ATTRIN float posmtx; // ATTR%d,\n", SHADER_POSMTX_ATTRIB); + out.Write("ATTRIN float fposmtx; // ATTR%d,\n", SHADER_POSMTX_ATTRIB); if (components & VB_HAS_NRM0) out.Write("ATTRIN float3 rawnorm0; // ATTR%d,\n", SHADER_NORM0_ATTRIB); if (components & VB_HAS_NRM1)