aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXin Yuan <xin.yuan@arm.com>2024-01-02 16:59:49 +0800
committerLorenzo Dal Col <lorenzo@khronosgroup.org>2024-05-01 09:45:12 +0000
commit42619c66decc7aa62dc4c71497cf3ee393f36393 (patch)
tree3c1298a150be79d81716d039b945fbc7d77fe412
parent1e923c5c440ba3a2f761ba4eff2ddea6169d3f6d (diff)
downloaddeqp-42619c66decc7aa62dc4c71497cf3ee393f36393.tar.gz
Fix the precision loss issue in native d16
The reference pixel is generated by comparing a value that is the same as the depth read by the gpu with the value of depth of type float generated in test. However, the accuracy of UNORM values in memory does not match that of float values, especially d16, which varies greatly. In the case of some edge values, the values of the reference pixels may be different because the comparison results may be different due to the processing of precision. This commit introduces a temporary 1x1 dimensional texture2D image to store the same reference depth as the depth buffer format used by the GPU. In this way, we can make the depth comparison in test consistent with GPU hardware in both precision and format, thus avoiding the previous accuracy loss problem. Affected tests: dEQP-EGL.functional.image.create* dEQP-EGL.functional.image.render_multiple_contexts* dEQP-EGL.functional.image.modify* VK-GL-CTS issue: 4800 Components: EGL Change-Id: Ie6d51923a021bd21e0b15672b64f41f246c177b6 (cherry picked from commit 9d54df4c4baf27713195ec104b5c95dbd05d5c93)
-rw-r--r--modules/egl/teglImageFormatTests.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/egl/teglImageFormatTests.cpp b/modules/egl/teglImageFormatTests.cpp
index f1b249087..8bc5dc475 100644
--- a/modules/egl/teglImageFormatTests.cpp
+++ b/modules/egl/teglImageFormatTests.cpp
@@ -1218,6 +1218,8 @@ bool GLESImageApi::RenderDepthbuffer::invokeGLES (GLESImageApi& api, MovePtr<Uni
gl.readPixels(0, 0, screen.getWidth(), screen.getHeight(), GL_RGBA, GL_UNSIGNED_BYTE, screen.getAccess().getDataPtr());
+ tcu::Texture2D tmpDepth(refAccess.getFormat(), 1, 1);
+ tmpDepth.allocLevel(0);
for (int y = 0; y < reference.getHeight(); y++)
{
for (int x = 0; x < reference.getWidth(); x++)
@@ -1226,7 +1228,8 @@ bool GLESImageApi::RenderDepthbuffer::invokeGLES (GLESImageApi& api, MovePtr<Uni
for (int level = 0; level < DE_LENGTH_OF_ARRAY(depthLevelColors); level++)
{
- if ((float)(level + 1) * 0.1f < refAccess.getPixDepth(x, y))
+ tcu::clearDepth(tmpDepth.getLevel(0), (float)(level + 1) * 0.1f);
+ if (tmpDepth.getLevel(0).getPixDepth(0, 0) < refAccess.getPixDepth(x, y))
result = depthLevelColors[level];
}