Shader_Minifier
Shader_Minifier copied to clipboard
Constant buffer variable renaming issue (HLSL)
I'm running into a weird issue where the minified code is containing non-ascii characters. I can repro the issue with the following HLSL shader (just pasting this into the CS example program and adding --hlsl will repro):
cbuffer cbMain : register(b0)
{
float g_test;
};
float4 Test() : SV_Target
{
float tmp = 0.0f;
for (int i = 0; i < 1; i++)
{
tmp++;
}
tmp += g_test;
return tmp;
}
where g_test gets renamed to something invalid on the return statement. If the for-loop is removed, then this doesn't happen, but that's the extent of my debugging efforts..
Thanks for the report. I can repro the issue on https://ctrl-alt-test.fr/minifier/
I even have a simpler repro (with inlining disabled):
int Test()
{
int tmp = 0;
for (int i = 0; i < 1; i++);
return tmp;
}
The renaming bug happens only with --hlsl.
Unfortunately, I don't have a workaround to suggest. We'll need to investigate.