[Piglit] [PATCH 25/25] arb_direct_state_access: Port gettextureimage-formats to OpenGL 2.0
Ian Romanick
idr at freedesktop.org
Mon May 18 13:50:18 PDT 2015
From: Ian Romanick <ian.d.romanick at intel.com>
DSA requires OpenGL 2.0, so this requirement is trivial.
I would have ported this directly to core profile / OpenGL 3.1, but the
test makes heavy use of the deprecated glDrawPixels function. The uses
in make_texture_image() should be trivial to remove.
However, I'm not even sure why test_format() uses glDrawPixels. It
seems like just comparing the results from glGetTextureImage for each
mip level should be sufficient. Is the glDrawPixels just to visualize
the result?
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Cc: Brian Paul <brianp at vmware.com>
---
.../spec/arb_direct_state_access/CMakeLists.gl.txt | 2 +-
.../gettextureimage-formats.c | 23 ++++++++--------------
2 files changed, 9 insertions(+), 16 deletions(-)
diff --git a/tests/spec/arb_direct_state_access/CMakeLists.gl.txt b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
index 9351c66..e5f064d 100644
--- a/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
+++ b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
@@ -25,7 +25,7 @@ piglit_add_executable (arb_direct_state_access-texture-params texture-params.c)
piglit_add_executable (arb_direct_state_access-copytexturesubimage copytexturesubimage.c dsa-utils.c)
piglit_add_executable (arb_direct_state_access-texture-errors texture-errors.c)
piglit_add_executable (arb_direct_state_access-get-textures get-textures.c)
-piglit_add_executable (arb_direct_state_access-gettextureimage-formats gettextureimage-formats.c)
+piglit_add_executable (arb_direct_state_access-gettextureimage-formats gettextureimage-formats.c dsa-utils.c)
piglit_add_executable (arb_direct_state_access-gettextureimage-luminance gettextureimage-luminance.c)
piglit_add_executable (arb_direct_state_access-gettextureimage-targets gettextureimage-targets.c)
piglit_add_executable (arb_direct_state_access-compressedtextureimage compressedtextureimage.c)
diff --git a/tests/spec/arb_direct_state_access/gettextureimage-formats.c b/tests/spec/arb_direct_state_access/gettextureimage-formats.c
index f6dbb45..d749c77 100644
--- a/tests/spec/arb_direct_state_access/gettextureimage-formats.c
+++ b/tests/spec/arb_direct_state_access/gettextureimage-formats.c
@@ -31,10 +31,11 @@
#include "piglit-util-gl.h"
#include "../fbo/fbo-formats.h"
+#include "dsa-utils.h"
PIGLIT_GL_TEST_CONFIG_BEGIN
- config.supports_gl_compat_version = 10;
+ config.supports_gl_compat_version = 20;
config.window_width = 600;
config.window_height = 200;
@@ -46,6 +47,7 @@ static const char *TestName = "gettextureimage-formats";
static const GLfloat clearColor[4] = { 0.4, 0.4, 0.4, 0.0 };
static GLuint texture_id;
+static GLuint prog;
static bool init_by_rendering;
#define TEX_SIZE 128
@@ -365,12 +367,13 @@ test_format(const struct test_desc *test,
compute_expected_color(fmt, upperRightTexel, expected, tolerance);
/* Draw with the texture */
- glEnable(GL_TEXTURE_2D);
+ glUseProgram(prog);
+ dsa_set_xform(prog, piglit_width, piglit_height);
#if DO_BLEND
glEnable(GL_BLEND);
#endif
piglit_draw_rect_tex(x, y, w, h, 0.0, 0.0, 1.0, 1.0);
- glDisable(GL_TEXTURE_2D);
+ glUseProgram(0);
glDisable(GL_BLEND);
x += TEX_SIZE + 20;
@@ -378,23 +381,18 @@ test_format(const struct test_desc *test,
level = 0;
while (w > 0) {
/* Get the texture image */
- assert(!glIsEnabled(GL_TEXTURE_2D));
glGetTextureImage(texture_id, level, GL_RGBA,
GL_FLOAT, sizeof(readback),
readback);
- assert(!glIsEnabled(GL_TEXTURE_2D));
/* Draw the texture image */
glWindowPos2iARB(x, y);
#if DO_BLEND
glEnable(GL_BLEND);
#endif
- assert(!glIsEnabled(GL_TEXTURE_2D));
glDrawPixels(w, h, GL_RGBA, GL_FLOAT, readback);
glDisable(GL_BLEND);
- assert(!glIsEnabled(GL_TEXTURE_2D));
-
if (level <= 2) {
GLint rx = x + w-1;
GLint ry = y + h-1;
@@ -504,11 +502,6 @@ piglit_init(int argc, char **argv)
piglit_require_extension("GL_ARB_direct_state_access");
- if ((piglit_get_gl_version() < 14) && !piglit_is_extension_supported("GL_ARB_window_pos")) {
- printf("Requires GL 1.4 or GL_ARB_window_pos");
- piglit_report_result(PIGLIT_SKIP);
- }
-
fbo_formats_init(1, argv, !piglit_automatic);
(void) fbo_formats_display;
@@ -526,9 +519,9 @@ piglit_init(int argc, char **argv)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glClearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);
+
+ prog = dsa_create_program(GL_TEXTURE_2D);
}
--
2.1.0
More information about the Piglit
mailing list