From e8d657bdbe228ae045e9902e14b6dd8119402b8a Mon Sep 17 00:00:00 2001 From: Nathaniel Cesario Date: Fri, 8 Sep 2023 13:44:08 -0600 Subject: [PATCH] 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. --- .../spv.ext.texture_shadow_lod.frag.out | 49 +++++++++---------- Test/spv.ext.texture_shadow_lod.frag | 1 - glslang/MachineIndependent/Initialize.cpp | 1 - 3 files changed, 22 insertions(+), 29 deletions(-) diff --git a/Test/baseResults/spv.ext.texture_shadow_lod.frag.out b/Test/baseResults/spv.ext.texture_shadow_lod.frag.out index 0428f182..0cc54a9b 100644 --- a/Test/baseResults/spv.ext.texture_shadow_lod.frag.out +++ b/Test/baseResults/spv.ext.texture_shadow_lod.frag.out @@ -1,7 +1,7 @@ spv.ext.texture_shadow_lod.frag // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 59 +// Id's are bound by 55 Capability Shader Capability SampledCubeArray @@ -16,15 +16,15 @@ spv.ext.texture_shadow_lod.frag Name 12 "s2da" Name 16 "tc" Name 24 "sca" - Name 47 "sc" + Name 43 "sc" Decorate 8(c) Location 0 Decorate 12(s2da) DescriptorSet 0 Decorate 12(s2da) Binding 0 Decorate 16(tc) Location 0 Decorate 24(sca) DescriptorSet 0 Decorate 24(sca) Binding 1 - Decorate 47(sc) DescriptorSet 0 - Decorate 47(sc) Binding 2 + Decorate 43(sc) DescriptorSet 0 + Decorate 43(sc) Binding 2 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -46,10 +46,10 @@ spv.ext.texture_shadow_lod.frag 31: TypeVector 30(int) 2 32: 30(int) Constant 0 33: 31(ivec2) ConstantComposite 32 32 - 44: TypeImage 6(float) Cube depth sampled format:Unknown - 45: TypeSampledImage 44 - 46: TypePointer UniformConstant 45 - 47(sc): 46(ptr) Variable UniformConstant + 40: TypeImage 6(float) Cube depth sampled format:Unknown + 41: TypeSampledImage 40 + 42: TypePointer UniformConstant 41 + 43(sc): 42(ptr) Variable UniformConstant 4(main): 2 Function None 3 5: Label 13: 10 Load 12(s2da) @@ -64,31 +64,26 @@ spv.ext.texture_shadow_lod.frag 28: 10 Load 12(s2da) 29: 14(fvec4) Load 16(tc) 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 36: 10 Load 12(s2da) 37: 14(fvec4) Load 16(tc) 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 - 40: 10 Load 12(s2da) - 41: 14(fvec4) Load 16(tc) - 42: 6(float) CompositeExtract 41 3 - 43: 6(float) ImageSampleDrefExplicitLod 40 41 42 Lod 18 - Store 8(c) 43 - 48: 45 Load 47(sc) + 44: 41 Load 43(sc) + 45: 14(fvec4) Load 16(tc) + 46: 6(float) CompositeExtract 45 3 + 47: 6(float) ImageSampleDrefExplicitLod 44 45 46 Lod 18 + Store 8(c) 47 + 48: 22 Load 24(sca) 49: 14(fvec4) Load 16(tc) - 50: 6(float) CompositeExtract 49 3 - 51: 6(float) ImageSampleDrefExplicitLod 48 49 50 Lod 18 - Store 8(c) 51 - 52: 22 Load 24(sca) - 53: 14(fvec4) Load 16(tc) - 54: 6(float) ImageSampleDrefExplicitLod 52 53 18 Lod 18 + 50: 6(float) ImageSampleDrefExplicitLod 48 49 18 Lod 18 + Store 8(c) 50 + 51: 10 Load 12(s2da) + 52: 14(fvec4) Load 16(tc) + 53: 6(float) CompositeExtract 52 3 + 54: 6(float) ImageSampleDrefExplicitLod 51 52 53 Lod ConstOffset 18 33 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 FunctionEnd diff --git a/Test/spv.ext.texture_shadow_lod.frag b/Test/spv.ext.texture_shadow_lod.frag index 2d9db7bb..8c879d9b 100644 --- a/Test/spv.ext.texture_shadow_lod.frag +++ b/Test/spv.ext.texture_shadow_lod.frag @@ -12,7 +12,6 @@ layout(location = 0) in vec4 tc; void main() { c = texture(s2da, tc, 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 = textureLod(s2da, tc, 0.0); c = textureLod(sc, tc, 0.0); diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index fc0a36fa..25d87370 100755 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -4866,7 +4866,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV } else if (version >= 130) { // Desktop textureShadowLodFunctions += "float texture(sampler2DArrayShadow, vec4, float);" "float texture(samplerCubeArrayShadow, vec4, float, float);" - "float textureOffset(sampler2DArrayShadow, vec4, ivec2);" "float textureOffset(sampler2DArrayShadow, vec4, ivec2, float);" "float textureLod(sampler2DArrayShadow, vec4, float);" "float textureLod(samplerCubeShadow, vec4, float);"