shader-slang / slang

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

Implement for metal `SV_GroupIndex` #4385

Closed ArielG-NV closed 3 months ago

ArielG-NV commented 3 months ago

fixes: #4370

  1. If we don't have SV_GroupThreadId available we create one using SV_GroupIndexs location data since SV_GroupIndex is not an actual SV for metal.
  2. We emit code emulating SV_GroupThreadId from the same logic that CUDA/CPP uses.

    note: added SV_GroupId translation to threadgroup_position_in_grid so I can get a SV_GroupIndex test to run

csyonghe commented 3 months ago

You may also want to enable all the tests that this PR fixes. Do you have a mac to test locally?

ArielG-NV commented 3 months ago

You may also want to enable all the tests that this PR fixes. Do you have a mac to test locally?

I do not have a Mac locally setup,

csyonghe commented 3 months ago

I am going to merge this PR as is. It seems that a natural next step following this is to investigate how we can reuse the entrypoint param legalization logic for metal, so that we can convert all vertex attribute inputs and fragment stage_in inputs buried inside nested structs into top level entry point parameters.

jkwak-work commented 3 months ago

Yes, we will do the refactoring as a part of #4375.