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

[RFE] Utilize "enhanced barriers", reach parity with VK #35

Closed
dzhdanNV opened this issue Feb 1, 2024 · 3 comments
Closed

[RFE] Utilize "enhanced barriers", reach parity with VK #35

dzhdanNV opened this issue Feb 1, 2024 · 3 comments

Comments

@dzhdanNV
Copy link
Collaborator

dzhdanNV commented Feb 1, 2024

https://microsoft.github.io/DirectX-Specs/d3d/D3D12EnhancedBarriers.html

It should help to make D3D12 backend closer to VK (with legacy resource states there are some hidden discrepancies). According to the spec "resource transitions" are emulated using "enhanced barriers" API under the hood.

@dzhdanNV dzhdanNV changed the title [RFE][D3D12] Utilize "enhanced barriers" [RFE] Utilize "enhanced barriers", reach parity with VK Feb 2, 2024
@dzhdanNV
Copy link
Collaborator Author

dzhdanNV commented Feb 2, 2024

API changes: this API instead of old one:

NRI_STRUCT(AccessDependency)
{
    NRI_NAME(AccessBits) acessBits;
    NRI_NAME(Dependency) dependency;
};

NRI_STRUCT(AccessDependencyLayout)
{
    NRI_NAME(AccessBits) acessBits;
    NRI_NAME(Dependency) dependency;
    NRI_NAME(TextureLayout) layout;
};

NRI_STRUCT(GlobalBarrierDesc)
{
    NRI_NAME(AccessDependency) before;
    NRI_NAME(AccessDependency) after;
};

NRI_STRUCT(BufferBarrierDesc)
{
    NRI_NAME(Buffer)* buffer;
    NRI_NAME(AccessDependency) before;
    NRI_NAME(AccessDependency) after;
};

NRI_STRUCT(TextureBarrierDesc)
{
    NRI_NAME(Texture)* texture;
    NRI_NAME(AccessDependencyLayout) before;
    NRI_NAME(AccessDependencyLayout) after;
    NRI_NAME(Mip_t) mipOffset;
    NRI_NAME(Mip_t) mipNum;
    NRI_NAME(Dim_t) arrayOffset;
    NRI_NAME(Dim_t) arraySize;
};

NRI_STRUCT(BarrierGroupDesc)
{
    const NRI_NAME(GlobalBarrierDesc)* globalBarriers;
    const NRI_NAME(BufferBarrierDesc)* bufferBarriers;
    const NRI_NAME(TextureBarrierDesc)* textureBarriers;
    uint32_t globalBarrierNum;
    uint32_t bufferBarrierNum;
    uint32_t textureBarrierNum;
};

// Barrier (can be used inside "Graphics" but with limited functionality)
void (NRI_CALL *CmdBarrier)(NRI_NAME_REF(CommandBuffer) commandBuffer, const NRI_NAME(BarrierGroupDesc)* barrierGroup);

@dzhdanNV
Copy link
Collaborator Author

dzhdanNV commented Feb 2, 2024

If Agility SDK is not enabled, "legacy barriers" will be used to implement this API in D3D12, but:

  • Dependency will be ignored
  • aliasing barriers will become unsupported, because "legacy barriers" require resource "before" and "after"

@dzhdanNV
Copy link
Collaborator Author

dzhdanNV commented Feb 9, 2024

Implemented.

@dzhdanNV dzhdanNV closed this as completed Feb 9, 2024
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

1 participant