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"
|
filter "options:debug-structureddatadef"
|
||||||
defines { "STRUCTUREDDATADEF_DEBUG" }
|
defines { "STRUCTUREDDATADEF_DEBUG" }
|
||||||
filter {}
|
filter {}
|
||||||
|
filter "options:debug-techset"
|
||||||
|
defines { "TECHSET_DEBUG" }
|
||||||
|
filter {}
|
||||||
|
|
||||||
-- ========================
|
-- ========================
|
||||||
-- ThirdParty
|
-- ThirdParty
|
||||||
|
@ -90,14 +90,15 @@ namespace IW4
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Indent();
|
std::string codeDestAccessor;
|
||||||
|
|
||||||
if (targetShaderArg->m_type_elements > 1)
|
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
|
else
|
||||||
m_stream << targetShaderArg->m_name;
|
codeDestAccessor = targetShaderArg->m_name;
|
||||||
|
|
||||||
m_stream << " = ";
|
|
||||||
|
|
||||||
if(arg.type == MTL_ARG_CODE_VERTEX_CONST || arg.type == MTL_ARG_CODE_PIXEL_CONST)
|
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)
|
if(FindCodeConstantSourceAccessor(sourceIndex, s_codeConsts, codeSourceAccessor)
|
||||||
|| FindCodeConstantSourceAccessor(sourceIndex, s_defaultCodeConsts, 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
|
else
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
m_stream << "UNKNOWN";
|
Indent();
|
||||||
|
m_stream << codeDestAccessor << " = UNKNOWN;\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_stream << "something";
|
Indent();
|
||||||
|
m_stream << codeDestAccessor << " = something;\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
m_stream << ";\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DumpVertexShader(const MaterialPass& pass)
|
void DumpVertexShader(const MaterialPass& pass)
|
||||||
|
@ -2,3 +2,7 @@ newoption {
|
|||||||
trigger = "debug-structureddatadef",
|
trigger = "debug-structureddatadef",
|
||||||
description = "Activate additional debugging logic for StructuredDataDef assets"
|
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