ShaderGen: Handle ShaderCode objects directly.

ShaderGeneratorInterface does not have virtual function members, so we have to implement each type explicitly.
This commit is contained in:
Jules Blok 2014-10-29 13:16:24 +01:00
parent b236c363de
commit fa32f751d3
6 changed files with 12 additions and 14 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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");

View File

@ -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);

View File

@ -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
}

View File

@ -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);