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

[hlsl-out] Stores of vec2-based matrix inside struct tries to access raw matrix directly #4423

Open
Tracked by #2719
cwfitzgerald opened this issue Dec 27, 2022 · 2 comments
Labels
area: naga back-end Outputs of naga shader conversion lang: HLSL D3D Shading Language naga Shader Translator type: bug Something isn't working

Comments

@cwfitzgerald
Copy link
Member

WGSL

struct Ah {
    inner: mat2x2<f32>,
};
@group(0) @binding(0)
var<storage, write> ah: Ah;

@compute @workgroup_size(1)
fn cs_main() {
    ah = Ah(mat2x2<f32>(vec2<f32>(0.0), vec2<f32>(1.0)));
}

HLSL

struct Ah {
    float2 inner_0; float2 inner_1;
};

RWByteAddressBuffer ah : register(u0);

Ah ConstructAh(float2x2 arg0) {
    Ah ret = (Ah)0;
    ret.inner_0 = arg0[0];
    ret.inner_1 = arg0[1];
    return ret;
}

[numthreads(1, 1, 1)]
void cs_main()
{
    {
        Ah _value2 = ConstructAh(float2x2((0.0).xx, (1.0).xx));
        {
            // ERROR: Inner doesn't exist
            float2x2 _value3 = _value2.inner;
            ah.Store2(0+0, asuint(_value3[0]));
            ah.Store2(0+8, asuint(_value3[1]));
        }
    }
    return;
}
@cwfitzgerald cwfitzgerald added kind: bug area: naga back-end Outputs of naga shader conversion lang: HLSL D3D Shading Language labels Dec 27, 2022
@ErichDonGubler
Copy link
Member

Firefox bug tracking this: https://bugzilla.mozilla.org/show_bug.cgi?id=1859304

@jimblandy
Copy link
Member

Since this causes HLSL compilation errors, it should be pretty easy to spot when we start running into it on the CTS. (If the symptom was just corrupted data, that would be harder to debug.)

In that light, Mozilla is going to wait until we run into this in our CTS runs to prioritize it.

Once that happens, this looks like a good first bug: easily reproduced, the HLSL backend isn't lovely but it's manageable, snapshot testing should suffice.

@cwfitzgerald cwfitzgerald transferred this issue from gfx-rs/naga Oct 25, 2023
@cwfitzgerald cwfitzgerald added naga Shader Translator type: bug Something isn't working and removed kind: bug labels Oct 25, 2023
@teoxoy teoxoy added this to the WebGPU Specification V1 milestone Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: naga back-end Outputs of naga shader conversion lang: HLSL D3D Shading Language naga Shader Translator type: bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

4 participants