ComputeSharp icon indicating copy to clipboard operation
ComputeSharp copied to clipboard

Add support for PascalCase in shader field names

Open moorehousew opened this issue 2 years ago • 1 comments

Description

Shaders should compile properly if field names are in Pascal-case (or any case, really).

Proposed API

The HLSL generator can internally rename these fields to the proper casing. ex. public readonly ReadWriteBuffer<float> Buffer; should be equivalent to public readonly ReadWriteBuffer<float> buffer;

Alternatives

Add support for private shader fields such that the normative casing is lower-case anyways.

moorehousew avatar Mar 08 '22 00:03 moorehousew

Not sure I understand the issue, you can already use uppercase fields just fine? 🤔

Eg. this works:

internal readonly partial struct MultiplyByTwo : IComputeShader
{
    public readonly ReadWriteBuffer<float> Buffer;

    /// <inheritdoc/>
    public void Execute()
    {
        Buffer[ThreadIds.X] *= 2;
    }
}

Is there a specific snippet of code that's failing to compile for you?

Sergio0694 avatar Apr 25 '22 11:04 Sergio0694

Closing this as no repro since the author didn't reply. That snippet I shared compiles fine, so I'm not sure I see the issue.

Sergio0694 avatar Aug 20 '22 01:08 Sergio0694