mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-19 15:52:53 +00:00
Omit code constants that have the same source and dest accessor
This commit is contained in:
parent
ef936eba57
commit
f386e82f89
@ -61,6 +61,9 @@ workspace "OpenAssetTools"
|
||||
filter "options:debug-structureddatadef"
|
||||
defines { "STRUCTUREDDATADEF_DEBUG" }
|
||||
filter {}
|
||||
filter "options:debug-techset"
|
||||
defines { "TECHSET_DEBUG" }
|
||||
filter {}
|
||||
|
||||
-- ========================
|
||||
-- ThirdParty
|
||||
|
@ -90,14 +90,15 @@ namespace IW4
|
||||
return;
|
||||
}
|
||||
|
||||
Indent();
|
||||
|
||||
std::string codeDestAccessor;
|
||||
if (targetShaderArg->m_type_elements > 1)
|
||||
m_stream << targetShaderArg->m_name << '[' << (arg.dest - targetShaderArg->m_register_index) << ']';
|
||||
{
|
||||
std::ostringstream ss;
|
||||
ss << targetShaderArg->m_name << '[' << (arg.dest - targetShaderArg->m_register_index) << ']';
|
||||
codeDestAccessor = ss.str();
|
||||
}
|
||||
else
|
||||
m_stream << targetShaderArg->m_name;
|
||||
|
||||
m_stream << " = ";
|
||||
codeDestAccessor = targetShaderArg->m_name;
|
||||
|
||||
if(arg.type == MTL_ARG_CODE_VERTEX_CONST || arg.type == MTL_ARG_CODE_PIXEL_CONST)
|
||||
{
|
||||
@ -106,20 +107,31 @@ namespace IW4
|
||||
if(FindCodeConstantSourceAccessor(sourceIndex, s_codeConsts, codeSourceAccessor)
|
||||
|| FindCodeConstantSourceAccessor(sourceIndex, s_defaultCodeConsts, codeSourceAccessor))
|
||||
{
|
||||
m_stream << "code." << codeSourceAccessor;
|
||||
if(codeDestAccessor != codeSourceAccessor)
|
||||
{
|
||||
Indent();
|
||||
m_stream << codeDestAccessor << " = code." << codeSourceAccessor << ";\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef TECHSET_DEBUG
|
||||
Indent();
|
||||
m_stream << "// Omitted due to matching accessors: " << codeDestAccessor << " = code." << codeSourceAccessor << ";\n";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(false);
|
||||
m_stream << "UNKNOWN";
|
||||
Indent();
|
||||
m_stream << codeDestAccessor << " = UNKNOWN;\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_stream << "something";
|
||||
Indent();
|
||||
m_stream << codeDestAccessor << " = something;\n";
|
||||
}
|
||||
|
||||
m_stream << ";\n";
|
||||
}
|
||||
|
||||
void DumpVertexShader(const MaterialPass& pass)
|
||||
|
@ -2,3 +2,7 @@ newoption {
|
||||
trigger = "debug-structureddatadef",
|
||||
description = "Activate additional debugging logic for StructuredDataDef assets"
|
||||
}
|
||||
newoption {
|
||||
trigger = "debug-techset",
|
||||
description = "Activate additional debugging logic for Techset assets"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user