summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Clark <robclark@freedesktop.org>2023-11-02 12:59:41 -0700
committerMarge Bot <emma+marge@anholt.net>2024-01-17 17:08:14 +0000
commit108e0707ca5c552034433612fa36845f913a6976 (patch)
tree2bf300a03ae64a922ab1ed5ce174dc1d41f78592
parentc7ab0ffce6d61d12ea77388b54b1977371c7cb59 (diff)
modifiers: Remove sampler-view tests
When a particular modifier is forced, it is not always possible to do various format casts. Normally the gl driver would internally demote the modifier, but this isn't possible with imported buffers with a particular modifier forced. Perhaps this is a spec issue, but since it is impossible in some cases, so lets just remove the tests. The alternative would be to somehow maintain an allow list of which format casts are permitted for a given modifier, which doesn't seem reasonable. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/849>
-rw-r--r--tests/spec/ext_image_dma_buf_import/modifiers.c173
1 files changed, 0 insertions, 173 deletions
diff --git a/tests/spec/ext_image_dma_buf_import/modifiers.c b/tests/spec/ext_image_dma_buf_import/modifiers.c
index e6f62569d..28c3dccb9 100644
--- a/tests/spec/ext_image_dma_buf_import/modifiers.c
+++ b/tests/spec/ext_image_dma_buf_import/modifiers.c
@@ -336,107 +336,6 @@ get_dma_buf(uint32_t format, EGLuint64KHR modifier, bool external_only,
}
}
-static int
-gl_cpp_for_fourcc(uint32_t format)
-{
- switch (format) {
- case DRM_FORMAT_R8:
- return 1;
- case DRM_FORMAT_R16:
- return 2;
- case DRM_FORMAT_XRGB8888:
- case DRM_FORMAT_XBGR8888:
- return 3;
- case DRM_FORMAT_ARGB8888:
- case DRM_FORMAT_ABGR8888:
- return 4;
- default:
- fprintf(stderr, "invalid fourcc: %.4s\n", (char *)&format);
- return 0;
- }
-}
-
-struct view_class
-{
- uint8_t cpp;
- uint8_t num_formats;
- GLenum formats[15];
-} static const fmt_views[] = {
- {
- .cpp = 32 / 8,
- .num_formats = 15,
- .formats = {
- GL_RG16F, GL_R11F_G11F_B10F, GL_R32F,
- GL_RGB10_A2UI, GL_RGBA8UI, GL_RG16UI,
- GL_R32UI, GL_RGBA8I, GL_RG16I, GL_R32I,
- GL_RGB10_A2, GL_RGBA8, GL_RGBA8_SNORM,
- GL_SRGB8_ALPHA8, GL_RGB9_E5
- }
- },
- {
- .cpp = 24 / 8,
- .num_formats = 5,
- .formats = {
- GL_RGB8UI, GL_RGB8I, GL_RGB8, GL_RGB8_SNORM,
- GL_SRGB8
- }
- },
- {
- .cpp = 16 / 8,
- .num_formats = 7,
- .formats = {
- GL_R16F, GL_RG8UI, GL_R16UI, GL_RG8I, GL_R16I,
- GL_RG8, GL_RG8_SNORM
- }
- },
- {
- .cpp = 8 / 8,
- .num_formats = 4,
- .formats = {
- GL_R8UI, GL_R8I, GL_R8, GL_R8_SNORM
- }
- },
-};
-
-static GLenum
-clear_color_type(GLenum format)
-{
- switch (format) {
- default:
- assert(!"unhandled clear format");
- case GL_RGBA8I:
- case GL_RG16I:
- case GL_R32I:
- case GL_RG8I:
- case GL_R16I:
- case GL_R8I:
- return GL_INT;
- case GL_RGB10_A2UI:
- case GL_RGBA8UI:
- case GL_RG16UI:
- case GL_R32UI:
- case GL_RG8UI:
- case GL_R16UI:
- case GL_R8UI:
- return GL_UNSIGNED_INT;
- case GL_RG16F:
- case GL_R11F_G11F_B10F:
- case GL_R32F:
- case GL_RGB10_A2:
- case GL_SRGB8_ALPHA8:
- case GL_RGB9_E5:
- case GL_RGBA8:
- case GL_RGB8:
- case GL_RGBA8_SNORM:
- case GL_R16F:
- case GL_RG8:
- case GL_RG8_SNORM:
- case GL_R8:
- case GL_R8_SNORM:
- return GL_FLOAT;
- }
-}
-
static void
clear_buffer(GLenum type)
{
@@ -459,16 +358,6 @@ clear_buffer(GLenum type)
}
static bool
-color_renderable(GLenum format)
-{
- return format != GL_RGB9_E5 &&
- format != GL_RGB8UI &&
- format != GL_RGB8I &&
- format != GL_RGB8_SNORM &&
- format != GL_SRGB8;
-}
-
-static bool
sample_compare(GLuint tex, GLuint tex_ref, bool external_only)
{
const int piglit_width_half = piglit_width / 2;
@@ -480,11 +369,6 @@ sample_compare(GLuint tex, GLuint tex_ref, bool external_only)
piglit_width_half, piglit_height,
GL_RGBA);
}
-static bool
-wrapped_sample_compare(GLuint tex, GLuint tex_ref, GLenum format)
-{
- return sample_compare(tex, tex_ref, false);
-}
static bool
clear_textures(GLuint tex, GLuint tex_ref, GLenum type)
@@ -508,13 +392,6 @@ clear_textures(GLuint tex, GLuint tex_ref, GLenum type)
return sample_compare(tex, tex_ref, false);
}
-static bool
-wrapped_clear_textures(GLuint tex, GLuint tex_ref, GLenum format)
-{
- GLenum type = clear_color_type(format);
- return clear_textures(tex, tex_ref, type);
-}
-
static enum piglit_result
test_export(EGLImageKHR img, struct dma_buf_info *buf,
int format, EGLuint64KHR modifier)
@@ -585,64 +462,14 @@ test_export(EGLImageKHR img, struct dma_buf_info *buf,
return PIGLIT_PASS;
}
-bool (*view_fn)(GLuint tex, GLuint tex_ref, GLenum format);
-
-static bool
-test_views(bool (*view_fn)(GLuint tex, GLuint tex_ref, GLenum format),
- unsigned cpp, GLuint tex, GLuint tex_ref, bool render_test)
-{
- for (int i = 0; i < ARRAY_SIZE(fmt_views); i++) {
- if (fmt_views[i].cpp != cpp)
- continue;
- for (int j = 0; j < fmt_views[i].num_formats; j++) {
- const GLenum format = fmt_views[i].formats[j];
- if (render_test && !color_renderable(format))
- continue;
-
- /* Create the texture views. */
- GLuint view, view_ref;
- glGenTextures(1, &view);
- glGenTextures(1, &view_ref);
- glTextureViewOES(view, GL_TEXTURE_2D, tex,
- format, 0, 1, 0, 1);
- glTextureViewOES(view_ref, GL_TEXTURE_2D, tex_ref,
- format, 0, 1, 0, 1);
-
- /* Run the view test. */
- const bool pass = view_fn(view, view_ref, format);
-
- glDeleteTextures(1, &view);
- glDeleteTextures(1, &view_ref);
-
- if (!pass)
- return false;
- }
- }
-
- return true;
-}
-
static bool
test_gl_advanced(GLuint tex, GLuint tex_ref, int fourcc)
{
- const unsigned cpp = gl_cpp_for_fourcc(fourcc);
-
- /* Attempt various operations using the original texture or a
- * textureview from the corresponding view class.
- */
- piglit_logd("Testing view sampling");
- if (!test_views(wrapped_sample_compare, cpp, tex, tex_ref, false))
- return false;
-
/* DRI formats are non-integer, clear with floating point values. */
piglit_logd("Testing clears");
if (!clear_textures(tex, tex_ref, GL_FLOAT))
return false;
- piglit_logd("Testing view clears");
- if (!test_views(wrapped_clear_textures, cpp, tex, tex_ref, true))
- return false;
-
return true;
}