shader-slang / slang

Making it easier to work with shaders
MIT License
1.81k stars 161 forks source link

Remove unnecessary call to __requireComputeDerivative #4283

Closed jkwak-work closed 1 month ago

jkwak-work commented 1 month ago

When SPIR-V uses operators whose name has a keyword, "Implicit", they require calling a function "__requireComputeDerivative()".

When it uses "Explicit", the function doesn't need to be called.

ArielG-NV commented 1 month ago

Is our HLSL intrinsic definitions correct? SampleLevel for example shouldn't need this either, right?

SampleLevel (including other explicit LOD functions) and gradient functions do not need __requireComputeDerivative.

jkwak-work commented 1 month ago

That's a good catch. I didn't think about hlsl.meta.slang. I spotted a few functions that uses Implicit but not calling __requireComputeDerivative(). I am pushing the new change for a review.