-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
area: naga back-endOutputs of naga shader conversionOutputs of naga shader conversionbackend: dx12Issues with DX12 or DXGIIssues with DX12 or DXGIlang: HLSLD3D Shading LanguageD3D Shading LanguagenagaShader TranslatorShader Translatortype: bugSomething isn't workingSomething isn't working
Description
I've ran into a really weird issue when using a nested array of matrices Struct member where if you don't access it directly in your WGSL (i.e. if you're assigning it to a variable first), then the values become complete garbage.
// 'color' member is originally this Float32Array:
// [1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
struct Storages {
color : array<mat4x4f, 1>,
}
struct NestedStorages {
elements: array<Storages>,
}
@binding(0) @group(0) var<storage, read> storages : NestedStorages;
@fragment
fn main() -> @location(0) vec4f {
// THIS WORKS (displays a red triangle)
// return storages.elements[0].color[0][0];
// HOWEVER THIS DOES NOT (displays a white triangle)
let storageElement = storages.elements[0];
return storageElement.color[0][0];
}
Here is a minimal reproduction of the issue: https://jsfiddle.net/9jLv5rzq/5/
The triangle drawn should always be red, however on load it is white on Firefox on Windows.
Note that if you use an array of vec4f
instead for example, it works again example:
// THIS WORKS
struct Storages {
color : array<vec4f, 4>,
}
Reproduced on both of my Windows computers:
Windows 10 (version 22H2), GPU: AMD Radeon Vega 8, Firefox 142.0.1
Windows 11 (version 23H2), GPU: Intel UHD 620, Firefox 142.0.1
Metadata
Metadata
Assignees
Labels
area: naga back-endOutputs of naga shader conversionOutputs of naga shader conversionbackend: dx12Issues with DX12 or DXGIIssues with DX12 or DXGIlang: HLSLD3D Shading LanguageD3D Shading LanguagenagaShader TranslatorShader Translatortype: bugSomething isn't workingSomething isn't working
Type
Projects
Status
Todo