SPV: Fix issue #320: Fetch needs to extract the image.

GLSL takes a traditional sampler, but SPIR-V wants just the
sampled image, not the combined sampler and image.
This commit is contained in:
John Kessenich
2016-06-02 23:45:21 -06:00
parent 98f2b3bfe0
commit a5c33d6ffb
4 changed files with 695 additions and 678 deletions

View File

@@ -2558,6 +2558,13 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
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);
}
// set the rest of the arguments
params.coords = arguments[1];