ComputeSharp
ComputeSharp copied to clipboard
Add support for PascalCase in shader field names
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.
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?
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.