Commit f7d78f74 by Chris Forbes

Fix lod plumbing for Fetch

- Sampler lod bias and limits do not apply - Fetch samplerfunction has a lod parameter, pass it Bug: b/129523279 Test: dEQP-VK.glsl.texture_functions.* Change-Id: Ia06bb5ff181068b29cf3e88acd9a0272ad1a54c9 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/31748Tested-by: 's avatarChris Forbes <chrisforbes@google.com> Presubmit-Ready: Chris Forbes <chrisforbes@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent c0c6ccfd
......@@ -121,7 +121,7 @@ namespace sw
}
else UNREACHABLE("Sampler function %d", int(function));
if(function != Base)
if(function != Base && function != Fetch)
{
lod += *Pointer<Float>(sampler + OFFSET(vk::Sampler, mipLodBias));
lod = Max(lod, *Pointer<Float>(sampler + OFFSET(vk::Sampler, minLod)));
......
......@@ -4806,6 +4806,14 @@ namespace sw
in[i] = dyValue.Float(j);
}
}
else if (instruction.samplerMethod == Fetch)
{
// The instruction didn't provide a lod operand, but the sampler's Fetch
// function requires one to be present. If no lod is supplied, the default
// is zero.
in[i] = As<SIMD::Float>(SIMD::Int(0));
i++;
}
if(constOffset)
{
......
......@@ -527,7 +527,7 @@ namespace sw
// Parameters are passed to the sampling routine in this order:
uint32_t coordinates : 3; // 1-4 (does not contain projection component)
// uint32_t dref : 1; // Indicated by Variant::ProjDref|Dref
// uint32_t lodOrBias : 1; // Indicated by SamplerMethod::Lod|Bias
// uint32_t lodOrBias : 1; // Indicated by SamplerMethod::Lod|Bias|Fetch
uint32_t gradComponents : 2; // 0-3 (for each of dx / dy)
uint32_t offsetComponents : 2; // 0-3
};
......
......@@ -123,7 +123,7 @@ SpirvShader::ImageSampler *SpirvShader::emitSamplerFunction(ImageInstruction ins
uvw[2] = in[1]; // Move 1D layer coordinate to 2D layer coordinate index.
}
if(instruction.samplerMethod == Lod || instruction.samplerMethod == Bias)
if(instruction.samplerMethod == Lod || instruction.samplerMethod == Bias || instruction.samplerMethod == Fetch)
{
lodOrBias = in[i];
i++;
......
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