mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 16:19:28 +01:00
ShaderGenCommon: Move uniforms into a common static string.
This commit is contained in:
parent
0a72cf94cb
commit
176191dc16
@ -56,18 +56,8 @@ static inline void GenerateGeometryShader(T& out, u32 components, API_TYPE ApiTy
|
||||
out.Write("layout(std140%s) uniform VSBlock {\n", g_ActiveConfig.backend_info.bSupportsBindingLayout ? ", binding = 2" : "");
|
||||
else
|
||||
out.Write("cbuffer VSBlock {\n");
|
||||
out.Write(
|
||||
"\tfloat4 " I_POSNORMALMATRIX"[6];\n"
|
||||
"\tfloat4 " I_PROJECTION"[4];\n"
|
||||
"\tint4 " I_MATERIALS"[4];\n"
|
||||
"\tLight " I_LIGHTS"[8];\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"
|
||||
"\tfloat4 " I_STEREOPROJECTION"[8];\n"
|
||||
"};\n");
|
||||
out.Write(s_shader_uniforms);
|
||||
out.Write("};\n");
|
||||
|
||||
GenerateVSOutputStruct(out, ApiType);
|
||||
|
||||
|
@ -254,18 +254,8 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
|
||||
{
|
||||
out.Write("cbuffer VSBlock : register(b1) {\n");
|
||||
}
|
||||
out.Write(
|
||||
"\tfloat4 " I_POSNORMALMATRIX"[6];\n"
|
||||
"\tfloat4 " I_PROJECTION"[4];\n"
|
||||
"\tint4 " I_MATERIALS"[4];\n"
|
||||
"\tLight " I_LIGHTS"[8];\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"
|
||||
"\tfloat4 " I_STEREOPROJECTION"[8];\n"
|
||||
"};\n");
|
||||
out.Write(s_shader_uniforms);
|
||||
out.Write("};\n");
|
||||
}
|
||||
|
||||
if (g_ActiveConfig.backend_info.bSupportsBBox)
|
||||
|
@ -240,3 +240,15 @@ private:
|
||||
#define I_POSTTRANSFORMMATRICES "cpostmtx"
|
||||
#define I_DEPTHPARAMS "cDepth" // farZ, zRange
|
||||
#define I_STEREOPROJECTION "csproj"
|
||||
|
||||
static const char s_shader_uniforms[] =
|
||||
"\tfloat4 " I_POSNORMALMATRIX"[6];\n"
|
||||
"\tfloat4 " I_PROJECTION"[4];\n"
|
||||
"\tint4 " I_MATERIALS"[4];\n"
|
||||
"\tLight " I_LIGHTS"[8];\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"
|
||||
"\tfloat4 " I_STEREOPROJECTION"[8];\n";
|
||||
|
@ -92,18 +92,8 @@ 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");
|
||||
out.Write(
|
||||
"\tfloat4 " I_POSNORMALMATRIX"[6];\n"
|
||||
"\tfloat4 " I_PROJECTION"[4];\n"
|
||||
"\tint4 " I_MATERIALS"[4];\n"
|
||||
"\tLight " I_LIGHTS"[8];\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"
|
||||
"\tfloat4 " I_STEREOPROJECTION"[8];\n"
|
||||
"};\n");
|
||||
out.Write(s_shader_uniforms);
|
||||
out.Write("};\n");
|
||||
|
||||
GenerateVSOutputStruct(out, api_type);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user