Skip to content

Disallow implicit LOD texture methods in Compute shaders. #1221

Closed

Description

@dj2

Using an implicit LOD in a compute shader in SPIR-V causes shader validation errors as it requires extra capabilities.

[[stage(compute)]] fn main() -> void { 
  result0.value = textureSample(tex0, samp, vec2<f32>(0.5, 0.5)).x;
  result1.value = textureLoad(tex1, vec2<i32>(0, 0), 0).x;
  return;
}
error: line 61: OpEntryPoint Entry Point <id> '20[%main]'s callgraph contains function <id> 20[%main], which cannot be used with the current execution modes:
ImplicitLod instructions require DerivativeGroupQuadsNV or DerivativeGroupLinearNV execution mode for GLCompute execution model: ImageSampleImplicitLod

Given the extra capabilities required, I think we should disallow the use of the implicit LOD texture methods in compute shaders.

Activity

  1. added
    wgsl
    on Nov 13, 2020
  2. added this to the MVP milestone on Nov 13, 2020
  3. dj2 commented on Nov 13, 2020

    @dj2
    MemberAuthor
  4. pow2clk commented on Nov 17, 2020

    @pow2clk

    HLSL has similar limitations. I had assumed that this was already disallowed.

  5. kvark commented on Nov 20, 2020

    @kvark
    Contributor

    Implicit LOD should only be allowed in fragment shaders.
    I.e. vertex shaders are also in the same group as compute.

  6. Kangz commented on Nov 16, 2021

    @Kangz
    Contributor

    Closing. The spec has restrictions that texture builtins with implicit LOD and derivative functions must only be called in fragment shaders and with uniform control flow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    wgsl

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions