Commit 19b51d29 by Jiawei Shao Committed by Commit Bot

ES31: Support textureGather[Offset] on shadow samplers

This patch implements translating textureGather[Offset] into HLSL when the sampler is a shadow sampler. The related HLSL function should be GatherCmp(). According to the definition of textureGatherOffset(): ([ESSL 3.1] Chapter 8.9.3 Page 138) - gvec4 textureGatherOffset(gsampler2D sampler, vec2 P, ivec2 offset, [,int comp]) - vec4 textureGatherOffset(sampler2DShadow sampler, vec2 P, float refZ, ivec2 offset) We need to add parameter "refZ" before "offset" when the sampler is a shadow sampler. Bug: angleproject:2826 Test: dEQP-GLES31.functional.texture.gather.basic.2d.depth32f.* dEQP-GLES31.functional.texture.gather.basic.2d_array.depth32f.* dEQP-GLES31.functional.texture.gather.basic.cube.depth32f.* dEQP-GLES31.functional.texture.gather.offset.min_required_offset.2d.depth32f.* dEQP-GLES31.functional.texture.gather.offset.min_required_offset.2d_array.depth32f.* dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d.depth32f.* dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d_array.depth32f.* Change-Id: I9a7d095dd3cfa41aaefd14d012ed1f309abfc6d5 Reviewed-on: https://chromium-review.googlesource.com/c/1244081 Commit-Queue: Jiawei Shao <jiawei.shao@intel.com> Reviewed-by: 's avatarJiajia Qin <jiajia.qin@intel.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 450bf36f
......@@ -387,6 +387,12 @@ void OutputTextureFunctionArgumentList(TInfoSinkBase &out,
UNREACHABLE();
}
if (textureFunction.method == TextureFunctionHLSL::TextureFunction::GATHER &&
IsShadowSampler(textureFunction.sampler))
{
out << ", float refZ";
}
if (textureFunction.offset)
{
switch (textureFunction.sampler)
......@@ -418,7 +424,8 @@ void OutputTextureFunctionArgumentList(TInfoSinkBase &out,
{
out << ", float bias";
}
else if (textureFunction.method == TextureFunctionHLSL::TextureFunction::GATHER)
else if (textureFunction.method == TextureFunctionHLSL::TextureFunction::GATHER &&
!IsShadowSampler(textureFunction.sampler))
{
out << ", int comp = 0";
}
......@@ -850,6 +857,18 @@ void OutputTextureGatherFunctionBody(TInfoSinkBase &out,
ImmutableString samplerCoordString(samplerCoordBuilder);
if (IsShadowSampler(textureFunction.sampler))
{
out << "return " << textureReference << ".GatherCmp(" << samplerReference << ", "
<< samplerCoordString << ", refZ";
if (textureFunction.offset)
{
out << ", offset";
}
out << ");\n";
return;
}
constexpr std::array<const char *, 4> kHLSLGatherFunctions = {
{"GatherRed", "GatherGreen", "GatherBlue", "GatherAlpha"}};
......@@ -1211,7 +1230,14 @@ const char *TextureFunctionHLSL::TextureFunction::getReturnType() const
case EbtSampler2DShadow:
case EbtSamplerCubeShadow:
case EbtSampler2DArrayShadow:
return "float";
if (method == TextureFunctionHLSL::TextureFunction::GATHER)
{
return "float4";
}
else
{
return "float";
}
default:
UNREACHABLE();
}
......
......@@ -1567,30 +1567,23 @@
1941 D3D11 : dEQP-GLES31.functional.debug.negative_coverage.callbacks.shader_directive.geometry_shader = FAIL
1941 D3D11 : dEQP-GLES31.functional.debug.negative_coverage.log.shader_directive.geometry_shader = FAIL
1941 D3D11 : dEQP-GLES31.functional.debug.negative_coverage.get_error.shader_directive.geometry_shader = FAIL
2826 D3D11 : dEQP-GLES31.functional.texture.gather.basic.2d.depth32f.* = FAIL
2826 D3D11 : dEQP-GLES31.functional.texture.gather.basic.2d.rgba8i.* = FAIL
2826 D3D11 : dEQP-GLES31.functional.texture.gather.basic.2d.rgba8ui.* = FAIL
2826 D3D11 : dEQP-GLES31.functional.texture.gather.basic.2d_array.depth32f.* = FAIL
2826 D3D11 : dEQP-GLES31.functional.texture.gather.basic.2d_array.rgba8.texture_swizzle.* = FAIL
2826 D3D11 : dEQP-GLES31.functional.texture.gather.basic.2d_array.rgba8i.* = FAIL
2826 D3D11 : dEQP-GLES31.functional.texture.gather.basic.2d_array.rgba8ui.* = FAIL
2826 D3D11 : dEQP-GLES31.functional.texture.gather.basic.cube.depth32f.* = FAIL
2826 D3D11 : dEQP-GLES31.functional.texture.gather.basic.cube.rgba8.texture_swizzle.* = FAIL
2826 D3D11 : dEQP-GLES31.functional.texture.gather.basic.cube.rgba8i.* = FAIL
2826 D3D11 : dEQP-GLES31.functional.texture.gather.basic.cube.rgba8ui.* = FAIL
2826 D3D11 : dEQP-GLES31.functional.texture.gather.offset.min_required_offset.2d.rgba8ui.* = FAIL
2826 D3D11 : dEQP-GLES31.functional.texture.gather.offset.min_required_offset.2d.rgba8i.* = FAIL
2826 D3D11 : dEQP-GLES31.functional.texture.gather.offset.min_required_offset.2d.depth32f.* = FAIL
2826 D3D11 : dEQP-GLES31.functional.texture.gather.offset.min_required_offset.2d_array.rgba8ui.* = FAIL
2826 D3D11 : dEQP-GLES31.functional.texture.gather.offset.min_required_offset.2d_array.rgba8i.* = FAIL
2826 D3D11 : dEQP-GLES31.functional.texture.gather.offset.min_required_offset.2d_array.depth32f.* = FAIL
2826 D3D11 : dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d.rgba8ui.* = FAIL
2826 D3D11 : dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d.rgba8i.* = FAIL
2826 D3D11 : dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d.depth32f.* = FAIL
2826 D3D11 : dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d_array.rgba8.texture_swizzle.* = FAIL
2826 D3D11 : dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d_array.rgba8ui.* = FAIL
2826 D3D11 : dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d_array.rgba8i.* = FAIL
2826 D3D11 : dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d_array.depth32f.* = FAIL
// Recetly added tests failing on D3D11 Windows.
2619 D3D11 : dEQP-GLES31.functional.shaders.builtin_functions.uniform.findLSBMinusOne.highp_compute = FAIL
......
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