shader-slang / slang

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

Add intrinsic for `IsHelperLane()` in HLSL #4471

Closed venkataram-nv closed 3 days ago

venkataram-nv commented 4 days ago

Fixes #4444

Adds the IsHelperLane() intrinsic from HLSL. Also adds corresponding intrinsics from GLSL, SPIRV, and Metal.

ArielG-NV commented 3 days ago

normally new intrinsic's should be implemented for: HLSL, GLSL, SPIRV, & (newly added) Metal

SPIR-V version of the intrinsic can be found here: OpIsHelperInvocationEXT

GLSL version of the intrinsic can be found here: https://registry.khronos.org/OpenGL-Refpages/gl4/html/gl_HelperInvocation.xhtml

metal version of the intrinsic can be found here: simd_is_helper_thread

jkwak-work commented 3 days ago

normally new intrinsic's should be implemented for: HLSL, GLSL, SPIRV, & (newly added) Metal

SPIR-V version of the intrinsic can be found here: OpIsHelperInvocationEXT

GLSL version of the intrinsic can be found here: https://registry.khronos.org/OpenGL-Refpages/gl4/html/gl_HelperInvocation.xhtml

metal version of the intrinsic can be found here: simd_is_helper_thread

Thanks to Ariel about the additional information.

The implementations for the other targets are good to have, but not required for this PR. It is more preferable to make smaller PRs if they can be separated in general. For this specific case, they are all small enough to be merged into one PR and it will be fine either way.

jkwak-work commented 3 days ago

Fixes #4444

When you create a new PR, please summarize what the change is about. People should be able to know what this PR is about before start reading the actual code. For this specific PR, it is simple enough, but let's start with a good practice.