shader-slang / slang

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

textureQueryLod needs to be used with ImageQuery capability #4357

Closed jkwak-work closed 3 days ago

jkwak-work commented 3 weeks ago

Problem Description A regression from CTS test is found when textureQueryLod is used. The tests pass but they print a validation error.

Goal We should use the function with a capability, "ImageQuery", before using the instruction, OpImageQueryLod.

Repro step The following vertex shader code is from CTS test, "dEQP-VK.glsl.texture_functions.query.texturequerylod.isampler2d_fragment".

//TEST:SIMPLE:-target spirv-asm -entry main -stage fragment

#version 450 core
layout(location = 0) out mediump vec4 o_color;
layout (location = 0) in highp vec2 v_texCoord;
layout(set = 0, binding = 0) uniform highp isampler2D u_sampler;

void main()
{
        o_color = vec4(textureQueryLod(u_sampler, v_texCoord), 0.0, 1.0);
}

When ran, a validation error is observed as following,

error: line 40: Opcode ImageQueryLod requires one of these capabilities: ImageQuery
  %20 = OpImageQueryLod %v2float %16 %19