summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorJules Blok <jules.blok@gmail.com>2014-10-29 13:16:24 +0100
committerJules Blok <jules.blok@gmail.com>2014-11-23 14:24:09 +0100
commitfa32f751d37604b7af46e7d9d118aacefbc5df76 (patch)
tree9ff5f229019213e71276f11dd5c033ffa7ad5abc /Source/Core
parentb236c363de097ca8164c315e37dc369139a8a20c (diff)
ShaderGen: Handle ShaderCode objects directly.
ShaderGeneratorInterface does not have virtual function members, so we have to implement each type explicitly.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/VideoBackends/D3D/LineGeometryShader.cpp2
-rw-r--r--Source/Core/VideoBackends/D3D/PointGeometryShader.cpp2
-rw-r--r--Source/Core/VideoCommon/GeometryShaderGen.cpp6
-rw-r--r--Source/Core/VideoCommon/PixelShaderGen.cpp6
-rw-r--r--Source/Core/VideoCommon/VertexShaderGen.cpp7
-rw-r--r--Source/Core/VideoCommon/VertexShaderGen.h3
6 files changed, 12 insertions, 14 deletions
diff --git a/Source/Core/VideoBackends/D3D/LineGeometryShader.cpp b/Source/Core/VideoBackends/D3D/LineGeometryShader.cpp
index fabe6ed91a..9cd3ba6b5a 100644
--- a/Source/Core/VideoBackends/D3D/LineGeometryShader.cpp
+++ b/Source/Core/VideoBackends/D3D/LineGeometryShader.cpp
@@ -172,7 +172,7 @@ bool LineGeometryShader::SetShader(u32 components, float lineWidth,
static char buffer[16384];
ShaderCode code;
code.SetBuffer(buffer);
- GenerateVSOutputStructForGS(code, API_D3D);
+ GenerateVSOutputStruct(code, API_D3D);
code.Write("\n%s", LINE_GS_COMMON);
std::stringstream numTexCoordsStream;
diff --git a/Source/Core/VideoBackends/D3D/PointGeometryShader.cpp b/Source/Core/VideoBackends/D3D/PointGeometryShader.cpp
index d15fe3eb0e..732ef95749 100644
--- a/Source/Core/VideoBackends/D3D/PointGeometryShader.cpp
+++ b/Source/Core/VideoBackends/D3D/PointGeometryShader.cpp
@@ -166,7 +166,7 @@ bool PointGeometryShader::SetShader(u32 components, float pointSize,
static char buffer[16384];
ShaderCode code;
code.SetBuffer(buffer);
- GenerateVSOutputStructForGS(code, API_D3D);
+ GenerateVSOutputStruct(code, API_D3D);
code.Write("\n%s", POINT_GS_COMMON);
std::stringstream numTexCoordsStream;
diff --git a/Source/Core/VideoCommon/GeometryShaderGen.cpp b/Source/Core/VideoCommon/GeometryShaderGen.cpp
index e305551cd8..749929e8ea 100644
--- a/Source/Core/VideoCommon/GeometryShaderGen.cpp
+++ b/Source/Core/VideoCommon/GeometryShaderGen.cpp
@@ -69,11 +69,7 @@ static inline void GenerateGeometryShader(T& out, u32 components, API_TYPE ApiTy
"\tfloat4 " I_STEREOPROJECTION"[8];\n"
"};\n");
- ShaderCode code;
- char buf[16384];
- code.SetBuffer(buf);
- GenerateVSOutputStructForGS(code, ApiType);
- out.Write(code.GetBuffer());
+ GenerateVSOutputStruct(out, ApiType);
out.Write("centroid in VS_OUTPUT v[];\n");
out.Write("centroid out VS_OUTPUT o;\n");
diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp
index d2124f2ad7..771ce124e6 100644
--- a/Source/Core/VideoCommon/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/PixelShaderGen.cpp
@@ -277,11 +277,7 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
);
}
- ShaderCode code;
- char buf[16384];
- code.SetBuffer(buf);
- GenerateVSOutputStructForGS(code, ApiType);
- out.Write(code.GetBuffer());
+ GenerateVSOutputStruct(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);
diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp
index 0daaaf3275..374acc69ec 100644
--- a/Source/Core/VideoCommon/VertexShaderGen.cpp
+++ b/Source/Core/VideoCommon/VertexShaderGen.cpp
@@ -467,7 +467,12 @@ void GenerateVertexShaderCode(VertexShaderCode& object, u32 components, API_TYPE
GenerateVertexShader<VertexShaderCode>(object, components, api_type);
}
-void GenerateVSOutputStructForGS(ShaderCode& object, API_TYPE api_type)
+void GenerateVSOutputStruct(ShaderCode& object, API_TYPE api_type)
{
GenerateVSOutputStruct<ShaderCode>(object, api_type);
}
+
+void GenerateVSOutputStruct(ShaderGeneratorInterface& object, API_TYPE api_type)
+{
+ // Ignore unknown types
+}
diff --git a/Source/Core/VideoCommon/VertexShaderGen.h b/Source/Core/VideoCommon/VertexShaderGen.h
index a7b5e9bd3f..06cab3ff91 100644
--- a/Source/Core/VideoCommon/VertexShaderGen.h
+++ b/Source/Core/VideoCommon/VertexShaderGen.h
@@ -66,4 +66,5 @@ typedef ShaderCode VertexShaderCode; // TODO: Obsolete..
void GetVertexShaderUid(VertexShaderUid& object, u32 components, API_TYPE api_type);
void GenerateVertexShaderCode(VertexShaderCode& object, u32 components, API_TYPE api_type);
-void GenerateVSOutputStructForGS(ShaderCode& object, API_TYPE api_type);
+void GenerateVSOutputStruct(ShaderCode& object, API_TYPE api_type);
+void GenerateVSOutputStruct(ShaderGeneratorInterface& object, API_TYPE api_type);