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] hlsl compilation error for global array initialiser #1913

Closed
hasali19 opened this issue May 12, 2022 · 1 comment · Fixed by #1914
Closed

[hlsl-out] hlsl compilation error for global array initialiser #1913

hasali19 opened this issue May 12, 2022 · 1 comment · Fixed by #1914
Labels
area: back-end Outputs of shader conversion kind: bug Something isn't working lang: HLSL High-Level Shading Language

Comments

@hasali19
Copy link
Contributor

hasali19 commented May 12, 2022

WGSL:

@group(0)
@binding(1)
var<storage, read_write> s_output: u32;

var<private> global1: array<u32, 2> = array<u32, 2>(1u, 2u);

@compute
@workgroup_size(1)
fn main() {
    s_output = global1[0];
}

HLSL:

uint Constructarray2_uint_(uint arg0, uint arg1)[2] {
    uint ret[2] = { arg0, arg1 };
    return ret;
}

RWByteAddressBuffer s_output : register(u1);
static uint global1_[2] = Constructarray2_uint_(1u, 2u);

[numthreads(1, 1, 1)]
void main()
{
    uint _expr4 = global1_[0];
    s_output.Store(0, asuint(_expr4));
    return;
}

HLSL compiler error:

D:\local\Temp\98929c1d-4490-4b2e-a958-cccfa42228a4.hlsl(2,38): error X3000: syntax error: unexpected token '['
@teoxoy
Copy link
Member

teoxoy commented May 12, 2022

I've noticed this a few hours ago and am already fixing it. The issue was that the array return syntax only works with DXC (not FXC).

@teoxoy teoxoy added kind: bug Something isn't working area: back-end Outputs of shader conversion lang: HLSL High-Level Shading Language labels May 12, 2022
@teoxoy teoxoy added this to the WGSL Specification V1 milestone May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: back-end Outputs of shader conversion kind: bug Something isn't working lang: HLSL High-Level Shading Language
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants