diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp index 702a2dc22d..ec58c606f1 100644 --- a/Source/Core/VideoCommon/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/PixelShaderGen.cpp @@ -221,6 +221,8 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T if (ApiType == API_OPENGL) out.Write("layout(std140%s) uniform PSBlock {\n", g_ActiveConfig.backend_info.bSupportsBindingLayout ? ", binding = 1" : ""); + else + out.Write("cbuffer PSBlock {\n"); DeclareUniform(out, ApiType, C_COLORS, "int4", I_COLORS"[4]"); DeclareUniform(out, ApiType, C_KCOLORS, "int4", I_KCOLORS"[4]"); @@ -238,8 +240,7 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T DeclareUniform(out, ApiType, C_PLIGHTS, "float4", I_PLIGHTS"[32]"); DeclareUniform(out, ApiType, C_PMATERIALS, "int4", I_PMATERIALS"[4]"); - if (ApiType == API_OPENGL) - out.Write("};\n"); + out.Write("};\n"); const bool forced_early_z = g_ActiveConfig.backend_info.bSupportsEarlyZ && bpmem.UseEarlyDepthTest() && (g_ActiveConfig.bFastDepthCalc || bpmem.alpha_test.TestResult() == AlphaTest::UNDETERMINED); const bool per_pixel_depth = (bpmem.ztex2.op != ZTEXTURE_DISABLE && bpmem.UseLateDepthTest()) || (!g_ActiveConfig.bFastDepthCalc && bpmem.zmode.testenable && !forced_early_z); diff --git a/Source/Core/VideoCommon/ShaderGenCommon.h b/Source/Core/VideoCommon/ShaderGenCommon.h index ca3650855c..bf9b382633 100644 --- a/Source/Core/VideoCommon/ShaderGenCommon.h +++ b/Source/Core/VideoCommon/ShaderGenCommon.h @@ -151,31 +151,10 @@ private: std::vector constant_usage; // TODO: Is vector appropriate here? }; -template -static inline void WriteRegister(T& object, API_TYPE ApiType, const char *prefix, const u32 num) -{ - if (ApiType == API_OPENGL) - return; // Nothing to do here - - object.Write(" : register(%s%d)", prefix, num); -} - -template -static inline void WriteLocation(T& object, API_TYPE ApiType) -{ - if (ApiType == API_OPENGL) - return; - - object.Write("uniform "); -} - template static inline void DeclareUniform(T& object, API_TYPE api_type, const u32 num, const char* type, const char* name) { - WriteLocation(object, api_type); - object.Write("%s %s ", type, name); - WriteRegister(object, api_type, "c", num); - object.Write(";\n"); + object.Write("%s %s;\n", type, name); } /** 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);