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

[spirv] do not round size of last row vector for dx layout #2645

Closed
wants to merge 1 commit into from

Conversation

jackoalan
Copy link

The matrix size rules for cbuffers/tbuffers do not match those of fxc
with -fvk-use-dx-layout enabled. The size of the last row should not be
rounded to the alignment size in order to maintain DirectX consistency.

This non-rounding scheme passes the SPIR-V validator, but only in
(GLSL) row-major layout. Column-major behavior is unaltered.

The relevant validator check is here:
https://github.com/KhronosGroup/SPIRV-Tools/blob/e70b009b0f1e47278d89ed7c9f418010d563eb5a/source/val/validate_decorations.cpp#L309-L317

The matrix size rules for cbuffers/tbuffers do not match those of fxc
with -fvk-use-dx-layout enabled. The size of the last row should not be
rounded to the alignment size in order to maintain DirectX consistency.

This non-rounding scheme passes the SPIR-V validator, but *only* in
(GLSL) row-major layout. Column-major behavior is unaltered.

The relevant validator check is here:
https://github.com/KhronosGroup/SPIRV-Tools/blob/e70b009b0f1e47278d89ed7c9f418010d563eb5a/source/val/validate_decorations.cpp#L309-L317
@msftclas
Copy link

msftclas commented Jan 11, 2020

CLA assistant check
All CLA requirements met.

@AppVeyorBot
Copy link

@jaebaek jaebaek self-requested a review January 14, 2020 20:36
@jaebaek jaebaek self-assigned this Jan 14, 2020
@jaebaek jaebaek added the spirv Work related to SPIR-V label Jan 14, 2020
@jaebaek
Copy link
Collaborator

jaebaek commented Jan 14, 2020

Thank you for sending this PR. I will take a look.

@jackoalan
Copy link
Author

On a related note, I am not entirely sure how to handle (HLSL) row major matrices. They also do not round up the last vector, but that must happen in order to pass SPIR-V validation. Should a warning indicating DX incompatibility be emitted in this case?

@jaebaek
Copy link
Collaborator

jaebaek commented Jan 22, 2020

I am really sorry for being late. Your PR looks good, but addressing your questions might be difficult. I have no idea whether we will just allow GLSL column major behavior even though it results in validation error or just do not handle the case of GLSL column major. Let me take some time to discuss this issue.

@jaebaek
Copy link
Collaborator

jaebaek commented Apr 30, 2021

#3672 fixes this issue. Let me close it.

@jaebaek jaebaek closed this Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spirv Work related to SPIR-V
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants