VideoCommon: Name ubershaders
This commit is contained in:
parent
23c1721fbd
commit
c7892d7371
|
@ -430,7 +430,8 @@ ShaderCache::CompileVertexUberShader(const UberShader::VertexShaderUid& uid) con
|
|||
{
|
||||
const ShaderCode source_code =
|
||||
UberShader::GenVertexShader(m_api_type, m_host_config, uid.GetUidData());
|
||||
return g_renderer->CreateShaderFromSource(ShaderStage::Vertex, source_code.GetBuffer());
|
||||
return g_renderer->CreateShaderFromSource(ShaderStage::Vertex, source_code.GetBuffer(),
|
||||
fmt::to_string(*uid.GetUidData()));
|
||||
}
|
||||
|
||||
std::unique_ptr<AbstractShader> ShaderCache::CompilePixelShader(const PixelShaderUid& uid) const
|
||||
|
@ -445,7 +446,8 @@ ShaderCache::CompilePixelUberShader(const UberShader::PixelShaderUid& uid) const
|
|||
{
|
||||
const ShaderCode source_code =
|
||||
UberShader::GenPixelShader(m_api_type, m_host_config, uid.GetUidData());
|
||||
return g_renderer->CreateShaderFromSource(ShaderStage::Pixel, source_code.GetBuffer());
|
||||
return g_renderer->CreateShaderFromSource(ShaderStage::Pixel, source_code.GetBuffer(),
|
||||
fmt::to_string(*uid.GetUidData()));
|
||||
}
|
||||
|
||||
const AbstractShader* ShaderCache::InsertVertexShader(const VertexShaderUid& uid,
|
||||
|
|
|
@ -66,8 +66,7 @@ ShaderCode GenPixelShader(APIType api_type, const ShaderHostConfig& host_config,
|
|||
const u32 numTexgen = uid_data->num_texgens;
|
||||
ShaderCode out;
|
||||
|
||||
out.Write("// Pixel UberShader for {} texgens{}{}\n", numTexgen,
|
||||
early_depth ? ", early-depth" : "", per_pixel_depth ? ", per-pixel depth" : "");
|
||||
out.Write("// {}\n", *uid_data);
|
||||
WriteBitfieldExtractHeader(out, api_type, host_config);
|
||||
WritePixelShaderCommonHeader(out, api_type, host_config, bounding_box);
|
||||
if (per_pixel_lighting)
|
||||
|
|
|
@ -34,3 +34,17 @@ void EnumeratePixelShaderUids(const std::function<void(const PixelShaderUid&)>&
|
|||
void ClearUnusedPixelShaderUidBits(APIType api_type, const ShaderHostConfig& host_config,
|
||||
PixelShaderUid* uid);
|
||||
} // namespace UberShader
|
||||
|
||||
template <>
|
||||
struct fmt::formatter<UberShader::pixel_ubershader_uid_data>
|
||||
{
|
||||
constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); }
|
||||
template <typename FormatContext>
|
||||
auto format(const UberShader::pixel_ubershader_uid_data& uid, FormatContext& ctx) const
|
||||
{
|
||||
return fmt::format_to(ctx.out(), "Pixel UberShader for {} texgens{}{}{}", uid.num_texgens,
|
||||
uid.early_depth ? ", early-depth" : "",
|
||||
uid.per_pixel_depth ? ", per-pixel depth" : "",
|
||||
uid.uint_output ? ", uint output" : "");
|
||||
}
|
||||
};
|
||||
|
|
|
@ -34,7 +34,7 @@ ShaderCode GenVertexShader(APIType api_type, const ShaderHostConfig& host_config
|
|||
const u32 num_texgen = uid_data->num_texgens;
|
||||
ShaderCode out;
|
||||
|
||||
out.Write("// Vertex UberShader\n\n");
|
||||
out.Write("// {}\n\n", *uid_data);
|
||||
out.Write("{}", s_lighting_struct);
|
||||
|
||||
// uniforms
|
||||
|
|
|
@ -25,3 +25,14 @@ ShaderCode GenVertexShader(APIType api_type, const ShaderHostConfig& host_config
|
|||
const vertex_ubershader_uid_data* uid_data);
|
||||
void EnumerateVertexShaderUids(const std::function<void(const VertexShaderUid&)>& callback);
|
||||
} // namespace UberShader
|
||||
|
||||
template <>
|
||||
struct fmt::formatter<UberShader::vertex_ubershader_uid_data>
|
||||
{
|
||||
constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); }
|
||||
template <typename FormatContext>
|
||||
auto format(const UberShader::vertex_ubershader_uid_data& uid, FormatContext& ctx) const
|
||||
{
|
||||
return fmt::format_to(ctx.out(), "Vertex UberShader for {} texgens", uid.num_texgens);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue