ES31: Support textureGather[Offset] on int/uint formats on D3D11
This patch implements the translation of textureGather[Offset] on
integer and unsigned integer format textures on D3D11.
According to MSDN, Gather[Red|Green|Blue|Alpha] can be used on integer
and unsigned integer format textures with float texture coordinates:
https://docs.microsoft.com/en-us/windows/desktop/direct3dhlsl/dx-graphics-hlsl-to-gather
Currently the dEQP tests on TextureGather[Offset] on cube map textures
in integer or unsigned formats still cannot pass. This issue is under
investigation.
Bug: angleproject:2826
Test: dEQP-GLES31.functional.texture.gather.basic.2d.*
dEQP-GLES31.functional.texture.gather.basic.2d_array.*
dEQP-GLES31.functional.texture.gather.offset.min_required_offset.2d.*
dEQP-GLES31.functional.texture.gather.offset.min_required_offset.2d_array.*
dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d.*
dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d_array.*
Change-Id: If049dc395fb17cd34dec902630e3a1154e5d4806
Reviewed-on: https://chromium-review.googlesource.com/c/1271926
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/compiler/translator/TextureFunctionHLSL.cpp b/src/compiler/translator/TextureFunctionHLSL.cpp
index ad28eea..edaf6fd 100644
--- a/src/compiler/translator/TextureFunctionHLSL.cpp
+++ b/src/compiler/translator/TextureFunctionHLSL.cpp
@@ -163,7 +163,11 @@
const TextureFunctionHLSL::TextureFunction &textureFunction,
int hlslCoords)
{
- if (IsIntegerSampler(textureFunction.sampler) ||
+ // Gather[Red|Green|Blue|Alpha] accepts float texture coordinates on textures in integer or
+ // unsigned integer formats.
+ // https://docs.microsoft.com/en-us/windows/desktop/direct3dhlsl/dx-graphics-hlsl-to-gather
+ if ((IsIntegerSampler(textureFunction.sampler) &&
+ textureFunction.method != TextureFunctionHLSL::TextureFunction::GATHER) ||
textureFunction.method == TextureFunctionHLSL::TextureFunction::FETCH)
{
switch (hlslCoords)