Merge pull request #3226 from Tilka/shadergen

VideoCommon: return code/uid from shader gens
This commit is contained in:
Scott Mansell
2015-11-04 13:42:49 +13:00
10 changed files with 48 additions and 60 deletions

View File

@ -190,12 +190,10 @@ void GeometryShaderCache::Shutdown()
bool GeometryShaderCache::SetShader(u32 primitive_type)
{
GeometryShaderUid uid;
GetGeometryShaderUid(uid, primitive_type, API_D3D);
GeometryShaderUid uid = GetGeometryShaderUid(primitive_type, API_D3D);
if (g_ActiveConfig.bEnableShaderDebugging)
{
ShaderCode code;
GenerateGeometryShaderCode(code, primitive_type, API_D3D);
ShaderCode code = GenerateGeometryShaderCode(primitive_type, API_D3D);
geometry_uid_checker.AddToIndexAndCheck(code, uid, "Geometry", "g");
}
@ -231,8 +229,7 @@ bool GeometryShaderCache::SetShader(u32 primitive_type)
}
// Need to compile a new shader
ShaderCode code;
GenerateGeometryShaderCode(code, primitive_type, API_D3D);
ShaderCode code = GenerateGeometryShaderCode(primitive_type, API_D3D);
D3DBlob* pbytecode;
if (!D3D::CompileGeometryShader(code.GetBuffer(), &pbytecode))

View File

@ -527,12 +527,10 @@ void PixelShaderCache::Shutdown()
bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode)
{
PixelShaderUid uid;
GetPixelShaderUid(uid, dstAlphaMode, API_D3D);
PixelShaderUid uid = GetPixelShaderUid(dstAlphaMode, API_D3D);
if (g_ActiveConfig.bEnableShaderDebugging)
{
ShaderCode code;
GeneratePixelShaderCode(code, dstAlphaMode, API_D3D);
ShaderCode code = GeneratePixelShaderCode(dstAlphaMode, API_D3D);
pixel_uid_checker.AddToIndexAndCheck(code, uid, "Pixel", "p");
}
@ -561,8 +559,7 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode)
}
// Need to compile a new shader
ShaderCode code;
GeneratePixelShaderCode(code, dstAlphaMode, API_D3D);
ShaderCode code = GeneratePixelShaderCode(dstAlphaMode, API_D3D);
D3DBlob* pbytecode;
if (!D3D::CompilePixelShader(code.GetBuffer(), &pbytecode))

View File

@ -186,12 +186,10 @@ void VertexShaderCache::Shutdown()
bool VertexShaderCache::SetShader()
{
VertexShaderUid uid;
GetVertexShaderUid(uid, API_D3D);
VertexShaderUid uid = GetVertexShaderUid(API_D3D);
if (g_ActiveConfig.bEnableShaderDebugging)
{
ShaderCode code;
GenerateVertexShaderCode(code, API_D3D);
ShaderCode code = GenerateVertexShaderCode(API_D3D);
vertex_uid_checker.AddToIndexAndCheck(code, uid, "Vertex", "v");
}
@ -216,8 +214,7 @@ bool VertexShaderCache::SetShader()
return (entry.shader != nullptr);
}
ShaderCode code;
GenerateVertexShaderCode(code, API_D3D);
ShaderCode code = GenerateVertexShaderCode(API_D3D);
D3DBlob* pbytecode = nullptr;
D3D::CompileVertexShader(code.GetBuffer(), &pbytecode);

View File

@ -211,13 +211,11 @@ SHADER* ProgramShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 primitive_
last_entry = &newentry;
newentry.in_cache = 0;
ShaderCode vcode;
ShaderCode pcode;
ShaderCode vcode = GenerateVertexShaderCode(API_OPENGL);
ShaderCode pcode = GeneratePixelShaderCode(dstAlphaMode, API_OPENGL);
ShaderCode gcode;
GenerateVertexShaderCode(vcode, API_OPENGL);
GeneratePixelShaderCode(pcode, dstAlphaMode, API_OPENGL);
if (g_ActiveConfig.backend_info.bSupportsGeometryShaders && !uid.guid.GetUidData()->IsPassthrough())
GenerateGeometryShaderCode(gcode, primitive_type, API_OPENGL);
gcode = GenerateGeometryShaderCode(primitive_type, API_OPENGL);
if (g_ActiveConfig.bEnableShaderDebugging)
{
@ -395,22 +393,19 @@ GLuint ProgramShaderCache::CompileSingleShader(GLuint type, const char* code)
void ProgramShaderCache::GetShaderId(SHADERUID* uid, DSTALPHA_MODE dstAlphaMode, u32 primitive_type)
{
GetPixelShaderUid(uid->puid, dstAlphaMode, API_OPENGL);
GetVertexShaderUid(uid->vuid, API_OPENGL);
GetGeometryShaderUid(uid->guid, primitive_type, API_OPENGL);
uid->puid = GetPixelShaderUid(dstAlphaMode, API_OPENGL);
uid->vuid = GetVertexShaderUid(API_OPENGL);
uid->guid = GetGeometryShaderUid(primitive_type, API_OPENGL);
if (g_ActiveConfig.bEnableShaderDebugging)
{
ShaderCode pcode;
GeneratePixelShaderCode(pcode, dstAlphaMode, API_OPENGL);
ShaderCode pcode = GeneratePixelShaderCode(dstAlphaMode, API_OPENGL);
pixel_uid_checker.AddToIndexAndCheck(pcode, uid->puid, "Pixel", "p");
ShaderCode vcode;
GenerateVertexShaderCode(vcode, API_OPENGL);
ShaderCode vcode = GenerateVertexShaderCode(API_OPENGL);
vertex_uid_checker.AddToIndexAndCheck(vcode, uid->vuid, "Vertex", "v");
ShaderCode gcode;
GenerateGeometryShaderCode(gcode, primitive_type, API_OPENGL);
ShaderCode gcode = GenerateGeometryShaderCode(primitive_type, API_OPENGL);
geometry_uid_checker.AddToIndexAndCheck(gcode, uid->guid, "Geometry", "g");
}
}