diff --git a/Source/Core/VideoBackends/D3D/GeometryShaderCache.cpp b/Source/Core/VideoBackends/D3D/GeometryShaderCache.cpp index bf0a75c7d8..bacca56a7b 100644 --- a/Source/Core/VideoBackends/D3D/GeometryShaderCache.cpp +++ b/Source/Core/VideoBackends/D3D/GeometryShaderCache.cpp @@ -228,7 +228,7 @@ bool GeometryShaderCache::SetShader(u32 primitive_type) } // Need to compile a new shader - ShaderCode code = GenerateGeometryShaderCode(primitive_type, API_D3D, uid.GetUidData()); + ShaderCode code = GenerateGeometryShaderCode(API_D3D, uid.GetUidData()); D3DBlob* pbytecode; if (!D3D::CompileGeometryShader(code.GetBuffer(), &pbytecode)) diff --git a/Source/Core/VideoBackends/D3D12/ShaderCache.cpp b/Source/Core/VideoBackends/D3D12/ShaderCache.cpp index d57d61073e..13a7c99465 100644 --- a/Source/Core/VideoBackends/D3D12/ShaderCache.cpp +++ b/Source/Core/VideoBackends/D3D12/ShaderCache.cpp @@ -222,8 +222,7 @@ void ShaderCache::HandleGSUIDChange(GeometryShaderUid gs_uid, u32 gs_primitive_t } else { - ShaderCode gs_code = - GenerateGeometryShaderCode(gs_primitive_type, API_D3D, gs_uid.GetUidData()); + ShaderCode gs_code = GenerateGeometryShaderCode(API_D3D, gs_uid.GetUidData()); ID3DBlob* gs_bytecode = nullptr; if (!D3D::CompileGeometryShader(gs_code.GetBuffer(), &gs_bytecode)) diff --git a/Source/Core/VideoBackends/Null/ShaderCache.cpp b/Source/Core/VideoBackends/Null/ShaderCache.cpp index 19dcc778d4..a08ef6952b 100644 --- a/Source/Core/VideoBackends/Null/ShaderCache.cpp +++ b/Source/Core/VideoBackends/Null/ShaderCache.cpp @@ -59,7 +59,7 @@ bool ShaderCache<Uid>::SetShader(DSTALPHA_MODE dst_alpha_mode, u32 primitive_typ } // Need to compile a new shader - ShaderCode code = GenerateCode(dst_alpha_mode, primitive_type, API_OPENGL, uid); + ShaderCode code = GenerateCode(dst_alpha_mode, API_OPENGL, uid); m_shaders.emplace(uid, code.GetBuffer()); GFX_DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE, true); diff --git a/Source/Core/VideoBackends/Null/ShaderCache.h b/Source/Core/VideoBackends/Null/ShaderCache.h index a988f81ce9..2dcdaf85b7 100644 --- a/Source/Core/VideoBackends/Null/ShaderCache.h +++ b/Source/Core/VideoBackends/Null/ShaderCache.h @@ -26,8 +26,7 @@ public: protected: virtual Uid GetUid(DSTALPHA_MODE dst_alpha_mode, u32 primitive_type, API_TYPE api_type) = 0; - virtual ShaderCode GenerateCode(DSTALPHA_MODE dst_alpha_mode, u32 primitive_type, - API_TYPE api_type, Uid uid) = 0; + virtual ShaderCode GenerateCode(DSTALPHA_MODE dst_alpha_mode, API_TYPE api_type, Uid uid) = 0; private: std::map<Uid, std::string> m_shaders; @@ -46,7 +45,7 @@ protected: { return GetVertexShaderUid(); } - ShaderCode GenerateCode(DSTALPHA_MODE dst_alpha_mode, u32 primitive_type, API_TYPE api_type, + ShaderCode GenerateCode(DSTALPHA_MODE dst_alpha_mode, API_TYPE api_type, VertexShaderUid uid) override { return GenerateVertexShaderCode(api_type, uid.GetUidData()); @@ -64,10 +63,10 @@ protected: { return GetGeometryShaderUid(primitive_type); } - ShaderCode GenerateCode(DSTALPHA_MODE dst_alpha_mode, u32 primitive_type, API_TYPE api_type, + ShaderCode GenerateCode(DSTALPHA_MODE dst_alpha_mode, API_TYPE api_type, GeometryShaderUid uid) override { - return GenerateGeometryShaderCode(primitive_type, api_type, uid.GetUidData()); + return GenerateGeometryShaderCode(api_type, uid.GetUidData()); } }; @@ -82,7 +81,7 @@ protected: { return GetPixelShaderUid(dst_alpha_mode); } - ShaderCode GenerateCode(DSTALPHA_MODE dst_alpha_mode, u32 primitive_type, API_TYPE api_type, + ShaderCode GenerateCode(DSTALPHA_MODE dst_alpha_mode, API_TYPE api_type, PixelShaderUid uid) override { return GeneratePixelShaderCode(dst_alpha_mode, api_type, uid.GetUidData()); diff --git a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp index 06ce67acfc..4425444b8d 100644 --- a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp +++ b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp @@ -211,7 +211,7 @@ SHADER* ProgramShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 primitive_ ShaderCode gcode; if (g_ActiveConfig.backend_info.bSupportsGeometryShaders && !uid.guid.GetUidData()->IsPassthrough()) - gcode = GenerateGeometryShaderCode(primitive_type, API_OPENGL, uid.guid.GetUidData()); + gcode = GenerateGeometryShaderCode(API_OPENGL, uid.guid.GetUidData()); if (g_ActiveConfig.bEnableShaderDebugging) { diff --git a/Source/Core/VideoCommon/GeometryShaderGen.cpp b/Source/Core/VideoCommon/GeometryShaderGen.cpp index f509072f8e..a137b7ff06 100644 --- a/Source/Core/VideoCommon/GeometryShaderGen.cpp +++ b/Source/Core/VideoCommon/GeometryShaderGen.cpp @@ -42,14 +42,13 @@ static void EmitVertex(ShaderCode& out, const geometry_shader_uid_data* uid_data static void EndPrimitive(ShaderCode& out, const geometry_shader_uid_data* uid_data, API_TYPE ApiType); -ShaderCode GenerateGeometryShaderCode(u32 primitive_type, API_TYPE ApiType, - const geometry_shader_uid_data* uid_data) +ShaderCode GenerateGeometryShaderCode(API_TYPE ApiType, const geometry_shader_uid_data* uid_data) { ShaderCode out; // Non-uid template parameters will write to the dummy data (=> gets optimized out) - const unsigned int vertex_in = primitive_type + 1; - unsigned int vertex_out = primitive_type == PRIMITIVE_TRIANGLES ? 3 : 4; + const unsigned int vertex_in = uid_data->primitive_type + 1; + unsigned int vertex_out = uid_data->primitive_type == PRIMITIVE_TRIANGLES ? 3 : 4; if (uid_data->wireframe) vertex_out++; @@ -59,14 +58,14 @@ ShaderCode GenerateGeometryShaderCode(u32 primitive_type, API_TYPE ApiType, // Insert layout parameters if (g_ActiveConfig.backend_info.bSupportsGSInstancing) { - out.Write("layout(%s, invocations = %d) in;\n", primitives_ogl[primitive_type], + out.Write("layout(%s, invocations = %d) in;\n", primitives_ogl[uid_data->primitive_type], uid_data->stereo ? 2 : 1); out.Write("layout(%s_strip, max_vertices = %d) out;\n", uid_data->wireframe ? "line" : "triangle", vertex_out); } else { - out.Write("layout(%s) in;\n", primitives_ogl[primitive_type]); + out.Write("layout(%s) in;\n", primitives_ogl[uid_data->primitive_type]); out.Write("layout(%s_strip, max_vertices = %d) out;\n", uid_data->wireframe ? "line" : "triangle", uid_data->stereo ? vertex_out * 2 : vertex_out); @@ -130,21 +129,21 @@ ShaderCode GenerateGeometryShaderCode(u32 primitive_type, API_TYPE ApiType, out.Write("[maxvertexcount(%d)]\n[instance(%d)]\n", vertex_out, uid_data->stereo ? 2 : 1); out.Write("void main(%s VS_OUTPUT o[%d], inout %sStream<VertexData> output, in uint " "InstanceID : SV_GSInstanceID)\n{\n", - primitives_d3d[primitive_type], vertex_in, + primitives_d3d[uid_data->primitive_type], vertex_in, uid_data->wireframe ? "Line" : "Triangle"); } else { out.Write("[maxvertexcount(%d)]\n", uid_data->stereo ? vertex_out * 2 : vertex_out); out.Write("void main(%s VS_OUTPUT o[%d], inout %sStream<VertexData> output)\n{\n", - primitives_d3d[primitive_type], vertex_in, + primitives_d3d[uid_data->primitive_type], vertex_in, uid_data->wireframe ? "Line" : "Triangle"); } out.Write("\tVertexData ps;\n"); } - if (primitive_type == PRIMITIVE_LINES) + if (uid_data->primitive_type == PRIMITIVE_LINES) { if (ApiType == API_OPENGL) { @@ -175,7 +174,7 @@ ShaderCode GenerateGeometryShaderCode(u32 primitive_type, API_TYPE ApiType, "\t\toffset = float2(0, -" I_LINEPTPARAMS ".z / " I_LINEPTPARAMS ".y);\n" "\t}\n"); } - else if (primitive_type == PRIMITIVE_POINTS) + else if (uid_data->primitive_type == PRIMITIVE_POINTS) { if (ApiType == API_OPENGL) { @@ -235,7 +234,7 @@ ShaderCode GenerateGeometryShaderCode(u32 primitive_type, API_TYPE ApiType, out.Write("\tf.pos.x += " I_STEREOPARAMS "[eye] * (f.pos.w - " I_STEREOPARAMS "[2]);\n"); } - if (primitive_type == PRIMITIVE_LINES) + if (uid_data->primitive_type == PRIMITIVE_LINES) { out.Write("\tVS_OUTPUT l = f;\n" "\tVS_OUTPUT r = f;\n"); @@ -256,7 +255,7 @@ ShaderCode GenerateGeometryShaderCode(u32 primitive_type, API_TYPE ApiType, EmitVertex(out, uid_data, "l", ApiType, true); EmitVertex(out, uid_data, "r", ApiType); } - else if (primitive_type == PRIMITIVE_POINTS) + else if (uid_data->primitive_type == PRIMITIVE_POINTS) { out.Write("\tVS_OUTPUT ll = f;\n" "\tVS_OUTPUT lr = f;\n" diff --git a/Source/Core/VideoCommon/GeometryShaderGen.h b/Source/Core/VideoCommon/GeometryShaderGen.h index 0d10078836..181bc502e1 100644 --- a/Source/Core/VideoCommon/GeometryShaderGen.h +++ b/Source/Core/VideoCommon/GeometryShaderGen.h @@ -31,6 +31,5 @@ struct geometry_shader_uid_data typedef ShaderUid<geometry_shader_uid_data> GeometryShaderUid; -ShaderCode GenerateGeometryShaderCode(u32 primitive_type, API_TYPE ApiType, - const geometry_shader_uid_data* uid_data); +ShaderCode GenerateGeometryShaderCode(API_TYPE ApiType, const geometry_shader_uid_data* uid_data); GeometryShaderUid GetGeometryShaderUid(u32 primitive_type); diff --git a/Source/Core/VideoCommon/PixelShaderGen.h b/Source/Core/VideoCommon/PixelShaderGen.h index 5b02171129..b222a1958f 100644 --- a/Source/Core/VideoCommon/PixelShaderGen.h +++ b/Source/Core/VideoCommon/PixelShaderGen.h @@ -63,7 +63,7 @@ struct pixel_shader_uid_data u32 tevindref_bi4 : 3; u32 tevindref_bc4 : 3; - inline void SetTevindrefValues(int index, u32 texcoord, u32 texmap) + void SetTevindrefValues(int index, u32 texcoord, u32 texmap) { if (index == 0) { @@ -87,7 +87,7 @@ struct pixel_shader_uid_data } } - inline u32 GetTevindirefCoord(int index) const + u32 GetTevindirefCoord(int index) const { if (index == 0) { @@ -108,7 +108,7 @@ struct pixel_shader_uid_data return 0; } - inline u32 GetTevindirefMap(int index) const + u32 GetTevindirefMap(int index) const { if (index == 0) { diff --git a/Source/Core/VideoCommon/VertexShaderGen.h b/Source/Core/VideoCommon/VertexShaderGen.h index 27ca46e19d..e8dfba2e1c 100644 --- a/Source/Core/VideoCommon/VertexShaderGen.h +++ b/Source/Core/VideoCommon/VertexShaderGen.h @@ -39,9 +39,9 @@ struct vertex_shader_uid_data u32 pixel_lighting : 1; u32 msaa : 1; - u32 ssaa : 1; u32 texMtxInfo_n_projection : 16; // Stored separately to guarantee that the texMtxInfo struct is // 8 bits wide + u32 ssaa : 1; u32 pad : 15; struct