shader-slang / slang

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

SPIR-V: `SubpassInput` should default to `float4` if explicit type parameter is not provided #4440

Closed chaoticbob closed 23 hours ago

chaoticbob commented 1 week ago

Slang currently expects an explicit type parameter for SubpassInput, this is contrary to the expected usage of SubpassInput from DXC (where it originated I'm guessing) and results in the following compile error:

shader.hlsl(3): error 30400: generic type '<DeclRef<GenericDecl>>' used without argument
SubpassInput gSubpassInputs[32];

According to DXC's SPIR-V docs: In the above, T is a scalar or vector type. If omitted, it will defaults to float4.

Shader

SubpassInput gSubpassInputs[32];

float4 main(uint index : A) : SV_TARGET{
    float4 v2 = gSubpassInputs[NonUniformResourceIndex(index)].SubpassLoad();
    return v2;
}