Skip to content

How to disable name mangling? #8337

@st0rmbtw

Description

@st0rmbtw

I have a compute shader with a function with uniform parameters like this:

[shader("compute")]
[numthreads(32, 1, 1)]
void CSComputeLightVertical(
    uint3 thread_id: SV_DispatchThreadID,
    uniform uint2 uniform_min,
    uniform uint2 uniform_max
) {
    ...
}

I want to compile it to HLSL. I'm expecting it to compile to something like this:

...

cbuffer UniformBuffer : register(b0)
{
    uint2 uniform_min;
    uint2 uniform_max;
}

[numthreads(32, 1, 1)]
void CSComputeLightVertical(uint3 thread_id_0 : SV_DispatchThreadID)
{
}

...

But instead, I get this:

struct EntryPointParams_0
{
    uint2 uniform_min_0;
    uint2 uniform_max_0;
};

cbuffer entryPointParams_0 : register(b0)
{
    EntryPointParams_0 entryPointParams_0;
}

[numthreads(32, 1, 1)]
void CSComputeLightVertical(uint3 thread_id_0 : SV_DispatchThreadID)
{
}

I need the uniform_* fields not to be mangled. I don't care about other fields in other structs.

And also, why does it declare a separate EntryPointParams_0 struct, if it can place the fields in the cbuffer, like this:

cbuffer entryPointParams_0 : register(b0)
{
    uint2 uniform_min_0;
    uint2 uniform_max_0;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions