naga icon indicating copy to clipboard operation
naga copied to clipboard

[hlsl-out] Invalid HLSL for function which accepts a pointer to an array

Open hasali19 opened this issue 2 years ago • 0 comments

WGSL:

var<private> c: array<i32, 1>;

fn f(e: ptr<private, array<i32, 1>>) {
    (*e)[0] = 1;
}

@compute
@workgroup_size(1)
fn main() {
    f(&c);
}

HLSL:

static int c[1] = {(int)0};

void f(inout int e)
{
    e[0] = 1;
    return;
}

[numthreads(1, 1, 1)]
void main()
{
    f(c);
    return;
}

This fails to compile with:

error X3121: array, matrix, vector, or indexable object type expected in index expression

Note that the argument type is an int instead of an array.

This looks like it might be related to #1930.

hasali19 avatar May 23 '22 10:05 hasali19