Repository navigation
Fix matrix truncating cast reading rows and columns swapped - #3409
Merged
Merged
Conversation
MatrixType stores dimensions HLSL-style, so Columns is the OpTypeMatrix column count and Rows the size of each column vector. The matrix to matrix branch of SpirvBuilder.Convert used them the other way round, emitting an OpCompositeExtract whose result type did not match the extracted column and skipping the component truncation. The swap cancels out for square sources, so only LightProbeShader was affected: it is the only shader casting a float3x4, and it failed SPIR-V validation (stride3d#3323). The same routine also sized its value buffer by Rows and ran the element-wise conversion over the whole buffer instead of the filled entries, so (float2x2)0 threw during compilation.
Composes LightProbeShader into the environmentLights slot of a forward shading effect, the way ForwardLightingRenderFeature does, and validates the resulting SPIR-V for both single sample and MSAA. This covers issue stride3d#3323 directly rather than only the matrix cast that caused it.
Member
Author
|
Note: this doesn't fully fix the lightprobes, I am investigating independently and likely a follow-up PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Details
Fixes #3323: placing enough light probes to form a tetrahedron made the forward shading effect fail SPIR-V validation, so the scene never finished rendering.
SpirvBuilder.ConvertreadMatrixType.RowsandMatrixType.Columnsthe wrong way round when truncating a matrix. The type stores its dimensions HLSL-style, soColumnsis theOpTypeMatrixcolumn count andRowsis the size of each column vector.The swap cancels out for square sources, so only
LightProbeShaderwas affected: it is the only engine shader casting afloat3x4.The same routine also sized its value buffer by
Rowsand converted more entries than the truncating step filled, so(float2x2)0threw at compile time.Tests: a render test covering row and column truncation, checking output pixels on Direct3D11 and Vulkan, plus a test compiling the real
LightProbeShaderin theenvironmentLightsslot. Both fail with the fix reverted.Types of changes
Checklist