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

GloballyCoherentAttribute for StructuredBuffers #588

Closed
Tracked by #598
Avid29 opened this issue Oct 2, 2023 · 0 comments · Fixed by #675
Closed
Tracked by #598

GloballyCoherentAttribute for StructuredBuffers #588

Avid29 opened this issue Oct 2, 2023 · 0 comments · Fixed by #675
Labels
proposal 💡 A proposal for a new feature

Comments

@Avid29
Copy link
Contributor

Avid29 commented Oct 2, 2023

Description (optional)

This section should contain an expanded description
of the proposal, if the title is not sufficient.

Rationale

The globallycoherent keyword would be a useful addition to be supported in the hlsl generator.

Proposed API

Adding an attribute to tag specify a StructuredBuffer should be marked globallycoherent.

Drawbacks

None

Alternatives

None

Other thoughts

Here's how I expect code generation would change with this proposal.

C# Code

[AutoConstructor]
[EmbeddedBytecode(DispatchAxis.XY)]
public partial struct SampleShader : IComputeShader
{
    [GloballyCoherent]
    ReadWriteBuffer<int> buffer;

    public void Execute()
    {
        ...
    }
}

Generated HLSL

cbuffer _ : register(b0)
{
    uint __x;
    uint __y;
    uint __z;
}

globallycoherent RWStructuredBuffer<int> sampleBuffer : register(u0);

[NumThreads(__GroupSize__get_X, __GroupSize__get_Y, __GroupSize__get_Z)]
void Execute(uint3 ThreadIds : SV_DispatchThreadID)
{
    if (ThreadIds.x < __x && ThreadIds.y < __y && ThreadIds.z < __z)
    {
        ...
    }
}
@Avid29 Avid29 added proposal 💡 A proposal for a new feature untriaged 🧰 A new issue that needs initial triage labels Oct 2, 2023
@Sergio0694 Sergio0694 removed the untriaged 🧰 A new issue that needs initial triage label Oct 8, 2023
@Sergio0694 Sergio0694 mentioned this issue Oct 8, 2023
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal 💡 A proposal for a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants