From 3a1379667dd7d998be1d7d64806443295e8cf5f9 Mon Sep 17 00:00:00 2001 From: Chao Chen Date: Wed, 19 Sep 2018 11:41:27 -0700 Subject: [PATCH] 0003-Add-support-for-SPV_NV_shader_image_footprint --- SPIRV/GLSL.ext.NV.h | 5 +- SPIRV/GlslangToSpv.cpp | 101 ++- SPIRV/SpvBuilder.cpp | 11 + SPIRV/SpvBuilder.h | 4 + SPIRV/doc.cpp | 8 + .../spv.shaderImageFootprint.frag.out | 849 ++++++++++++++++++ Test/spv.shaderImageFootprint.frag | 123 +++ glslang/Include/intermediate.h | 30 + glslang/MachineIndependent/Initialize.cpp | 51 ++ glslang/MachineIndependent/Versions.cpp | 2 + glslang/MachineIndependent/Versions.h | 1 + glslang/MachineIndependent/intermOut.cpp | 8 +- gtests/Spv.FromFile.cpp | 1 + 13 files changed, 1189 insertions(+), 5 deletions(-) create mode 100644 Test/baseResults/spv.shaderImageFootprint.frag.out create mode 100644 Test/spv.shaderImageFootprint.frag diff --git a/SPIRV/GLSL.ext.NV.h b/SPIRV/GLSL.ext.NV.h index ddef3ddae..651ef0922 100644 --- a/SPIRV/GLSL.ext.NV.h +++ b/SPIRV/GLSL.ext.NV.h @@ -33,7 +33,7 @@ enum Op; enum Capability; static const int GLSLextNVVersion = 100; -static const int GLSLextNVRevision = 7; +static const int GLSLextNVRevision = 8; //SPV_NV_sample_mask_override_coverage const char* const E_SPV_NV_sample_mask_override_coverage = "SPV_NV_sample_mask_override_coverage"; @@ -60,4 +60,7 @@ const char* const E_SPV_NV_fragment_shader_barycentric = "SPV_NV_fragment_shader //SPV_NV_compute_shader_derivatives const char* const E_SPV_NV_compute_shader_derivatives = "SPV_NV_compute_shader_derivatives"; +//SPV_NV_shader_image_footprint +const char* const E_SPV_NV_shader_image_footprint = "SPV_NV_shader_image_footprint"; + #endif // #ifndef GLSLextNV_H \ No newline at end of file diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 4911920da..842582f52 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -3667,6 +3667,25 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& if (i == 3) lvalue = true; break; +#endif +#ifdef NV_EXTENSIONS + case glslang::EOpImageSampleFootprintNV: + if (i == 4) + lvalue = true; + break; + case glslang::EOpImageSampleFootprintClampNV: + case glslang::EOpImageSampleFootprintLodNV: + if (i == 5) + lvalue = true; + break; + case glslang::EOpImageSampleFootprintGradNV: + if (i == 6) + lvalue = true; + break; + case glslang::EOpImageSampleFootprintGradClampNV: + if (i == 7) + lvalue = true; + break; #endif default: break; @@ -4020,6 +4039,10 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO // Check for texture functions other than queries bool sparse = node->isSparseTexture(); +#ifdef NV_EXTENSIONS + bool imageFootprint = node->isImageFootprint(); +#endif + bool cubeCompare = sampler.dim == glslang::EsdCube && sampler.arrayed && sampler.shadow; // check for bias argument @@ -4049,7 +4072,12 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ++nonBiasArgCount; if (sparse) ++nonBiasArgCount; - +#ifdef NV_EXTENSIONS + if (imageFootprint) + //Following three extra arguments + // int granularity, bool coarse, out gl_TextureFootprint2DNV footprint + nonBiasArgCount += 3; +#endif if ((int)arguments.size() > nonBiasArgCount) bias = true; } @@ -4142,7 +4170,6 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO params.lodClamp = arguments[2 + extraArgs]; ++extraArgs; } - // sparse if (sparse) { params.texelOut = arguments[2 + extraArgs]; @@ -4158,13 +4185,81 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO } else params.component = builder.makeIntConstant(0); } - +#ifdef NV_EXTENSIONS + spv::Id resultStruct = spv::NoResult; + if (imageFootprint) { + //Following three extra arguments + // int granularity, bool coarse, out gl_TextureFootprint2DNV footprint + params.granularity = arguments[2 + extraArgs]; + params.coarse = arguments[3 + extraArgs]; + resultStruct = arguments[4 + extraArgs]; + extraArgs += 3; + } +#endif // bias if (bias) { params.bias = arguments[2 + extraArgs]; ++extraArgs; } +#ifdef NV_EXTENSIONS + if (imageFootprint) { + builder.addExtension(spv::E_SPV_NV_shader_image_footprint); + builder.addCapability(spv::CapabilityImageFootprintNV); + + + //resultStructType(OpenGL type) contains 5 elements: + //struct gl_TextureFootprint2DNV { + // uvec2 anchor; + // uvec2 offset; + // uvec2 mask; + // uint lod; + // uint granularity; + //}; + //or + //struct gl_TextureFootprint3DNV { + // uvec3 anchor; + // uvec3 offset; + // uvec2 mask; + // uint lod; + // uint granularity; + //}; + spv::Id resultStructType = builder.getContainedTypeId(builder.getTypeId(resultStruct)); + assert(builder.isStructType(resultStructType)); + + //resType (SPIR-V type) contains 6 elements: + //Member 0 must be a Boolean type scalar(LOD), + //Member 1 must be a vector of integer type, whose Signedness operand is 0(anchor), + //Member 2 must be a vector of integer type, whose Signedness operand is 0(offset), + //Member 3 must be a vector of integer type, whose Signedness operand is 0(mask), + //Member 4 must be a scalar of integer type, whose Signedness operand is 0(lod), + //Member 5 must be a scalar of integer type, whose Signedness operand is 0(granularity). + std::vector members; + members.push_back(resultType()); + for (int i = 0; i < 5; i++) { + members.push_back(builder.getContainedTypeId(resultStructType, i)); + } + spv::Id resType = builder.makeStructType(members, "ResType"); + + //call ImageFootprintNV + spv::Id res = builder.createTextureCall(precision, resType, sparse, cracked.fetch, cracked.proj, cracked.gather, noImplicitLod, params); + + //copy resType (SPIR-V type) to resultStructType(OpenGL type) + for (int i = 0; i < 5; i++) { + builder.clearAccessChain(); + builder.setAccessChainLValue(resultStruct); + + //Accessing to a struct we created, no coherent flag is set + spv::Builder::AccessChain::CoherentFlags flags; + flags.clear(); + + builder.accessChainPush(builder.makeIntConstant(i), flags); + builder.accessChainStore(builder.createCompositeExtract(res, builder.getContainedTypeId(resType, i+1), i+1)); + } + return builder.createCompositeExtract(res, resultType(), 0); + } +#endif + // projective component (might not to move) // GLSL: "The texture coordinates consumed from P, not including the last component of P, // are divided by the last component of P." diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index 0891e8c7f..c13f77f15 100644 --- a/SPIRV/SpvBuilder.cpp +++ b/SPIRV/SpvBuilder.cpp @@ -1654,6 +1654,13 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, if (parameters.component != NoResult) texArgs[numArgs++] = parameters.component; +#ifdef NV_EXTENSIONS + if (parameters.granularity != NoResult) + texArgs[numArgs++] = parameters.granularity; + if (parameters.coarse != NoResult) + texArgs[numArgs++] = parameters.coarse; +#endif + // // Set up the optional arguments // @@ -1725,6 +1732,10 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, opCode = OpImageSparseFetch; else opCode = OpImageFetch; +#ifdef NV_EXTENSIONS + } else if (parameters.granularity && parameters.coarse) { + opCode = OpImageSampleFootprintNV; +#endif } else if (gather) { if (parameters.Dref) if (sparse) diff --git a/SPIRV/SpvBuilder.h b/SPIRV/SpvBuilder.h index eb52d0142..94533e483 100644 --- a/SPIRV/SpvBuilder.h +++ b/SPIRV/SpvBuilder.h @@ -366,6 +366,10 @@ public: Id component; Id texelOut; Id lodClamp; +#ifdef NV_EXTENSIONS + Id granularity; + Id coarse; +#endif bool nonprivate; bool volatil; }; diff --git a/SPIRV/doc.cpp b/SPIRV/doc.cpp index 4aaf79091..7cf3fc8de 100644 --- a/SPIRV/doc.cpp +++ b/SPIRV/doc.cpp @@ -1251,7 +1251,9 @@ const char* OpcodeString(int op) #ifdef NV_EXTENSIONS case OpGroupNonUniformPartitionNV: return "OpGroupNonUniformPartitionNV"; + case OpImageSampleFootprintNV: return "OpImageSampleFootprintNV"; #endif + default: return "Bad"; } @@ -2596,6 +2598,12 @@ void Parameterize() #ifdef NV_EXTENSIONS InstructionDesc[OpGroupNonUniformPartitionNV].operands.push(OperandId, "X"); + InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Sampled Image'"); + InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Granularity'"); + InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Coarse'"); + InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandVariableIds, "", true); #endif } diff --git a/Test/baseResults/spv.shaderImageFootprint.frag.out b/Test/baseResults/spv.shaderImageFootprint.frag.out new file mode 100644 index 000000000..2ada2b5af --- /dev/null +++ b/Test/baseResults/spv.shaderImageFootprint.frag.out @@ -0,0 +1,849 @@ +spv.shaderImageFootprint.frag +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 622 + + Capability Shader + Capability MinLod + Capability Bad + Extension "SPV_NV_shader_image_footprint" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 21 24 76 125 225 275 277 387 + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_NV_shader_texture_footprint" + Name 4 "main" + Name 8 "result2D" + MemberName 8(result2D) 0 "ret2D" + MemberName 8(result2D) 1 "anchor2D" + MemberName 8(result2D) 2 "offset2D" + MemberName 8(result2D) 3 "mask2D" + MemberName 8(result2D) 4 "lod2D" + MemberName 8(result2D) 5 "granularity2D" + Name 10 "" + Name 17 "sample2D" + Name 21 "P2" + Name 24 "granularity" + Name 28 "gl_TextureFootprint2DNV" + MemberName 28(gl_TextureFootprint2DNV) 0 "anchor" + MemberName 28(gl_TextureFootprint2DNV) 1 "offset" + MemberName 28(gl_TextureFootprint2DNV) 2 "mask" + MemberName 28(gl_TextureFootprint2DNV) 3 "lod" + MemberName 28(gl_TextureFootprint2DNV) 4 "granularity" + Name 30 "fp2D" + Name 31 "ResType" + Name 76 "bias" + Name 78 "ResType" + Name 125 "lodClamp" + Name 128 "ResType" + Name 178 "ResType" + Name 225 "lod" + Name 228 "ResType" + Name 275 "dx" + Name 277 "dy" + Name 280 "ResType" + Name 331 "ResType" + Name 377 "result3D" + MemberName 377(result3D) 0 "ret3D" + MemberName 377(result3D) 1 "anchor3D" + MemberName 377(result3D) 2 "offset3D" + MemberName 377(result3D) 3 "mask3D" + MemberName 377(result3D) 4 "lod3D" + MemberName 377(result3D) 5 "granularity3D" + Name 379 "" + Name 383 "sample3D" + Name 387 "P3" + Name 390 "gl_TextureFootprint3DNV" + MemberName 390(gl_TextureFootprint3DNV) 0 "anchor" + MemberName 390(gl_TextureFootprint3DNV) 1 "offset" + MemberName 390(gl_TextureFootprint3DNV) 2 "mask" + MemberName 390(gl_TextureFootprint3DNV) 3 "lod" + MemberName 390(gl_TextureFootprint3DNV) 4 "granularity" + Name 392 "fp3D" + Name 393 "ResType" + Name 429 "ResType" + Name 478 "ResType" + Name 528 "ResType" + Name 577 "ResType" + MemberDecorate 8(result2D) 0 Offset 0 + MemberDecorate 8(result2D) 1 Offset 8 + MemberDecorate 8(result2D) 2 Offset 16 + MemberDecorate 8(result2D) 3 Offset 24 + MemberDecorate 8(result2D) 4 Offset 32 + MemberDecorate 8(result2D) 5 Offset 36 + Decorate 8(result2D) BufferBlock + Decorate 10 DescriptorSet 0 + Decorate 17(sample2D) DescriptorSet 0 + Decorate 21(P2) Location 0 + Decorate 24(granularity) Flat + Decorate 24(granularity) Location 3 + Decorate 76(bias) Location 9 + Decorate 125(lodClamp) Location 4 + Decorate 225(lod) Location 5 + Decorate 275(dx) Location 6 + Decorate 277(dy) Location 8 + MemberDecorate 377(result3D) 0 Offset 0 + MemberDecorate 377(result3D) 1 Offset 16 + MemberDecorate 377(result3D) 2 Offset 32 + MemberDecorate 377(result3D) 3 Offset 48 + MemberDecorate 377(result3D) 4 Offset 56 + MemberDecorate 377(result3D) 5 Offset 60 + Decorate 377(result3D) BufferBlock + Decorate 379 DescriptorSet 0 + Decorate 383(sample3D) DescriptorSet 0 + Decorate 387(P3) Location 2 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 2 + 8(result2D): TypeStruct 6(int) 7(ivec2) 7(ivec2) 7(ivec2) 6(int) 6(int) + 9: TypePointer Uniform 8(result2D) + 10: 9(ptr) Variable Uniform + 11: TypeInt 32 1 + 12: 11(int) Constant 0 + 13: TypeFloat 32 + 14: TypeImage 13(float) 2D sampled format:Unknown + 15: TypeSampledImage 14 + 16: TypePointer UniformConstant 15 + 17(sample2D): 16(ptr) Variable UniformConstant + 19: TypeVector 13(float) 2 + 20: TypePointer Input 19(fvec2) + 21(P2): 20(ptr) Variable Input + 23: TypePointer Input 11(int) + 24(granularity): 23(ptr) Variable Input + 26: TypeBool + 27: 26(bool) ConstantTrue +28(gl_TextureFootprint2DNV): TypeStruct 7(ivec2) 7(ivec2) 7(ivec2) 6(int) 6(int) + 29: TypePointer Function 28(gl_TextureFootprint2DNV) + 31(ResType): TypeStruct 26(bool) 7(ivec2) 7(ivec2) 7(ivec2) 6(int) 6(int) + 34: TypePointer Function 7(ivec2) + 36: 11(int) Constant 1 + 39: 11(int) Constant 2 + 42: 11(int) Constant 3 + 44: TypePointer Function 6(int) + 46: 11(int) Constant 4 + 50: 6(int) Constant 1 + 51: 6(int) Constant 0 + 53: TypePointer Uniform 6(int) + 57: TypePointer Uniform 7(ivec2) + 68: 11(int) Constant 5 + 75: TypePointer Input 13(float) + 76(bias): 75(ptr) Variable Input + 78(ResType): TypeStruct 26(bool) 7(ivec2) 7(ivec2) 7(ivec2) 6(int) 6(int) + 125(lodClamp): 75(ptr) Variable Input + 128(ResType): TypeStruct 26(bool) 7(ivec2) 7(ivec2) 7(ivec2) 6(int) 6(int) + 178(ResType): TypeStruct 26(bool) 7(ivec2) 7(ivec2) 7(ivec2) 6(int) 6(int) + 225(lod): 75(ptr) Variable Input + 228(ResType): TypeStruct 26(bool) 7(ivec2) 7(ivec2) 7(ivec2) 6(int) 6(int) + 275(dx): 20(ptr) Variable Input + 277(dy): 20(ptr) Variable Input + 280(ResType): TypeStruct 26(bool) 7(ivec2) 7(ivec2) 7(ivec2) 6(int) 6(int) + 331(ResType): TypeStruct 26(bool) 7(ivec2) 7(ivec2) 7(ivec2) 6(int) 6(int) + 376: TypeVector 6(int) 3 + 377(result3D): TypeStruct 6(int) 376(ivec3) 376(ivec3) 7(ivec2) 6(int) 6(int) + 378: TypePointer Uniform 377(result3D) + 379: 378(ptr) Variable Uniform + 380: TypeImage 13(float) 3D sampled format:Unknown + 381: TypeSampledImage 380 + 382: TypePointer UniformConstant 381 + 383(sample3D): 382(ptr) Variable UniformConstant + 385: TypeVector 13(float) 3 + 386: TypePointer Input 385(fvec3) + 387(P3): 386(ptr) Variable Input +390(gl_TextureFootprint3DNV): TypeStruct 376(ivec3) 376(ivec3) 7(ivec2) 6(int) 6(int) + 391: TypePointer Function 390(gl_TextureFootprint3DNV) + 393(ResType): TypeStruct 26(bool) 376(ivec3) 376(ivec3) 7(ivec2) 6(int) 6(int) + 396: TypePointer Function 376(ivec3) + 411: TypePointer Uniform 376(ivec3) + 429(ResType): TypeStruct 26(bool) 376(ivec3) 376(ivec3) 7(ivec2) 6(int) 6(int) + 478(ResType): TypeStruct 26(bool) 376(ivec3) 376(ivec3) 7(ivec2) 6(int) 6(int) + 528(ResType): TypeStruct 26(bool) 376(ivec3) 376(ivec3) 7(ivec2) 6(int) 6(int) + 577(ResType): TypeStruct 26(bool) 376(ivec3) 376(ivec3) 7(ivec2) 6(int) 6(int) + 4(main): 2 Function None 3 + 5: Label + 30(fp2D): 29(ptr) Variable Function + 392(fp3D): 391(ptr) Variable Function + 18: 15 Load 17(sample2D) + 22: 19(fvec2) Load 21(P2) + 25: 11(int) Load 24(granularity) + 32: 31(ResType) ImageSampleFootprintNV 18 22 25 27 + 33: 7(ivec2) CompositeExtract 32 1 + 35: 34(ptr) AccessChain 30(fp2D) 12 + Store 35 33 + 37: 7(ivec2) CompositeExtract 32 2 + 38: 34(ptr) AccessChain 30(fp2D) 36 + Store 38 37 + 40: 7(ivec2) CompositeExtract 32 3 + 41: 34(ptr) AccessChain 30(fp2D) 39 + Store 41 40 + 43: 6(int) CompositeExtract 32 4 + 45: 44(ptr) AccessChain 30(fp2D) 42 + Store 45 43 + 47: 6(int) CompositeExtract 32 5 + 48: 44(ptr) AccessChain 30(fp2D) 46 + Store 48 47 + 49: 26(bool) CompositeExtract 32 0 + 52: 6(int) Select 49 50 51 + 54: 53(ptr) AccessChain 10 12 + Store 54 52 + 55: 34(ptr) AccessChain 30(fp2D) 12 + 56: 7(ivec2) Load 55 + 58: 57(ptr) AccessChain 10 36 + Store 58 56 + 59: 34(ptr) AccessChain 30(fp2D) 36 + 60: 7(ivec2) Load 59 + 61: 57(ptr) AccessChain 10 39 + Store 61 60 + 62: 34(ptr) AccessChain 30(fp2D) 39 + 63: 7(ivec2) Load 62 + 64: 57(ptr) AccessChain 10 42 + Store 64 63 + 65: 44(ptr) AccessChain 30(fp2D) 42 + 66: 6(int) Load 65 + 67: 53(ptr) AccessChain 10 46 + Store 67 66 + 69: 44(ptr) AccessChain 30(fp2D) 46 + 70: 6(int) Load 69 + 71: 53(ptr) AccessChain 10 68 + Store 71 70 + 72: 15 Load 17(sample2D) + 73: 19(fvec2) Load 21(P2) + 74: 11(int) Load 24(granularity) + 77: 13(float) Load 76(bias) + 79: 78(ResType) ImageSampleFootprintNV 72 73 74 27 Bias 77 + 80: 7(ivec2) CompositeExtract 79 1 + 81: 34(ptr) AccessChain 30(fp2D) 12 + Store 81 80 + 82: 7(ivec2) CompositeExtract 79 2 + 83: 34(ptr) AccessChain 30(fp2D) 36 + Store 83 82 + 84: 7(ivec2) CompositeExtract 79 3 + 85: 34(ptr) AccessChain 30(fp2D) 39 + Store 85 84 + 86: 6(int) CompositeExtract 79 4 + 87: 44(ptr) AccessChain 30(fp2D) 42 + Store 87 86 + 88: 6(int) CompositeExtract 79 5 + 89: 44(ptr) AccessChain 30(fp2D) 46 + Store 89 88 + 90: 26(bool) CompositeExtract 79 0 + 91: 6(int) Select 90 50 51 + 92: 53(ptr) AccessChain 10 12 + Store 92 91 + 93: 34(ptr) AccessChain 30(fp2D) 12 + 94: 7(ivec2) Load 93 + 95: 57(ptr) AccessChain 10 36 + 96: 7(ivec2) Load 95 + 97: 7(ivec2) IAdd 96 94 + 98: 57(ptr) AccessChain 10 36 + Store 98 97 + 99: 34(ptr) AccessChain 30(fp2D) 36 + 100: 7(ivec2) Load 99 + 101: 57(ptr) AccessChain 10 39 + 102: 7(ivec2) Load 101 + 103: 7(ivec2) IAdd 102 100 + 104: 57(ptr) AccessChain 10 39 + Store 104 103 + 105: 34(ptr) AccessChain 30(fp2D) 39 + 106: 7(ivec2) Load 105 + 107: 57(ptr) AccessChain 10 42 + 108: 7(ivec2) Load 107 + 109: 7(ivec2) IAdd 108 106 + 110: 57(ptr) AccessChain 10 42 + Store 110 109 + 111: 44(ptr) AccessChain 30(fp2D) 42 + 112: 6(int) Load 111 + 113: 53(ptr) AccessChain 10 46 + 114: 6(int) Load 113 + 115: 6(int) IAdd 114 112 + 116: 53(ptr) AccessChain 10 46 + Store 116 115 + 117: 44(ptr) AccessChain 30(fp2D) 46 + 118: 6(int) Load 117 + 119: 53(ptr) AccessChain 10 68 + 120: 6(int) Load 119 + 121: 6(int) IAdd 120 118 + 122: 53(ptr) AccessChain 10 68 + Store 122 121 + 123: 15 Load 17(sample2D) + 124: 19(fvec2) Load 21(P2) + 126: 13(float) Load 125(lodClamp) + 127: 11(int) Load 24(granularity) + 129:128(ResType) ImageSampleFootprintNV 123 124 127 27 MinLod 126 + 130: 7(ivec2) CompositeExtract 129 1 + 131: 34(ptr) AccessChain 30(fp2D) 12 + Store 131 130 + 132: 7(ivec2) CompositeExtract 129 2 + 133: 34(ptr) AccessChain 30(fp2D) 36 + Store 133 132 + 134: 7(ivec2) CompositeExtract 129 3 + 135: 34(ptr) AccessChain 30(fp2D) 39 + Store 135 134 + 136: 6(int) CompositeExtract 129 4 + 137: 44(ptr) AccessChain 30(fp2D) 42 + Store 137 136 + 138: 6(int) CompositeExtract 129 5 + 139: 44(ptr) AccessChain 30(fp2D) 46 + Store 139 138 + 140: 26(bool) CompositeExtract 129 0 + 141: 6(int) Select 140 50 51 + 142: 53(ptr) AccessChain 10 12 + Store 142 141 + 143: 34(ptr) AccessChain 30(fp2D) 12 + 144: 7(ivec2) Load 143 + 145: 57(ptr) AccessChain 10 36 + 146: 7(ivec2) Load 145 + 147: 7(ivec2) IAdd 146 144 + 148: 57(ptr) AccessChain 10 36 + Store 148 147 + 149: 34(ptr) AccessChain 30(fp2D) 36 + 150: 7(ivec2) Load 149 + 151: 57(ptr) AccessChain 10 39 + 152: 7(ivec2) Load 151 + 153: 7(ivec2) IAdd 152 150 + 154: 57(ptr) AccessChain 10 39 + Store 154 153 + 155: 34(ptr) AccessChain 30(fp2D) 39 + 156: 7(ivec2) Load 155 + 157: 57(ptr) AccessChain 10 42 + 158: 7(ivec2) Load 157 + 159: 7(ivec2) IAdd 158 156 + 160: 57(ptr) AccessChain 10 42 + Store 160 159 + 161: 44(ptr) AccessChain 30(fp2D) 42 + 162: 6(int) Load 161 + 163: 53(ptr) AccessChain 10 46 + 164: 6(int) Load 163 + 165: 6(int) IAdd 164 162 + 166: 53(ptr) AccessChain 10 46 + Store 166 165 + 167: 44(ptr) AccessChain 30(fp2D) 46 + 168: 6(int) Load 167 + 169: 53(ptr) AccessChain 10 68 + 170: 6(int) Load 169 + 171: 6(int) IAdd 170 168 + 172: 53(ptr) AccessChain 10 68 + Store 172 171 + 173: 15 Load 17(sample2D) + 174: 19(fvec2) Load 21(P2) + 175: 13(float) Load 125(lodClamp) + 176: 11(int) Load 24(granularity) + 177: 13(float) Load 76(bias) + 179:178(ResType) ImageSampleFootprintNV 173 174 176 27 Bias MinLod 177 175 + 180: 7(ivec2) CompositeExtract 179 1 + 181: 34(ptr) AccessChain 30(fp2D) 12 + Store 181 180 + 182: 7(ivec2) CompositeExtract 179 2 + 183: 34(ptr) AccessChain 30(fp2D) 36 + Store 183 182 + 184: 7(ivec2) CompositeExtract 179 3 + 185: 34(ptr) AccessChain 30(fp2D) 39 + Store 185 184 + 186: 6(int) CompositeExtract 179 4 + 187: 44(ptr) AccessChain 30(fp2D) 42 + Store 187 186 + 188: 6(int) CompositeExtract 179 5 + 189: 44(ptr) AccessChain 30(fp2D) 46 + Store 189 188 + 190: 26(bool) CompositeExtract 179 0 + 191: 6(int) Select 190 50 51 + 192: 53(ptr) AccessChain 10 12 + Store 192 191 + 193: 34(ptr) AccessChain 30(fp2D) 12 + 194: 7(ivec2) Load 193 + 195: 57(ptr) AccessChain 10 36 + 196: 7(ivec2) Load 195 + 197: 7(ivec2) IAdd 196 194 + 198: 57(ptr) AccessChain 10 36 + Store 198 197 + 199: 34(ptr) AccessChain 30(fp2D) 36 + 200: 7(ivec2) Load 199 + 201: 57(ptr) AccessChain 10 39 + 202: 7(ivec2) Load 201 + 203: 7(ivec2) IAdd 202 200 + 204: 57(ptr) AccessChain 10 39 + Store 204 203 + 205: 34(ptr) AccessChain 30(fp2D) 39 + 206: 7(ivec2) Load 205 + 207: 57(ptr) AccessChain 10 42 + 208: 7(ivec2) Load 207 + 209: 7(ivec2) IAdd 208 206 + 210: 57(ptr) AccessChain 10 42 + Store 210 209 + 211: 44(ptr) AccessChain 30(fp2D) 42 + 212: 6(int) Load 211 + 213: 53(ptr) AccessChain 10 46 + 214: 6(int) Load 213 + 215: 6(int) IAdd 214 212 + 216: 53(ptr) AccessChain 10 46 + Store 216 215 + 217: 44(ptr) AccessChain 30(fp2D) 46 + 218: 6(int) Load 217 + 219: 53(ptr) AccessChain 10 68 + 220: 6(int) Load 219 + 221: 6(int) IAdd 220 218 + 222: 53(ptr) AccessChain 10 68 + Store 222 221 + 223: 15 Load 17(sample2D) + 224: 19(fvec2) Load 21(P2) + 226: 13(float) Load 225(lod) + 227: 11(int) Load 24(granularity) + 229:228(ResType) ImageSampleFootprintNV 223 224 227 27 Lod 226 + 230: 7(ivec2) CompositeExtract 229 1 + 231: 34(ptr) AccessChain 30(fp2D) 12 + Store 231 230 + 232: 7(ivec2) CompositeExtract 229 2 + 233: 34(ptr) AccessChain 30(fp2D) 36 + Store 233 232 + 234: 7(ivec2) CompositeExtract 229 3 + 235: 34(ptr) AccessChain 30(fp2D) 39 + Store 235 234 + 236: 6(int) CompositeExtract 229 4 + 237: 44(ptr) AccessChain 30(fp2D) 42 + Store 237 236 + 238: 6(int) CompositeExtract 229 5 + 239: 44(ptr) AccessChain 30(fp2D) 46 + Store 239 238 + 240: 26(bool) CompositeExtract 229 0 + 241: 6(int) Select 240 50 51 + 242: 53(ptr) AccessChain 10 12 + Store 242 241 + 243: 34(ptr) AccessChain 30(fp2D) 12 + 244: 7(ivec2) Load 243 + 245: 57(ptr) AccessChain 10 36 + 246: 7(ivec2) Load 245 + 247: 7(ivec2) IAdd 246 244 + 248: 57(ptr) AccessChain 10 36 + Store 248 247 + 249: 34(ptr) AccessChain 30(fp2D) 36 + 250: 7(ivec2) Load 249 + 251: 57(ptr) AccessChain 10 39 + 252: 7(ivec2) Load 251 + 253: 7(ivec2) IAdd 252 250 + 254: 57(ptr) AccessChain 10 39 + Store 254 253 + 255: 34(ptr) AccessChain 30(fp2D) 39 + 256: 7(ivec2) Load 255 + 257: 57(ptr) AccessChain 10 42 + 258: 7(ivec2) Load 257 + 259: 7(ivec2) IAdd 258 256 + 260: 57(ptr) AccessChain 10 42 + Store 260 259 + 261: 44(ptr) AccessChain 30(fp2D) 42 + 262: 6(int) Load 261 + 263: 53(ptr) AccessChain 10 46 + 264: 6(int) Load 263 + 265: 6(int) IAdd 264 262 + 266: 53(ptr) AccessChain 10 46 + Store 266 265 + 267: 44(ptr) AccessChain 30(fp2D) 46 + 268: 6(int) Load 267 + 269: 53(ptr) AccessChain 10 68 + 270: 6(int) Load 269 + 271: 6(int) IAdd 270 268 + 272: 53(ptr) AccessChain 10 68 + Store 272 271 + 273: 15 Load 17(sample2D) + 274: 19(fvec2) Load 21(P2) + 276: 19(fvec2) Load 275(dx) + 278: 19(fvec2) Load 277(dy) + 279: 11(int) Load 24(granularity) + 281:280(ResType) ImageSampleFootprintNV 273 274 279 27 Grad 276 278 + 282: 7(ivec2) CompositeExtract 281 1 + 283: 34(ptr) AccessChain 30(fp2D) 12 + Store 283 282 + 284: 7(ivec2) CompositeExtract 281 2 + 285: 34(ptr) AccessChain 30(fp2D) 36 + Store 285 284 + 286: 7(ivec2) CompositeExtract 281 3 + 287: 34(ptr) AccessChain 30(fp2D) 39 + Store 287 286 + 288: 6(int) CompositeExtract 281 4 + 289: 44(ptr) AccessChain 30(fp2D) 42 + Store 289 288 + 290: 6(int) CompositeExtract 281 5 + 291: 44(ptr) AccessChain 30(fp2D) 46 + Store 291 290 + 292: 26(bool) CompositeExtract 281 0 + 293: 6(int) Select 292 50 51 + 294: 53(ptr) AccessChain 10 12 + Store 294 293 + 295: 34(ptr) AccessChain 30(fp2D) 12 + 296: 7(ivec2) Load 295 + 297: 57(ptr) AccessChain 10 36 + 298: 7(ivec2) Load 297 + 299: 7(ivec2) IAdd 298 296 + 300: 57(ptr) AccessChain 10 36 + Store 300 299 + 301: 34(ptr) AccessChain 30(fp2D) 36 + 302: 7(ivec2) Load 301 + 303: 57(ptr) AccessChain 10 39 + 304: 7(ivec2) Load 303 + 305: 7(ivec2) IAdd 304 302 + 306: 57(ptr) AccessChain 10 39 + Store 306 305 + 307: 34(ptr) AccessChain 30(fp2D) 39 + 308: 7(ivec2) Load 307 + 309: 57(ptr) AccessChain 10 42 + 310: 7(ivec2) Load 309 + 311: 7(ivec2) IAdd 310 308 + 312: 57(ptr) AccessChain 10 42 + Store 312 311 + 313: 44(ptr) AccessChain 30(fp2D) 42 + 314: 6(int) Load 313 + 315: 53(ptr) AccessChain 10 46 + 316: 6(int) Load 315 + 317: 6(int) IAdd 316 314 + 318: 53(ptr) AccessChain 10 46 + Store 318 317 + 319: 44(ptr) AccessChain 30(fp2D) 46 + 320: 6(int) Load 319 + 321: 53(ptr) AccessChain 10 68 + 322: 6(int) Load 321 + 323: 6(int) IAdd 322 320 + 324: 53(ptr) AccessChain 10 68 + Store 324 323 + 325: 15 Load 17(sample2D) + 326: 19(fvec2) Load 21(P2) + 327: 19(fvec2) Load 275(dx) + 328: 19(fvec2) Load 277(dy) + 329: 13(float) Load 125(lodClamp) + 330: 11(int) Load 24(granularity) + 332:331(ResType) ImageSampleFootprintNV 325 326 330 27 Grad MinLod 327 328 329 + 333: 7(ivec2) CompositeExtract 332 1 + 334: 34(ptr) AccessChain 30(fp2D) 12 + Store 334 333 + 335: 7(ivec2) CompositeExtract 332 2 + 336: 34(ptr) AccessChain 30(fp2D) 36 + Store 336 335 + 337: 7(ivec2) CompositeExtract 332 3 + 338: 34(ptr) AccessChain 30(fp2D) 39 + Store 338 337 + 339: 6(int) CompositeExtract 332 4 + 340: 44(ptr) AccessChain 30(fp2D) 42 + Store 340 339 + 341: 6(int) CompositeExtract 332 5 + 342: 44(ptr) AccessChain 30(fp2D) 46 + Store 342 341 + 343: 26(bool) CompositeExtract 332 0 + 344: 6(int) Select 343 50 51 + 345: 53(ptr) AccessChain 10 12 + Store 345 344 + 346: 34(ptr) AccessChain 30(fp2D) 12 + 347: 7(ivec2) Load 346 + 348: 57(ptr) AccessChain 10 36 + 349: 7(ivec2) Load 348 + 350: 7(ivec2) IAdd 349 347 + 351: 57(ptr) AccessChain 10 36 + Store 351 350 + 352: 34(ptr) AccessChain 30(fp2D) 36 + 353: 7(ivec2) Load 352 + 354: 57(ptr) AccessChain 10 39 + 355: 7(ivec2) Load 354 + 356: 7(ivec2) IAdd 355 353 + 357: 57(ptr) AccessChain 10 39 + Store 357 356 + 358: 34(ptr) AccessChain 30(fp2D) 39 + 359: 7(ivec2) Load 358 + 360: 57(ptr) AccessChain 10 42 + 361: 7(ivec2) Load 360 + 362: 7(ivec2) IAdd 361 359 + 363: 57(ptr) AccessChain 10 42 + Store 363 362 + 364: 44(ptr) AccessChain 30(fp2D) 42 + 365: 6(int) Load 364 + 366: 53(ptr) AccessChain 10 46 + 367: 6(int) Load 366 + 368: 6(int) IAdd 367 365 + 369: 53(ptr) AccessChain 10 46 + Store 369 368 + 370: 44(ptr) AccessChain 30(fp2D) 46 + 371: 6(int) Load 370 + 372: 53(ptr) AccessChain 10 68 + 373: 6(int) Load 372 + 374: 6(int) IAdd 373 371 + 375: 53(ptr) AccessChain 10 68 + Store 375 374 + 384: 381 Load 383(sample3D) + 388: 385(fvec3) Load 387(P3) + 389: 11(int) Load 24(granularity) + 394:393(ResType) ImageSampleFootprintNV 384 388 389 27 + 395: 376(ivec3) CompositeExtract 394 1 + 397: 396(ptr) AccessChain 392(fp3D) 12 + Store 397 395 + 398: 376(ivec3) CompositeExtract 394 2 + 399: 396(ptr) AccessChain 392(fp3D) 36 + Store 399 398 + 400: 7(ivec2) CompositeExtract 394 3 + 401: 34(ptr) AccessChain 392(fp3D) 39 + Store 401 400 + 402: 6(int) CompositeExtract 394 4 + 403: 44(ptr) AccessChain 392(fp3D) 42 + Store 403 402 + 404: 6(int) CompositeExtract 394 5 + 405: 44(ptr) AccessChain 392(fp3D) 46 + Store 405 404 + 406: 26(bool) CompositeExtract 394 0 + 407: 6(int) Select 406 50 51 + 408: 53(ptr) AccessChain 379 12 + Store 408 407 + 409: 396(ptr) AccessChain 392(fp3D) 12 + 410: 376(ivec3) Load 409 + 412: 411(ptr) AccessChain 379 36 + Store 412 410 + 413: 396(ptr) AccessChain 392(fp3D) 36 + 414: 376(ivec3) Load 413 + 415: 411(ptr) AccessChain 379 39 + Store 415 414 + 416: 34(ptr) AccessChain 392(fp3D) 39 + 417: 7(ivec2) Load 416 + 418: 57(ptr) AccessChain 379 42 + Store 418 417 + 419: 44(ptr) AccessChain 392(fp3D) 42 + 420: 6(int) Load 419 + 421: 53(ptr) AccessChain 379 46 + Store 421 420 + 422: 44(ptr) AccessChain 392(fp3D) 46 + 423: 6(int) Load 422 + 424: 53(ptr) AccessChain 379 68 + Store 424 423 + 425: 381 Load 383(sample3D) + 426: 385(fvec3) Load 387(P3) + 427: 11(int) Load 24(granularity) + 428: 13(float) Load 76(bias) + 430:429(ResType) ImageSampleFootprintNV 425 426 427 27 Bias 428 + 431: 376(ivec3) CompositeExtract 430 1 + 432: 396(ptr) AccessChain 392(fp3D) 12 + Store 432 431 + 433: 376(ivec3) CompositeExtract 430 2 + 434: 396(ptr) AccessChain 392(fp3D) 36 + Store 434 433 + 435: 7(ivec2) CompositeExtract 430 3 + 436: 34(ptr) AccessChain 392(fp3D) 39 + Store 436 435 + 437: 6(int) CompositeExtract 430 4 + 438: 44(ptr) AccessChain 392(fp3D) 42 + Store 438 437 + 439: 6(int) CompositeExtract 430 5 + 440: 44(ptr) AccessChain 392(fp3D) 46 + Store 440 439 + 441: 26(bool) CompositeExtract 430 0 + 442: 6(int) Select 441 50 51 + 443: 53(ptr) AccessChain 379 12 + Store 443 442 + 444: 396(ptr) AccessChain 392(fp3D) 12 + 445: 376(ivec3) Load 444 + 446: 411(ptr) AccessChain 379 36 + 447: 376(ivec3) Load 446 + 448: 376(ivec3) IAdd 447 445 + 449: 411(ptr) AccessChain 379 36 + Store 449 448 + 450: 396(ptr) AccessChain 392(fp3D) 36 + 451: 376(ivec3) Load 450 + 452: 411(ptr) AccessChain 379 39 + 453: 376(ivec3) Load 452 + 454: 376(ivec3) IAdd 453 451 + 455: 411(ptr) AccessChain 379 39 + Store 455 454 + 456: 34(ptr) AccessChain 392(fp3D) 39 + 457: 7(ivec2) Load 456 + 458: 57(ptr) AccessChain 379 42 + 459: 7(ivec2) Load 458 + 460: 7(ivec2) IAdd 459 457 + 461: 57(ptr) AccessChain 379 42 + Store 461 460 + 462: 44(ptr) AccessChain 392(fp3D) 42 + 463: 6(int) Load 462 + 464: 53(ptr) AccessChain 379 46 + 465: 6(int) Load 464 + 466: 6(int) IAdd 465 463 + 467: 53(ptr) AccessChain 379 46 + Store 467 466 + 468: 44(ptr) AccessChain 392(fp3D) 46 + 469: 6(int) Load 468 + 470: 53(ptr) AccessChain 379 68 + 471: 6(int) Load 470 + 472: 6(int) IAdd 471 469 + 473: 53(ptr) AccessChain 379 68 + Store 473 472 + 474: 381 Load 383(sample3D) + 475: 385(fvec3) Load 387(P3) + 476: 13(float) Load 125(lodClamp) + 477: 11(int) Load 24(granularity) + 479:478(ResType) ImageSampleFootprintNV 474 475 477 27 MinLod 476 + 480: 376(ivec3) CompositeExtract 479 1 + 481: 396(ptr) AccessChain 392(fp3D) 12 + Store 481 480 + 482: 376(ivec3) CompositeExtract 479 2 + 483: 396(ptr) AccessChain 392(fp3D) 36 + Store 483 482 + 484: 7(ivec2) CompositeExtract 479 3 + 485: 34(ptr) AccessChain 392(fp3D) 39 + Store 485 484 + 486: 6(int) CompositeExtract 479 4 + 487: 44(ptr) AccessChain 392(fp3D) 42 + Store 487 486 + 488: 6(int) CompositeExtract 479 5 + 489: 44(ptr) AccessChain 392(fp3D) 46 + Store 489 488 + 490: 26(bool) CompositeExtract 479 0 + 491: 6(int) Select 490 50 51 + 492: 53(ptr) AccessChain 379 12 + Store 492 491 + 493: 396(ptr) AccessChain 392(fp3D) 12 + 494: 376(ivec3) Load 493 + 495: 411(ptr) AccessChain 379 36 + 496: 376(ivec3) Load 495 + 497: 376(ivec3) IAdd 496 494 + 498: 411(ptr) AccessChain 379 36 + Store 498 497 + 499: 396(ptr) AccessChain 392(fp3D) 36 + 500: 376(ivec3) Load 499 + 501: 411(ptr) AccessChain 379 39 + 502: 376(ivec3) Load 501 + 503: 376(ivec3) IAdd 502 500 + 504: 411(ptr) AccessChain 379 39 + Store 504 503 + 505: 34(ptr) AccessChain 392(fp3D) 39 + 506: 7(ivec2) Load 505 + 507: 57(ptr) AccessChain 379 42 + 508: 7(ivec2) Load 507 + 509: 7(ivec2) IAdd 508 506 + 510: 57(ptr) AccessChain 379 42 + Store 510 509 + 511: 44(ptr) AccessChain 392(fp3D) 42 + 512: 6(int) Load 511 + 513: 53(ptr) AccessChain 379 46 + 514: 6(int) Load 513 + 515: 6(int) IAdd 514 512 + 516: 53(ptr) AccessChain 379 46 + Store 516 515 + 517: 44(ptr) AccessChain 392(fp3D) 46 + 518: 6(int) Load 517 + 519: 53(ptr) AccessChain 379 68 + 520: 6(int) Load 519 + 521: 6(int) IAdd 520 518 + 522: 53(ptr) AccessChain 379 68 + Store 522 521 + 523: 381 Load 383(sample3D) + 524: 385(fvec3) Load 387(P3) + 525: 13(float) Load 125(lodClamp) + 526: 11(int) Load 24(granularity) + 527: 13(float) Load 76(bias) + 529:528(ResType) ImageSampleFootprintNV 523 524 526 27 Bias MinLod 527 525 + 530: 376(ivec3) CompositeExtract 529 1 + 531: 396(ptr) AccessChain 392(fp3D) 12 + Store 531 530 + 532: 376(ivec3) CompositeExtract 529 2 + 533: 396(ptr) AccessChain 392(fp3D) 36 + Store 533 532 + 534: 7(ivec2) CompositeExtract 529 3 + 535: 34(ptr) AccessChain 392(fp3D) 39 + Store 535 534 + 536: 6(int) CompositeExtract 529 4 + 537: 44(ptr) AccessChain 392(fp3D) 42 + Store 537 536 + 538: 6(int) CompositeExtract 529 5 + 539: 44(ptr) AccessChain 392(fp3D) 46 + Store 539 538 + 540: 26(bool) CompositeExtract 529 0 + 541: 6(int) Select 540 50 51 + 542: 53(ptr) AccessChain 379 12 + Store 542 541 + 543: 396(ptr) AccessChain 392(fp3D) 12 + 544: 376(ivec3) Load 543 + 545: 411(ptr) AccessChain 379 36 + 546: 376(ivec3) Load 545 + 547: 376(ivec3) IAdd 546 544 + 548: 411(ptr) AccessChain 379 36 + Store 548 547 + 549: 396(ptr) AccessChain 392(fp3D) 36 + 550: 376(ivec3) Load 549 + 551: 411(ptr) AccessChain 379 39 + 552: 376(ivec3) Load 551 + 553: 376(ivec3) IAdd 552 550 + 554: 411(ptr) AccessChain 379 39 + Store 554 553 + 555: 34(ptr) AccessChain 392(fp3D) 39 + 556: 7(ivec2) Load 555 + 557: 57(ptr) AccessChain 379 42 + 558: 7(ivec2) Load 557 + 559: 7(ivec2) IAdd 558 556 + 560: 57(ptr) AccessChain 379 42 + Store 560 559 + 561: 44(ptr) AccessChain 392(fp3D) 42 + 562: 6(int) Load 561 + 563: 53(ptr) AccessChain 379 46 + 564: 6(int) Load 563 + 565: 6(int) IAdd 564 562 + 566: 53(ptr) AccessChain 379 46 + Store 566 565 + 567: 44(ptr) AccessChain 392(fp3D) 46 + 568: 6(int) Load 567 + 569: 53(ptr) AccessChain 379 68 + 570: 6(int) Load 569 + 571: 6(int) IAdd 570 568 + 572: 53(ptr) AccessChain 379 68 + Store 572 571 + 573: 381 Load 383(sample3D) + 574: 385(fvec3) Load 387(P3) + 575: 13(float) Load 225(lod) + 576: 11(int) Load 24(granularity) + 578:577(ResType) ImageSampleFootprintNV 573 574 576 27 Lod 575 + 579: 376(ivec3) CompositeExtract 578 1 + 580: 396(ptr) AccessChain 392(fp3D) 12 + Store 580 579 + 581: 376(ivec3) CompositeExtract 578 2 + 582: 396(ptr) AccessChain 392(fp3D) 36 + Store 582 581 + 583: 7(ivec2) CompositeExtract 578 3 + 584: 34(ptr) AccessChain 392(fp3D) 39 + Store 584 583 + 585: 6(int) CompositeExtract 578 4 + 586: 44(ptr) AccessChain 392(fp3D) 42 + Store 586 585 + 587: 6(int) CompositeExtract 578 5 + 588: 44(ptr) AccessChain 392(fp3D) 46 + Store 588 587 + 589: 26(bool) CompositeExtract 578 0 + 590: 6(int) Select 589 50 51 + 591: 53(ptr) AccessChain 379 12 + Store 591 590 + 592: 396(ptr) AccessChain 392(fp3D) 12 + 593: 376(ivec3) Load 592 + 594: 411(ptr) AccessChain 379 36 + 595: 376(ivec3) Load 594 + 596: 376(ivec3) IAdd 595 593 + 597: 411(ptr) AccessChain 379 36 + Store 597 596 + 598: 396(ptr) AccessChain 392(fp3D) 36 + 599: 376(ivec3) Load 598 + 600: 411(ptr) AccessChain 379 39 + 601: 376(ivec3) Load 600 + 602: 376(ivec3) IAdd 601 599 + 603: 411(ptr) AccessChain 379 39 + Store 603 602 + 604: 34(ptr) AccessChain 392(fp3D) 39 + 605: 7(ivec2) Load 604 + 606: 57(ptr) AccessChain 379 42 + 607: 7(ivec2) Load 606 + 608: 7(ivec2) IAdd 607 605 + 609: 57(ptr) AccessChain 379 42 + Store 609 608 + 610: 44(ptr) AccessChain 392(fp3D) 42 + 611: 6(int) Load 610 + 612: 53(ptr) AccessChain 379 46 + 613: 6(int) Load 612 + 614: 6(int) IAdd 613 611 + 615: 53(ptr) AccessChain 379 46 + Store 615 614 + 616: 44(ptr) AccessChain 392(fp3D) 46 + 617: 6(int) Load 616 + 618: 53(ptr) AccessChain 379 68 + 619: 6(int) Load 618 + 620: 6(int) IAdd 619 617 + 621: 53(ptr) AccessChain 379 68 + Store 621 620 + Return + FunctionEnd diff --git a/Test/spv.shaderImageFootprint.frag b/Test/spv.shaderImageFootprint.frag new file mode 100644 index 000000000..efde3704d --- /dev/null +++ b/Test/spv.shaderImageFootprint.frag @@ -0,0 +1,123 @@ +#version 450 + +#extension GL_NV_shader_texture_footprint : require + + +layout (location = 0) in vec2 P2; +layout (location = 2) in vec3 P3; +layout (location = 3) in flat int granularity; +layout (location = 4) in float lodClamp; +layout (location = 5) in float lod; +layout (location = 6) in vec2 dx; +layout (location = 8) in vec2 dy; +layout (location = 9) in float bias; + +uniform sampler2D sample2D; +uniform sampler3D sample3D; + +buffer result2D { + bool ret2D; + uvec2 anchor2D; + uvec2 offset2D; + uvec2 mask2D; + uint lod2D; + uint granularity2D; +}; + +buffer result3D { + bool ret3D; + uvec3 anchor3D; + uvec3 offset3D; + uvec2 mask3D; + uint lod3D; + uint granularity3D; +}; + +void main() { + gl_TextureFootprint2DNV fp2D; + gl_TextureFootprint3DNV fp3D; + + ret2D = textureFootprintNV(sample2D, P2, granularity, true, fp2D); + anchor2D = fp2D.anchor; + offset2D = fp2D.offset; + mask2D = fp2D.mask; + lod2D = fp2D.lod; + granularity2D = fp2D.granularity; + + ret2D = textureFootprintNV(sample2D, P2, granularity, true, fp2D, bias); + anchor2D += fp2D.anchor; + offset2D += fp2D.offset; + mask2D += fp2D.mask; + lod2D += fp2D.lod; + granularity2D += fp2D.granularity; + + ret2D = textureFootprintClampNV(sample2D, P2, lodClamp, granularity, true, fp2D); + anchor2D += fp2D.anchor; + offset2D += fp2D.offset; + mask2D += fp2D.mask; + lod2D += fp2D.lod; + granularity2D += fp2D.granularity; + + ret2D = textureFootprintClampNV(sample2D, P2, lodClamp, granularity, true, fp2D, bias); + anchor2D += fp2D.anchor; + offset2D += fp2D.offset; + mask2D += fp2D.mask; + lod2D += fp2D.lod; + granularity2D += fp2D.granularity; + + ret2D = textureFootprintLodNV(sample2D, P2, lod, granularity, true, fp2D); + anchor2D += fp2D.anchor; + offset2D += fp2D.offset; + mask2D += fp2D.mask; + lod2D += fp2D.lod; + granularity2D += fp2D.granularity; + + ret2D = textureFootprintGradNV(sample2D, P2, dx, dy, granularity, true, fp2D); + anchor2D += fp2D.anchor; + offset2D += fp2D.offset; + mask2D += fp2D.mask; + lod2D += fp2D.lod; + granularity2D += fp2D.granularity; + + ret2D = textureFootprintGradClampNV(sample2D, P2, dx, dy, lodClamp, granularity, true, fp2D); + anchor2D += fp2D.anchor; + offset2D += fp2D.offset; + mask2D += fp2D.mask; + lod2D += fp2D.lod; + granularity2D += fp2D.granularity; + + ret3D = textureFootprintNV(sample3D, P3, granularity, true, fp3D); + anchor3D = fp3D.anchor; + offset3D = fp3D.offset; + mask3D = fp3D.mask; + lod3D = fp3D.lod; + granularity3D = fp3D.granularity; + + ret3D = textureFootprintNV(sample3D, P3, granularity, true, fp3D, bias); + anchor3D += fp3D.anchor; + offset3D += fp3D.offset; + mask3D += fp3D.mask; + lod3D += fp3D.lod; + granularity3D += fp3D.granularity; + + ret3D = textureFootprintClampNV(sample3D, P3, lodClamp, granularity, true, fp3D); + anchor3D += fp3D.anchor; + offset3D += fp3D.offset; + mask3D += fp3D.mask; + lod3D += fp3D.lod; + granularity3D += fp3D.granularity; + + ret3D = textureFootprintClampNV(sample3D, P3, lodClamp, granularity, true, fp3D, bias); + anchor3D += fp3D.anchor; + offset3D += fp3D.offset; + mask3D += fp3D.mask; + lod3D += fp3D.lod; + granularity3D += fp3D.granularity; + + ret3D = textureFootprintLodNV(sample3D, P3, lod, granularity, true, fp3D); + anchor3D += fp3D.anchor; + offset3D += fp3D.offset; + mask3D += fp3D.mask; + lod3D += fp3D.lod; + granularity3D += fp3D.granularity; +} \ No newline at end of file diff --git a/glslang/Include/intermediate.h b/glslang/Include/intermediate.h index b125adb05..5fa75d97e 100644 --- a/glslang/Include/intermediate.h +++ b/glslang/Include/intermediate.h @@ -865,6 +865,16 @@ enum TOperator { #endif EOpSparseTextureGuardEnd, + +#ifdef NV_EXTENSIONS + EOpImageFootprintGuardBegin, + EOpImageSampleFootprintNV, + EOpImageSampleFootprintClampNV, + EOpImageSampleFootprintLodNV, + EOpImageSampleFootprintGradNV, + EOpImageSampleFootprintGradClampNV, + EOpImageFootprintGuardEnd, +#endif EOpSamplingGuardEnd, EOpTextureGuardEnd, @@ -1248,6 +1258,9 @@ public: bool isSampling() const { return op > EOpSamplingGuardBegin && op < EOpSamplingGuardEnd; } bool isImage() const { return op > EOpImageGuardBegin && op < EOpImageGuardEnd; } bool isSparseTexture() const { return op > EOpSparseTextureGuardBegin && op < EOpSparseTextureGuardEnd; } +#ifdef NV_EXTENSIONS + bool isImageFootprint() const { return op > EOpImageFootprintGuardBegin && op < EOpImageFootprintGuardEnd; } +#endif bool isSparseImage() const { return op == EOpSparseImageLoad; } void setOperationPrecision(TPrecisionQualifier p) { operationPrecision = p; } @@ -1420,6 +1433,23 @@ public: cracked.subpass = sampler.dim == EsdSubpass; cracked.fragMask = true; break; +#endif +#ifdef NV_EXTENSIONS + case EOpImageSampleFootprintNV: + break; + case EOpImageSampleFootprintClampNV: + cracked.lodClamp = true; + break; + case EOpImageSampleFootprintLodNV: + cracked.lod = true; + break; + case EOpImageSampleFootprintGradNV: + cracked.grad = true; + break; + case EOpImageSampleFootprintGradClampNV: + cracked.lodClamp = true; + cracked.grad = true; + break; #endif case EOpSubpassLoad: case EOpSubpassLoadMS: diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index becce8473..68618a934 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -3850,6 +3850,42 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV #endif // AMD_EXTENSIONS + +#ifdef NV_EXTENSIONS + if ((profile != EEsProfile && version >= 450) || + (profile == EEsProfile && version >= 320)) { + commonBuiltins.append( + "struct gl_TextureFootprint2DNV {" + "uvec2 anchor;" + "uvec2 offset;" + "uvec2 mask;" + "uint lod;" + "uint granularity;" + "};" + + "struct gl_TextureFootprint3DNV {" + "uvec3 anchor;" + "uvec3 offset;" + "uvec2 mask;" + "uint lod;" + "uint granularity;" + "};" + "bool textureFootprintNV(sampler2D, vec2, int, bool, out gl_TextureFootprint2DNV);" + "bool textureFootprintNV(sampler3D, vec3, int, bool, out gl_TextureFootprint3DNV);" + "bool textureFootprintNV(sampler2D, vec2, int, bool, out gl_TextureFootprint2DNV, float);" + "bool textureFootprintNV(sampler3D, vec3, int, bool, out gl_TextureFootprint3DNV, float);" + "bool textureFootprintClampNV(sampler2D, vec2, float, int, bool, out gl_TextureFootprint2DNV);" + "bool textureFootprintClampNV(sampler3D, vec3, float, int, bool, out gl_TextureFootprint3DNV);" + "bool textureFootprintClampNV(sampler2D, vec2, float, int, bool, out gl_TextureFootprint2DNV, float);" + "bool textureFootprintClampNV(sampler3D, vec3, float, int, bool, out gl_TextureFootprint3DNV, float);" + "bool textureFootprintLodNV(sampler2D, vec2, float, int, bool, out gl_TextureFootprint2DNV);" + "bool textureFootprintLodNV(sampler3D, vec3, float, int, bool, out gl_TextureFootprint3DNV);" + "bool textureFootprintGradNV(sampler2D, vec2, vec2, vec2, int, bool, out gl_TextureFootprint2DNV);" + "bool textureFootprintGradClampNV(sampler2D, vec2, vec2, vec2, float, int, bool, out gl_TextureFootprint2DNV);" + "\n"); + } + +#endif // NV_EXTENSIONS // GL_AMD_gpu_shader_half_float/Explicit types if (profile != EEsProfile && version >= 450) { commonBuiltins.append( @@ -7545,6 +7581,13 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion } #endif +#ifdef NV_EXTENSIONS + symbolTable.setFunctionExtensions("textureFootprintNV", 1, &E_GL_NV_shader_texture_footprint); + symbolTable.setFunctionExtensions("textureFootprintClampNV", 1, &E_GL_NV_shader_texture_footprint); + symbolTable.setFunctionExtensions("textureFootprintLodNV", 1, &E_GL_NV_shader_texture_footprint); + symbolTable.setFunctionExtensions("textureFootprintGradNV", 1, &E_GL_NV_shader_texture_footprint); + symbolTable.setFunctionExtensions("textureFootprintGradClampNV", 1, &E_GL_NV_shader_texture_footprint); +#endif // Compatibility variables, vertex only if (spvVersion.spv == 0) { BuiltInVariable("gl_Color", EbvColor, symbolTable); @@ -8501,6 +8544,14 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("noise3", EOpNoise); symbolTable.relateToOperator("noise4", EOpNoise); +#ifdef NV_EXTENSIONS + symbolTable.relateToOperator("textureFootprintNV", EOpImageSampleFootprintNV); + symbolTable.relateToOperator("textureFootprintClampNV", EOpImageSampleFootprintClampNV); + symbolTable.relateToOperator("textureFootprintLodNV", EOpImageSampleFootprintLodNV); + symbolTable.relateToOperator("textureFootprintGradNV", EOpImageSampleFootprintGradNV); + symbolTable.relateToOperator("textureFootprintGradClampNV", EOpImageSampleFootprintGradClampNV); +#endif + if (spvVersion.spv == 0 && (IncludeLegacy(version, profile, spvVersion) || (profile == EEsProfile && version == 100))) { symbolTable.relateToOperator("ftransform", EOpFtransform); diff --git a/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp index 0221288b6..82a0ac2b9 100644 --- a/glslang/MachineIndependent/Versions.cpp +++ b/glslang/MachineIndependent/Versions.cpp @@ -237,6 +237,7 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_NV_shader_subgroup_partitioned] = EBhDisable; extensionBehavior[E_GL_NV_fragment_shader_barycentric] = EBhDisable; extensionBehavior[E_GL_NV_compute_shader_derivatives] = EBhDisable; + extensionBehavior[E_GL_NV_shader_texture_footprint] = EBhDisable; #endif // AEP @@ -409,6 +410,7 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_NV_shader_subgroup_partitioned 1\n" "#define GL_NV_fragment_shader_barycentric 1\n" "#define GL_NV_compute_shader_derivatives 1\n" + "#define GL_NV_shader_texture_footprint 1\n" #endif "#define GL_KHX_shader_explicit_arithmetic_types 1\n" "#define GL_KHX_shader_explicit_arithmetic_types_int8 1\n" diff --git a/glslang/MachineIndependent/Versions.h b/glslang/MachineIndependent/Versions.h index 2102c253a..2b3cb1216 100644 --- a/glslang/MachineIndependent/Versions.h +++ b/glslang/MachineIndependent/Versions.h @@ -209,6 +209,7 @@ const char* const E_GL_NV_shader_noperspective_interpolation = "GL_NV_shader_ const char* const E_GL_NV_shader_subgroup_partitioned = "GL_NV_shader_subgroup_partitioned"; const char* const E_GL_NV_fragment_shader_barycentric = "GL_NV_fragment_shader_barycentric"; const char* const E_GL_NV_compute_shader_derivatives = "GL_NV_compute_shader_derivatives"; +const char* const E_GL_NV_shader_texture_footprint = "GL_NV_shader_texture_footprint"; // Arrays of extensions for the above viewportEXTs duplications const char* const viewportEXTs[] = { E_GL_ARB_shader_viewport_layer_array, E_GL_NV_viewport_array2 }; diff --git a/glslang/MachineIndependent/intermOut.cpp b/glslang/MachineIndependent/intermOut.cpp index 525114112..70c986b4d 100644 --- a/glslang/MachineIndependent/intermOut.cpp +++ b/glslang/MachineIndependent/intermOut.cpp @@ -956,7 +956,13 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpSparseTextureGatherLodOffsets: out.debug << "sparseTextureGatherLodOffsets"; break; case EOpSparseImageLoadLod: out.debug << "sparseImageLoadLod"; break; #endif - +#ifdef NV_EXTENSIONS + case EOpImageSampleFootprintNV: out.debug << "imageSampleFootprintNV"; break; + case EOpImageSampleFootprintClampNV: out.debug << "imageSampleFootprintClampNV"; break; + case EOpImageSampleFootprintLodNV: out.debug << "imageSampleFootprintLodNV"; break; + case EOpImageSampleFootprintGradNV: out.debug << "imageSampleFootprintGradNV"; break; + case EOpImageSampleFootprintGradClampNV: out.debug << "mageSampleFootprintGradClampNV"; break; +#endif case EOpAddCarry: out.debug << "addCarry"; break; case EOpSubBorrow: out.debug << "subBorrow"; break; case EOpUMulExtended: out.debug << "uMulExtended"; break; diff --git a/gtests/Spv.FromFile.cpp b/gtests/Spv.FromFile.cpp index f860041f7..854b073e7 100644 --- a/gtests/Spv.FromFile.cpp +++ b/gtests/Spv.FromFile.cpp @@ -505,6 +505,7 @@ INSTANTIATE_TEST_CASE_P( "spv.fragmentShaderBarycentric2.frag", "spv.computeShaderDerivatives.comp", "spv.computeShaderDerivatives2.comp", + "spv.shaderImageFootprint.frag", })), FileNameAsCustomTestSuffix );