Merge pull request #121 from amdrexu/feature

Parser & SPV: Implement two extensions regarding GLSL sparse texture.
This commit is contained in:
John Kessenich 2016-01-15 00:52:18 -07:00
commit 68f1431a55
12 changed files with 1621 additions and 151 deletions

View File

@ -1884,6 +1884,14 @@ void TGlslangToSpvTraverser::handleFunctionEntry(const glslang::TIntermAggregate
void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& node, std::vector<spv::Id>& arguments)
{
const glslang::TIntermSequence& glslangArguments = node.getSequence();
glslang::TSampler sampler = {};
bool cubeCompare = false;
if (node.isTexture()) {
sampler = glslangArguments[0]->getAsTyped()->getType().getSampler();
cubeCompare = sampler.dim == glslang::EsdCube && sampler.arrayed && sampler.shadow;
}
for (int i = 0; i < (int)glslangArguments.size(); ++i) {
builder.clearAccessChain();
glslangArguments[i]->traverse(this);
@ -1902,6 +1910,51 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate&
if (i == 0)
lvalue = true;
break;
case glslang::EOpSparseTexture:
if ((cubeCompare && i == 3) || (! cubeCompare && i == 2))
lvalue = true;
break;
case glslang::EOpSparseTextureClamp:
if ((cubeCompare && i == 4) || (! cubeCompare && i == 3))
lvalue = true;
break;
case glslang::EOpSparseTextureLod:
case glslang::EOpSparseTextureOffset:
if (i == 3)
lvalue = true;
break;
case glslang::EOpSparseTextureFetch:
if ((sampler.dim != glslang::EsdRect && i == 3) || (sampler.dim == glslang::EsdRect && i == 2))
lvalue = true;
break;
case glslang::EOpSparseTextureFetchOffset:
if ((sampler.dim != glslang::EsdRect && i == 4) || (sampler.dim == glslang::EsdRect && i == 3))
lvalue = true;
break;
case glslang::EOpSparseTextureLodOffset:
case glslang::EOpSparseTextureGrad:
case glslang::EOpSparseTextureOffsetClamp:
if (i == 4)
lvalue = true;
break;
case glslang::EOpSparseTextureGradOffset:
case glslang::EOpSparseTextureGradClamp:
if (i == 5)
lvalue = true;
break;
case glslang::EOpSparseTextureGradOffsetClamp:
if (i == 6)
lvalue = true;
break;
case glslang::EOpSparseTextureGather:
if ((sampler.shadow && i == 3) || (! sampler.shadow && i == 2))
lvalue = true;
break;
case glslang::EOpSparseTextureGatherOffset:
case glslang::EOpSparseTextureGatherOffsets:
if ((sampler.shadow && i == 4) || (! sampler.shadow && i == 3))
lvalue = true;
break;
default:
break;
}
@ -1963,6 +2016,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
return builder.createTextureQueryCall(spv::OpImageQueryLod, params);
case glslang::EOpTextureQueryLevels:
return builder.createTextureQueryCall(spv::OpImageQueryLevels, params);
case glslang::EOpSparseTexelsResident:
return builder.createUnaryOp(spv::OpImageSparseTexelsResident, builder.makeBoolType(), arguments[0]);
default:
assert(0);
break;
@ -1990,7 +2045,11 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
operands.push_back(*opIt);
builder.createNoResultOp(spv::OpImageWrite, operands);
return spv::NoResult;
} else {
} else if (node->isSparseImage()) {
spv::MissingFunctionality("sparse image functions");
return spv::NoResult;
}
else {
// Process image atomic operations
// GLSL "IMAGE_PARAMS" will involve in constructing an image texel pointer and this pointer,
@ -2010,7 +2069,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
}
// Check for texture functions other than queries
bool sparse = node->isSparseTexture();
bool cubeCompare = sampler.dim == glslang::EsdCube && sampler.arrayed && sampler.shadow;
// check for bias argument
@ -2021,6 +2080,10 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
++nonBiasArgCount;
if (cracked.grad)
nonBiasArgCount += 2;
if (cracked.lodClamp)
++nonBiasArgCount;
if (sparse)
++nonBiasArgCount;
if ((int)arguments.size() > nonBiasArgCount)
bias = true;
@ -2032,9 +2095,10 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
int extraArgs = 0;
// sort out where Dref is coming from
if (sampler.shadow && sampler.dim == glslang::EsdCube && sampler.arrayed)
if (cubeCompare) {
params.Dref = arguments[2];
else if (sampler.shadow && cracked.gather) {
++extraArgs;
} else if (sampler.shadow && cracked.gather) {
params.Dref = arguments[2];
++extraArgs;
} else if (sampler.shadow) {
@ -2066,6 +2130,14 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
params.offsets = arguments[2 + extraArgs];
++extraArgs;
}
if (cracked.lodClamp) {
params.lodClamp = arguments[2 + extraArgs];
++extraArgs;
}
if (sparse) {
params.texelOut = arguments[2 + extraArgs];
++extraArgs;
}
if (bias) {
params.bias = arguments[2 + extraArgs];
++extraArgs;
@ -2080,7 +2152,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
}
}
return builder.createTextureCall(precision, convertGlslangToSpvType(node->getType()), cracked.fetch, cracked.proj, cracked.gather, params);
return builder.createTextureCall(precision, convertGlslangToSpvType(node->getType()), sparse, cracked.fetch, cracked.proj, cracked.gather, params);
}
spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAggregate* node)

View File

@ -1222,7 +1222,7 @@ Id Builder::createBuiltinCall(Decoration /*precision*/, Id resultType, Id builti
// Accept all parameters needed to create a texture instruction.
// Create the correct instruction based on the inputs, and make the call.
Id Builder::createTextureCall(Decoration precision, Id resultType, bool fetch, bool proj, bool gather, const TextureParameters& parameters)
Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, bool fetch, bool proj, bool gather, const TextureParameters& parameters)
{
static const int maxTextureArgs = 10;
Id texArgs[maxTextureArgs] = {};
@ -1275,6 +1275,10 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool fetch, b
mask = (ImageOperandsMask)(mask | ImageOperandsSampleMask);
texArgs[numArgs++] = parameters.sample;
}
if (parameters.lodClamp) {
mask = (ImageOperandsMask)(mask | ImageOperandsMinLodMask);
texArgs[numArgs++] = parameters.lodClamp;
}
if (mask == ImageOperandsMaskNone)
--numArgs; // undo speculative reservation for the mask argument
else
@ -1286,33 +1290,66 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool fetch, b
Op opCode;
opCode = OpImageSampleImplicitLod;
if (fetch) {
if (sparse)
opCode = OpImageSparseFetch;
else
opCode = OpImageFetch;
} else if (gather) {
if (parameters.Dref)
if (sparse)
opCode = OpImageSparseDrefGather;
else
opCode = OpImageDrefGather;
else
if (sparse)
opCode = OpImageSparseGather;
else
opCode = OpImageGather;
} else if (xplicit) {
if (parameters.Dref) {
if (proj)
if (sparse)
opCode = OpImageSparseSampleProjDrefExplicitLod;
else
opCode = OpImageSampleProjDrefExplicitLod;
else
if (sparse)
opCode = OpImageSparseSampleDrefExplicitLod;
else
opCode = OpImageSampleDrefExplicitLod;
} else {
if (proj)
if (sparse)
opCode = OpImageSparseSampleProjExplicitLod;
else
opCode = OpImageSampleProjExplicitLod;
else
if (sparse)
opCode = OpImageSparseSampleExplicitLod;
else
opCode = OpImageSampleExplicitLod;
}
} else {
if (parameters.Dref) {
if (proj)
if (sparse)
opCode = OpImageSparseSampleProjDrefImplicitLod;
else
opCode = OpImageSampleProjDrefImplicitLod;
else
if (sparse)
opCode = OpImageSparseSampleDrefImplicitLod;
else
opCode = OpImageSampleDrefImplicitLod;
} else {
if (proj)
if (sparse)
opCode = OpImageSparseSampleProjImplicitLod;
else
opCode = OpImageSampleProjImplicitLod;
else
if (sparse)
opCode = OpImageSparseSampleImplicitLod;
else
opCode = OpImageSampleImplicitLod;
}
@ -1335,6 +1372,15 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool fetch, b
}
}
Id typeId0 = 0;
Id typeId1 = 0;
if (sparse) {
typeId0 = resultType;
typeId1 = getDerefTypeId(parameters.texelOut);
resultType = makeStructResultType(typeId0, typeId1);
}
// Build the SPIR-V instruction
Instruction* textureInst = new Instruction(getUniqueId(), resultType, opCode);
for (int op = 0; op < optArgNum; ++op)
@ -1348,10 +1394,16 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool fetch, b
Id resultId = textureInst->getResultId();
if (sparse) {
// Decode the return type that was a special structure
createStore(createCompositeExtract(resultId, typeId1, 1), parameters.texelOut);
resultId = createCompositeExtract(resultId, typeId0, 0);
} else {
// When a smear is needed, do it, as per what was computed
// above when resultType was changed to a scalar type.
if (resultType != smearedType)
resultId = smearScalar(precision, resultId, smearedType);
}
return resultId;
}

View File

@ -310,10 +310,12 @@ public:
Id gradY;
Id sample;
Id comp;
Id texelOut;
Id lodClamp;
};
// Select the correct texture operation based on all inputs, and emit the correct instruction
Id createTextureCall(Decoration precision, Id resultType, bool fetch, bool proj, bool gather, const TextureParameters&);
Id createTextureCall(Decoration precision, Id resultType, bool sparse, bool fetch, bool proj, bool gather, const TextureParameters&);
// Emit the OpTextureQuery* instruction that was passed in.
// Figure out the right return value and type, and return it.

View File

@ -0,0 +1,522 @@
spv.sparseTexture.frag
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 399
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 384
ExecutionMode 4 OriginLowerLeft
Source GLSL 450
SourceExtension "GL_ARB_sparse_texture2"
Name 4 "main"
Name 8 "resident"
Name 13 "texel"
Name 18 "itexel"
Name 23 "utexel"
Name 29 "s2D"
Name 33 "c2"
Name 35 "ResType"
Name 44 "s3D"
Name 48 "c3"
Name 59 "isCube"
Name 62 "ResType"
Name 71 "s2DShadow"
Name 77 "ResType"
Name 86 "sCubeArrayShadow"
Name 89 "c4"
Name 108 "usCubeArray"
Name 111 "ResType"
Name 140 "us2DRect"
Name 154 "s2DArrayShadow"
Name 186 "s2DMS"
Name 223 "is2DArray"
Name 256 "sCubeShadow"
Name 289 "s2DRectShadow"
Name 360 "offsets"
Name 384 "outColor"
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Function 6(int)
9: 6(int) Constant 0
10: TypeFloat 32
11: TypeVector 10(float) 4
12: TypePointer Function 11(fvec4)
14: 10(float) Constant 0
15: 11(fvec4) ConstantComposite 14 14 14 14
16: TypeVector 6(int) 4
17: TypePointer Function 16(ivec4)
19: 16(ivec4) ConstantComposite 9 9 9 9
20: TypeInt 32 0
21: TypeVector 20(int) 4
22: TypePointer Function 21(ivec4)
24: 20(int) Constant 0
25: 21(ivec4) ConstantComposite 24 24 24 24
26: TypeImage 10(float) 2D sampled format:Unknown
27: TypeSampledImage 26
28: TypePointer UniformConstant 27
29(s2D): 28(ptr) Variable UniformConstant
31: TypeVector 10(float) 2
32: TypePointer UniformConstant 31(fvec2)
33(c2): 32(ptr) Variable UniformConstant
35(ResType): TypeStruct 6(int) 11(fvec4)
41: TypeImage 10(float) 3D sampled format:Unknown
42: TypeSampledImage 41
43: TypePointer UniformConstant 42
44(s3D): 43(ptr) Variable UniformConstant
46: TypeVector 10(float) 3
47: TypePointer UniformConstant 46(fvec3)
48(c3): 47(ptr) Variable UniformConstant
50: 10(float) Constant 1073741824
56: TypeImage 6(int) Cube sampled format:Unknown
57: TypeSampledImage 56
58: TypePointer UniformConstant 57
59(isCube): 58(ptr) Variable UniformConstant
62(ResType): TypeStruct 6(int) 16(ivec4)
68: TypeImage 10(float) 2D depth sampled format:Unknown
69: TypeSampledImage 68
70: TypePointer UniformConstant 69
71(s2DShadow): 70(ptr) Variable UniformConstant
74: TypePointer Function 10(float)
77(ResType): TypeStruct 6(int) 10(float)
83: TypeImage 10(float) Cube depth array sampled format:Unknown
84: TypeSampledImage 83
85: TypePointer UniformConstant 84
86(sCubeArrayShadow): 85(ptr) Variable UniformConstant
88: TypePointer UniformConstant 11(fvec4)
89(c4): 88(ptr) Variable UniformConstant
91: 10(float) Constant 1065353216
105: TypeImage 20(int) Cube array sampled format:Unknown
106: TypeSampledImage 105
107: TypePointer UniformConstant 106
108(usCubeArray): 107(ptr) Variable UniformConstant
111(ResType): TypeStruct 6(int) 21(ivec4)
119: 20(int) Constant 1
129: TypeVector 6(int) 3
130: 6(int) Constant 2
131: 129(ivec3) ConstantComposite 130 130 130
137: TypeImage 20(int) Rect sampled format:Unknown
138: TypeSampledImage 137
139: TypePointer UniformConstant 138
140(us2DRect): 139(ptr) Variable UniformConstant
143: TypeVector 6(int) 2
144: 6(int) Constant 3
145: 143(ivec2) ConstantComposite 144 144
151: TypeImage 10(float) 2D depth array sampled format:Unknown
152: TypeSampledImage 151
153: TypePointer UniformConstant 152
154(s2DArrayShadow): 153(ptr) Variable UniformConstant
157: 6(int) Constant 5
158: 143(ivec2) ConstantComposite 157 157
159: 20(int) Constant 2
183: TypeImage 10(float) 2D multi-sampled sampled format:Unknown
184: TypeSampledImage 183
185: TypePointer UniformConstant 184
186(s2DMS): 185(ptr) Variable UniformConstant
190: 6(int) Constant 4
199: 129(ivec3) ConstantComposite 190 190 190
220: TypeImage 6(int) 2D array sampled format:Unknown
221: TypeSampledImage 220
222: TypePointer UniformConstant 221
223(is2DArray): 222(ptr) Variable UniformConstant
226: 6(int) Constant 6
227: 143(ivec2) ConstantComposite 226 226
235: 6(int) Constant 7
236: 143(ivec2) ConstantComposite 235 235
253: TypeImage 10(float) Cube depth sampled format:Unknown
254: TypeSampledImage 253
255: TypePointer UniformConstant 254
256(sCubeShadow): 255(ptr) Variable UniformConstant
286: TypeImage 10(float) Rect depth sampled format:Unknown
287: TypeSampledImage 286
288: TypePointer UniformConstant 287
289(s2DRectShadow): 288(ptr) Variable UniformConstant
294: 20(int) Constant 3
306: 143(ivec2) ConstantComposite 130 130
335: 143(ivec2) ConstantComposite 190 190
357: 20(int) Constant 4
358: TypeArray 143(ivec2) 357
359: TypePointer UniformConstant 358
360(offsets): 359(ptr) Variable UniformConstant
383: TypePointer Output 11(fvec4)
384(outColor): 383(ptr) Variable Output
387: TypeBool
4(main): 2 Function None 3
5: Label
8(resident): 7(ptr) Variable Function
13(texel): 12(ptr) Variable Function
18(itexel): 17(ptr) Variable Function
23(utexel): 22(ptr) Variable Function
385: 12(ptr) Variable Function
Store 8(resident) 9
Store 13(texel) 15
Store 18(itexel) 19
Store 23(utexel) 25
30: 27 Load 29(s2D)
34: 31(fvec2) Load 33(c2)
36: 35(ResType) ImageSparseSampleImplicitLod 30 34
37: 11(fvec4) CompositeExtract 36 1
Store 13(texel) 37
38: 6(int) CompositeExtract 36 0
39: 6(int) Load 8(resident)
40: 6(int) BitwiseOr 39 38
Store 8(resident) 40
45: 42 Load 44(s3D)
49: 46(fvec3) Load 48(c3)
51: 35(ResType) ImageSparseSampleImplicitLod 45 49 Bias 50
52: 11(fvec4) CompositeExtract 51 1
Store 13(texel) 52
53: 6(int) CompositeExtract 51 0
54: 6(int) Load 8(resident)
55: 6(int) BitwiseOr 54 53
Store 8(resident) 55
60: 57 Load 59(isCube)
61: 46(fvec3) Load 48(c3)
63: 62(ResType) ImageSparseSampleImplicitLod 60 61
64: 16(ivec4) CompositeExtract 63 1
Store 18(itexel) 64
65: 6(int) CompositeExtract 63 0
66: 6(int) Load 8(resident)
67: 6(int) BitwiseOr 66 65
Store 8(resident) 67
72: 69 Load 71(s2DShadow)
73: 46(fvec3) Load 48(c3)
75: 74(ptr) AccessChain 13(texel) 24
76: 10(float) CompositeExtract 73 2
78: 77(ResType) ImageSparseSampleDrefImplicitLod 72 73 76
79: 10(float) CompositeExtract 78 1
Store 75 79
80: 6(int) CompositeExtract 78 0
81: 6(int) Load 8(resident)
82: 6(int) BitwiseOr 81 80
Store 8(resident) 82
87: 84 Load 86(sCubeArrayShadow)
90: 11(fvec4) Load 89(c4)
92: 74(ptr) AccessChain 13(texel) 24
93: 77(ResType) ImageSparseSampleDrefImplicitLod 87 90 91
94: 10(float) CompositeExtract 93 1
Store 92 94
95: 6(int) CompositeExtract 93 0
96: 6(int) Load 8(resident)
97: 6(int) BitwiseOr 96 95
Store 8(resident) 97
98: 27 Load 29(s2D)
99: 31(fvec2) Load 33(c2)
100: 35(ResType) ImageSparseSampleExplicitLod 98 99 Lod 50
101: 11(fvec4) CompositeExtract 100 1
Store 13(texel) 101
102: 6(int) CompositeExtract 100 0
103: 6(int) Load 8(resident)
104: 6(int) BitwiseOr 103 102
Store 8(resident) 104
109: 106 Load 108(usCubeArray)
110: 11(fvec4) Load 89(c4)
112:111(ResType) ImageSparseSampleExplicitLod 109 110 Lod 91
113: 21(ivec4) CompositeExtract 112 1
Store 23(utexel) 113
114: 6(int) CompositeExtract 112 0
115: 6(int) Load 8(resident)
116: 6(int) BitwiseOr 115 114
Store 8(resident) 116
117: 69 Load 71(s2DShadow)
118: 46(fvec3) Load 48(c3)
120: 74(ptr) AccessChain 13(texel) 119
121: 10(float) CompositeExtract 118 2
122: 77(ResType) ImageSparseSampleDrefExplicitLod 117 118 121 Lod 50
123: 10(float) CompositeExtract 122 1
Store 120 123
124: 6(int) CompositeExtract 122 0
125: 6(int) Load 8(resident)
126: 6(int) BitwiseOr 125 124
Store 8(resident) 126
127: 42 Load 44(s3D)
128: 46(fvec3) Load 48(c3)
132: 35(ResType) ImageSparseSampleImplicitLod 127 128 Bias ConstOffset 50 131
133: 11(fvec4) CompositeExtract 132 1
Store 13(texel) 133
134: 6(int) CompositeExtract 132 0
135: 6(int) Load 8(resident)
136: 6(int) BitwiseOr 135 134
Store 8(resident) 136
141: 138 Load 140(us2DRect)
142: 31(fvec2) Load 33(c2)
146:111(ResType) ImageSparseSampleImplicitLod 141 142 ConstOffset 145
147: 21(ivec4) CompositeExtract 146 1
Store 23(utexel) 147
148: 6(int) CompositeExtract 146 0
149: 6(int) Load 8(resident)
150: 6(int) BitwiseOr 149 148
Store 8(resident) 150
155: 152 Load 154(s2DArrayShadow)
156: 11(fvec4) Load 89(c4)
160: 74(ptr) AccessChain 13(texel) 159
161: 10(float) CompositeExtract 156 3
162: 77(ResType) ImageSparseSampleDrefImplicitLod 155 156 161 ConstOffset 158
163: 10(float) CompositeExtract 162 1
Store 160 163
164: 6(int) CompositeExtract 162 0
165: 6(int) Load 8(resident)
166: 6(int) BitwiseOr 165 164
Store 8(resident) 166
167: 27 Load 29(s2D)
168: 31(fvec2) Load 33(c2)
169: 143(ivec2) ConvertFToS 168
170: 35(ResType) ImageSparseFetch 167 169 Lod 130
171: 11(fvec4) CompositeExtract 170 1
Store 13(texel) 171
172: 6(int) CompositeExtract 170 0
173: 6(int) Load 8(resident)
174: 6(int) BitwiseOr 173 172
Store 8(resident) 174
175: 138 Load 140(us2DRect)
176: 31(fvec2) Load 33(c2)
177: 143(ivec2) ConvertFToS 176
178:111(ResType) ImageSparseFetch 175 177
179: 21(ivec4) CompositeExtract 178 1
Store 23(utexel) 179
180: 6(int) CompositeExtract 178 0
181: 6(int) Load 8(resident)
182: 6(int) BitwiseOr 181 180
Store 8(resident) 182
187: 184 Load 186(s2DMS)
188: 31(fvec2) Load 33(c2)
189: 143(ivec2) ConvertFToS 188
191: 35(ResType) ImageSparseFetch 187 189 Sample 190
192: 11(fvec4) CompositeExtract 191 1
Store 13(texel) 192
193: 6(int) CompositeExtract 191 0
194: 6(int) Load 8(resident)
195: 6(int) BitwiseOr 194 193
Store 8(resident) 195
196: 42 Load 44(s3D)
197: 46(fvec3) Load 48(c3)
198: 129(ivec3) ConvertFToS 197
200: 35(ResType) ImageSparseFetch 196 198 Lod ConstOffset 130 199
201: 11(fvec4) CompositeExtract 200 1
Store 13(texel) 201
202: 6(int) CompositeExtract 200 0
203: 6(int) Load 8(resident)
204: 6(int) BitwiseOr 203 202
Store 8(resident) 204
205: 138 Load 140(us2DRect)
206: 31(fvec2) Load 33(c2)
207: 143(ivec2) ConvertFToS 206
208:111(ResType) ImageSparseFetch 205 207 ConstOffset 145
209: 21(ivec4) CompositeExtract 208 1
Store 23(utexel) 209
210: 6(int) CompositeExtract 208 0
211: 6(int) Load 8(resident)
212: 6(int) BitwiseOr 211 210
Store 8(resident) 212
213: 27 Load 29(s2D)
214: 31(fvec2) Load 33(c2)
215: 35(ResType) ImageSparseSampleExplicitLod 213 214 Lod ConstOffset 50 158
216: 11(fvec4) CompositeExtract 215 1
Store 13(texel) 216
217: 6(int) CompositeExtract 215 0
218: 6(int) Load 8(resident)
219: 6(int) BitwiseOr 218 217
Store 8(resident) 219
224: 221 Load 223(is2DArray)
225: 46(fvec3) Load 48(c3)
228: 62(ResType) ImageSparseSampleExplicitLod 224 225 Lod ConstOffset 50 227
229: 16(ivec4) CompositeExtract 228 1
Store 18(itexel) 229
230: 6(int) CompositeExtract 228 0
231: 6(int) Load 8(resident)
232: 6(int) BitwiseOr 231 230
Store 8(resident) 232
233: 69 Load 71(s2DShadow)
234: 46(fvec3) Load 48(c3)
237: 74(ptr) AccessChain 13(texel) 159
238: 10(float) CompositeExtract 234 2
239: 77(ResType) ImageSparseSampleDrefExplicitLod 233 234 238 Lod ConstOffset 50 236
240: 10(float) CompositeExtract 239 1
Store 237 240
241: 6(int) CompositeExtract 239 0
242: 6(int) Load 8(resident)
243: 6(int) BitwiseOr 242 241
Store 8(resident) 243
244: 42 Load 44(s3D)
245: 46(fvec3) Load 48(c3)
246: 46(fvec3) Load 48(c3)
247: 46(fvec3) Load 48(c3)
248: 35(ResType) ImageSparseSampleExplicitLod 244 245 Grad 246 247
249: 11(fvec4) CompositeExtract 248 1
Store 13(texel) 249
250: 6(int) CompositeExtract 248 0
251: 6(int) Load 8(resident)
252: 6(int) BitwiseOr 251 250
Store 8(resident) 252
257: 254 Load 256(sCubeShadow)
258: 11(fvec4) Load 89(c4)
259: 46(fvec3) Load 48(c3)
260: 46(fvec3) Load 48(c3)
261: 74(ptr) AccessChain 13(texel) 119
262: 10(float) CompositeExtract 258 3
263: 77(ResType) ImageSparseSampleDrefExplicitLod 257 258 262 Grad 259 260
264: 10(float) CompositeExtract 263 1
Store 261 264
265: 6(int) CompositeExtract 263 0
266: 6(int) Load 8(resident)
267: 6(int) BitwiseOr 266 265
Store 8(resident) 267
268: 106 Load 108(usCubeArray)
269: 11(fvec4) Load 89(c4)
270: 46(fvec3) Load 48(c3)
271: 46(fvec3) Load 48(c3)
272:111(ResType) ImageSparseSampleExplicitLod 268 269 Grad 270 271
273: 21(ivec4) CompositeExtract 272 1
Store 23(utexel) 273
274: 6(int) CompositeExtract 272 0
275: 6(int) Load 8(resident)
276: 6(int) BitwiseOr 275 274
Store 8(resident) 276
277: 27 Load 29(s2D)
278: 31(fvec2) Load 33(c2)
279: 31(fvec2) Load 33(c2)
280: 31(fvec2) Load 33(c2)
281: 35(ResType) ImageSparseSampleExplicitLod 277 278 Grad ConstOffset 279 280 158
282: 11(fvec4) CompositeExtract 281 1
Store 13(texel) 282
283: 6(int) CompositeExtract 281 0
284: 6(int) Load 8(resident)
285: 6(int) BitwiseOr 284 283
Store 8(resident) 285
290: 287 Load 289(s2DRectShadow)
291: 46(fvec3) Load 48(c3)
292: 31(fvec2) Load 33(c2)
293: 31(fvec2) Load 33(c2)
295: 74(ptr) AccessChain 13(texel) 294
296: 10(float) CompositeExtract 291 2
297: 77(ResType) ImageSparseSampleDrefExplicitLod 290 291 296 Grad ConstOffset 292 293 227
298: 10(float) CompositeExtract 297 1
Store 295 298
299: 6(int) CompositeExtract 297 0
300: 6(int) Load 8(resident)
301: 6(int) BitwiseOr 300 299
Store 8(resident) 301
302: 221 Load 223(is2DArray)
303: 46(fvec3) Load 48(c3)
304: 31(fvec2) Load 33(c2)
305: 31(fvec2) Load 33(c2)
307: 62(ResType) ImageSparseSampleExplicitLod 302 303 Grad ConstOffset 304 305 306
308: 16(ivec4) CompositeExtract 307 1
Store 18(itexel) 308
309: 6(int) CompositeExtract 307 0
310: 6(int) Load 8(resident)
311: 6(int) BitwiseOr 310 309
Store 8(resident) 311
312: 27 Load 29(s2D)
313: 31(fvec2) Load 33(c2)
314: 35(ResType) ImageSparseGather 312 313 9
315: 11(fvec4) CompositeExtract 314 1
Store 13(texel) 315
316: 6(int) CompositeExtract 314 0
317: 6(int) Load 8(resident)
318: 6(int) BitwiseOr 317 316
Store 8(resident) 318
319: 221 Load 223(is2DArray)
320: 46(fvec3) Load 48(c3)
321: 62(ResType) ImageSparseGather 319 320 130
322: 16(ivec4) CompositeExtract 321 1
Store 18(itexel) 322
323: 6(int) CompositeExtract 321 0
324: 6(int) Load 8(resident)
325: 6(int) BitwiseOr 324 323
Store 8(resident) 325
326: 152 Load 154(s2DArrayShadow)
327: 46(fvec3) Load 48(c3)
328: 35(ResType) ImageSparseDrefGather 326 327 50
329: 11(fvec4) CompositeExtract 328 1
Store 13(texel) 329
330: 6(int) CompositeExtract 328 0
331: 6(int) Load 8(resident)
332: 6(int) BitwiseOr 331 330
Store 8(resident) 332
333: 27 Load 29(s2D)
334: 31(fvec2) Load 33(c2)
336: 35(ResType) ImageSparseGather 333 334 9 ConstOffset 335
337: 11(fvec4) CompositeExtract 336 1
Store 13(texel) 337
338: 6(int) CompositeExtract 336 0
339: 6(int) Load 8(resident)
340: 6(int) BitwiseOr 339 338
Store 8(resident) 340
341: 221 Load 223(is2DArray)
342: 46(fvec3) Load 48(c3)
343: 62(ResType) ImageSparseGather 341 342 130 ConstOffset 158
344: 16(ivec4) CompositeExtract 343 1
Store 18(itexel) 344
345: 6(int) CompositeExtract 343 0
346: 6(int) Load 8(resident)
347: 6(int) BitwiseOr 346 345
Store 8(resident) 347
348: 287 Load 289(s2DRectShadow)
349: 31(fvec2) Load 33(c2)
350: 35(ResType) ImageSparseDrefGather 348 349 50 ConstOffset 236
351: 11(fvec4) CompositeExtract 350 1
Store 13(texel) 351
352: 6(int) CompositeExtract 350 0
353: 6(int) Load 8(resident)
354: 6(int) BitwiseOr 353 352
Store 8(resident) 354
355: 27 Load 29(s2D)
356: 31(fvec2) Load 33(c2)
361: 358 Load 360(offsets)
362: 35(ResType) ImageSparseGather 355 356 9 ConstOffsets 361
363: 11(fvec4) CompositeExtract 362 1
Store 13(texel) 363
364: 6(int) CompositeExtract 362 0
365: 6(int) Load 8(resident)
366: 6(int) BitwiseOr 365 364
Store 8(resident) 366
367: 221 Load 223(is2DArray)
368: 46(fvec3) Load 48(c3)
369: 358 Load 360(offsets)
370: 62(ResType) ImageSparseGather 367 368 130 ConstOffsets 369
371: 16(ivec4) CompositeExtract 370 1
Store 18(itexel) 371
372: 6(int) CompositeExtract 370 0
373: 6(int) Load 8(resident)
374: 6(int) BitwiseOr 373 372
Store 8(resident) 374
375: 287 Load 289(s2DRectShadow)
376: 31(fvec2) Load 33(c2)
377: 358 Load 360(offsets)
378: 35(ResType) ImageSparseDrefGather 375 376 50 ConstOffsets 377
379: 11(fvec4) CompositeExtract 378 1
Store 13(texel) 379
380: 6(int) CompositeExtract 378 0
381: 6(int) Load 8(resident)
382: 6(int) BitwiseOr 381 380
Store 8(resident) 382
386: 6(int) Load 8(resident)
388: 387(bool) ImageSparseTexelsResident 386
SelectionMerge 390 None
BranchConditional 388 389 392
389: Label
391: 11(fvec4) Load 13(texel)
Store 385 391
Branch 390
392: Label
393: 16(ivec4) Load 18(itexel)
394: 11(fvec4) ConvertSToF 393
395: 21(ivec4) Load 23(utexel)
396: 11(fvec4) ConvertUToF 395
397: 11(fvec4) FAdd 394 396
Store 385 397
Branch 390
390: Label
398: 11(fvec4) Load 385
Store 384(outColor) 398
Return
FunctionEnd

View File

@ -0,0 +1,456 @@
spv.sparseTextureClamp.frag
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 360
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 345
ExecutionMode 4 OriginLowerLeft
Source GLSL 450
SourceExtension "GL_ARB_sparse_texture_clamp"
Name 4 "main"
Name 8 "resident"
Name 13 "texel"
Name 18 "itexel"
Name 23 "utexel"
Name 29 "s2D"
Name 33 "c2"
Name 36 "lodClamp"
Name 38 "ResType"
Name 47 "s3D"
Name 51 "c3"
Name 63 "isCube"
Name 67 "ResType"
Name 76 "s2DShadow"
Name 83 "ResType"
Name 92 "sCubeArrayShadow"
Name 95 "c4"
Name 154 "us2DRect"
Name 161 "ResType"
Name 170 "s2DArrayShadow"
Name 218 "sCubeShadow"
Name 235 "usCubeArray"
Name 286 "s2DRectShadow"
Name 305 "is2DArray"
Name 345 "outColor"
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Function 6(int)
9: 6(int) Constant 0
10: TypeFloat 32
11: TypeVector 10(float) 4
12: TypePointer Function 11(fvec4)
14: 10(float) Constant 0
15: 11(fvec4) ConstantComposite 14 14 14 14
16: TypeVector 6(int) 4
17: TypePointer Function 16(ivec4)
19: 16(ivec4) ConstantComposite 9 9 9 9
20: TypeInt 32 0
21: TypeVector 20(int) 4
22: TypePointer Function 21(ivec4)
24: 20(int) Constant 0
25: 21(ivec4) ConstantComposite 24 24 24 24
26: TypeImage 10(float) 2D sampled format:Unknown
27: TypeSampledImage 26
28: TypePointer UniformConstant 27
29(s2D): 28(ptr) Variable UniformConstant
31: TypeVector 10(float) 2
32: TypePointer UniformConstant 31(fvec2)
33(c2): 32(ptr) Variable UniformConstant
35: TypePointer UniformConstant 10(float)
36(lodClamp): 35(ptr) Variable UniformConstant
38(ResType): TypeStruct 6(int) 11(fvec4)
44: TypeImage 10(float) 3D sampled format:Unknown
45: TypeSampledImage 44
46: TypePointer UniformConstant 45
47(s3D): 46(ptr) Variable UniformConstant
49: TypeVector 10(float) 3
50: TypePointer UniformConstant 49(fvec3)
51(c3): 50(ptr) Variable UniformConstant
54: 10(float) Constant 1073741824
60: TypeImage 6(int) Cube sampled format:Unknown
61: TypeSampledImage 60
62: TypePointer UniformConstant 61
63(isCube): 62(ptr) Variable UniformConstant
67(ResType): TypeStruct 6(int) 16(ivec4)
73: TypeImage 10(float) 2D depth sampled format:Unknown
74: TypeSampledImage 73
75: TypePointer UniformConstant 74
76(s2DShadow): 75(ptr) Variable UniformConstant
80: TypePointer Function 10(float)
83(ResType): TypeStruct 6(int) 10(float)
89: TypeImage 10(float) Cube depth array sampled format:Unknown
90: TypeSampledImage 89
91: TypePointer UniformConstant 90
92(sCubeArrayShadow): 91(ptr) Variable UniformConstant
94: TypePointer UniformConstant 11(fvec4)
95(c4): 94(ptr) Variable UniformConstant
97: 10(float) Constant 1065353216
142: TypeVector 6(int) 3
143: 6(int) Constant 2
144: 142(ivec3) ConstantComposite 143 143 143
151: TypeImage 20(int) Rect sampled format:Unknown
152: TypeSampledImage 151
153: TypePointer UniformConstant 152
154(us2DRect): 153(ptr) Variable UniformConstant
157: TypeVector 6(int) 2
158: 6(int) Constant 3
159: 157(ivec2) ConstantComposite 158 158
161(ResType): TypeStruct 6(int) 21(ivec4)
167: TypeImage 10(float) 2D depth array sampled format:Unknown
168: TypeSampledImage 167
169: TypePointer UniformConstant 168
170(s2DArrayShadow): 169(ptr) Variable UniformConstant
173: 6(int) Constant 5
174: 157(ivec2) ConstantComposite 173 173
176: 20(int) Constant 2
215: TypeImage 10(float) Cube depth sampled format:Unknown
216: TypeSampledImage 215
217: TypePointer UniformConstant 216
218(sCubeShadow): 217(ptr) Variable UniformConstant
224: 20(int) Constant 1
232: TypeImage 20(int) Cube array sampled format:Unknown
233: TypeSampledImage 232
234: TypePointer UniformConstant 233
235(usCubeArray): 234(ptr) Variable UniformConstant
283: TypeImage 10(float) Rect depth sampled format:Unknown
284: TypeSampledImage 283
285: TypePointer UniformConstant 284
286(s2DRectShadow): 285(ptr) Variable UniformConstant
291: 6(int) Constant 6
292: 157(ivec2) ConstantComposite 291 291
294: 20(int) Constant 3
302: TypeImage 6(int) 2D array sampled format:Unknown
303: TypeSampledImage 302
304: TypePointer UniformConstant 303
305(is2DArray): 304(ptr) Variable UniformConstant
310: 157(ivec2) ConstantComposite 143 143
344: TypePointer Output 11(fvec4)
345(outColor): 344(ptr) Variable Output
348: TypeBool
4(main): 2 Function None 3
5: Label
8(resident): 7(ptr) Variable Function
13(texel): 12(ptr) Variable Function
18(itexel): 17(ptr) Variable Function
23(utexel): 22(ptr) Variable Function
346: 12(ptr) Variable Function
Store 8(resident) 9
Store 13(texel) 15
Store 18(itexel) 19
Store 23(utexel) 25
30: 27 Load 29(s2D)
34: 31(fvec2) Load 33(c2)
37: 10(float) Load 36(lodClamp)
39: 38(ResType) ImageSparseSampleImplicitLod 30 34 MinLod 37
40: 11(fvec4) CompositeExtract 39 1
Store 13(texel) 40
41: 6(int) CompositeExtract 39 0
42: 6(int) Load 8(resident)
43: 6(int) BitwiseOr 42 41
Store 8(resident) 43
48: 45 Load 47(s3D)
52: 49(fvec3) Load 51(c3)
53: 10(float) Load 36(lodClamp)
55: 38(ResType) ImageSparseSampleImplicitLod 48 52 Bias MinLod 54 53
56: 11(fvec4) CompositeExtract 55 1
Store 13(texel) 56
57: 6(int) CompositeExtract 55 0
58: 6(int) Load 8(resident)
59: 6(int) BitwiseOr 58 57
Store 8(resident) 59
64: 61 Load 63(isCube)
65: 49(fvec3) Load 51(c3)
66: 10(float) Load 36(lodClamp)
68: 67(ResType) ImageSparseSampleImplicitLod 64 65 MinLod 66
69: 16(ivec4) CompositeExtract 68 1
Store 18(itexel) 69
70: 6(int) CompositeExtract 68 0
71: 6(int) Load 8(resident)
72: 6(int) BitwiseOr 71 70
Store 8(resident) 72
77: 74 Load 76(s2DShadow)
78: 49(fvec3) Load 51(c3)
79: 10(float) Load 36(lodClamp)
81: 80(ptr) AccessChain 13(texel) 24
82: 10(float) CompositeExtract 78 2
84: 83(ResType) ImageSparseSampleDrefImplicitLod 77 78 82 MinLod 79
85: 10(float) CompositeExtract 84 1
Store 81 85
86: 6(int) CompositeExtract 84 0
87: 6(int) Load 8(resident)
88: 6(int) BitwiseOr 87 86
Store 8(resident) 88
93: 90 Load 92(sCubeArrayShadow)
96: 11(fvec4) Load 95(c4)
98: 10(float) Load 36(lodClamp)
99: 80(ptr) AccessChain 13(texel) 24
100: 83(ResType) ImageSparseSampleDrefImplicitLod 93 96 97 MinLod 98
101: 10(float) CompositeExtract 100 1
Store 99 101
102: 6(int) CompositeExtract 100 0
103: 6(int) Load 8(resident)
104: 6(int) BitwiseOr 103 102
Store 8(resident) 104
105: 27 Load 29(s2D)
106: 31(fvec2) Load 33(c2)
107: 10(float) Load 36(lodClamp)
108: 11(fvec4) ImageSampleImplicitLod 105 106 MinLod 107
109: 11(fvec4) Load 13(texel)
110: 11(fvec4) FAdd 109 108
Store 13(texel) 110
111: 45 Load 47(s3D)
112: 49(fvec3) Load 51(c3)
113: 10(float) Load 36(lodClamp)
114: 11(fvec4) ImageSampleImplicitLod 111 112 Bias MinLod 54 113
115: 11(fvec4) Load 13(texel)
116: 11(fvec4) FAdd 115 114
Store 13(texel) 116
117: 61 Load 63(isCube)
118: 49(fvec3) Load 51(c3)
119: 10(float) Load 36(lodClamp)
120: 16(ivec4) ImageSampleImplicitLod 117 118 MinLod 119
121: 16(ivec4) Load 18(itexel)
122: 16(ivec4) IAdd 121 120
Store 18(itexel) 122
123: 74 Load 76(s2DShadow)
124: 49(fvec3) Load 51(c3)
125: 10(float) Load 36(lodClamp)
126: 10(float) CompositeExtract 124 2
127: 10(float) ImageSampleDrefImplicitLod 123 124 126 MinLod 125
128: 80(ptr) AccessChain 13(texel) 24
129: 10(float) Load 128
130: 10(float) FAdd 129 127
131: 80(ptr) AccessChain 13(texel) 24
Store 131 130
132: 90 Load 92(sCubeArrayShadow)
133: 11(fvec4) Load 95(c4)
134: 10(float) Load 36(lodClamp)
135: 10(float) ImageSampleDrefImplicitLod 132 133 97 MinLod 134
136: 80(ptr) AccessChain 13(texel) 24
137: 10(float) Load 136
138: 10(float) FAdd 137 135
139: 80(ptr) AccessChain 13(texel) 24
Store 139 138
140: 45 Load 47(s3D)
141: 49(fvec3) Load 51(c3)
145: 10(float) Load 36(lodClamp)
146: 38(ResType) ImageSparseSampleImplicitLod 140 141 Bias ConstOffset MinLod 54 144 145
147: 11(fvec4) CompositeExtract 146 1
Store 13(texel) 147
148: 6(int) CompositeExtract 146 0
149: 6(int) Load 8(resident)
150: 6(int) BitwiseOr 149 148
Store 8(resident) 150
155: 152 Load 154(us2DRect)
156: 31(fvec2) Load 33(c2)
160: 10(float) Load 36(lodClamp)
162:161(ResType) ImageSparseSampleImplicitLod 155 156 ConstOffset MinLod 159 160
163: 21(ivec4) CompositeExtract 162 1
Store 23(utexel) 163
164: 6(int) CompositeExtract 162 0
165: 6(int) Load 8(resident)
166: 6(int) BitwiseOr 165 164
Store 8(resident) 166
171: 168 Load 170(s2DArrayShadow)
172: 11(fvec4) Load 95(c4)
175: 10(float) Load 36(lodClamp)
177: 80(ptr) AccessChain 13(texel) 176
178: 10(float) CompositeExtract 172 3
179: 83(ResType) ImageSparseSampleDrefImplicitLod 171 172 178 ConstOffset MinLod 174 175
180: 10(float) CompositeExtract 179 1
Store 177 180
181: 6(int) CompositeExtract 179 0
182: 6(int) Load 8(resident)
183: 6(int) BitwiseOr 182 181
Store 8(resident) 183
184: 45 Load 47(s3D)
185: 49(fvec3) Load 51(c3)
186: 10(float) Load 36(lodClamp)
187: 11(fvec4) ImageSampleImplicitLod 184 185 Bias ConstOffset MinLod 54 144 186
188: 11(fvec4) Load 13(texel)
189: 11(fvec4) FAdd 188 187
Store 13(texel) 189
190: 152 Load 154(us2DRect)
191: 31(fvec2) Load 33(c2)
192: 10(float) Load 36(lodClamp)
193: 21(ivec4) ImageSampleImplicitLod 190 191 ConstOffset MinLod 159 192
194: 21(ivec4) Load 23(utexel)
195: 21(ivec4) IAdd 194 193
Store 23(utexel) 195
196: 168 Load 170(s2DArrayShadow)
197: 11(fvec4) Load 95(c4)
198: 10(float) Load 36(lodClamp)
199: 10(float) CompositeExtract 197 3
200: 10(float) ImageSampleDrefImplicitLod 196 197 199 ConstOffset MinLod 174 198
201: 80(ptr) AccessChain 13(texel) 176
202: 10(float) Load 201
203: 10(float) FAdd 202 200
204: 80(ptr) AccessChain 13(texel) 176
Store 204 203
205: 45 Load 47(s3D)
206: 49(fvec3) Load 51(c3)
207: 49(fvec3) Load 51(c3)
208: 49(fvec3) Load 51(c3)
209: 10(float) Load 36(lodClamp)
210: 38(ResType) ImageSparseSampleExplicitLod 205 206 Grad MinLod 207 208 209
211: 11(fvec4) CompositeExtract 210 1
Store 13(texel) 211
212: 6(int) CompositeExtract 210 0
213: 6(int) Load 8(resident)
214: 6(int) BitwiseOr 213 212
Store 8(resident) 214
219: 216 Load 218(sCubeShadow)
220: 11(fvec4) Load 95(c4)
221: 49(fvec3) Load 51(c3)
222: 49(fvec3) Load 51(c3)
223: 10(float) Load 36(lodClamp)
225: 80(ptr) AccessChain 13(texel) 224
226: 10(float) CompositeExtract 220 3
227: 83(ResType) ImageSparseSampleDrefExplicitLod 219 220 226 Grad MinLod 221 222 223
228: 10(float) CompositeExtract 227 1
Store 225 228
229: 6(int) CompositeExtract 227 0
230: 6(int) Load 8(resident)
231: 6(int) BitwiseOr 230 229
Store 8(resident) 231
236: 233 Load 235(usCubeArray)
237: 11(fvec4) Load 95(c4)
238: 49(fvec3) Load 51(c3)
239: 49(fvec3) Load 51(c3)
240: 10(float) Load 36(lodClamp)
241:161(ResType) ImageSparseSampleExplicitLod 236 237 Grad MinLod 238 239 240
242: 21(ivec4) CompositeExtract 241 1
Store 23(utexel) 242
243: 6(int) CompositeExtract 241 0
244: 6(int) Load 8(resident)
245: 6(int) BitwiseOr 244 243
Store 8(resident) 245
246: 45 Load 47(s3D)
247: 49(fvec3) Load 51(c3)
248: 49(fvec3) Load 51(c3)
249: 49(fvec3) Load 51(c3)
250: 10(float) Load 36(lodClamp)
251: 11(fvec4) ImageSampleExplicitLod 246 247 Grad MinLod 248 249 250
252: 11(fvec4) Load 13(texel)
253: 11(fvec4) FAdd 252 251
Store 13(texel) 253
254: 216 Load 218(sCubeShadow)
255: 11(fvec4) Load 95(c4)
256: 49(fvec3) Load 51(c3)
257: 49(fvec3) Load 51(c3)
258: 10(float) Load 36(lodClamp)
259: 10(float) CompositeExtract 255 3
260: 10(float) ImageSampleDrefExplicitLod 254 255 259 Grad MinLod 256 257 258
261: 80(ptr) AccessChain 13(texel) 224
262: 10(float) Load 261
263: 10(float) FAdd 262 260
264: 80(ptr) AccessChain 13(texel) 224
Store 264 263
265: 233 Load 235(usCubeArray)
266: 11(fvec4) Load 95(c4)
267: 49(fvec3) Load 51(c3)
268: 49(fvec3) Load 51(c3)
269: 10(float) Load 36(lodClamp)
270: 21(ivec4) ImageSampleExplicitLod 265 266 Grad MinLod 267 268 269
271: 21(ivec4) Load 23(utexel)
272: 21(ivec4) IAdd 271 270
Store 23(utexel) 272
273: 27 Load 29(s2D)
274: 31(fvec2) Load 33(c2)
275: 31(fvec2) Load 33(c2)
276: 31(fvec2) Load 33(c2)
277: 10(float) Load 36(lodClamp)
278: 38(ResType) ImageSparseSampleExplicitLod 273 274 Grad ConstOffset MinLod 275 276 174 277
279: 11(fvec4) CompositeExtract 278 1
Store 13(texel) 279
280: 6(int) CompositeExtract 278 0
281: 6(int) Load 8(resident)
282: 6(int) BitwiseOr 281 280
Store 8(resident) 282
287: 284 Load 286(s2DRectShadow)
288: 49(fvec3) Load 51(c3)
289: 31(fvec2) Load 33(c2)
290: 31(fvec2) Load 33(c2)
293: 10(float) Load 36(lodClamp)
295: 80(ptr) AccessChain 13(texel) 294
296: 10(float) CompositeExtract 288 2
297: 83(ResType) ImageSparseSampleDrefExplicitLod 287 288 296 Grad ConstOffset MinLod 289 290 292 293
298: 10(float) CompositeExtract 297 1
Store 295 298
299: 6(int) CompositeExtract 297 0
300: 6(int) Load 8(resident)
301: 6(int) BitwiseOr 300 299
Store 8(resident) 301
306: 303 Load 305(is2DArray)
307: 49(fvec3) Load 51(c3)
308: 31(fvec2) Load 33(c2)
309: 31(fvec2) Load 33(c2)
311: 10(float) Load 36(lodClamp)
312: 67(ResType) ImageSparseSampleExplicitLod 306 307 Grad ConstOffset MinLod 308 309 310 311
313: 16(ivec4) CompositeExtract 312 1
Store 18(itexel) 313
314: 6(int) CompositeExtract 312 0
315: 6(int) Load 8(resident)
316: 6(int) BitwiseOr 315 314
Store 8(resident) 316
317: 27 Load 29(s2D)
318: 31(fvec2) Load 33(c2)
319: 31(fvec2) Load 33(c2)
320: 31(fvec2) Load 33(c2)
321: 10(float) Load 36(lodClamp)
322: 11(fvec4) ImageSampleExplicitLod 317 318 Grad ConstOffset MinLod 319 320 174 321
323: 11(fvec4) Load 13(texel)
324: 11(fvec4) FAdd 323 322
Store 13(texel) 324
325: 284 Load 286(s2DRectShadow)
326: 49(fvec3) Load 51(c3)
327: 31(fvec2) Load 33(c2)
328: 31(fvec2) Load 33(c2)
329: 10(float) Load 36(lodClamp)
330: 10(float) CompositeExtract 326 2
331: 10(float) ImageSampleDrefExplicitLod 325 326 330 Grad ConstOffset MinLod 327 328 292 329
332: 80(ptr) AccessChain 13(texel) 294
333: 10(float) Load 332
334: 10(float) FAdd 333 331
335: 80(ptr) AccessChain 13(texel) 294
Store 335 334
336: 303 Load 305(is2DArray)
337: 49(fvec3) Load 51(c3)
338: 31(fvec2) Load 33(c2)
339: 31(fvec2) Load 33(c2)
340: 10(float) Load 36(lodClamp)
341: 16(ivec4) ImageSampleExplicitLod 336 337 Grad ConstOffset MinLod 338 339 310 340
342: 16(ivec4) Load 18(itexel)
343: 16(ivec4) IAdd 342 341
Store 18(itexel) 343
347: 6(int) Load 8(resident)
349: 348(bool) ImageSparseTexelsResident 347
SelectionMerge 351 None
BranchConditional 349 350 353
350: Label
352: 11(fvec4) Load 13(texel)
Store 346 352
Branch 351
353: Label
354: 16(ivec4) Load 18(itexel)
355: 11(fvec4) ConvertSToF 354
356: 21(ivec4) Load 23(utexel)
357: 11(fvec4) ConvertUToF 356
358: 11(fvec4) FAdd 355 357
Store 346 358
Branch 351
351: Label
359: 11(fvec4) Load 346
Store 345(outColor) 359
Return
FunctionEnd

View File

@ -0,0 +1,80 @@
#version 450
#extension GL_ARB_sparse_texture2: enable
uniform sampler2D s2D;
uniform sampler3D s3D;
uniform sampler2DShadow s2DShadow;
uniform samplerCubeShadow sCubeShadow;
uniform sampler2DArrayShadow s2DArrayShadow;
uniform sampler2DRectShadow s2DRectShadow;
uniform samplerCubeArrayShadow sCubeArrayShadow;
uniform sampler2DMS s2DMS;
uniform isamplerCube isCube;
uniform isampler2DArray is2DArray;
uniform usamplerCubeArray usCubeArray;
uniform usampler2DRect us2DRect;
uniform vec2 c2;
uniform vec3 c3;
uniform vec4 c4;
uniform ivec2 offsets[4];
out vec4 outColor;
void main()
{
int resident = 0;
vec4 texel = vec4(0.0);
ivec4 itexel = ivec4(0);
uvec4 utexel = uvec4(0);
resident |= sparseTextureARB(s2D, c2, texel);
resident |= sparseTextureARB(s3D, c3, texel, 2.0);
resident |= sparseTextureARB(isCube, c3, itexel);
resident |= sparseTextureARB(s2DShadow, c3, texel.x);
resident |= sparseTextureARB(sCubeArrayShadow, c4, 1.0, texel.x);
resident |= sparseTextureLodARB(s2D, c2, 2.0, texel);
resident |= sparseTextureLodARB(usCubeArray, c4, 1.0, utexel);
resident |= sparseTextureLodARB(s2DShadow, c3, 2.0, texel.y);
resident |= sparseTextureOffsetARB(s3D, c3, ivec3(2), texel, 2.0);
resident |= sparseTextureOffsetARB(us2DRect, c2, ivec2(3), utexel);
resident |= sparseTextureOffsetARB(s2DArrayShadow, c4, ivec2(5), texel.z);
resident |= sparseTexelFetchARB(s2D, ivec2(c2), 2, texel);
resident |= sparseTexelFetchARB(us2DRect, ivec2(c2), utexel);
resident |= sparseTexelFetchARB(s2DMS, ivec2(c2), 4, texel);
resident |= sparseTexelFetchOffsetARB(s3D, ivec3(c3), 2, ivec3(4), texel);
resident |= sparseTexelFetchOffsetARB(us2DRect, ivec2(c2), ivec2(3), utexel);
resident |= sparseTextureLodOffsetARB(s2D, c2, 2.0, ivec2(5), texel);
resident |= sparseTextureLodOffsetARB(is2DArray, c3, 2.0, ivec2(6), itexel);
resident |= sparseTextureLodOffsetARB(s2DShadow, c3, 2.0, ivec2(7), texel.z);
resident |= sparseTextureGradARB(s3D, c3, c3, c3, texel);
resident |= sparseTextureGradARB(sCubeShadow, c4, c3, c3, texel.y);
resident |= sparseTextureGradARB(usCubeArray, c4, c3, c3, utexel);
resident |= sparseTextureGradOffsetARB(s2D, c2, c2, c2, ivec2(5), texel);
resident |= sparseTextureGradOffsetARB(s2DRectShadow, c3, c2, c2, ivec2(6), texel.w);
resident |= sparseTextureGradOffsetARB(is2DArray, c3, c2, c2, ivec2(2), itexel);
resident |= sparseTextureGatherARB(s2D, c2, texel);
resident |= sparseTextureGatherARB(is2DArray, c3, itexel, 2);
resident |= sparseTextureGatherARB(s2DArrayShadow, c3, 2.0, texel);
resident |= sparseTextureGatherOffsetARB(s2D, c2, ivec2(4), texel);
resident |= sparseTextureGatherOffsetARB(is2DArray, c3, ivec2(5), itexel, 2);
resident |= sparseTextureGatherOffsetARB(s2DRectShadow, c2, 2.0, ivec2(7), texel);
resident |= sparseTextureGatherOffsetsARB(s2D, c2, offsets, texel);
resident |= sparseTextureGatherOffsetsARB(is2DArray, c3, offsets, itexel, 2);
resident |= sparseTextureGatherOffsetsARB(s2DRectShadow, c2, 2.0, offsets, texel);
outColor = sparseTexelsResidentARB(resident) ? texel : vec4(itexel) + vec4(utexel);
}

View File

@ -0,0 +1,70 @@
#version 450
#extension GL_ARB_sparse_texture_clamp: enable
uniform sampler2D s2D;
uniform sampler3D s3D;
uniform sampler2DShadow s2DShadow;
uniform samplerCubeShadow sCubeShadow;
uniform sampler2DArrayShadow s2DArrayShadow;
uniform sampler2DRectShadow s2DRectShadow;
uniform samplerCubeArrayShadow sCubeArrayShadow;
uniform isamplerCube isCube;
uniform isampler2DArray is2DArray;
uniform usamplerCubeArray usCubeArray;
uniform usampler2DRect us2DRect;
uniform vec2 c2;
uniform vec3 c3;
uniform vec4 c4;
uniform float lodClamp;
out vec4 outColor;
void main()
{
int resident = 0;
vec4 texel = vec4(0.0);
ivec4 itexel = ivec4(0);
uvec4 utexel = uvec4(0);
resident |= sparseTextureClampARB(s2D, c2, lodClamp, texel);
resident |= sparseTextureClampARB(s3D, c3, lodClamp, texel, 2.0);
resident |= sparseTextureClampARB(isCube, c3, lodClamp, itexel);
resident |= sparseTextureClampARB(s2DShadow, c3, lodClamp, texel.x);
resident |= sparseTextureClampARB(sCubeArrayShadow, c4, 1.0, lodClamp, texel.x);
texel += textureClampARB(s2D, c2, lodClamp);
texel += textureClampARB(s3D, c3, lodClamp, 2.0);
itexel += textureClampARB(isCube, c3, lodClamp);
texel.x += textureClampARB(s2DShadow, c3, lodClamp);
texel.x += textureClampARB(sCubeArrayShadow, c4, 1.0, lodClamp);
resident |= sparseTextureOffsetClampARB(s3D, c3, ivec3(2), lodClamp, texel, 2.0);
resident |= sparseTextureOffsetClampARB(us2DRect, c2, ivec2(3), lodClamp, utexel);
resident |= sparseTextureOffsetClampARB(s2DArrayShadow, c4, ivec2(5), lodClamp, texel.z);
texel += textureOffsetClampARB(s3D, c3, ivec3(2), lodClamp, 2.0);
utexel += textureOffsetClampARB(us2DRect, c2, ivec2(3), lodClamp);
texel.z += textureOffsetClampARB(s2DArrayShadow, c4, ivec2(5), lodClamp);
resident |= sparseTextureGradClampARB(s3D, c3, c3, c3, lodClamp, texel);
resident |= sparseTextureGradClampARB(sCubeShadow, c4, c3, c3, lodClamp, texel.y);
resident |= sparseTextureGradClampARB(usCubeArray, c4, c3, c3, lodClamp, utexel);
texel += textureGradClampARB(s3D, c3, c3, c3, lodClamp);
texel.y += textureGradClampARB(sCubeShadow, c4, c3, c3, lodClamp);
utexel += textureGradClampARB(usCubeArray, c4, c3, c3, lodClamp);
resident |= sparseTextureGradOffsetClampARB(s2D, c2, c2, c2, ivec2(5), lodClamp, texel);
resident |= sparseTextureGradOffsetClampARB(s2DRectShadow, c3, c2, c2, ivec2(6), lodClamp, texel.w);
resident |= sparseTextureGradOffsetClampARB(is2DArray, c3, c2, c2, ivec2(2), lodClamp, itexel);
texel += textureGradOffsetClampARB(s2D, c2, c2, c2, ivec2(5), lodClamp);
texel.w += textureGradOffsetClampARB(s2DRectShadow, c3, c2, c2, ivec2(6), lodClamp);
itexel += textureGradOffsetClampARB(is2DArray, c3, c2, c2, ivec2(2), lodClamp);
outColor = sparseTexelsResidentARB(resident) ? texel : vec4(itexel) + vec4(utexel);
}

View File

@ -66,6 +66,8 @@ spv.qualifiers.vert
spv.shiftOps.frag
spv.simpleFunctionCall.frag
spv.simpleMat.vert
spv.sparseTexture.frag
spv.sparseTextureClamp.frag
spv.structAssignment.frag
spv.structDeref.frag
spv.structure.frag

View File

@ -369,6 +369,8 @@ enum TOperator {
EOpImageAtomicExchange,
EOpImageAtomicCompSwap,
EOpSparseImageLoad,
EOpImageGuardEnd,
//
@ -398,6 +400,31 @@ enum TOperator {
EOpTextureGather,
EOpTextureGatherOffset,
EOpTextureGatherOffsets,
EOpTextureClamp,
EOpTextureOffsetClamp,
EOpTextureGradClamp,
EOpTextureGradOffsetClamp,
EOpSparseTextureGuardBegin,
EOpSparseTexture,
EOpSparseTextureLod,
EOpSparseTextureOffset,
EOpSparseTextureFetch,
EOpSparseTextureFetchOffset,
EOpSparseTextureLodOffset,
EOpSparseTextureGrad,
EOpSparseTextureGradOffset,
EOpSparseTextureGather,
EOpSparseTextureGatherOffset,
EOpSparseTextureGatherOffsets,
EOpSparseTexelsResident,
EOpSparseTextureClamp,
EOpSparseTextureOffsetClamp,
EOpSparseTextureGradClamp,
EOpSparseTextureGradOffsetClamp,
EOpSparseTextureGuardEnd,
EOpTextureGuardEnd,
@ -622,6 +649,7 @@ struct TCrackedTextureOp {
bool offsets;
bool gather;
bool grad;
bool lodClamp;
};
//
@ -637,6 +665,8 @@ public:
bool isConstructor() const;
bool isTexture() const { return op > EOpTextureGuardBegin && op < EOpTextureGuardEnd; }
bool isImage() const { return op > EOpImageGuardBegin && op < EOpImageGuardEnd; }
bool isSparseTexture() const { return op > EOpSparseTextureGuardBegin && op < EOpSparseTextureGuardEnd; }
bool isSparseImage() const { return op == EOpSparseImageLoad; }
// Crack the op into the individual dimensions of texturing operation.
void crackTexture(TSampler sampler, TCrackedTextureOp& cracked) const
@ -649,6 +679,7 @@ public:
cracked.offsets = false;
cracked.gather = false;
cracked.grad = false;
cracked.lodClamp = false;
switch (op) {
case EOpImageQuerySize:
@ -657,25 +688,40 @@ public:
case EOpTextureQueryLod:
case EOpTextureQueryLevels:
case EOpTextureQuerySamples:
case EOpSparseTexelsResident:
cracked.query = true;
break;
case EOpTexture:
case EOpSparseTexture:
break;
case EOpTextureClamp:
case EOpSparseTextureClamp:
cracked.lodClamp = true;
break;
case EOpTextureProj:
cracked.proj = true;
break;
case EOpTextureLod:
case EOpSparseTextureLod:
cracked.lod = true;
break;
case EOpTextureOffset:
case EOpSparseTextureOffset:
cracked.offset = true;
break;
case EOpTextureOffsetClamp:
case EOpSparseTextureOffsetClamp:
cracked.offset = true;
cracked.lodClamp = true;
break;
case EOpTextureFetch:
case EOpSparseTextureFetch:
cracked.fetch = true;
if (sampler.dim == Esd1D || (sampler.dim == Esd2D && ! sampler.ms) || sampler.dim == Esd3D)
cracked.lod = true;
break;
case EOpTextureFetchOffset:
case EOpSparseTextureFetchOffset:
cracked.fetch = true;
cracked.offset = true;
if (sampler.dim == Esd1D || (sampler.dim == Esd2D && ! sampler.ms) || sampler.dim == Esd3D)
@ -686,6 +732,7 @@ public:
cracked.proj = true;
break;
case EOpTextureLodOffset:
case EOpSparseTextureLodOffset:
cracked.offset = true;
cracked.lod = true;
break;
@ -699,9 +746,16 @@ public:
cracked.proj = true;
break;
case EOpTextureGrad:
case EOpSparseTextureGrad:
cracked.grad = true;
break;
case EOpTextureGradClamp:
case EOpSparseTextureGradClamp:
cracked.grad = true;
cracked.lodClamp = true;
break;
case EOpTextureGradOffset:
case EOpSparseTextureGradOffset:
cracked.grad = true;
cracked.offset = true;
break;
@ -714,14 +768,23 @@ public:
cracked.offset = true;
cracked.proj = true;
break;
case EOpTextureGradOffsetClamp:
case EOpSparseTextureGradOffsetClamp:
cracked.grad = true;
cracked.offset = true;
cracked.lodClamp = true;
break;
case EOpTextureGather:
case EOpSparseTextureGather:
cracked.gather = true;
break;
case EOpTextureGatherOffset:
case EOpSparseTextureGatherOffset:
cracked.gather = true;
cracked.offset = true;
break;
case EOpTextureGatherOffsets:
case EOpSparseTextureGatherOffsets:
cracked.gather = true;
cracked.offsets = true;
break;

View File

@ -1956,6 +1956,14 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, i
}
}
}
//
// sparseTexelsResidentARB()
//
if (profile != EEsProfile && version >= 450) {
commonBuiltins.append("bool sparseTexelsResidentARB(int code);\n");
}
}
//
@ -2069,6 +2077,15 @@ void TBuiltIns::addImageFunctions(TSampler sampler, TString& typeName, int versi
commonBuiltins.append(prefixes[sampler.type]);
commonBuiltins.append("vec4);\n");
if (sampler.dim != Esd1D && sampler.dim != EsdBuffer && profile != EEsProfile && version >= 450) {
commonBuiltins.append("int sparseImageLoadARB(readonly volatile coherent ");
commonBuiltins.append(imageParams);
commonBuiltins.append(", out ");
commonBuiltins.append(prefixes[sampler.type]);
commonBuiltins.append("vec4");
commonBuiltins.append(");\n");
}
if ( profile != EEsProfile ||
(profile == EEsProfile && version >= 310)) {
if (sampler.type == EbtInt || sampler.type == EbtUint) {
@ -2123,7 +2140,7 @@ void TBuiltIns::addImageFunctions(TSampler sampler, TString& typeName, int versi
//
// Add all the texture lookup functions for the given type.
//
void TBuiltIns::addSamplingFunctions(TSampler sampler, TString& typeName, int /*version*/, EProfile /*profile*/)
void TBuiltIns::addSamplingFunctions(TSampler sampler, TString& typeName, int version, EProfile profile)
{
//
// texturing
@ -2196,21 +2213,47 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, TString& typeName, int /*
if (extraProj && (sampler.dim == Esd3D || sampler.shadow))
continue;
for (int lodClamp = 0; lodClamp <= 1 ;++lodClamp) { // loop over "bool" lod clamp
if (lodClamp && (profile == EEsProfile || version < 450))
continue;
if (lodClamp && (proj || lod || fetch))
continue;
for (int sparse = 0; sparse <= 1; ++sparse) { // loop over "bool" sparse or not
if (sparse && (profile == EEsProfile || version < 450))
continue;
// Sparse sampling is not for 1D/1D array texture, buffer texture, and projective texture
if (sparse && (sampler.dim == Esd1D || sampler.dim == EsdBuffer || proj))
continue;
TString s;
// return type
if (sparse)
s.append("int ");
else {
if (sampler.shadow)
s.append("float ");
else {
s.append(prefixes[sampler.type]);
s.append("vec4 ");
}
}
// name
if (sparse) {
if (fetch)
s.append("sparseTexel");
else
s.append("sparseTexture");
} else {
if (fetch)
s.append("texel");
else
s.append("texture");
}
if (proj)
s.append("Proj");
if (lod)
@ -2221,6 +2264,10 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, TString& typeName, int /*
s.append("Fetch");
if (offset)
s.append("Offset");
if (lodClamp)
s.append("Clamp");
if (lodClamp || sparse)
s.append("ARB");
s.append("(");
// sampler type
@ -2275,8 +2322,27 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, TString& typeName, int /*
}
}
// optional bias or non-optional compare
if (bias || compare)
// non-optional compare
if (compare)
s.append(",float");
// lod clamp
if (lodClamp)
s.append(",float");
// texel out (for sparse texture)
if (sparse) {
s.append(",out ");
if (sampler.shadow)
s.append("float ");
else {
s.append(prefixes[sampler.type]);
s.append("vec4 ");
}
}
// optional bias
if (bias)
s.append(",float");
s.append(");\n");
@ -2294,6 +2360,8 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, TString& typeName, int /*
}
}
}
}
}
}
@ -2303,7 +2371,7 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, TString& typeName, int /*
//
// Add all the texture gather functions for the given type.
//
void TBuiltIns::addGatherFunctions(TSampler sampler, TString& typeName, int version, EProfile /* profile */)
void TBuiltIns::addGatherFunctions(TSampler sampler, TString& typeName, int version, EProfile profile)
{
switch (sampler.dim) {
case Esd2D:
@ -2330,13 +2398,24 @@ void TBuiltIns::addGatherFunctions(TSampler sampler, TString& typeName, int vers
if (offset > 0 && sampler.dim == EsdCube)
continue;
for (int sparse = 0; sparse <= 1; ++sparse) { // loop over "bool" sparse or not
if (sparse && (profile == EEsProfile || version < 450))
continue;
TString s;
// return type
if (sparse)
s.append("int ");
else {
s.append(prefixes[sampler.type]);
s.append("vec4 ");
}
// name
if (sparse)
s.append("sparseTextureGather");
else
s.append("textureGather");
switch (offset) {
case 1:
@ -2347,6 +2426,8 @@ void TBuiltIns::addGatherFunctions(TSampler sampler, TString& typeName, int vers
default:
break;
}
if (sparse)
s.append("ARB");
s.append("(");
// sampler type argument
@ -2368,13 +2449,20 @@ void TBuiltIns::addGatherFunctions(TSampler sampler, TString& typeName, int vers
s.append("[4]");
}
// texel out (for sparse texture)
if (sparse) {
s.append(",out ");
s.append(prefixes[sampler.type]);
s.append("vec4 ");
}
// comp argument
if (comp)
s.append(",int");
s.append(");\n");
commonBuiltins.append(s);
//printf("%s", s.c_str());
}
}
}
}
@ -3164,6 +3252,37 @@ void IdentifyBuiltIns(int version, EProfile profile, int spv, EShLanguage langua
symbolTable.setFunctionExtensions("fwidthCoarse", 1, &E_GL_ARB_derivative_control);
}
// E_GL_ARB_sparse_texture2
if (profile != EEsProfile)
{
symbolTable.setFunctionExtensions("sparseTextureARB", 1, &E_GL_ARB_sparse_texture2);
symbolTable.setFunctionExtensions("sparseTextureLodARB", 1, &E_GL_ARB_sparse_texture2);
symbolTable.setFunctionExtensions("sparseTextureOffsetARB", 1, &E_GL_ARB_sparse_texture2);
symbolTable.setFunctionExtensions("sparseTexelFetchARB", 1, &E_GL_ARB_sparse_texture2);
symbolTable.setFunctionExtensions("sparseTexelFetchOffsetARB", 1, &E_GL_ARB_sparse_texture2);
symbolTable.setFunctionExtensions("sparseTextureLodOffsetARB", 1, &E_GL_ARB_sparse_texture2);
symbolTable.setFunctionExtensions("sparseTextureGradARB", 1, &E_GL_ARB_sparse_texture2);
symbolTable.setFunctionExtensions("sparseTextureGradOffsetARB", 1, &E_GL_ARB_sparse_texture2);
symbolTable.setFunctionExtensions("sparseTextureGatherARB", 1, &E_GL_ARB_sparse_texture2);
symbolTable.setFunctionExtensions("sparseTextureGatherOffsetARB", 1, &E_GL_ARB_sparse_texture2);
symbolTable.setFunctionExtensions("sparseTextureGatherOffsetsARB", 1, &E_GL_ARB_sparse_texture2);
symbolTable.setFunctionExtensions("sparseImageLoadARB", 1, &E_GL_ARB_sparse_texture2);
symbolTable.setFunctionExtensions("sparseTexelsResident", 1, &E_GL_ARB_sparse_texture2);
}
// E_GL_ARB_sparse_texture_clamp
if (profile != EEsProfile)
{
symbolTable.setFunctionExtensions("sparseTextureClampARB", 1, &E_GL_ARB_sparse_texture_clamp);
symbolTable.setFunctionExtensions("sparseTextureOffsetClampARB", 1, &E_GL_ARB_sparse_texture_clamp);
symbolTable.setFunctionExtensions("sparseTextureGradClampARB", 1, &E_GL_ARB_sparse_texture_clamp);
symbolTable.setFunctionExtensions("sparseTextureGradOffsetClampARB", 1, &E_GL_ARB_sparse_texture_clamp);
symbolTable.setFunctionExtensions("textureClampARB", 1, &E_GL_ARB_sparse_texture_clamp);
symbolTable.setFunctionExtensions("textureOffsetClampARB", 1, &E_GL_ARB_sparse_texture_clamp);
symbolTable.setFunctionExtensions("textureGradClampARB", 1, &E_GL_ARB_sparse_texture_clamp);
symbolTable.setFunctionExtensions("textureGradOffsetClampARB", 1, &E_GL_ARB_sparse_texture_clamp);
}
symbolTable.setVariableExtensions("gl_FragDepthEXT", 1, &E_GL_EXT_frag_depth);
if (profile == EEsProfile) {
@ -3423,6 +3542,32 @@ void IdentifyBuiltIns(int version, EProfile profile, int spv, EShLanguage langua
symbolTable.relateToOperator("shadow1DProjLod", EOpTextureProjLod);
symbolTable.relateToOperator("shadow2DProjLod", EOpTextureProjLod);
}
if (profile != EEsProfile)
{
symbolTable.relateToOperator("sparseTextureARB", EOpSparseTexture);
symbolTable.relateToOperator("sparseTextureLodARB", EOpSparseTextureLod);
symbolTable.relateToOperator("sparseTextureOffsetARB", EOpSparseTextureOffset);
symbolTable.relateToOperator("sparseTexelFetchARB", EOpSparseTextureFetch);
symbolTable.relateToOperator("sparseTexelFetchOffsetARB", EOpSparseTextureFetchOffset);
symbolTable.relateToOperator("sparseTextureLodOffsetARB", EOpSparseTextureLodOffset);
symbolTable.relateToOperator("sparseTextureGradARB", EOpSparseTextureGrad);
symbolTable.relateToOperator("sparseTextureGradOffsetARB", EOpSparseTextureGradOffset);
symbolTable.relateToOperator("sparseTextureGatherARB", EOpSparseTextureGather);
symbolTable.relateToOperator("sparseTextureGatherOffsetARB", EOpSparseTextureGatherOffset);
symbolTable.relateToOperator("sparseTextureGatherOffsetsARB", EOpSparseTextureGatherOffsets);
symbolTable.relateToOperator("sparseImageLoadARB", EOpSparseImageLoad);
symbolTable.relateToOperator("sparseTexelsResidentARB", EOpSparseTexelsResident);
symbolTable.relateToOperator("sparseTextureClampARB", EOpSparseTextureClamp);
symbolTable.relateToOperator("sparseTextureOffsetClampARB", EOpSparseTextureOffsetClamp);
symbolTable.relateToOperator("sparseTextureGradClampARB", EOpSparseTextureGradClamp);
symbolTable.relateToOperator("sparseTextureGradOffsetClampARB", EOpSparseTextureGradOffsetClamp);
symbolTable.relateToOperator("textureClampARB", EOpTextureClamp);
symbolTable.relateToOperator("textureOffsetClampARB", EOpTextureOffsetClamp);
symbolTable.relateToOperator("textureGradClampARB", EOpTextureGradClamp);
symbolTable.relateToOperator("textureGradOffsetClampARB", EOpTextureGradOffsetClamp);
}
}
switch(language) {

View File

@ -173,6 +173,8 @@ void TParseContext::initializeExtensionBehavior()
extensionBehavior[E_GL_ARB_derivative_control] = EBhDisable;
extensionBehavior[E_GL_ARB_shader_texture_image_samples] = EBhDisable;
extensionBehavior[E_GL_ARB_viewport_array] = EBhDisable;
extensionBehavior[E_GL_ARB_sparse_texture2] = EBhDisable;
extensionBehavior[E_GL_ARB_sparse_texture_clamp] = EBhDisable;
// extensionBehavior[E_GL_ARB_cull_distance] = EBhDisable; // present for 4.5, but need extension control over block members
// #line and #include
@ -274,6 +276,8 @@ const char* TParseContext::getPreamble()
"#define GL_ARB_derivative_control 1\n"
"#define GL_ARB_shader_texture_image_samples 1\n"
"#define GL_ARB_viewport_array 1\n"
"#define GL_ARB_sparse_texture2 1\n"
"#define GL_ARB_sparse_texture_clamp 1\n"
"#define GL_GOOGLE_cpp_style_line_directive 1\n"
"#define GL_GOOGLE_include_directive 1\n"

View File

@ -111,6 +111,8 @@ const char* const E_GL_ARB_shader_draw_parameters = "GL_ARB_shader_draw_pa
const char* const E_GL_ARB_derivative_control = "GL_ARB_derivative_control";
const char* const E_GL_ARB_shader_texture_image_samples = "GL_ARB_shader_texture_image_samples";
const char* const E_GL_ARB_viewport_array = "GL_ARB_viewport_array";
const char* const E_GL_ARB_sparse_texture2 = "GL_ARB_sparse_texture2";
const char* const E_GL_ARB_sparse_texture_clamp = "GL_ARB_sparse_texture_clamp";
//const char* const E_GL_ARB_cull_distance = "GL_ARB_cull_distance"; // present for 4.5, but need extension control over block members
// #line and #include