shader-slang / slang

Making it easier to work with shaders
MIT License
1.78k stars 159 forks source link

Metal: `legalizeArrayReturnType` leads to missing address space for `Out` parameter #4468

Closed ArielG-NV closed 1 day ago

ArielG-NV commented 4 days ago

breaks: tests\bugs\gh-2959.slang, #4291

With Metal as a target, kIROp_MakeArray incorrectly results in:

void _S1(array<uint, int(2)> _S2)
{

#line 14
    (*_S2)[int(0)] = 0U;

#line 14
    (*_S2)[int(1)] = 1U;

#line 14
    return;
}

This should be of the form:

void _S1(SOME_ADDRESS_SPACE array<uint, int(2)>* _S2)
{

#line 14
    (*_S2)[int(0)] = 0U;

#line 14
    (*_S2)[int(1)] = 1U;

#line 14
    return;
}

This is a source of a compile error