From b0878c54b2a2ee1e0fd45f037562a9a6a61d919c Mon Sep 17 00:00:00 2001 From: degasus Date: Mon, 17 Mar 2014 10:19:54 +0100 Subject: ShaderGen: use cbuffers for D3D --- Source/Core/VideoCommon/VertexShaderGen.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon/VertexShaderGen.cpp') diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp index 41549609c7..05d67ed8e5 100644 --- a/Source/Core/VideoCommon/VertexShaderGen.cpp +++ b/Source/Core/VideoCommon/VertexShaderGen.cpp @@ -84,6 +84,8 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ // uniforms if (api_type == API_OPENGL) out.Write("layout(std140%s) uniform VSBlock {\n", g_ActiveConfig.backend_info.bSupportsBindingLayout ? ", binding = 2" : ""); + else + out.Write("cbuffer VSBlock {\n"); DeclareUniform(out, api_type, C_POSNORMALMATRIX, "float4", I_POSNORMALMATRIX"[6]"); DeclareUniform(out, api_type, C_PROJECTION, "float4", I_PROJECTION"[4]"); @@ -96,8 +98,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ DeclareUniform(out, api_type, C_POSTTRANSFORMMATRICES, "float4", I_POSTTRANSFORMMATRICES"[64]"); DeclareUniform(out, api_type, C_DEPTHPARAMS, "float4", I_DEPTHPARAMS); - if (api_type == API_OPENGL) - out.Write("};\n"); + out.Write("};\n"); GenerateVSOutputStruct(out, api_type); -- cgit v1.2.3 From c82991df5ba360986f18cfee32c34405f65df09f Mon Sep 17 00:00:00 2001 From: degasus Date: Mon, 17 Mar 2014 10:29:32 +0100 Subject: ShaderGen: inline constant shaders --- Source/Core/VideoCommon/VertexShaderGen.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'Source/Core/VideoCommon/VertexShaderGen.cpp') diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp index 05d67ed8e5..32bd8ae9fb 100644 --- a/Source/Core/VideoCommon/VertexShaderGen.cpp +++ b/Source/Core/VideoCommon/VertexShaderGen.cpp @@ -86,19 +86,18 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ out.Write("layout(std140%s) uniform VSBlock {\n", g_ActiveConfig.backend_info.bSupportsBindingLayout ? ", binding = 2" : ""); else out.Write("cbuffer VSBlock {\n"); - - DeclareUniform(out, api_type, C_POSNORMALMATRIX, "float4", I_POSNORMALMATRIX"[6]"); - DeclareUniform(out, api_type, C_PROJECTION, "float4", I_PROJECTION"[4]"); - DeclareUniform(out, api_type, C_MATERIALS, "int4", I_MATERIALS"[4]"); - DeclareUniform(out, api_type, C_LIGHT_COLORS, "int4", I_LIGHT_COLORS"[8]"); - DeclareUniform(out, api_type, C_LIGHTS, "float4", I_LIGHTS"[32]"); - DeclareUniform(out, api_type, C_TEXMATRICES, "float4", I_TEXMATRICES"[24]"); - DeclareUniform(out, api_type, C_TRANSFORMMATRICES, "float4", I_TRANSFORMMATRICES"[64]"); - DeclareUniform(out, api_type, C_NORMALMATRICES, "float4", I_NORMALMATRICES"[32]"); - DeclareUniform(out, api_type, C_POSTTRANSFORMMATRICES, "float4", I_POSTTRANSFORMMATRICES"[64]"); - DeclareUniform(out, api_type, C_DEPTHPARAMS, "float4", I_DEPTHPARAMS); - - out.Write("};\n"); + out.Write( + "\tfloat4 " I_POSNORMALMATRIX"[6];\n" + "\tfloat4 " I_PROJECTION"[4];\n" + "\tint4 " I_MATERIALS"[4];\n" + "\tint4 " I_LIGHT_COLORS"[8];\n" + "\tfloat4 " I_LIGHTS"[32];\n" + "\tfloat4 " I_TEXMATRICES"[24];\n" + "\tfloat4 " I_TRANSFORMMATRICES"[64];\n" + "\tfloat4 " I_NORMALMATRICES"[32];\n" + "\tfloat4 " I_POSTTRANSFORMMATRICES"[64];\n" + "\tfloat4 " I_DEPTHPARAMS";\n" + "};\n"); GenerateVSOutputStruct(out, api_type); -- cgit v1.2.3 From 0e0da8c8fd165b9fbd704ad7846ad4a000e3ae55 Mon Sep 17 00:00:00 2001 From: degasus Date: Sun, 30 Mar 2014 12:19:15 +0200 Subject: ShaderGen: make clipPos readonly --- Source/Core/VideoCommon/VertexShaderGen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon/VertexShaderGen.cpp') diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp index 32bd8ae9fb..2a98502091 100644 --- a/Source/Core/VideoCommon/VertexShaderGen.cpp +++ b/Source/Core/VideoCommon/VertexShaderGen.cpp @@ -137,7 +137,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ out.Write("centroid out float3 uv%d_2;\n", i); } } - out.Write("centroid out float4 clipPos_2;\n"); + out.Write("centroid out float4 clipPos;\n"); if (g_ActiveConfig.bEnablePixelLighting) out.Write("centroid out float4 Normal_2;\n"); @@ -434,7 +434,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ for (unsigned int i = 0; i < xfregs.numTexGen.numTexGens; ++i) out.Write(" uv%d_2.xyz = o.tex%d;\n", i, i); - out.Write(" clipPos_2 = o.clipPos;\n"); + out.Write(" clipPos = o.clipPos;\n"); if (g_ActiveConfig.bEnablePixelLighting) out.Write(" Normal_2 = o.Normal;\n"); -- cgit v1.2.3 From 6109958e68112005506c66801ab73e54cac8b4bb Mon Sep 17 00:00:00 2001 From: degasus Date: Sun, 30 Mar 2014 12:22:59 +0200 Subject: ShaderGen: OGL: don't make a copy of "Normal" --- Source/Core/VideoCommon/VertexShaderGen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon/VertexShaderGen.cpp') diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp index 2a98502091..9bb1ffcf2e 100644 --- a/Source/Core/VideoCommon/VertexShaderGen.cpp +++ b/Source/Core/VideoCommon/VertexShaderGen.cpp @@ -139,7 +139,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ } out.Write("centroid out float4 clipPos;\n"); if (g_ActiveConfig.bEnablePixelLighting) - out.Write("centroid out float4 Normal_2;\n"); + out.Write("centroid out float4 Normal;\n"); out.Write("centroid out float4 colors_02;\n"); out.Write("centroid out float4 colors_12;\n"); @@ -436,7 +436,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ out.Write(" uv%d_2.xyz = o.tex%d;\n", i, i); out.Write(" clipPos = o.clipPos;\n"); if (g_ActiveConfig.bEnablePixelLighting) - out.Write(" Normal_2 = o.Normal;\n"); + out.Write(" Normal = o.Normal;\n"); out.Write("colors_02 = o.colors_0;\n"); out.Write("colors_12 = o.colors_1;\n"); -- cgit v1.2.3 From 813e30ec2a337e09b5a0339144c9f6b4d356b9a8 Mon Sep 17 00:00:00 2001 From: degasus Date: Sun, 30 Mar 2014 12:36:57 +0200 Subject: ShaderGen: make uv readonly --- Source/Core/VideoCommon/VertexShaderGen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon/VertexShaderGen.cpp') diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp index 9bb1ffcf2e..e372c96827 100644 --- a/Source/Core/VideoCommon/VertexShaderGen.cpp +++ b/Source/Core/VideoCommon/VertexShaderGen.cpp @@ -134,7 +134,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ { if (i < xfregs.numTexGen.numTexGens) { - out.Write("centroid out float3 uv%d_2;\n", i); + out.Write("centroid out float3 uv%d;\n", i); } } out.Write("centroid out float4 clipPos;\n"); @@ -433,7 +433,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ // clipPos/w needs to be done in pixel shader, not here for (unsigned int i = 0; i < xfregs.numTexGen.numTexGens; ++i) - out.Write(" uv%d_2.xyz = o.tex%d;\n", i, i); + out.Write(" uv%d.xyz = o.tex%d;\n", i, i); out.Write(" clipPos = o.clipPos;\n"); if (g_ActiveConfig.bEnablePixelLighting) out.Write(" Normal = o.Normal;\n"); -- cgit v1.2.3