зеркало из https://github.com/AvaloniaUI/angle.git
ES31: Support translating textureGatherOffset into HLSL
This patch implements the translation from GLSL texture function textureGatherOffset into HLSL by using the optional "offset" parameter of Texture2D.Gather[Red|Green|Blue|Alpha]. This patch also defines the implementation-dependent limit MIN_PROGRAM_TEXTURE_GATHER_OFFSET and MAX_PROGRAM_TEXTURE_GATHER_OFFSET on D3D11. According to MSDN, the valid range of "offset" used in Gather should be [-32, 31]. https://docs.microsoft.com/en-us/windows/desktop/direct3dhlsl/gather4-po--sm5---asm- This patch also refactors OutputTextureGatherFunctionBody() so that some redundant code can be removed. BUG=angleproject:2826 TEST=dEQP-GLES31.functional.texture.gather.offset.min_required_offset.2d.rgba8.* dEQP-GLES31.functional.texture.gather.offset.min_required_offset.2d_array.rgba8.* dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d.rgba8.* dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d_array.rgba8.* (without texture_swizzle) Change-Id: Id0f411257b64c8a97428f16b1a86950ec6d36e2f Reviewed-on: https://chromium-review.googlesource.com/1237303 Reviewed-by: Jiajia Qin <jiajia.qin@intel.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
Родитель
219ef05b22
Коммит
cf8ad76095
|
@ -850,25 +850,24 @@ void OutputTextureGatherFunctionBody(TInfoSinkBase &out,
|
|||
|
||||
ImmutableString samplerCoordString(samplerCoordBuilder);
|
||||
|
||||
constexpr std::array<const char *, 4> kHLSLGatherFunctions = {
|
||||
{"GatherRed", "GatherGreen", "GatherBlue", "GatherAlpha"}};
|
||||
|
||||
out << " switch(comp)\n"
|
||||
" {\n"
|
||||
" case 0:\n"
|
||||
" return "
|
||||
<< textureReference << ".GatherRed(" << samplerReference << ", " << samplerCoordString
|
||||
<< ");\n"
|
||||
" case 1:\n"
|
||||
" return "
|
||||
<< textureReference << ".GatherGreen(" << samplerReference << ", " << samplerCoordString
|
||||
<< ");\n"
|
||||
" case 2:\n"
|
||||
" return "
|
||||
<< textureReference << ".GatherBlue(" << samplerReference << ", " << samplerCoordString
|
||||
<< ");\n"
|
||||
" case 3:\n"
|
||||
" return "
|
||||
<< textureReference << ".GatherAlpha(" << samplerReference << ", " << samplerCoordString
|
||||
<< ");\n"
|
||||
" default:\n"
|
||||
" {\n";
|
||||
for (size_t component = 0; component < kHLSLGatherFunctions.size(); ++component)
|
||||
{
|
||||
out << " case " << component << ":\n"
|
||||
<< " return " << textureReference << "." << kHLSLGatherFunctions[component]
|
||||
<< "(" << samplerReference << ", " << samplerCoordString;
|
||||
if (textureFunction.offset)
|
||||
{
|
||||
out << ", offset";
|
||||
}
|
||||
out << ");\n";
|
||||
}
|
||||
|
||||
out << " default:\n"
|
||||
" return float4(0.0, 0.0, 0.0, 1.0);\n"
|
||||
" }\n";
|
||||
}
|
||||
|
@ -1320,6 +1319,11 @@ ImmutableString TextureFunctionHLSL::useTextureFunction(const ImmutableString &n
|
|||
{
|
||||
textureFunction.method = TextureFunction::GATHER;
|
||||
}
|
||||
else if (name == "textureGatherOffset")
|
||||
{
|
||||
textureFunction.method = TextureFunction::GATHER;
|
||||
textureFunction.offset = true;
|
||||
}
|
||||
else
|
||||
UNREACHABLE();
|
||||
|
||||
|
|
|
@ -1049,6 +1049,50 @@ int GetMaximumTexelOffset(D3D_FEATURE_LEVEL featureLevel)
|
|||
}
|
||||
}
|
||||
|
||||
int GetMinimumTextureGatherOffset(D3D_FEATURE_LEVEL featureLevel)
|
||||
{
|
||||
switch (featureLevel)
|
||||
{
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/direct3dhlsl/gather4-po--sm5---asm-
|
||||
case D3D_FEATURE_LEVEL_11_1:
|
||||
case D3D_FEATURE_LEVEL_11_0:
|
||||
return -32;
|
||||
|
||||
case D3D_FEATURE_LEVEL_10_1:
|
||||
case D3D_FEATURE_LEVEL_10_0:
|
||||
case D3D_FEATURE_LEVEL_9_3:
|
||||
case D3D_FEATURE_LEVEL_9_2:
|
||||
case D3D_FEATURE_LEVEL_9_1:
|
||||
return 0;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int GetMaximumTextureGatherOffset(D3D_FEATURE_LEVEL featureLevel)
|
||||
{
|
||||
switch (featureLevel)
|
||||
{
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/direct3dhlsl/gather4-po--sm5---asm-
|
||||
case D3D_FEATURE_LEVEL_11_1:
|
||||
case D3D_FEATURE_LEVEL_11_0:
|
||||
return 31;
|
||||
|
||||
case D3D_FEATURE_LEVEL_10_1:
|
||||
case D3D_FEATURE_LEVEL_10_0:
|
||||
case D3D_FEATURE_LEVEL_9_3:
|
||||
case D3D_FEATURE_LEVEL_9_2:
|
||||
case D3D_FEATURE_LEVEL_9_1:
|
||||
return 0;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
size_t GetMaximumConstantBufferSize(D3D_FEATURE_LEVEL featureLevel)
|
||||
{
|
||||
// Returns a size_t despite the limit being a GLuint64 because size_t is the maximum
|
||||
|
@ -1506,6 +1550,10 @@ void GenerateCaps(ID3D11Device *device,
|
|||
static_cast<GLuint>(GetMaximumRenderToBufferWindowSize(featureLevel));
|
||||
caps->maxFramebufferHeight = caps->maxFramebufferWidth;
|
||||
|
||||
// Texture gather offset limits
|
||||
caps->minProgramTextureGatherOffset = GetMinimumTextureGatherOffset(featureLevel);
|
||||
caps->maxProgramTextureGatherOffset = GetMaximumTextureGatherOffset(featureLevel);
|
||||
|
||||
// GL extension support
|
||||
extensions->setTextureExtensionSupport(*textureCapsMap);
|
||||
extensions->elementIndexUint = true;
|
||||
|
|
|
@ -1578,7 +1578,19 @@
|
|||
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.* = 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
|
||||
|
|
Загрузка…
Ссылка в новой задаче