Commit f43c739a by John Kessenich

SPV 1.4: Emit SignExtend and ZeroExtend for integer image reads/writes.

parent 61a5ce19
...@@ -4182,7 +4182,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ...@@ -4182,7 +4182,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
// Process a GLSL texturing op (will be SPV image) // Process a GLSL texturing op (will be SPV image)
const glslang::TType &imageType = node->getAsAggregate() ? node->getAsAggregate()->getSequence()[0]->getAsTyped()->getType() const glslang::TType &imageType = node->getAsAggregate()
? node->getAsAggregate()->getSequence()[0]->getAsTyped()->getType()
: node->getAsUnaryNode()->getOperand()->getAsTyped()->getType(); : node->getAsUnaryNode()->getOperand()->getAsTyped()->getType();
const glslang::TSampler sampler = imageType.getSampler(); const glslang::TSampler sampler = imageType.getSampler();
#ifdef AMD_EXTENSIONS #ifdef AMD_EXTENSIONS
...@@ -4191,6 +4192,16 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ...@@ -4191,6 +4192,16 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
: false; : false;
#endif #endif
const auto signExtensionMask = [&]() {
if (builder.getSpvVersion() >= spv::Spv_1_4) {
if (sampler.type == glslang::EbtUint)
return spv::ImageOperandsZeroExtendMask;
else if (sampler.type == glslang::EbtInt)
return spv::ImageOperandsSignExtendMask;
}
return spv::ImageOperandsMaskNone;
};
std::vector<spv::Id> arguments; std::vector<spv::Id> arguments;
if (node->getAsAggregate()) if (node->getAsAggregate())
translateArguments(*node->getAsAggregate(), arguments); translateArguments(*node->getAsAggregate(), arguments);
...@@ -4269,12 +4280,18 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ...@@ -4269,12 +4280,18 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
spv::IdImmediate coord = { true, spv::IdImmediate coord = { true,
builder.makeCompositeConstant(builder.makeVectorType(builder.makeIntType(32), 2), comps) }; builder.makeCompositeConstant(builder.makeVectorType(builder.makeIntType(32), 2), comps) };
operands.push_back(coord); operands.push_back(coord);
spv::IdImmediate imageOperands = { false, spv::ImageOperandsMaskNone };
imageOperands.word = imageOperands.word | signExtensionMask();
if (sampler.ms) { if (sampler.ms) {
spv::IdImmediate imageOperands = { false, spv::ImageOperandsSampleMask }; imageOperands.word = imageOperands.word | spv::ImageOperandsSampleMask;
}
if (imageOperands.word != spv::ImageOperandsMaskNone) {
operands.push_back(imageOperands); operands.push_back(imageOperands);
if (sampler.ms) {
spv::IdImmediate imageOperand = { true, *(opIt++) }; spv::IdImmediate imageOperand = { true, *(opIt++) };
operands.push_back(imageOperand); operands.push_back(imageOperand);
} }
}
spv::Id result = builder.createOp(spv::OpImageRead, resultType(), operands); spv::Id result = builder.createOp(spv::OpImageRead, resultType(), operands);
builder.setPrecision(result, precision); builder.setPrecision(result, precision);
return result; return result;
...@@ -4300,7 +4317,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ...@@ -4300,7 +4317,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
#endif #endif
mask = mask | TranslateImageOperands(TranslateCoherent(imageType)); mask = mask | TranslateImageOperands(TranslateCoherent(imageType));
mask = (spv::ImageOperandsMask)(mask & ~spv::ImageOperandsMakeTexelAvailableKHRMask); mask = (spv::ImageOperandsMask)(mask & ~spv::ImageOperandsMakeTexelAvailableKHRMask);
if (mask) { mask = mask | signExtensionMask();
if (mask != spv::MemoryAccessMaskNone) {
spv::IdImmediate imageOperands = { false, (unsigned int)mask }; spv::IdImmediate imageOperands = { false, (unsigned int)mask };
operands.push_back(imageOperands); operands.push_back(imageOperands);
} }
...@@ -4315,7 +4333,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ...@@ -4315,7 +4333,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
} }
#endif #endif
if (mask & spv::ImageOperandsMakeTexelVisibleKHRMask) { if (mask & spv::ImageOperandsMakeTexelVisibleKHRMask) {
spv::IdImmediate imageOperand = { true, builder.makeUintConstant(TranslateMemoryScope(TranslateCoherent(imageType))) }; spv::IdImmediate imageOperand = { true,
builder.makeUintConstant(TranslateMemoryScope(TranslateCoherent(imageType))) };
operands.push_back(imageOperand); operands.push_back(imageOperand);
} }
...@@ -4362,7 +4381,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ...@@ -4362,7 +4381,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
#endif #endif
mask = mask | TranslateImageOperands(TranslateCoherent(imageType)); mask = mask | TranslateImageOperands(TranslateCoherent(imageType));
mask = (spv::ImageOperandsMask)(mask & ~spv::ImageOperandsMakeTexelVisibleKHRMask); mask = (spv::ImageOperandsMask)(mask & ~spv::ImageOperandsMakeTexelVisibleKHRMask);
if (mask) { mask = mask | signExtensionMask();
if (mask != spv::MemoryAccessMaskNone) {
spv::IdImmediate imageOperands = { false, (unsigned int)mask }; spv::IdImmediate imageOperands = { false, (unsigned int)mask };
operands.push_back(imageOperands); operands.push_back(imageOperands);
} }
...@@ -4377,7 +4397,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ...@@ -4377,7 +4397,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
} }
#endif #endif
if (mask & spv::ImageOperandsMakeTexelAvailableKHRMask) { if (mask & spv::ImageOperandsMakeTexelAvailableKHRMask) {
spv::IdImmediate imageOperand = { true, builder.makeUintConstant(TranslateMemoryScope(TranslateCoherent(imageType))) }; spv::IdImmediate imageOperand = { true,
builder.makeUintConstant(TranslateMemoryScope(TranslateCoherent(imageType))) };
operands.push_back(imageOperand); operands.push_back(imageOperand);
} }
...@@ -4386,7 +4407,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ...@@ -4386,7 +4407,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
builder.addCapability(spv::CapabilityStorageImageWriteWithoutFormat); builder.addCapability(spv::CapabilityStorageImageWriteWithoutFormat);
return spv::NoResult; return spv::NoResult;
#ifdef AMD_EXTENSIONS #ifdef AMD_EXTENSIONS
} else if (node->getOp() == glslang::EOpSparseImageLoad || node->getOp() == glslang::EOpSparseImageLoadLod) { } else if (node->getOp() == glslang::EOpSparseImageLoad ||
node->getOp() == glslang::EOpSparseImageLoadLod) {
#else #else
} else if (node->getOp() == glslang::EOpSparseImageLoad) { } else if (node->getOp() == glslang::EOpSparseImageLoad) {
#endif #endif
...@@ -4408,7 +4430,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ...@@ -4408,7 +4430,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
#endif #endif
mask = mask | TranslateImageOperands(TranslateCoherent(imageType)); mask = mask | TranslateImageOperands(TranslateCoherent(imageType));
mask = (spv::ImageOperandsMask)(mask & ~spv::ImageOperandsMakeTexelAvailableKHRMask); mask = (spv::ImageOperandsMask)(mask & ~spv::ImageOperandsMakeTexelAvailableKHRMask);
if (mask) { mask = mask | signExtensionMask();
if (mask != spv::MemoryAccessMaskNone) {
spv::IdImmediate imageOperands = { false, (unsigned int)mask }; spv::IdImmediate imageOperands = { false, (unsigned int)mask };
operands.push_back(imageOperands); operands.push_back(imageOperands);
} }
...@@ -4710,7 +4733,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ...@@ -4710,7 +4733,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
spv::Id resType = builder.makeStructType(members, "ResType"); spv::Id resType = builder.makeStructType(members, "ResType");
//call ImageFootprintNV //call ImageFootprintNV
spv::Id res = builder.createTextureCall(precision, resType, sparse, cracked.fetch, cracked.proj, cracked.gather, noImplicitLod, params); spv::Id res = builder.createTextureCall(precision, resType, sparse, cracked.fetch, cracked.proj,
cracked.gather, noImplicitLod, params, signExtensionMask());
//copy resType (SPIR-V type) to resultStructType(OpenGL type) //copy resType (SPIR-V type) to resultStructType(OpenGL type)
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
...@@ -4763,7 +4787,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ...@@ -4763,7 +4787,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
} }
std::vector<spv::Id> result( 1, std::vector<spv::Id> result( 1,
builder.createTextureCall(precision, resultType(), sparse, cracked.fetch, cracked.proj, cracked.gather, noImplicitLod, params) builder.createTextureCall(precision, resultType(), sparse, cracked.fetch, cracked.proj, cracked.gather,
noImplicitLod, params, signExtensionMask())
); );
if (components != node->getType().getVectorSize()) if (components != node->getType().getVectorSize())
......
...@@ -1808,7 +1808,7 @@ Id Builder::createBuiltinCall(Id resultType, Id builtins, int entryPoint, const ...@@ -1808,7 +1808,7 @@ Id Builder::createBuiltinCall(Id resultType, Id builtins, int entryPoint, const
// Accept all parameters needed to create a texture instruction. // Accept all parameters needed to create a texture instruction.
// Create the correct instruction based on the inputs, and make the call. // Create the correct instruction based on the inputs, and make the call.
Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, bool fetch, bool proj, bool gather, Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, bool fetch, bool proj, bool gather,
bool noImplicitLod, const TextureParameters& parameters) bool noImplicitLod, const TextureParameters& parameters, ImageOperandsMask signExtensionMask)
{ {
static const int maxTextureArgs = 10; static const int maxTextureArgs = 10;
Id texArgs[maxTextureArgs] = {}; Id texArgs[maxTextureArgs] = {};
...@@ -1889,6 +1889,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, ...@@ -1889,6 +1889,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
if (parameters.volatil) { if (parameters.volatil) {
mask = mask | ImageOperandsVolatileTexelKHRMask; mask = mask | ImageOperandsVolatileTexelKHRMask;
} }
mask = mask | signExtensionMask;
if (mask == ImageOperandsMaskNone) if (mask == ImageOperandsMaskNone)
--numArgs; // undo speculative reservation for the mask argument --numArgs; // undo speculative reservation for the mask argument
else else
......
...@@ -416,7 +416,8 @@ public: ...@@ -416,7 +416,8 @@ public:
}; };
// Select the correct texture operation based on all inputs, and emit the correct instruction // Select the correct texture operation based on all inputs, and emit the correct instruction
Id createTextureCall(Decoration precision, Id resultType, bool sparse, bool fetch, bool proj, bool gather, bool noImplicit, const TextureParameters&); Id createTextureCall(Decoration precision, Id resultType, bool sparse, bool fetch, bool proj, bool gather,
bool noImplicit, const TextureParameters&, ImageOperandsMask);
// Emit the OpTextureQuery* instruction that was passed in. // Emit the OpTextureQuery* instruction that was passed in.
// Figure out the right return value and type, and return it. // Figure out the right return value and type, and return it.
......
...@@ -575,7 +575,7 @@ const char* ImageChannelDataTypeString(int type) ...@@ -575,7 +575,7 @@ const char* ImageChannelDataTypeString(int type)
} }
} }
const int ImageOperandsCeiling = 12; const int ImageOperandsCeiling = 14;
const char* ImageOperandsString(int format) const char* ImageOperandsString(int format)
{ {
...@@ -592,6 +592,8 @@ const char* ImageOperandsString(int format) ...@@ -592,6 +592,8 @@ const char* ImageOperandsString(int format)
case ImageOperandsMakeTexelVisibleKHRShift: return "MakeTexelVisibleKHR"; case ImageOperandsMakeTexelVisibleKHRShift: return "MakeTexelVisibleKHR";
case ImageOperandsNonPrivateTexelKHRShift: return "NonPrivateTexelKHR"; case ImageOperandsNonPrivateTexelKHRShift: return "NonPrivateTexelKHR";
case ImageOperandsVolatileTexelKHRShift: return "VolatileTexelKHR"; case ImageOperandsVolatileTexelKHRShift: return "VolatileTexelKHR";
case ImageOperandsSignExtendShift: return "SignExtend";
case ImageOperandsZeroExtendShift: return "ZeroExtend";
case ImageOperandsCeiling: case ImageOperandsCeiling:
default: default:
......
spv.1.4.image.frag
Validation failed
// Module Version 10400
// Generated by (magic number): 80007
// Id's are bound by 104
Capability Shader
Capability StorageImageMultisample
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 26 30 40 52 64 77 89 100 103
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
Name 4 "main"
Name 9 "v"
Name 15 "iv"
Name 21 "uv"
Name 26 "i2D"
Name 30 "ic2D"
Name 40 "ii2D"
Name 52 "ui2D"
Name 64 "i2DMS"
Name 77 "ii2DMS"
Name 89 "ui2DMS"
Name 100 "fragData"
Name 103 "value"
Decorate 26(i2D) DescriptorSet 0
Decorate 26(i2D) Binding 1
Decorate 30(ic2D) Flat
Decorate 40(ii2D) DescriptorSet 0
Decorate 40(ii2D) Binding 12
Decorate 52(ui2D) DescriptorSet 0
Decorate 52(ui2D) Binding 12
Decorate 64(i2DMS) DescriptorSet 0
Decorate 64(i2DMS) Binding 9
Decorate 77(ii2DMS) DescriptorSet 0
Decorate 77(ii2DMS) Binding 13
Decorate 89(ui2DMS) DescriptorSet 0
Decorate 89(ui2DMS) Binding 13
Decorate 103(value) Flat
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Function 7(fvec4)
10: 6(float) Constant 0
11: 7(fvec4) ConstantComposite 10 10 10 10
12: TypeInt 32 1
13: TypeVector 12(int) 4
14: TypePointer Function 13(ivec4)
16: 12(int) Constant 0
17: 13(ivec4) ConstantComposite 16 16 16 16
18: TypeInt 32 0
19: TypeVector 18(int) 4
20: TypePointer Function 19(ivec4)
22: 18(int) Constant 0
23: 19(ivec4) ConstantComposite 22 22 22 22
24: TypeImage 6(float) 2D nonsampled format:Rgba32f
25: TypePointer UniformConstant 24
26(i2D): 25(ptr) Variable UniformConstant
28: TypeVector 12(int) 2
29: TypePointer Input 28(ivec2)
30(ic2D): 29(ptr) Variable Input
38: TypeImage 12(int) 2D nonsampled format:R32i
39: TypePointer UniformConstant 38
40(ii2D): 39(ptr) Variable UniformConstant
50: TypeImage 18(int) 2D nonsampled format:R32ui
51: TypePointer UniformConstant 50
52(ui2D): 51(ptr) Variable UniformConstant
62: TypeImage 6(float) 2D multi-sampled nonsampled format:Rgba32f
63: TypePointer UniformConstant 62
64(i2DMS): 63(ptr) Variable UniformConstant
67: 12(int) Constant 1
73: 12(int) Constant 2
75: TypeImage 12(int) 2D multi-sampled nonsampled format:R32i
76: TypePointer UniformConstant 75
77(ii2DMS): 76(ptr) Variable UniformConstant
87: TypeImage 18(int) 2D multi-sampled nonsampled format:R32ui
88: TypePointer UniformConstant 87
89(ui2DMS): 88(ptr) Variable UniformConstant
99: TypePointer Output 7(fvec4)
100(fragData): 99(ptr) Variable Output
102: TypePointer Input 18(int)
103(value): 102(ptr) Variable Input
4(main): 2 Function None 3
5: Label
9(v): 8(ptr) Variable Function
15(iv): 14(ptr) Variable Function
21(uv): 20(ptr) Variable Function
Store 9(v) 11
Store 15(iv) 17
Store 21(uv) 23
27: 24 Load 26(i2D)
31: 28(ivec2) Load 30(ic2D)
32: 7(fvec4) ImageRead 27 31
33: 7(fvec4) Load 9(v)
34: 7(fvec4) FAdd 33 32
Store 9(v) 34
35: 24 Load 26(i2D)
36: 28(ivec2) Load 30(ic2D)
37: 7(fvec4) Load 9(v)
ImageWrite 35 36 37
41: 38 Load 40(ii2D)
42: 28(ivec2) Load 30(ic2D)
43: 13(ivec4) ImageRead 41 42 SignExtend
44: 7(fvec4) ConvertSToF 43
45: 7(fvec4) Load 9(v)
46: 7(fvec4) FAdd 45 44
Store 9(v) 46
47: 38 Load 40(ii2D)
48: 28(ivec2) Load 30(ic2D)
49: 13(ivec4) Load 15(iv)
ImageWrite 47 48 49 SignExtend
53: 50 Load 52(ui2D)
54: 28(ivec2) Load 30(ic2D)
55: 19(ivec4) ImageRead 53 54 ZeroExtend
56: 7(fvec4) ConvertUToF 55
57: 7(fvec4) Load 9(v)
58: 7(fvec4) FAdd 57 56
Store 9(v) 58
59: 50 Load 52(ui2D)
60: 28(ivec2) Load 30(ic2D)
61: 19(ivec4) Load 21(uv)
ImageWrite 59 60 61 ZeroExtend
65: 62 Load 64(i2DMS)
66: 28(ivec2) Load 30(ic2D)
68: 7(fvec4) ImageRead 65 66 Sample 67
69: 7(fvec4) Load 9(v)
70: 7(fvec4) FAdd 69 68
Store 9(v) 70
71: 62 Load 64(i2DMS)
72: 28(ivec2) Load 30(ic2D)
74: 7(fvec4) Load 9(v)
ImageWrite 71 72 74 Sample 73
78: 75 Load 77(ii2DMS)
79: 28(ivec2) Load 30(ic2D)
80: 13(ivec4) ImageRead 78 79 Sample SignExtend 67
81: 7(fvec4) ConvertSToF 80
82: 7(fvec4) Load 9(v)
83: 7(fvec4) FAdd 82 81
Store 9(v) 83
84: 75 Load 77(ii2DMS)
85: 28(ivec2) Load 30(ic2D)
86: 13(ivec4) Load 15(iv)
ImageWrite 84 85 86 Sample SignExtend 73
90: 87 Load 89(ui2DMS)
91: 28(ivec2) Load 30(ic2D)
92: 19(ivec4) ImageRead 90 91 Sample ZeroExtend 67
93: 7(fvec4) ConvertUToF 92
94: 7(fvec4) Load 9(v)
95: 7(fvec4) FAdd 94 93
Store 9(v) 95
96: 87 Load 89(ui2DMS)
97: 28(ivec2) Load 30(ic2D)
98: 19(ivec4) Load 21(uv)
ImageWrite 96 97 98 Sample ZeroExtend 73
101: 7(fvec4) Load 9(v)
Store 100(fragData) 101
Return
FunctionEnd
spv.1.4.texture.frag
Validation failed
// Module Version 10400
// Generated by (magic number): 80007
// Id's are bound by 79
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 15 19 28 40 51 54 76 78
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
Name 4 "main"
Name 9 "color"
Name 15 "texSampler2D"
Name 19 "coords2D"
Name 28 "itexSampler2D"
Name 40 "utexSampler2D"
Name 51 "iCoords2D"
Name 54 "iLod"
Name 76 "t"
Name 78 "color"
Decorate 15(texSampler2D) DescriptorSet 0
Decorate 15(texSampler2D) Binding 0
Decorate 28(itexSampler2D) DescriptorSet 0
Decorate 28(itexSampler2D) Binding 0
Decorate 40(utexSampler2D) DescriptorSet 0
Decorate 40(utexSampler2D) Binding 0
Decorate 51(iCoords2D) Flat
Decorate 54(iLod) Flat
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Function 7(fvec4)
10: 6(float) Constant 0
11: 7(fvec4) ConstantComposite 10 10 10 10
12: TypeImage 6(float) 2D sampled format:Unknown
13: TypeSampledImage 12
14: TypePointer UniformConstant 13
15(texSampler2D): 14(ptr) Variable UniformConstant
17: TypeVector 6(float) 2
18: TypePointer Input 17(fvec2)
19(coords2D): 18(ptr) Variable Input
24: TypeInt 32 1
25: TypeImage 24(int) 2D sampled format:Unknown
26: TypeSampledImage 25
27: TypePointer UniformConstant 26
28(itexSampler2D): 27(ptr) Variable UniformConstant
31: TypeVector 24(int) 4
36: TypeInt 32 0
37: TypeImage 36(int) 2D sampled format:Unknown
38: TypeSampledImage 37
39: TypePointer UniformConstant 38
40(utexSampler2D): 39(ptr) Variable UniformConstant
43: TypeVector 36(int) 4
49: TypeVector 24(int) 2
50: TypePointer Input 49(ivec2)
51(iCoords2D): 50(ptr) Variable Input
53: TypePointer Input 24(int)
54(iLod): 53(ptr) Variable Input
76(t): 18(ptr) Variable Input
77: TypePointer Output 7(fvec4)
78(color): 77(ptr) Variable Output
4(main): 2 Function None 3
5: Label
9(color): 8(ptr) Variable Function
Store 9(color) 11
16: 13 Load 15(texSampler2D)
20: 17(fvec2) Load 19(coords2D)
21: 7(fvec4) ImageSampleImplicitLod 16 20
22: 7(fvec4) Load 9(color)
23: 7(fvec4) FAdd 22 21
Store 9(color) 23
29: 26 Load 28(itexSampler2D)
30: 17(fvec2) Load 19(coords2D)
32: 31(ivec4) ImageSampleImplicitLod 29 30 SignExtend
33: 7(fvec4) ConvertSToF 32
34: 7(fvec4) Load 9(color)
35: 7(fvec4) FAdd 34 33
Store 9(color) 35
41: 38 Load 40(utexSampler2D)
42: 17(fvec2) Load 19(coords2D)
44: 43(ivec4) ImageSampleImplicitLod 41 42 ZeroExtend
45: 7(fvec4) ConvertUToF 44
46: 7(fvec4) Load 9(color)
47: 7(fvec4) FAdd 46 45
Store 9(color) 47
48: 13 Load 15(texSampler2D)
52: 49(ivec2) Load 51(iCoords2D)
55: 24(int) Load 54(iLod)
56: 12 Image 48
57: 7(fvec4) ImageFetch 56 52 Lod 55
58: 7(fvec4) Load 9(color)
59: 7(fvec4) FAdd 58 57
Store 9(color) 59
60: 26 Load 28(itexSampler2D)
61: 49(ivec2) Load 51(iCoords2D)
62: 24(int) Load 54(iLod)
63: 25 Image 60
64: 31(ivec4) ImageFetch 63 61 Lod SignExtend 62
65: 7(fvec4) ConvertSToF 64
66: 7(fvec4) Load 9(color)
67: 7(fvec4) FAdd 66 65
Store 9(color) 67
68: 38 Load 40(utexSampler2D)
69: 49(ivec2) Load 51(iCoords2D)
70: 24(int) Load 54(iLod)
71: 37 Image 68
72: 43(ivec4) ImageFetch 71 69 Lod ZeroExtend 70
73: 7(fvec4) ConvertUToF 72
74: 7(fvec4) Load 9(color)
75: 7(fvec4) FAdd 74 73
Store 9(color) 75
Return
FunctionEnd
#version 450
layout(rgba32f, binding = 1) uniform image2D i2D;
layout(r32i, binding = 12) uniform iimage2D ii2D;
layout(r32ui, binding = 12) uniform uimage2D ui2D;
layout(rgba32f, binding = 9) uniform image2DMS i2DMS;
layout(r32i, binding = 13) uniform iimage2DMS ii2DMS;
layout(r32ui, binding = 13) uniform uimage2DMS ui2DMS;
flat in ivec2 ic2D;
flat in uint value;
out vec4 fragData;
void main()
{
vec4 v = vec4(0.0);
ivec4 iv = ivec4(0.0);
uvec4 uv = uvec4(0.0);
v += imageLoad(i2D, ic2D);
imageStore(i2D, ic2D, v);
v += imageLoad(ii2D, ic2D);
imageStore(ii2D, ic2D, iv);
v += imageLoad(ui2D, ic2D);
imageStore(ui2D, ic2D, uv);
v += imageLoad(i2DMS, ic2D, 1);
imageStore(i2DMS, ic2D, 2, v);
v += imageLoad(ii2DMS, ic2D, 1);
imageStore(ii2DMS, ic2D, 2, iv);
v += imageLoad(ui2DMS, ic2D, 1);
imageStore(ui2DMS, ic2D, 2, uv);
fragData = v;
}
#version 450
#extension GL_ARB_sparse_texture2: enable
uniform sampler2D s2D;
uniform isampler2D is2D;
uniform usampler2D us2D;
layout(rgba32f) uniform image2D i2D;
layout(rgba32i) uniform iimage2DMS ii2DMS;
layout(rgba32ui) uniform uimage3D ui3D;
in vec2 c2;
in vec3 c3;
in vec4 c4;
in flat ivec2 ic2;
in flat ivec3 ic3;
in flat 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(is2D, c2, texel);
resident |= sparseTextureARB(us2D, c2, texel);
resident |= sparseTextureLodARB( s2D, c2, 2.0, texel);
resident |= sparseTextureLodARB(is2D, c2, 2.0, texel);
resident |= sparseTextureLodARB(us2D, c2, 2.0, texel);
resident |= sparseTexelFetchARB( s2D, ivec2(c2), 2, texel);
resident |= sparseTexelFetchARB(is2D, ivec2(c2), 2, texel);
resident |= sparseTexelFetchARB(us2D, ivec2(c2), 2, texel);
resident |= sparseImageLoadARB(i2D, ic2, texel);
resident |= sparseImageLoadARB(ii2DMS, ic2, 3, texel);
resident |= sparseImageLoadARB(ui3D, ic3, utexel);
outColor = sparseTexelsResidentARB(resident) ? texel : vec4(itexel) + vec4(utexel);
}
\ No newline at end of file
#version 450
uniform sampler2D texSampler2D;
uniform isampler2D itexSampler2D;
uniform usampler2D utexSampler2D;
in vec2 t;
in vec2 coords2D;
flat in ivec2 iCoords2D;
out vec4 color;
flat in int iLod;
void main()
{
vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
color += texture( texSampler2D, coords2D);
color += texture(itexSampler2D, coords2D);
color += texture(utexSampler2D, coords2D);
color += texelFetch( texSampler2D, iCoords2D, iLod);
color += texelFetch(itexSampler2D, iCoords2D, iLod);
color += texelFetch(utexSampler2D, iCoords2D, iLod);
}
\ No newline at end of file
...@@ -472,6 +472,9 @@ INSTANTIATE_TEST_CASE_P( ...@@ -472,6 +472,9 @@ INSTANTIATE_TEST_CASE_P(
"spv.1.4.OpCopyLogical.comp", "spv.1.4.OpCopyLogical.comp",
"spv.1.4.OpCopyLogicalBool.comp", "spv.1.4.OpCopyLogicalBool.comp",
"spv.1.4.OpCopyLogical.funcall.frag", "spv.1.4.OpCopyLogical.funcall.frag",
"spv.1.4.image.frag",
"spv.1.4.sparseTexture.frag",
"spv.1.4.texture.frag",
})), })),
FileNameAsCustomTestSuffix FileNameAsCustomTestSuffix
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment