Fix textureOffset overload

float textureOffset(sampler2DArrayShadow sampler, vec4 P, ivec2 offset)
was incorrectly requiring the GL_EXT_texture_shadow_lod extension.

NOTE: Prior to GLSL 440, this prototype was defined as

float textureOffset(sampler2DArrayShadow sampler, vec4 P, vec2 offset)

i.e., the type of 'offset' was specified as 'vec2' rather than 'ivec2'.
This is believed to be a typo.

Fixes #3325.
This commit is contained in:
Nathaniel Cesario 2023-09-08 13:44:08 -06:00 committed by arcady-lunarg
parent fb2882a3c3
commit e8d657bdbe
3 changed files with 22 additions and 29 deletions

View File

@ -1,7 +1,7 @@
spv.ext.texture_shadow_lod.frag spv.ext.texture_shadow_lod.frag
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 8000b // Generated by (magic number): 8000b
// Id's are bound by 59 // Id's are bound by 55
Capability Shader Capability Shader
Capability SampledCubeArray Capability SampledCubeArray
@ -16,15 +16,15 @@ spv.ext.texture_shadow_lod.frag
Name 12 "s2da" Name 12 "s2da"
Name 16 "tc" Name 16 "tc"
Name 24 "sca" Name 24 "sca"
Name 47 "sc" Name 43 "sc"
Decorate 8(c) Location 0 Decorate 8(c) Location 0
Decorate 12(s2da) DescriptorSet 0 Decorate 12(s2da) DescriptorSet 0
Decorate 12(s2da) Binding 0 Decorate 12(s2da) Binding 0
Decorate 16(tc) Location 0 Decorate 16(tc) Location 0
Decorate 24(sca) DescriptorSet 0 Decorate 24(sca) DescriptorSet 0
Decorate 24(sca) Binding 1 Decorate 24(sca) Binding 1
Decorate 47(sc) DescriptorSet 0 Decorate 43(sc) DescriptorSet 0
Decorate 47(sc) Binding 2 Decorate 43(sc) Binding 2
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
@ -46,10 +46,10 @@ spv.ext.texture_shadow_lod.frag
31: TypeVector 30(int) 2 31: TypeVector 30(int) 2
32: 30(int) Constant 0 32: 30(int) Constant 0
33: 31(ivec2) ConstantComposite 32 32 33: 31(ivec2) ConstantComposite 32 32
44: TypeImage 6(float) Cube depth sampled format:Unknown 40: TypeImage 6(float) Cube depth sampled format:Unknown
45: TypeSampledImage 44 41: TypeSampledImage 40
46: TypePointer UniformConstant 45 42: TypePointer UniformConstant 41
47(sc): 46(ptr) Variable UniformConstant 43(sc): 42(ptr) Variable UniformConstant
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
13: 10 Load 12(s2da) 13: 10 Load 12(s2da)
@ -64,31 +64,26 @@ spv.ext.texture_shadow_lod.frag
28: 10 Load 12(s2da) 28: 10 Load 12(s2da)
29: 14(fvec4) Load 16(tc) 29: 14(fvec4) Load 16(tc)
34: 6(float) CompositeExtract 29 3 34: 6(float) CompositeExtract 29 3
35: 6(float) ImageSampleDrefImplicitLod 28 29 34 ConstOffset 33 35: 6(float) ImageSampleDrefImplicitLod 28 29 34 Bias ConstOffset 18 33
Store 8(c) 35 Store 8(c) 35
36: 10 Load 12(s2da) 36: 10 Load 12(s2da)
37: 14(fvec4) Load 16(tc) 37: 14(fvec4) Load 16(tc)
38: 6(float) CompositeExtract 37 3 38: 6(float) CompositeExtract 37 3
39: 6(float) ImageSampleDrefImplicitLod 36 37 38 Bias ConstOffset 18 33 39: 6(float) ImageSampleDrefExplicitLod 36 37 38 Lod 18
Store 8(c) 39 Store 8(c) 39
40: 10 Load 12(s2da) 44: 41 Load 43(sc)
41: 14(fvec4) Load 16(tc) 45: 14(fvec4) Load 16(tc)
42: 6(float) CompositeExtract 41 3 46: 6(float) CompositeExtract 45 3
43: 6(float) ImageSampleDrefExplicitLod 40 41 42 Lod 18 47: 6(float) ImageSampleDrefExplicitLod 44 45 46 Lod 18
Store 8(c) 43 Store 8(c) 47
48: 45 Load 47(sc) 48: 22 Load 24(sca)
49: 14(fvec4) Load 16(tc) 49: 14(fvec4) Load 16(tc)
50: 6(float) CompositeExtract 49 3 50: 6(float) ImageSampleDrefExplicitLod 48 49 18 Lod 18
51: 6(float) ImageSampleDrefExplicitLod 48 49 50 Lod 18 Store 8(c) 50
Store 8(c) 51 51: 10 Load 12(s2da)
52: 22 Load 24(sca) 52: 14(fvec4) Load 16(tc)
53: 14(fvec4) Load 16(tc) 53: 6(float) CompositeExtract 52 3
54: 6(float) ImageSampleDrefExplicitLod 52 53 18 Lod 18 54: 6(float) ImageSampleDrefExplicitLod 51 52 53 Lod ConstOffset 18 33
Store 8(c) 54 Store 8(c) 54
55: 10 Load 12(s2da)
56: 14(fvec4) Load 16(tc)
57: 6(float) CompositeExtract 56 3
58: 6(float) ImageSampleDrefExplicitLod 55 56 57 Lod ConstOffset 18 33
Store 8(c) 58
Return Return
FunctionEnd FunctionEnd

View File

@ -12,7 +12,6 @@ layout(location = 0) in vec4 tc;
void main() { void main() {
c = texture(s2da, tc, 0.0); c = texture(s2da, tc, 0.0);
c = texture(sca, tc, 0.0, 0.0); c = texture(sca, tc, 0.0, 0.0);
c = textureOffset(s2da, tc, ivec2(0.0));
c = textureOffset(s2da, tc, ivec2(0.0), 0.0); c = textureOffset(s2da, tc, ivec2(0.0), 0.0);
c = textureLod(s2da, tc, 0.0); c = textureLod(s2da, tc, 0.0);
c = textureLod(sc, tc, 0.0); c = textureLod(sc, tc, 0.0);

View File

@ -4866,7 +4866,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
} else if (version >= 130) { // Desktop } else if (version >= 130) { // Desktop
textureShadowLodFunctions += "float texture(sampler2DArrayShadow, vec4, float);" textureShadowLodFunctions += "float texture(sampler2DArrayShadow, vec4, float);"
"float texture(samplerCubeArrayShadow, vec4, float, float);" "float texture(samplerCubeArrayShadow, vec4, float, float);"
"float textureOffset(sampler2DArrayShadow, vec4, ivec2);"
"float textureOffset(sampler2DArrayShadow, vec4, ivec2, float);" "float textureOffset(sampler2DArrayShadow, vec4, ivec2, float);"
"float textureLod(sampler2DArrayShadow, vec4, float);" "float textureLod(sampler2DArrayShadow, vec4, float);"
"float textureLod(samplerCubeShadow, vec4, float);" "float textureLod(samplerCubeShadow, vec4, float);"