Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constant buffer variable renaming issue (HLSL) #475

Open
mrdooz opened this issue Jan 14, 2025 · 1 comment
Open

Constant buffer variable renaming issue (HLSL) #475

mrdooz opened this issue Jan 14, 2025 · 1 comment

Comments

@mrdooz
Copy link

mrdooz commented Jan 14, 2025

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..

@laurentlb
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants