SPV: Add NonUniform decoration for OpImages created during lowering.
By directly creating the OpImage instructions we were not propagating the appropriate decorations. Since this had a lot of cases I centralized the OpImage creation a bit too.
This commit is contained in:
parent
de949a2afc
commit
58064311be
@ -4753,12 +4753,15 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
|
|||||||
|
|
||||||
const bool isUnsignedResult = node->getType().getBasicType() == glslang::EbtUint;
|
const bool isUnsignedResult = node->getType().getBasicType() == glslang::EbtUint;
|
||||||
|
|
||||||
|
if (builder.isSampledImage(params.sampler) &&
|
||||||
|
((cracked.query && node->getOp() != glslang::EOpTextureQueryLod) || cracked.fragMask || cracked.fetch)) {
|
||||||
|
params.sampler = builder.createUnaryOp(spv::OpImage, builder.getImageType(params.sampler), params.sampler);
|
||||||
|
if (imageType.getQualifier().isNonUniform()) {
|
||||||
|
builder.addDecoration(params.sampler, spv::DecorationNonUniformEXT);
|
||||||
|
}
|
||||||
|
}
|
||||||
// Check for queries
|
// Check for queries
|
||||||
if (cracked.query) {
|
if (cracked.query) {
|
||||||
// OpImageQueryLod works on a sampled image, for other queries the image has to be extracted first
|
|
||||||
if (node->getOp() != glslang::EOpTextureQueryLod && builder.isSampledImage(params.sampler))
|
|
||||||
params.sampler = builder.createUnaryOp(spv::OpImage, builder.getImageType(params.sampler), params.sampler);
|
|
||||||
|
|
||||||
switch (node->getOp()) {
|
switch (node->getOp()) {
|
||||||
case glslang::EOpImageQuerySize:
|
case glslang::EOpImageQuerySize:
|
||||||
case glslang::EOpTextureQuerySize:
|
case glslang::EOpTextureQuerySize:
|
||||||
@ -5012,10 +5015,6 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
|
|||||||
auto opIt = arguments.begin();
|
auto opIt = arguments.begin();
|
||||||
std::vector<spv::Id> operands;
|
std::vector<spv::Id> operands;
|
||||||
|
|
||||||
// Extract the image if necessary
|
|
||||||
if (builder.isSampledImage(params.sampler))
|
|
||||||
params.sampler = builder.createUnaryOp(spv::OpImage, builder.getImageType(params.sampler), params.sampler);
|
|
||||||
|
|
||||||
operands.push_back(params.sampler);
|
operands.push_back(params.sampler);
|
||||||
++opIt;
|
++opIt;
|
||||||
|
|
||||||
@ -5076,13 +5075,6 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
|
|||||||
bias = true;
|
bias = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// See if the sampler param should really be just the SPV image part
|
|
||||||
if (cracked.fetch) {
|
|
||||||
// a fetch needs to have the image extracted first
|
|
||||||
if (builder.isSampledImage(params.sampler))
|
|
||||||
params.sampler = builder.createUnaryOp(spv::OpImage, builder.getImageType(params.sampler), params.sampler);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef GLSLANG_WEB
|
#ifndef GLSLANG_WEB
|
||||||
if (cracked.gather) {
|
if (cracked.gather) {
|
||||||
const auto& sourceExtensions = glslangIntermediate->getRequestedExtensions();
|
const auto& sourceExtensions = glslangIntermediate->getRequestedExtensions();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user