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

vendor:directx/d3d12: add shader component mapping constants and macro-procedures #4669

Merged

Conversation

denovodavid
Copy link
Contributor

When creating a d3d12 shader resource view, a component mapping must be provided as the default is non-zero. This PR adds the default value and other constants/macro-procedures from d3d12.h for shader component mapping. It also changes the SHADER_COMPONENT_MAPPING enum type to u32 to match the SHADER_RESOURCE_VIEW_DESC.Shader4ComponentMapping type.

Relevant docs:

// example usage
rd.device->CreateShaderResourceView(
    vertex_buffer,
    &d3d12.SHADER_RESOURCE_VIEW_DESC{
        ViewDimension = .BUFFER,
        Shader4ComponentMapping = d3d12.DEFAULT_SHADER_4_COMPONENT_MAPPING,
        Buffer = {
            NumElements = u32(len(vertices)),
            StructureByteStride = size_of(vertices[0]),
        },
    },
    srv_handle,
)

@gingerBill gingerBill merged commit 5a259ed into odin-lang:master Jan 10, 2025
7 checks passed
@denovodavid denovodavid deleted the pr-d3d12-shader-component-mapping branch January 10, 2025 11:26
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

Successfully merging this pull request may close these issues.

2 participants