shader-slang / slang

Making it easier to work with shaders
MIT License
2.06k stars 177 forks source link

`SV_Targetn` semantics not properly translated in Metal #4384

Closed na2axl closed 3 months ago

na2axl commented 3 months ago

Hey there,

I came across an issue when trying to do multi-target rendering (usually with a G-buffer) on Metal. Basically, my targets struct looks like this:

struct Output
{
  float4 Diffuse  : SV_Target0;
  float4 Normal   : SV_Target1;
  float4 Material : SV_Target2;
}

But it generates this struct in Metal:

struct Output
{
  float4 Diffuse   [[user(SV_Target0)]];
  float4 Normal    [[user(SV_Target1)]];
  float4 Material  [[user(SV_Target2)]];
}

Which is wrong because Metal is expecting this instead:

struct Output
{
  float4 Diffuse   [[color(0)]];
  float4 Normal    [[color(1)]];
  float4 Material  [[color(2)]];
}
swoods-nv commented 3 months ago

Hi @na2axl - Please note that Metal support is not yet complete.

[EDIT] - Ah, I see you filed this at a project member's request. Thank you!