summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/PixelShaderGen.cpp
diff options
context:
space:
mode:
authorDolphin Bot <dolphin-emu-bot@users.noreply.github.com>2014-12-14 13:42:45 +0100
committerDolphin Bot <dolphin-emu-bot@users.noreply.github.com>2014-12-14 13:42:45 +0100
commit21ac9aa715d7bfc24e52474c2511892ed4ad6ac8 (patch)
tree5f0bbfc8bb3ee85a9210b1ef7e6a25d203e83b93 /Source/Core/VideoCommon/PixelShaderGen.cpp
parent5aa1d4733d30c2779bd857940699c01d079fe80f (diff)
parent6c7bed25a541a3093a9e9e6c43751b34592e42c0 (diff)
Merge pull request #1612 from Armada651/d3d-stereo-3d
D3D: Add geometry shader stereoscopy support.
Diffstat (limited to 'Source/Core/VideoCommon/PixelShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/PixelShaderGen.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp
index 0e0e9d214c..48cd5b8fec 100644
--- a/Source/Core/VideoCommon/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/PixelShaderGen.cpp
@@ -205,7 +205,7 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
out.Write("\n");
for (int i = 0; i < 8; ++i)
- out.Write("Texture2D Tex%d : register(t%d);\n", i, i);
+ out.Write("Texture2DArray Tex%d : register(t%d);\n", i, i);
}
out.Write("\n");
@@ -264,7 +264,7 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
}
}
- GenerateVSOutputStruct(out, ApiType);
+ GenerateVSOutputStruct<T>(out, ApiType);
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);
@@ -319,7 +319,7 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
uid_data->stereo = g_ActiveConfig.iStereoMode > 0;
if (g_ActiveConfig.iStereoMode > 0)
{
- out.Write("centroid in VS_OUTPUT f;\n");
+ out.Write("centroid in VS_OUTPUT vs;\n");
out.Write("flat in int layer;\n");
}
else
@@ -348,19 +348,19 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
// Let's set up attributes
for (unsigned int i = 0; i < numTexgen; ++i)
{
- out.Write("\tfloat3 uv%d = f.tex%d;\n", i, i);
+ out.Write("\tfloat3 uv%d = vs.tex%d;\n", i, i);
}
- out.Write("\tfloat4 clipPos = f.clipPos;\n");
+ out.Write("\tfloat4 clipPos = vs.clipPos;\n");
if (g_ActiveConfig.bEnablePixelLighting)
{
- out.Write("\tfloat4 Normal = f.Normal;\n");
+ out.Write("\tfloat4 Normal = vs.Normal;\n");
}
}
// On Mali, global variables must be initialized as constants.
// This is why we initialize these variables locally instead.
- out.Write("\tfloat4 colors_0 = %s;\n", (g_ActiveConfig.iStereoMode > 0) ? "f.colors_0" : "colors_02");
- out.Write("\tfloat4 colors_1 = %s;\n", (g_ActiveConfig.iStereoMode > 0) ? "f.colors_1" : "colors_12");
+ out.Write("\tfloat4 colors_0 = %s;\n", (g_ActiveConfig.iStereoMode > 0) ? "vs.colors_0" : "colors_02");
+ out.Write("\tfloat4 colors_1 = %s;\n", (g_ActiveConfig.iStereoMode > 0) ? "vs.colors_1" : "colors_12");
out.Write("\tfloat4 rawpos = gl_FragCoord;\n");
}
@@ -372,7 +372,7 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
per_pixel_depth ? "\n out float depth : SV_Depth," : "");
out.Write(" in centroid float4 colors_0 : COLOR0,\n");
- out.Write(" in centroid float4 colors_1 : COLOR1");
+ out.Write(" in centroid float4 colors_1 : COLOR1\n");
// compute window position if needed because binding semantic WPOS is not widely supported
for (unsigned int i = 0; i < numTexgen; ++i)
@@ -380,6 +380,9 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
out.Write(",\n in centroid float4 clipPos : TEXCOORD%d", numTexgen);
if (g_ActiveConfig.bEnablePixelLighting)
out.Write(",\n in centroid float4 Normal : TEXCOORD%d", numTexgen + 1);
+ uid_data->stereo = g_ActiveConfig.iStereoMode > 0;
+ if (g_ActiveConfig.iStereoMode > 0)
+ out.Write(",\n in uint layer : SV_RenderTargetArrayIndex\n");
out.Write(" ) {\n");
}
@@ -938,7 +941,7 @@ static inline void SampleTexture(T& out, const char *texcoords, const char *texs
out.SetConstantsUsed(C_TEXDIMS+texmap,C_TEXDIMS+texmap);
if (ApiType == API_D3D)
- out.Write("iround(255.0 * Tex%d.Sample(samp%d,%s.xy * " I_TEXDIMS"[%d].xy)).%s;\n", texmap,texmap, texcoords, texmap, texswap);
+ out.Write("iround(255.0 * Tex%d.Sample(samp%d, float3(%s.xy * " I_TEXDIMS"[%d].xy, %s))).%s;\n", texmap, texmap, texcoords, texmap, g_ActiveConfig.iStereoMode > 0 ? "layer" : "0.0", texswap);
else
out.Write("iround(255.0 * texture(samp%d, float3(%s.xy * " I_TEXDIMS"[%d].xy, %s))).%s;\n", texmap, texcoords, texmap, g_ActiveConfig.iStereoMode > 0 ? "layer" : "0.0", texswap);
}