Open hordurj opened 3 months ago
I was testing this again and core-sysgpu-textured-quad only shows the warning and does not crash. But sprite2d is still crashing.
One thing with the sprite2d example is that is tries to load the sprite sheet from ../../examples/sprite2d/sprites.json but the file is actually under ../../src/core/examples/sysgpu/sprite2d/sprites.json. Not sure if the path should be changed or the sample file moved. I guess this is because of project reorganization.
I have the Debug layer now enabled. The output I get from that is: [40476] D3D12 ERROR: ID3D12Device::CreateGraphicsPipelineState: Vertex Shader - Pixel Shader linkage error: Signatures between stages are incompatible. Semantic 'ATTR' is defined for mismatched hardware registers between the output stage and input stage. [ STATE_CREATION ERROR #660: CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_REGISTERINDEX] [40476] D3D12 ERROR: ID3D12Device::CreateGraphicsPipelineState: Vertex Shader - Pixel Shader linkage error: Signatures between stages are incompatible. Semantic 'ATTR' of the input stage has a hardware register component mask that is not a subset of the output of the previous stage. [ STATE_CREATION ERROR #662: CREATEGRAPHICSPIPELINESTATE_SHADER_LINKAGE_REGISTERMASK]
The sprite2d example works if the spriteIndex is changed from a f32 to vec3
struct VertexOutput {
@builtin(position) Position : vec4<f32>,
@location(0) fragUV : vec2<f32>,
- @location(1) spriteIndex : f32,
+ @location(1) spriteIndex : vec3<f32>,
};
I found out why the mach.Core sprite example is not working on sysgpu / d3d12. 1) Texture.GetWidth returns height 2) Transfrom and transform_uv need to be transposed 3) Had to increase transform_uv to mat4x4. Probably because of this storage order issue.
additional context
https://maraneshi.github.io/HLSL-ConstantBufferLayoutVisualizer/HLSL%20matrix%20storage%20order.png
in some modes not all buffers have the same column ordering
the default in HLSL is column major. Given that is what mach uses I think that is for the best to just use that.
Running textured-quad, sprite2d sysgpu examples on Windows / D3D12 fails.
If I change the shader return to
return VertexOutput(vec4(position, 0.0, 1.0), uv);
I get: