Quick answer: Vulkan compute shader using ddx/ddy validation error? Derivatives are fragment-only; compute shaders need explicit gradient sampling.

Compute shader; uses ddx for mip selection; validation: 'derivative outside fragment'.

Use textureGrad

Explicit gradient sample; compute-shader compatible.

Or compute manually

Sample 4 nearby texels; compute derivatives manually.

Verify per stage

Each shader stage's capability set documented.

“Shader stages have different capabilities. Derivatives are fragment-only.”

If your compute shader needs mip selection, the textureGrad path is the answer.

Related reading