summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/PixelShaderGen.cpp
diff options
context:
space:
mode:
authordegasus <wickmarkus@web.de>2014-05-30 15:19:04 +0200
committerdegasus <wickmarkus@web.de>2014-06-19 16:33:33 +0200
commitd93f2973f7330a033253d94a738f820231bb6623 (patch)
tree5a8f1fd8bcc20dd4c6654307e9d6471a1687bac8 /Source/Core/VideoCommon/PixelShaderGen.cpp
parent027baad73ba17f0a5d6311b7abbefbcca7f9b6a5 (diff)
PixelShader: use the vertex const buffer for ppl
Diffstat (limited to 'Source/Core/VideoCommon/PixelShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/PixelShaderGen.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp
index b3db7ec6a5..dd010f1583 100644
--- a/Source/Core/VideoCommon/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/PixelShaderGen.cpp
@@ -14,6 +14,7 @@
#include "VideoCommon/LightingShaderGen.h"
#include "VideoCommon/NativeVertexFormat.h"
#include "VideoCommon/PixelShaderGen.h"
+#include "VideoCommon/VertexShaderGen.h"
#include "VideoCommon/VideoConfig.h"
#include "VideoCommon/XFMemory.h" // for texture projection mode
@@ -218,9 +219,13 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
out.Write("\n");
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");
+ {
+ out.Write("cbuffer PSBlock : register(b0) {\n");
+ }
out.Write(
"\tint4 " I_COLORS"[4];\n"
"\tint4 " I_KCOLORS"[4];\n"
@@ -239,6 +244,27 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
"\tint4 " I_PMATERIALS"[4];\n"
"};\n");
+ if (ApiType == API_OPENGL)
+ {
+ out.Write("layout(std140%s) uniform VSBlock {\n", g_ActiveConfig.backend_info.bSupportsBindingLayout ? ", binding = 2" : "");
+ }
+ else
+ {
+ out.Write("cbuffer VSBlock : register(b1) {\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");
+
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);
@@ -355,7 +381,7 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
out.SetConstantsUsed(C_PLIGHTS, C_PLIGHTS+31); // TODO: Can be optimized further
out.SetConstantsUsed(C_PMATERIALS, C_PMATERIALS+3);
uid_data.components = components;
- GenerateLightingShader<T>(out, uid_data.lighting, components, I_PMATERIALS, I_PLIGHT_COLORS, I_PLIGHTS, "colors_", "colors_");
+ GenerateLightingShader<T>(out, uid_data.lighting, components, I_MATERIALS, I_LIGHT_COLORS, I_LIGHTS, "colors_", "colors_");
}
// HACK to handle cases where the tex gen is not enabled