[Piglit] [PATCH 01/25] arb_direct_state_access: Coding standards fixes
Ian Romanick
idr at freedesktop.org
Mon May 18 13:49:54 PDT 2015
From: Ian Romanick <ian.d.romanick at intel.com>
Use canonical format for spec quotations.
Use
pass = stuff() && pass
instead of
pass &= stuff();
Put 'else if' on the same line as the preceeding closing brace.
Various whitespace fixes.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
.../arb_direct_state_access/bind-texture-unit.c | 27 +--
.../arb_direct_state_access/copytexturesubimage.c | 20 +-
.../spec/arb_direct_state_access/create-textures.c | 8 +-
tests/spec/arb_direct_state_access/dsa-textures.c | 20 +-
tests/spec/arb_direct_state_access/dsa-utils.c | 2 -
tests/spec/arb_direct_state_access/get-textures.c | 12 +-
.../getcompressedtextureimage.c | 38 ++--
.../gettextureimage-formats.c | 66 +++----
.../gettextureimage-luminance.c | 5 -
.../gettextureimage-targets.c | 20 +-
.../spec/arb_direct_state_access/texture-buffer.c | 22 ++-
.../spec/arb_direct_state_access/texture-errors.c | 208 +++++++++++----------
.../spec/arb_direct_state_access/texture-params.c | 16 +-
.../texture-storage-multisample.c | 123 ++++++------
.../spec/arb_direct_state_access/texture-storage.c | 17 +-
.../spec/arb_direct_state_access/texturesubimage.c | 30 +--
tests/spec/arb_direct_state_access/texunits.c | 50 ++---
17 files changed, 308 insertions(+), 376 deletions(-)
diff --git a/tests/spec/arb_direct_state_access/bind-texture-unit.c b/tests/spec/arb_direct_state_access/bind-texture-unit.c
index 205bfe1..fdca1bf 100644
--- a/tests/spec/arb_direct_state_access/bind-texture-unit.c
+++ b/tests/spec/arb_direct_state_access/bind-texture-unit.c
@@ -55,23 +55,28 @@ piglit_display(void)
/* Throw some invalid inputs at BindTextureUnit. */
- /* GL spec section 8.1: "An INVALID_OPERATION error is generated by
- * BindTextureUnit if texture is not zero or the name of an existing
- * texture object."
+ /* Section 8.1. of the OpenGL 4.5 Core Profile spec says:
+ *
+ * "An INVALID_OPERATION error is generated by BindTextureUnit if
+ * texture is not zero or the name of an existing texture object."
*/
/* Texture name doesn't exist */
glBindTextureUnit(0, name);
- pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
/* Texture name exists, but texture object does not */
glGenTextures(1, &name);
glBindTextureUnit(0, name);
- pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
-
- /* GL spec section 8.1 says of BindTextures: "An INVALID_OPERATION error
- * is generated if first + count is greater than the number of texture
- * image units supported by the implementation."
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
+
+ /* Section 8.1. of the OpenGL 4.5 Core Profile spec says for
+ * BindTextures:
+ *
+ * "An INVALID_OPERATION error is generated if first + count is
+ * greater than the number of texture image units supported by the
+ * implementation."
+ *
* However, it doesn't say the same about BindTextureUnit. Table 2.3
* implies that a numeric argument out of range yields INVALID_VALUE,
* not INVALID_OPERATION.
@@ -82,11 +87,11 @@ piglit_display(void)
glCreateTextures(GL_TEXTURE_2D, 1, &name);
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &nunits);
glBindTextureUnit(nunits, name); /* Too High */
- pass &= piglit_check_gl_error(GL_INVALID_VALUE);
+ pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
/* Trivial, but should work. */
glBindTextureUnit(1, name);
- pass &= piglit_check_gl_error(GL_NO_ERROR);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
diff --git a/tests/spec/arb_direct_state_access/copytexturesubimage.c b/tests/spec/arb_direct_state_access/copytexturesubimage.c
index 818257d..fb1a5ff 100644
--- a/tests/spec/arb_direct_state_access/copytexturesubimage.c
+++ b/tests/spec/arb_direct_state_access/copytexturesubimage.c
@@ -1,5 +1,5 @@
/*
- * Copyright © 2008 Intel Corporation
+ * Copyright © 2008, 2014 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -19,12 +19,6 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
- *
- * Authors:
- * Eric Anholt <eric at anholt.net>
- *
- * Laura Ekstrand <laura at jlekstrand.net> adapted this for testing
- * CopyTextureSubImage* from ARB_direct_state_access.
*/
#include "piglit-util-gl.h"
@@ -218,9 +212,9 @@ do_row(int srcy, int srcw, int srch, GLenum target)
glDeleteTextures(1, &texname);
printf("Checking %s, rect 1:\n", piglit_get_gl_enum_name(target));
- pass &= check_results(dstx, dsty, srcw, srch);
+ pass = check_results(dstx, dsty, srcw, srch) && pass;
printf("Checking %s, rect 2:\n", piglit_get_gl_enum_name(target));
- pass &= check_results(dstx2, dsty2, srcw, srch);
+ pass = check_results(dstx2, dsty2, srcw, srch) && pass;
return pass;
}
@@ -245,9 +239,9 @@ piglit_display(void)
/* Test non-power-of-two 2D textures.
*/
if (have_NPOT) {
- pass &= do_row(srcy, 31, 13, GL_TEXTURE_2D);
+ pass = do_row(srcy, 31, 13, GL_TEXTURE_2D) && pass;
srcy += 15;
- pass &= do_row(srcy, 11, 34, GL_TEXTURE_2D);
+ pass = do_row(srcy, 11, 34, GL_TEXTURE_2D) && pass;
srcy += 35 + 5;
}
@@ -255,9 +249,9 @@ piglit_display(void)
/* Test non-power-of-two 2D textures.
*/
if (have_rect) {
- pass &= do_row(srcy, 31, 13, GL_TEXTURE_RECTANGLE_ARB);
+ pass = do_row(srcy, 31, 13, GL_TEXTURE_RECTANGLE_ARB) && pass;
srcy += 14;
- pass &= do_row(srcy, 11, 34, GL_TEXTURE_RECTANGLE_ARB);
+ pass = do_row(srcy, 11, 34, GL_TEXTURE_RECTANGLE_ARB) && pass;
srcy += 35 + 5;
}
diff --git a/tests/spec/arb_direct_state_access/create-textures.c b/tests/spec/arb_direct_state_access/create-textures.c
index 767cf41..6ce5bb3 100644
--- a/tests/spec/arb_direct_state_access/create-textures.c
+++ b/tests/spec/arb_direct_state_access/create-textures.c
@@ -55,19 +55,19 @@ piglit_display(void)
/* Invalid (not a target) */
glCreateTextures(GL_INVALID_ENUM, 1, &name);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
/* Invalid (not supported) target */
glCreateTextures(GL_PROXY_TEXTURE_2D, 1, &name);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
/* n is negative */
glCreateTextures(GL_TEXTURE_2D, -1, &name);
- pass &= piglit_check_gl_error(GL_INVALID_VALUE);
+ pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
/* Trivial, but should work. */
glCreateTextures(GL_TEXTURE_2D, 1, &name);
- pass &= piglit_check_gl_error(GL_NO_ERROR);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
diff --git a/tests/spec/arb_direct_state_access/dsa-textures.c b/tests/spec/arb_direct_state_access/dsa-textures.c
index 9419b28..5e8b3a1 100644
--- a/tests/spec/arb_direct_state_access/dsa-textures.c
+++ b/tests/spec/arb_direct_state_access/dsa-textures.c
@@ -31,8 +31,6 @@
#include <stdlib.h>
-static const char* glversion;
-
PIGLIT_GL_TEST_CONFIG_BEGIN
config.supports_gl_compat_version = 13;
@@ -61,12 +59,10 @@ piglit_init(int argc, char **argv)
srand(0);
- glversion = (const char*) glGetString(GL_VERSION);
- printf("Using driver %s.\n", glversion);
+ printf("Using driver %s.\n", (const char *) glGetString(GL_VERSION));
dsa_init_program();
-
-} /* piglit_init */
+}
enum piglit_result
piglit_display(void)
@@ -74,7 +70,7 @@ piglit_display(void)
bool pass = true;
GLfloat* data = random_image_data();
GLuint name;
- int texunit = 3;
+ const GLuint texunit = 3;
glCreateTextures(GL_TEXTURE_2D, 1, &name);
glTextureStorage2D(name, 1, GL_RGBA32F, piglit_width, piglit_height);
@@ -88,16 +84,16 @@ piglit_display(void)
dsa_texture_with_unit(texunit);
glEnable(GL_TEXTURE_2D);
glBindTextureUnit(texunit, name);
- pass &= piglit_check_gl_error(GL_NO_ERROR);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
piglit_draw_rect_tex(0, 0, piglit_width, piglit_height, 0, 0, 1, 1);
- pass &= piglit_check_gl_error(GL_NO_ERROR);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
/* Check to make sure the image was drawn correctly */
- pass &= piglit_probe_image_rgba(0, 0, piglit_width, piglit_height,
- data);
+ pass = piglit_probe_image_rgba(0, 0, piglit_width, piglit_height, data)
+ && pass;
if (!piglit_automatic)
piglit_present_results();
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
-} /* piglit_display */
+}
diff --git a/tests/spec/arb_direct_state_access/dsa-utils.c b/tests/spec/arb_direct_state_access/dsa-utils.c
index ec7bb24..fefbae1 100644
--- a/tests/spec/arb_direct_state_access/dsa-utils.c
+++ b/tests/spec/arb_direct_state_access/dsa-utils.c
@@ -25,8 +25,6 @@
*
* Contains some common functionality for writing arb_direct_state_access
* Piglit tests.
- *
- * @author Laura Ekstrand (laura at jlekstrand.net)
*/
#include "dsa-utils.h"
diff --git a/tests/spec/arb_direct_state_access/get-textures.c b/tests/spec/arb_direct_state_access/get-textures.c
index bdb021d..129e45a 100644
--- a/tests/spec/arb_direct_state_access/get-textures.c
+++ b/tests/spec/arb_direct_state_access/get-textures.c
@@ -57,19 +57,19 @@ piglit_display(void)
/* Non-gen-ed name */
glGetTextureImage(3, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, data);
- pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
/* Unsupported target. */
glGenTextures(1, &name);
glBindTexture(GL_TEXTURE_CUBE_MAP_POSITIVE_X, name);
glGetTextureImage(name, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, data);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glDeleteTextures(1, &name);
/* Unsupported dsa target for non-dsa version. */
glGetTexImage(GL_TEXTURE_CUBE_MAP, 0, GL_RGBA, GL_UNSIGNED_BYTE,
data);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
/* No Storage
*
@@ -78,7 +78,7 @@ piglit_display(void)
*/
glCreateTextures(GL_TEXTURE_CUBE_MAP, 1, &name);
glGetTextureImage(name, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, data);
- pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
glDeleteTextures(1, &name);
/* Insufficient storage
@@ -100,7 +100,7 @@ piglit_display(void)
glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0,
GL_RGBA8, 50, 50, 0, GL_RGBA, GL_UNSIGNED_BYTE, image);
glGetTextureImage(name, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, data);
- pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
glDeleteTextures(1, &name);
/* Trivial, but should work. */
@@ -108,7 +108,7 @@ piglit_display(void)
glTextureStorage2D(name, 1, GL_RGBA8, 50, 50);
glGetTextureImage(name, 0, GL_RGBA, GL_UNSIGNED_BYTE,
50 * 50 * 6 * 4, data);
- pass &= piglit_check_gl_error(GL_NO_ERROR);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
diff --git a/tests/spec/arb_direct_state_access/getcompressedtextureimage.c b/tests/spec/arb_direct_state_access/getcompressedtextureimage.c
index dbfe0e0..66b99af 100644
--- a/tests/spec/arb_direct_state_access/getcompressedtextureimage.c
+++ b/tests/spec/arb_direct_state_access/getcompressedtextureimage.c
@@ -24,11 +24,7 @@
/**
* @file getcompressedtextureimage.c
- *
- * Adapted for testing glGetCompressedTextureImage in ARB_direct_state_access
- * by Laura Ekstrand <laura at jlekstrand.net>, November 2014.
*/
-
#include "piglit-util-gl.h"
PIGLIT_GL_TEST_CONFIG_BEGIN
@@ -147,12 +143,10 @@ getTexImage(bool doPBO, GLenum target, GLubyte *data,
GLint compressed;
GLint comp_size;
- /* Upload the data. */
+ /* Upload the data. These are all targets that can be compressed
+ * according to _mesa_target_can_be_compressed.
+ */
switch (target) {
-
- /* These are all targets that can be compressed according to
- * _mesa_target_can_be_compressed */
-
case GL_TEXTURE_2D:
glCreateTextures(target, 1, &name);
glTextureStorage2D(name, 1, internalformat, IMAGE_WIDTH,
@@ -194,7 +188,6 @@ getTexImage(bool doPBO, GLenum target, GLubyte *data,
default:
puts("Invalid texture target.");
return PIGLIT_FAIL;
-
}
/* Make sure the driver has compressed the image. */
@@ -206,12 +199,13 @@ getTexImage(bool doPBO, GLenum target, GLubyte *data,
glGetTextureLevelParameteriv(name, 0,
GL_TEXTURE_COMPRESSED_IMAGE_SIZE,
&comp_size);
- /* The OpenGL 4.5 core spec
- * (30.10.2014) Section 8.11 Texture Queries says:
- * "For GetTextureLevelParameter* only, texture may also be a
- * cube map texture object. In this case the query is always
- * performed for face zero (the TEXTURE_CUBE_MAP_POSITIVE_X
- * face), since there is no way to specify another face."
+ /* Section 8.11 (Texture Queries) of the OpenGL 4.5 Core Profile spec
+ * says:
+ *
+ * "For GetTextureLevelParameter* only, texture may also be a cube
+ * map texture object. In this case the query is always performed
+ * for face zero (the TEXTURE_CUBE_MAP_POSITIVE_X face), since
+ * there is no way to specify another face."
*/
if (target == GL_TEXTURE_CUBE_MAP)
comp_size *= num_faces;
@@ -222,7 +216,8 @@ getTexImage(bool doPBO, GLenum target, GLubyte *data,
/* Setup the PBO or data array to read into from
- * glGetCompressedTextureImage */
+ * glGetCompressedTextureImage
+ */
if (doPBO) {
glGenBuffers(1, &packPBO);
glBindBuffer(GL_PIXEL_PACK_BUFFER, packPBO);
@@ -358,9 +353,8 @@ piglit_init(int argc, char **argv)
if (!piglit_is_extension_supported("GL_ARB_texture_cube_map"))
clear_target_mask(GL_TEXTURE_CUBE_MAP);
- if (!piglit_is_extension_supported("GL_EXT_texture_array")) {
+ if (!piglit_is_extension_supported("GL_EXT_texture_array"))
clear_target_mask(GL_TEXTURE_2D_ARRAY);
- }
if (!piglit_is_extension_supported("GL_ARB_texture_cube_map_array"))
clear_target_mask(GL_TEXTURE_CUBE_MAP_ARRAY);
@@ -414,8 +408,9 @@ piglit_display(void)
result = PIGLIT_FAIL;
}
- /* 1D targets can't be compressed in Mesa right now,
- * but here is a trivial test for the entry point. */
+ /* 1D targets can't be compressed in Mesa right now, but here is a
+ * trivial test for the entry point.
+ */
glCompressedTextureSubImage1D(250, 0, 0, 60,
internalformat, 60*4*8,
NULL);
@@ -433,4 +428,3 @@ piglit_display(void)
return result;
}
-
diff --git a/tests/spec/arb_direct_state_access/gettextureimage-formats.c b/tests/spec/arb_direct_state_access/gettextureimage-formats.c
index e2d637c..49f6e54 100644
--- a/tests/spec/arb_direct_state_access/gettextureimage-formats.c
+++ b/tests/spec/arb_direct_state_access/gettextureimage-formats.c
@@ -26,13 +26,6 @@
/**
* @file gettextureimage-formats.c
- *
- * Test glGetTexImage with a variety of formats.
- * Brian Paul
- * Sep 2011
- *
- * Adapted for testing glGetTextureImage in ARB_direct_state_access by
- * Laura Ekstrand <laura at jlekstrand.net>, November 2014.
*/
@@ -115,8 +108,7 @@ make_texture_image(GLenum intFormat, GLubyte upperRightTexel[4])
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
glDeleteFramebuffers(1, &fb);
glViewport(0, 0, piglit_width, piglit_height);
- }
- else {
+ } else {
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
glTexImage2D(GL_TEXTURE_2D, 0, intFormat, TEX_SIZE, TEX_SIZE, 0,
GL_RGBA, GL_UNSIGNED_BYTE, tex);
@@ -132,8 +124,7 @@ ubyte_to_float(GLubyte b, GLint bits)
GLint b2 = b >> (8 - bits);
GLint max = 255 >> (8 - bits);
return b2 / (float) max;
- }
- else {
+ } else {
return b / 255.0;
}
}
@@ -146,17 +137,14 @@ bits_to_tolerance(GLint bits, GLboolean compressed)
if (bits == 0) {
return 0.25;
- }
- else if (bits == 1) {
+ } else if (bits == 1) {
return 0.5;
- }
- else if (bits > 8) {
+ } else if (bits > 8) {
/* The original texture was specified as GLubyte and we
* assume that the window/surface is 8-bits/channel.
*/
t = 4.0 / 255;
- }
- else {
+ } else {
t = 4.0 / (1 << (bits - 1));
}
@@ -193,8 +181,7 @@ compute_expected_color(const struct format_desc *fmt,
texel[2] = ubyte_to_float(upperRightTexel[2], bits[2]);
texel[3] = 1.0;
compressed = GL_FALSE;
- }
- else {
+ } else {
GLint r, g, b, a, l, i;
GLenum baseFormat = 0;
@@ -219,8 +206,7 @@ compute_expected_color(const struct format_desc *fmt,
texel[1] = 0.0;
texel[2] = 0.0;
texel[3] = ubyte_to_float(upperRightTexel[0], bits[3]);
- }
- else if (a > 0) {
+ } else if (a > 0) {
if (l > 0) {
baseFormat = GL_LUMINANCE_ALPHA;
bits[0] = l;
@@ -231,8 +217,7 @@ compute_expected_color(const struct format_desc *fmt,
texel[1] = 0.0;
texel[2] = 0.0;
texel[3] = ubyte_to_float(upperRightTexel[3], bits[3]);
- }
- else if (r > 0 && g > 0 && b > 0) {
+ } else if (r > 0 && g > 0 && b > 0) {
baseFormat = GL_RGBA;
bits[0] = r;
bits[1] = g;
@@ -242,8 +227,7 @@ compute_expected_color(const struct format_desc *fmt,
texel[1] = ubyte_to_float(upperRightTexel[1], bits[1]);
texel[2] = ubyte_to_float(upperRightTexel[2], bits[2]);
texel[3] = ubyte_to_float(upperRightTexel[3], bits[3]);
- }
- else if (r == 0 && g == 0 && b == 0) {
+ } else if (r == 0 && g == 0 && b == 0) {
baseFormat = GL_ALPHA;
bits[0] = 0;
bits[1] = 0;
@@ -253,16 +237,14 @@ compute_expected_color(const struct format_desc *fmt,
texel[1] = 0.0;
texel[2] = 0.0;
texel[3] = ubyte_to_float(upperRightTexel[3], bits[3]);
- }
- else {
+ } else {
baseFormat = 0; /* ??? */
texel[0] = 0.0;
texel[1] = 0.0;
texel[2] = 0.0;
texel[3] = 0.0;
}
- }
- else if (l > 0) {
+ } else if (l > 0) {
baseFormat = GL_LUMINANCE;
bits[0] = l;
bits[1] = 0;
@@ -272,8 +254,7 @@ compute_expected_color(const struct format_desc *fmt,
texel[1] = 0.0;
texel[2] = 0.0;
texel[3] = 1.0;
- }
- else if (r > 0) {
+ } else if (r > 0) {
if (g > 0) {
if (b > 0) {
baseFormat = GL_RGB;
@@ -285,8 +266,7 @@ compute_expected_color(const struct format_desc *fmt,
texel[1] = ubyte_to_float(upperRightTexel[1], bits[1]);
texel[2] = ubyte_to_float(upperRightTexel[2], bits[2]);
texel[3] = 1.0;
- }
- else {
+ } else {
baseFormat = GL_RG;
bits[0] = r;
bits[1] = g;
@@ -297,8 +277,7 @@ compute_expected_color(const struct format_desc *fmt,
texel[2] = 0.0;
texel[3] = 1.0;
}
- }
- else {
+ } else {
baseFormat = GL_RED;
bits[0] = r;
bits[1] = 0;
@@ -459,12 +438,11 @@ supported_format_set(const struct test_desc *set)
return GL_FALSE;
if (set->format == ext_texture_integer ||
- set->format == ext_packed_depth_stencil ||
- set->format == arb_texture_rg_int ||
- set->format == arb_depth_texture ||
- set->format == arb_depth_buffer_float) {
- /*
- * texture_integer requires a fragment shader, different
+ set->format == ext_packed_depth_stencil ||
+ set->format == arb_texture_rg_int ||
+ set->format == arb_depth_texture ||
+ set->format == arb_depth_buffer_float) {
+ /* texture_integer requires a fragment shader, different
* glTexImage calls. Depth/stencil formats not implemented.
*/
return GL_FALSE;
@@ -504,13 +482,11 @@ piglit_display(void)
if (piglit_automatic) {
pass = test_all_formats();
- }
- else {
+ } else {
const struct test_desc *set = &test_sets[test_index];
if (supported_format_set(set)) {
pass = test_format(set, &set->format[format_index]);
- }
- else {
+ } else {
/* unsupported format - not a failure */
pass = GL_TRUE;
glClear(GL_COLOR_BUFFER_BIT);
diff --git a/tests/spec/arb_direct_state_access/gettextureimage-luminance.c b/tests/spec/arb_direct_state_access/gettextureimage-luminance.c
index 3add1d7..fa6813f 100644
--- a/tests/spec/arb_direct_state_access/gettextureimage-luminance.c
+++ b/tests/spec/arb_direct_state_access/gettextureimage-luminance.c
@@ -25,11 +25,6 @@
/*
* Test glGetTexImage for luminance formats.
- * Brian Paul
- * 8 Mar 2012
- *
- * Adapted for testing glGetTextureImage in ARB_direct_state_access by
- * Laura Ekstrand <laura at jlekstrand.net>, November 2014.
*/
#include "piglit-util-gl.h"
diff --git a/tests/spec/arb_direct_state_access/gettextureimage-targets.c b/tests/spec/arb_direct_state_access/gettextureimage-targets.c
index 7f5c51e..4642cfe 100644
--- a/tests/spec/arb_direct_state_access/gettextureimage-targets.c
+++ b/tests/spec/arb_direct_state_access/gettextureimage-targets.c
@@ -24,9 +24,6 @@
/**
* @file gettextureimage-targets.c
- *
- * Adapted for testing glGetTextureImage in ARB_direct_state_access by
- * Laura Ekstrand <laura at jlekstrand.net>, November 2014.
*/
#include "piglit-util-gl.h"
@@ -134,7 +131,7 @@ getTexImage(bool doPBO, GLenum target, GLubyte data[][IMAGE_SIZE],
/* This is invalid. You must use 2D storage call for cube. */
glTextureStorage3D(name, 1, internalformat,
IMAGE_WIDTH, IMAGE_HEIGHT, num_faces);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glTextureStorage2D(name, 1, internalformat,
IMAGE_WIDTH, IMAGE_HEIGHT);
/* This is legal. */
@@ -194,8 +191,7 @@ getTexImage(bool doPBO, GLenum target, GLubyte data[][IMAGE_SIZE],
if (doPBO) {
glGetTextureImage(name, 0, GL_RGBA, GL_UNSIGNED_BYTE,
layer_size * num_faces * num_layers, NULL);
- }
- else {
+ } else {
glGetTextureImage(name, 0, GL_RGBA, GL_UNSIGNED_BYTE,
layer_size * num_faces * num_layers, data2);
}
@@ -290,15 +286,17 @@ piglit_display(void)
printf("Testing %s into PBO\n",
piglit_get_gl_enum_name(targets[i].target));
- pass &= getTexImage(true, targets[i].target, data,
- internalformat, tolerance);
+ pass = getTexImage(true, targets[i].target, data,
+ internalformat, tolerance)
+ && pass;
printf("Testing %s into client array\n",
piglit_get_gl_enum_name(targets[i].target));
- pass &= getTexImage(false, targets[i].target, data,
- internalformat, tolerance);
+ pass = getTexImage(false, targets[i].target, data,
+ internalformat, tolerance)
+ && pass;
- pass &= piglit_check_gl_error(GL_NO_ERROR);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
}
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
diff --git a/tests/spec/arb_direct_state_access/texture-buffer.c b/tests/spec/arb_direct_state_access/texture-buffer.c
index 1246071..58015b4 100644
--- a/tests/spec/arb_direct_state_access/texture-buffer.c
+++ b/tests/spec/arb_direct_state_access/texture-buffer.c
@@ -62,10 +62,10 @@ piglit_display(void)
bool pass = true;
GLuint tex, bo;
GLuint prog;
- float green[] = {0, 1, 0, 0};
- float blue[] = {0, 0, 1, 0};
- uint8_t g_rgba8[] = {0x00, 0xff, 0x00, 0x00};
- uint8_t b_rgba8[] = {0x00, 0x00, 0xff, 0x00};
+ static const float green[] = {0, 1, 0, 0};
+ static const float blue[] = {0, 0, 1, 0};
+ static const uint8_t g_rgba8[] = {0x00, 0xff, 0x00, 0x00};
+ static const uint8_t b_rgba8[] = {0x00, 0x00, 0xff, 0x00};
prog = piglit_build_simple_program(vs_source, fs_source);
glUseProgram(prog);
@@ -84,12 +84,14 @@ piglit_display(void)
GL_STREAM_DRAW);
piglit_draw_rect(0, -1, 1, 2);
- pass = pass && piglit_probe_rect_rgba(0, 0,
- piglit_width / 2, piglit_height,
- green);
- pass = pass && piglit_probe_rect_rgba(piglit_width / 2, 0,
- piglit_width / 2, piglit_height,
- blue);
+ pass = piglit_probe_rect_rgba(0, 0,
+ piglit_width / 2, piglit_height,
+ green)
+ && pass;
+ pass = piglit_probe_rect_rgba(piglit_width / 2, 0,
+ piglit_width / 2, piglit_height,
+ blue)
+ && pass;
piglit_present_results();
diff --git a/tests/spec/arb_direct_state_access/texture-errors.c b/tests/spec/arb_direct_state_access/texture-errors.c
index c79fbc4..c1f5010 100644
--- a/tests/spec/arb_direct_state_access/texture-errors.c
+++ b/tests/spec/arb_direct_state_access/texture-errors.c
@@ -49,16 +49,16 @@ test_pos_and_sizes(void)
/* all of these should generate GL_INVALID_VALUE */
glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA, -16, 0, GL_RGBA, GL_FLOAT, NULL);
- pass &= piglit_check_gl_error(GL_INVALID_VALUE);
+ pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, -6, -5, 0, GL_RGBA, GL_FLOAT, NULL);
- pass &= piglit_check_gl_error(GL_INVALID_VALUE);
+ pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
glTexImage2D(GL_TEXTURE_2D, -2, GL_RGBA, 16, 16, 0, GL_RGBA, GL_FLOAT, NULL);
- pass &= piglit_check_gl_error(GL_INVALID_VALUE);
+ pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
glTexImage2D(GL_TEXTURE_2D, 2000, GL_RGBA, 16, 16, 0, GL_RGBA, GL_FLOAT, NULL);
- pass &= piglit_check_gl_error(GL_INVALID_VALUE);
+ pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
/* Setup dsa. */
glCreateTextures(GL_TEXTURE_2D, 1, &name);
@@ -68,37 +68,37 @@ test_pos_and_sizes(void)
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_FLOAT, NULL);
glTextureSubImage2D(name, 0, 6, 6, 100, 100, GL_RGBA, GL_FLOAT, NULL);
- pass &= piglit_check_gl_error(GL_INVALID_VALUE);
+ pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
glTextureSubImage2D(name, 0, -6, -6, 10, 10, GL_RGBA, GL_FLOAT, NULL);
- pass &= piglit_check_gl_error(GL_INVALID_VALUE);
+ pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
glCopyTextureSubImage2D(name, 0, -6, -6, 2, 2, 10, 10);
- pass &= piglit_check_gl_error(GL_INVALID_VALUE);
+ pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
glCopyTextureSubImage2D(name, 0, 6, 6, 2, 2, 200, 200);
- pass &= piglit_check_gl_error(GL_INVALID_VALUE);
+ pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
/* mipmap level 1 doesn't exist */
glTextureSubImage2D(name, 1, 0, 0, 8, 8, GL_RGBA, GL_FLOAT, NULL);
- pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
/* mipmap level 2 doesn't exist */
glCopyTextureSubImage2D(name, 2, 0, 0, 0, 0, 4, 4);
- pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
/* To test 1D and 3D entry points, let's try using the wrong functions. */
glTextureSubImage1D(name, 0, 0, 4, GL_RGBA, GL_FLOAT, NULL);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glTextureSubImage3D(name, 0, 0, 0, 0, 4, 4, 4, GL_RGBA, GL_FLOAT, NULL);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glCopyTextureSubImage1D(name, 0, 0, 0, 0, 4);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glCopyTextureSubImage3D(name, 0, 0, 0, 0, 0, 0, 4, 4);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
return pass;
}
@@ -117,25 +117,26 @@ test_target_name(void)
bool pass = true;
glTextureParameteri(badname, GL_TEXTURE_MAX_LEVEL, 4);
- pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
glTextureParameterf(badname, GL_TEXTURE_MAX_LEVEL, 4.0);
- pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
glTextureParameterfv(badname, GL_TEXTURE_MAX_LEVEL, fvec);
- pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
glTextureParameteriv(badname, GL_TEXTURE_MAX_LEVEL, ivec);
- pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
glTextureParameterIiv(badname, GL_TEXTURE_MAX_LEVEL, ivec);
- pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
glTextureParameterIuiv(badname, GL_TEXTURE_MAX_LEVEL, uvec);
- pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
- "glTextureParameter: GL_INVALID_OPERATION on bad texture");
+ "glTextureParameter: GL_INVALID_OPERATION "
+ "on bad texture");
return pass;
}
@@ -144,35 +145,36 @@ static bool
test_getter_target_name(void)
{
static const GLuint badname = 250;
- static GLfloat f = 1.0;
- static GLuint u = 1;
- static GLint i = -5;
+ GLfloat f;
+ GLuint u;
+ GLint i;
bool pass = true;
glGetTextureParameterfv(badname, GL_TEXTURE_MAX_LEVEL, &f);
- pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
glGetTextureParameteriv(badname, GL_TEXTURE_MAX_LEVEL, &i);
- pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
glGetTextureParameterIiv(badname, GL_TEXTURE_MAX_LEVEL, &i);
- pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
glGetTextureParameterIuiv(badname, GL_TEXTURE_MAX_LEVEL, &u);
- pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
- "glGetTextureParameter: GL_INVALID_OPERATION on bad texture");
+ "glGetTextureParameter: "
+ "GL_INVALID_OPERATION on bad texture");
return pass;
}
static bool
test_getter_pname(void)
{
- static GLuint name;
- static GLfloat f = 1.0;
- static GLuint u = 1;
- static GLint i = -5;
+ GLuint name;
+ GLfloat f;
+ GLuint u;
+ GLint i;
bool pass = true;
/* Setup dsa. */
@@ -180,26 +182,27 @@ test_getter_pname(void)
glBindTextureUnit(0, name); /* Since next command isn't bindless. */
glGetTextureParameterfv(name, GL_TEXTURE_1D, &f);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glGetTextureParameteriv(name, GL_TEXTURE_1D, &i);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glGetTextureParameterIiv(name, GL_TEXTURE_1D, &i);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glGetTextureParameterIuiv(name, GL_TEXTURE_1D, &u);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
- "glGetTextureParameter: GL_INVALID_ENUM on bad pname");
+ "glGetTextureParameter: GL_INVALID_ENUM "
+ "on bad pname");
return pass;
}
static bool
test_pname(void)
{
- static GLuint name;
+ GLuint name;
const static GLfloat f = 1.0;
const static GLuint u = 1;
const static GLint i = -5;
@@ -210,19 +213,20 @@ test_pname(void)
glBindTextureUnit(0, name); /* Since next command isn't bindless. */
glTextureParameterfv(name, GL_TEXTURE_1D, &f);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glTextureParameteriv(name, GL_TEXTURE_1D, &i);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glTextureParameterIiv(name, GL_TEXTURE_1D, &i);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glTextureParameterIuiv(name, GL_TEXTURE_1D, &u);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
- "glTextureParameter: GL_INVALID_ENUM on bad pname");
+ "glTextureParameter: GL_INVALID_ENUM on "
+ "bad pname");
return pass;
}
@@ -235,20 +239,21 @@ test_scalar_vector(void)
bool pass = true;
const static GLfloat f = 1.0;
const static GLint i = -1;
- static GLuint name;
+ GLuint name;
/* Setup dsa. */
glCreateTextures(GL_TEXTURE_2D, 1, &name);
glBindTextureUnit(0, name); /* Since next command isn't bindless. */
glTextureParameteri(name, GL_TEXTURE_BORDER_COLOR, i);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glTextureParameterf(name, GL_TEXTURE_BORDER_COLOR, f);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
- "glTextureParameter{if}: GL_INVALID_ENUM for non-scalars");
+ "glTextureParameter{if}: GL_INVALID_ENUM "
+ "for non-scalars");
return pass;
}
@@ -261,34 +266,34 @@ static bool
test_multisample(void)
{
bool pass = true;
- static GLfloat f = 1.0;
- static GLint i = -1;
+ static const GLfloat f = 1.0;
+ static const GLint i = -1;
static const GLfloat fvec[2] = { 1.0, -1.0 };
static const GLint ivec[2] = { 1, -1 };
static const GLuint uvec[2] = { 1, 4 };
- static GLuint name;
+ GLuint name;
/* GL_TEXTURE_2D_MULTISAMPLE_ARRAY */
glCreateTextures(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, 1, &name);
glBindTextureUnit(0, name); /* Since next command isn't bindless. */
glTextureParameteri(name, GL_TEXTURE_WRAP_R, i);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glTextureParameterf(name, GL_TEXTURE_WRAP_R, f);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glTextureParameterfv(name, GL_TEXTURE_WRAP_R, fvec);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glTextureParameteriv(name, GL_TEXTURE_WRAP_R, ivec);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glTextureParameterIiv(name, GL_TEXTURE_WRAP_R, ivec);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glTextureParameterIuiv(name, GL_TEXTURE_WRAP_R, uvec);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
/* GL_TEXTURE_2D_MULTISAMPLE */
glDeleteTextures(1, &name);
@@ -296,25 +301,26 @@ test_multisample(void)
glBindTextureUnit(0, name); /* Since next command isn't bindless. */
glTextureParameteri(name, GL_TEXTURE_WRAP_R, i);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glTextureParameterf(name, GL_TEXTURE_WRAP_R, f);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glTextureParameterfv(name, GL_TEXTURE_WRAP_R, fvec);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glTextureParameteriv(name, GL_TEXTURE_WRAP_R, ivec);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glTextureParameterIiv(name, GL_TEXTURE_WRAP_R, ivec);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glTextureParameterIuiv(name, GL_TEXTURE_WRAP_R, uvec);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
- "glTextureParameter: GL_INVALID_ENUM if multisample+sampler state");
+ "glTextureParameter: GL_INVALID_ENUM if "
+ "multisample+sampler state");
return pass;
}
@@ -326,32 +332,33 @@ static bool
test_texture_rec(void)
{
bool pass = true;
- static GLuint name;
+ GLuint name;
/* GL_TEXTURE_2D_MULTISAMPLE_ARRAY */
glCreateTextures(GL_TEXTURE_RECTANGLE, 1, &name);
glBindTextureUnit(0, name); /* Since next command isn't bindless. */
glTextureParameteri(name, GL_TEXTURE_WRAP_S, GL_MIRROR_CLAMP_TO_EDGE);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glTextureParameteri(name, GL_TEXTURE_WRAP_T, GL_MIRROR_CLAMP_TO_EDGE);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glTextureParameteri(name, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glTextureParameteri(name, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glTextureParameteri(name, GL_TEXTURE_WRAP_S, GL_REPEAT);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
glTextureParameteri(name, GL_TEXTURE_WRAP_T, GL_REPEAT);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
- "glTextureParameter: GL_INVALID_ENUM in texture_rectangle case");
+ "glTextureParameter: GL_INVALID_ENUM in "
+ "texture_rectangle case");
return pass;
}
@@ -363,16 +370,17 @@ static bool
test_texture_rec_min_filter(void)
{
bool pass = true;
- static GLuint name;
+ GLuint name;
glCreateTextures(GL_TEXTURE_RECTANGLE, 1, &name);
glBindTextureUnit(0, name); /* Since next command isn't bindless. */
glTextureParameteri(name, GL_TEXTURE_MIN_FILTER, 0);
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
- "glTextureParameter: GL_INVALID_ENUM for texture_rectangle+min_filter");
+ "glTextureParameter: GL_INVALID_ENUM for "
+ "texture_rectangle+min_filter");
return pass;
}
@@ -384,22 +392,23 @@ static bool
test_multisample_texture_base(void)
{
bool pass = true;
- static GLuint name;
+ GLuint name;
glCreateTextures(GL_TEXTURE_2D_MULTISAMPLE, 1, &name);
glBindTextureUnit(0, name); /* Since next command isn't bindless. */
glTextureParameteri(name, GL_TEXTURE_BASE_LEVEL, 1);
- pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
glCreateTextures(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, 1, &name);
glBindTextureUnit(0, name); /* Since next command isn't bindless. */
glTextureParameteri(name, GL_TEXTURE_BASE_LEVEL, 1);
- pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
- "glTextureParameter: GL_INVALID_OPERATION for multisample+texture_base");
+ "glTextureParameter: GL_INVALID_OPERATION "
+ "for multisample+texture_base");
return pass;
}
@@ -411,16 +420,17 @@ static bool
test_texture_rec_texture_base(void)
{
bool pass = true;
- static GLuint name;
+ GLuint name;
glCreateTextures(GL_TEXTURE_RECTANGLE, 1, &name);
glBindTextureUnit(0, name); /* Since next command isn't bindless. */
glTextureParameteri(name, GL_TEXTURE_BASE_LEVEL, 1);
- pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
- "glTextureParameter: GL_INVALID_OPERATION for texture_rectangle+min_filter");
+ "glTextureParameter: GL_INVALID_OPERATION "
+ "for texture_rectangle+min_filter");
return pass;
}
@@ -431,19 +441,20 @@ static bool
test_texture_level_negative(void)
{
bool pass = true;
- static GLuint name;
+ GLuint name;
glCreateTextures(GL_TEXTURE_2D, 1, &name);
glBindTextureUnit(0, name); /* Since next command isn't bindless. */
glTextureParameteri(name, GL_TEXTURE_BASE_LEVEL, -1);
- pass &= piglit_check_gl_error(GL_INVALID_VALUE);
+ pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
glTextureParameteri(name, GL_TEXTURE_MAX_LEVEL, -1);
- pass &= piglit_check_gl_error(GL_INVALID_VALUE);
+ pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
- "glTextureParameter: GL_INVALID_VALUE for negative tex_*_level");
+ "glTextureParameter: GL_INVALID_VALUE for "
+ "negative tex_*_level");
return pass;
}
@@ -451,21 +462,22 @@ enum piglit_result
piglit_display(void)
{
bool pass = true;
- pass &= test_pos_and_sizes();
- pass &= test_target_name();
- pass &= test_getter_target_name();
- pass &= test_pname();
- pass &= test_getter_pname();
- pass &= test_scalar_vector();
- pass &= test_texture_level_negative();
+
+ pass = test_pos_and_sizes() && pass;
+ pass = test_target_name() && pass;
+ pass = test_getter_target_name() && pass;
+ pass = test_pname() && pass;
+ pass = test_getter_pname() && pass;
+ pass = test_scalar_vector() && pass;
+ pass = test_texture_level_negative() && pass;
if (piglit_is_extension_supported("GL_ARB_texture_multisample")){
- pass &= test_multisample();
- pass &= test_multisample_texture_base();
+ pass = test_multisample() && pass;
+ pass = test_multisample_texture_base() && pass;
}
if (piglit_is_extension_supported("GL_ARB_texture_rectangle")) {
- pass &= test_texture_rec();
- pass &= test_texture_rec_min_filter();
- pass &= test_texture_rec_texture_base();
+ pass = test_texture_rec() && pass;
+ pass = test_texture_rec_min_filter() && pass;
+ pass = test_texture_rec_texture_base() && pass;
}
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
diff --git a/tests/spec/arb_direct_state_access/texture-params.c b/tests/spec/arb_direct_state_access/texture-params.c
index 66fb9db..d603aeb 100644
--- a/tests/spec/arb_direct_state_access/texture-params.c
+++ b/tests/spec/arb_direct_state_access/texture-params.c
@@ -76,7 +76,7 @@ piglit_display(void)
/* f case */
glTextureParameterf(name, GL_TEXTURE_MIN_LOD, scalarf);
glGetTextureParameterfv(name, GL_TEXTURE_MIN_LOD, ¶mf);
- pass &= piglit_check_gl_error(GL_NO_ERROR);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
if (paramf != scalarf) {
printf("glTextureParameterf did not correctly set "
"GL_TEXTURE_MIN_LOD.\n\tValue returned by "
@@ -88,7 +88,7 @@ piglit_display(void)
/* fv case */
glTextureParameterfv(name, GL_TEXTURE_BORDER_COLOR, colorfv);
glGetTextureParameterfv(name, GL_TEXTURE_BORDER_COLOR, ¶mfv[0]);
- pass &= piglit_check_gl_error(GL_NO_ERROR);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
for (i = 0; i < 4; ++i) {
if (paramfv[i] != colorfv[i]) {
printf("glTextureParameterfv did not correctly set "
@@ -104,7 +104,7 @@ piglit_display(void)
/* i case */
glTextureParameteri(name, GL_TEXTURE_MAX_LEVEL, scalari);
glGetTextureParameteriv(name, GL_TEXTURE_MAX_LEVEL, ¶mi);
- pass &= piglit_check_gl_error(GL_NO_ERROR);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
if (parami != scalari) {
printf("glTextureParameteri did not correctly set "
"GL_TEXTURE_MAX_LEVEL.\n\tValue returned by "
@@ -117,7 +117,7 @@ piglit_display(void)
/* i (enum) case */
glTextureParameteri(name, GL_TEXTURE_MIN_FILTER, scalare);
glGetTextureParameterIuiv(name, GL_TEXTURE_MIN_FILTER, ¶me);
- pass &= piglit_check_gl_error(GL_NO_ERROR);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
if (parame != scalare) {
printf("glTextureParameteri did not correctly set "
"GL_TEXTURE_MIN_FILTER.\n\tValue returned by "
@@ -134,7 +134,7 @@ piglit_display(void)
}
glTextureParameteriv(name, GL_TEXTURE_BORDER_COLOR, coloriv);
glGetTextureParameterfv(name, GL_TEXTURE_BORDER_COLOR, ¶mfv[0]);
- pass &= piglit_check_gl_error(GL_NO_ERROR);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
for (i = 0; i < 4; ++i) {
if (fabs(paramfv[i] - colorfv[i]) >= piglit_tolerance[i]) {
printf("glTextureParameteriv did not correctly set "
@@ -150,7 +150,7 @@ piglit_display(void)
/* Iiv case */
glTextureParameterIiv(name, GL_TEXTURE_BORDER_COLOR, colorIiv);
glGetTextureParameterIiv(name, GL_TEXTURE_BORDER_COLOR, ¶mIiv[0]);
- pass &= piglit_check_gl_error(GL_NO_ERROR);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
for (i = 0; i < 4; ++i) {
if (paramIiv[i] != colorIiv[i]) {
printf("glTextureParameterIiv did not correctly set "
@@ -167,7 +167,7 @@ piglit_display(void)
glTextureParameterIuiv(name, GL_TEXTURE_BORDER_COLOR, colorIuiv);
glGetTextureParameterIuiv(name, GL_TEXTURE_BORDER_COLOR,
¶mIuiv[0]);
- pass &= piglit_check_gl_error(GL_NO_ERROR);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
for (i = 0; i < 4; ++i) {
if (paramIuiv[i] != colorIuiv[i]) {
printf("glTextureParameterIuiv did not correctly set "
@@ -183,7 +183,7 @@ piglit_display(void)
/* Iuiv (enum) case */
glTextureParameterIuiv(name, GL_TEXTURE_SWIZZLE_RGBA, swizzle);
glGetTextureParameterIuiv(name, GL_TEXTURE_SWIZZLE_RGBA, ¶mse[0]);
- pass &= piglit_check_gl_error(GL_NO_ERROR);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
for (i = 0; i < 4; ++i) {
if (paramse[i] != swizzle[i]) {
printf("glTextureParameterIuiv did not correctly set "
diff --git a/tests/spec/arb_direct_state_access/texture-storage-multisample.c b/tests/spec/arb_direct_state_access/texture-storage-multisample.c
index f0437d4..6b96bb1 100644
--- a/tests/spec/arb_direct_state_access/texture-storage-multisample.c
+++ b/tests/spec/arb_direct_state_access/texture-storage-multisample.c
@@ -43,28 +43,30 @@ PIGLIT_GL_TEST_CONFIG_END
/* This has the modelview matrix built in. */
static const char multisample_texture_vs_source[] =
-"#version 130\n"
-"in vec2 vertex;\n"
-"out vec2 tex_coords;\n"
-"void main()\n"
-"{\n"
-" tex_coords = vertex;\n"
-" vec2 pos = (vertex.xy * 2) - vec2(1, 1);\n"
-" gl_Position = vec4(pos, 0, 1);\n"
-"}\n";
+ "#version 130\n"
+ "in vec2 vertex;\n"
+ "out vec2 tex_coords;\n"
+ "void main()\n"
+ "{\n"
+ " tex_coords = vertex;\n"
+ " vec2 pos = (vertex.xy * 2) - vec2(1, 1);\n"
+ " gl_Position = vec4(pos, 0, 1);\n"
+ "}\n"
+ ;
static const char multisample_texture_fs_source[] =
-"#version 130\n"
-"#extension GL_ARB_sample_shading : enable\n"
-"in vec2 tex_coords;\n"
-"uniform sampler2DArray tex;\n"
-"uniform int tex_depth;\n"
-"uniform int z;\n"
-"void main()\n"
-"{\n"
-" int layer = (gl_SampleID * tex_depth) + z;\n"
-" gl_FragColor = texture(tex, vec3(tex_coords, layer));\n"
-"}\n";
+ "#version 130\n"
+ "#extension GL_ARB_sample_shading : enable\n"
+ "in vec2 tex_coords;\n"
+ "uniform sampler2DArray tex;\n"
+ "uniform int tex_depth;\n"
+ "uniform int z;\n"
+ "void main()\n"
+ "{\n"
+ " int layer = (gl_SampleID * tex_depth) + z;\n"
+ " gl_FragColor = texture(tex, vec3(tex_coords, layer));\n"
+ "}\n"
+ ;
/**
* Uploads an arbitrary multisample texture.
@@ -130,10 +132,9 @@ texture_sub_image_multisample(GLenum tex, GLenum target,
if (target == GL_TEXTURE_2D_MULTISAMPLE) {
assert(depth == 1);
- }
- else if (target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) {
- }
- else {
+ } else if (target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) {
+ /* empty */
+ } else {
assert(!"Invalid texture target");
return;
}
@@ -168,7 +169,8 @@ texture_sub_image_multisample(GLenum tex, GLenum target,
glGetFloatv(GL_MIN_SAMPLE_SHADING_VALUE_ARB, &backup.min_sample_shading);
/* This ensures that copying is done on a per-sample basis rather than
- * the default per-pixel basis. */
+ * the default per-pixel basis.
+ */
glEnable(GL_SAMPLE_SHADING_ARB);
glMinSampleShadingARB(1.0f);
@@ -194,7 +196,8 @@ texture_sub_image_multisample(GLenum tex, GLenum target,
/* When we call draw arrays, the data (in array_tex) will get drawn
* into our texture (in tex) because it's attached to
- * the framebuffer. */
+ * the framebuffer.
+ */
if (target == GL_TEXTURE_2D_MULTISAMPLE) {
glUniform1i(z_loc, 0);
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER,
@@ -239,15 +242,15 @@ check_non_generated_texture(void)
{
bool pass = true;
- /* Attempting to call TextureStorage* for a texture name that was not
- * generated by OpenGL must fail with INVALID_OPERATION
- * (OpenGL 4.5 core spec 30.10.2014, beginning of Section 8.19
- * Immutable-Format Texture Images).
+ /* Section 8.19 of the OpenGL 4.5 Core Profile spec says:
+ *
+ * "An INVALID_OPERATION error is generated by TextureStorage* if
+ * texture is not the name of an existing texture object."
*/
glTextureStorage2DMultisample(250, 4, GL_RGBA8, 64, 64, GL_TRUE);
- pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
glTextureStorage3DMultisample(250, 4, GL_RGBA8, 64, 64, 3, GL_TRUE);
- pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
"non-generated texture name");
@@ -259,17 +262,17 @@ check_unsized_format(void)
{
bool pass = true;
- /* Attempting to call TextureStorage* with an unsized internalformat
- * must fail with INVALID_ENUM (OpenGL 4.5 core spec 30.10.2014,
- * beginning of Section 8.19 Immutable-Format Texture Images)
+ /* Section 8.19 of the OpenGL 4.5 Core Profile spec says:
+ *
+ * "An INVALID_ENUM error is generated if internalformat is one of
+ * the unsized base internal formats listed in table 8.11."
*/
-
GLuint tex;
glCreateTextures(GL_TEXTURE_2D_MULTISAMPLE, 1, &tex);
glTextureStorage2DMultisample(tex, 4, GL_RGBA, 64, 64, GL_TRUE);
/* unsized formats may not be used with TexStorage* */
- pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
"unsized-format");
return pass;
@@ -285,7 +288,7 @@ check_immutable(void)
glCreateTextures(GL_TEXTURE_2D_MULTISAMPLE, 1, &tex);
/* specify storage for the texture, and mark it immutable-format */
glTextureStorage2DMultisample(tex, 4, GL_RGBA8, 64, 64, GL_TRUE);
- pass &= piglit_check_gl_error(GL_NO_ERROR);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
/* should now have TEXTURE_IMMUTABLE_FORMAT */
glGetTextureParameteriv(tex, GL_TEXTURE_IMMUTABLE_FORMAT, ¶m);
@@ -337,7 +340,8 @@ draw_multisampled(void)
/* Make a texture of size piglit_width x piglit_height that is divided
* into two triangles by a diagonal (\) line. (Use \ rather than /
- * because texture_sub_image_multisample uses /.) */
+ * because texture_sub_image_multisample uses /.)
+ */
/* TODO: Do spatial anti-aliasing rather than blending. */
GLubyte* data = malloc(4 * samples * piglit_width * piglit_height *
sizeof(GLubyte));
@@ -375,7 +379,8 @@ draw_multisampled(void)
data);
/* Draw the image. Can't use piglit_draw_rect_tex because the OpenGL
- * 1.0 pipeline doesn't handle multisample textures. */
+ * 1.0 pipeline doesn't handle multisample textures.
+ */
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
@@ -384,7 +389,8 @@ draw_multisampled(void)
glBlitFramebuffer(0, 0, piglit_width, piglit_height,
0, 0, piglit_width, piglit_height,
GL_COLOR_BUFFER_BIT, GL_LINEAR);
- pass &= piglit_check_gl_error(GL_NO_ERROR);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+
/* TODO: Add a Piglit probe call to check the output */
if (!piglit_automatic) {
piglit_present_results();
@@ -407,14 +413,14 @@ trivial_but_should_work(void)
/* 2D case */
glCreateTextures(GL_TEXTURE_2D_MULTISAMPLE, 1, &texture);
glTextureStorage2DMultisample(texture, 4, GL_RGBA8, 64, 64, GL_TRUE);
- pass &= piglit_check_gl_error(GL_NO_ERROR);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
/* 3D case */
glDeleteTextures(1, &texture);
glCreateTextures(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, 1, &texture);
glTextureStorage3DMultisample(texture, 4, GL_RGBA8, 64, 64, 3,
GL_TRUE);
- pass &= piglit_check_gl_error(GL_NO_ERROR);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
"trivial, but should work");
@@ -431,19 +437,19 @@ check_improper_effective_target(void)
glCreateTextures(GL_TEXTURE_2D_MULTISAMPLE, 1, &texture);
glTextureStorage3DMultisample(texture, 4, GL_RGBA8, 64, 64, 3,
GL_TRUE);
- pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
/* 2D case with 3D target */
glDeleteTextures(1, &texture);
glCreateTextures(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, 1, &texture);
glTextureStorage2DMultisample(texture, 4, GL_RGBA8, 64, 64, GL_TRUE);
- pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
/* 2D case with non-multisampled target */
glDeleteTextures(1, &texture);
glCreateTextures(GL_TEXTURE_2D, 1, &texture);
glTextureStorage2DMultisample(texture, 4, GL_RGBA8, 64, 64, GL_TRUE);
- pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
"improper effective target");
@@ -463,19 +469,14 @@ piglit_init(int argc, char **argv)
enum piglit_result
piglit_display(void)
{
- enum piglit_result result = PIGLIT_PASS;
- if (!check_non_generated_texture())
- result = PIGLIT_FAIL;
- if (!check_immutable())
- result = PIGLIT_FAIL;
- if (!check_unsized_format())
- result = PIGLIT_FAIL;
- if (!check_improper_effective_target())
- result = PIGLIT_FAIL;
- if (!trivial_but_should_work())
- result = PIGLIT_FAIL;
- if (!draw_multisampled())
- result = PIGLIT_FAIL;
-
- return result;
+ bool pass = true;
+
+ pass = check_non_generated_texture() && pass;
+ pass = check_immutable() && pass;
+ pass = check_unsized_format() && pass;
+ pass = check_improper_effective_target() && pass;
+ pass = trivial_but_should_work() && pass;
+ pass = draw_multisampled() && pass;
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
diff --git a/tests/spec/arb_direct_state_access/texture-storage.c b/tests/spec/arb_direct_state_access/texture-storage.c
index 16bd39d..d73224d 100644
--- a/tests/spec/arb_direct_state_access/texture-storage.c
+++ b/tests/spec/arb_direct_state_access/texture-storage.c
@@ -26,11 +26,6 @@
/**
* Note: only the glTextureStorage2D() function is tested with actual
* rendering.
- *
- * Original author: Brian Paul
- * Adapted for testing ARB_direct_state_access by
- * Laura Ekstrand
- * November 2014
*/
#include "piglit-util-gl.h"
@@ -78,11 +73,9 @@ test_one_level_errors(GLenum target)
if (target == GL_TEXTURE_1D) {
glTextureStorage1D(tex, 1, GL_RGBA8, width);
- }
- else if (target == GL_TEXTURE_2D) {
+ } else if (target == GL_TEXTURE_2D) {
glTextureStorage2D(tex, 1, GL_RGBA8, width, height);
- }
- else if (target == GL_TEXTURE_3D) {
+ } else if (target == GL_TEXTURE_3D) {
glTextureStorage3D(tex, 1, GL_RGBA8, width, height, depth);
}
@@ -174,12 +167,10 @@ test_mipmap_errors(GLenum target)
if (target == GL_TEXTURE_1D) {
glTextureStorage1D(tex, levels, GL_RGBA8, width);
targetString = "GL_TEXTURE_1D";
- }
- else if (target == GL_TEXTURE_2D) {
+ } else if (target == GL_TEXTURE_2D) {
glTextureStorage2D(tex, levels, GL_RGBA8, width, height);
targetString = "GL_TEXTURE_2D";
- }
- else if (target == GL_TEXTURE_3D) {
+ } else if (target == GL_TEXTURE_3D) {
glTextureStorage3D(tex, levels, GL_RGBA8, width,
height, depth);
targetString = "GL_TEXTURE_3D";
diff --git a/tests/spec/arb_direct_state_access/texturesubimage.c b/tests/spec/arb_direct_state_access/texturesubimage.c
index ded934d..a1c1ce0 100644
--- a/tests/spec/arb_direct_state_access/texturesubimage.c
+++ b/tests/spec/arb_direct_state_access/texturesubimage.c
@@ -23,24 +23,13 @@
*
*/
-
/**
* Test glTextureSubImage*D. This is pretty trivial, since it only uses
* glTextureSubImage*D with offsets of 0 and the width, height, and depth of
* the full image. Moreover, it doesn't test varying depths for the 3D case.
* But since DSA functions share backends with the non-DSA ones, we really
* only need to test entry points here.
- *
- * Laura Ekstrand
- * October 2014
- *
- * Based on texsubimage.c by
- * Brian Paul
- * October 2011
- *
*/
-
-
#include "piglit-util-gl.h"
#include <stdlib.h>
#include <string.h>
@@ -82,14 +71,12 @@ subtest(GLenum target)
glTextureStorage1D(tex, 1, GL_RGBA8, piglit_width);
glTextureSubImage1D(tex, 0, 0, piglit_width, GL_RGBA,
GL_UNSIGNED_BYTE, refImg);
- }
- else if (target == GL_TEXTURE_2D) {
+ } else if (target == GL_TEXTURE_2D) {
glTextureStorage2D(tex, 1, GL_RGBA8, piglit_width,
piglit_height);
glTextureSubImage2D(tex, 0, 0, 0, piglit_width, piglit_height,
GL_RGBA, GL_UNSIGNED_BYTE, refImg);
- }
- else if (target == GL_TEXTURE_3D) {
+ } else if (target == GL_TEXTURE_3D) {
glTextureStorage3D(tex, 1, GL_RGBA8, piglit_width,
piglit_height, depth);
glTextureSubImage3D(tex, 0, 0, 0, 0,
@@ -103,13 +90,14 @@ subtest(GLenum target)
glClear(GL_COLOR_BUFFER_BIT);
piglit_draw_rect_tex(0, 0, piglit_width, piglit_height, 0, 0, 1, 1);
if (target == GL_TEXTURE_1D) {
- pass &= piglit_probe_image_ubyte(0, 0, piglit_width, 1,
- GL_RGBA, refImg);
- }
- else {
- pass &= piglit_probe_image_ubyte(0, 0, piglit_width,
+ pass = piglit_probe_image_ubyte(0, 0, piglit_width, 1,
+ GL_RGBA, refImg)
+ && pass;
+ } else {
+ pass = piglit_probe_image_ubyte(0, 0, piglit_width,
piglit_height,
- GL_RGBA, refImg);
+ GL_RGBA, refImg)
+ && pass;
}
if (!piglit_automatic)
diff --git a/tests/spec/arb_direct_state_access/texunits.c b/tests/spec/arb_direct_state_access/texunits.c
index adc2400..43a702d 100644
--- a/tests/spec/arb_direct_state_access/texunits.c
+++ b/tests/spec/arb_direct_state_access/texunits.c
@@ -21,13 +21,11 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
/**
* @file
* Test texture unit state with respect to the different number of
* texture coord units, image units, combined units, etc.
*/
-
#include "piglit-util-gl.h"
PIGLIT_GL_TEST_CONFIG_BEGIN
@@ -153,8 +151,7 @@ test_rasterpos(void)
if (!piglit_check_gl_error(GL_INVALID_ENUM)) {
return GL_FALSE;
}
- }
- else {
+ } else {
/* INVALID_OPERATION is expected */
glGetFloatv(GL_CURRENT_RASTER_TEXTURE_COORDS, v);
if (!piglit_check_gl_error(GL_INVALID_OPERATION)) {
@@ -193,9 +190,8 @@ test_texture_matrix(void)
}
/* there should be no errors at this point */
- if (!piglit_check_gl_error(GL_NO_ERROR)) {
+ if (!piglit_check_gl_error(GL_NO_ERROR))
return GL_FALSE;
- }
/* this should generate an error */
{
@@ -203,16 +199,14 @@ test_texture_matrix(void)
glActiveTexture(GL_TEXTURE0 + MaxTextureCoordUnits);
if (MaxTextureCoordUnits == MaxTextureCombinedUnits) {
/* INVALID_ENUM is expected */
- if (!piglit_check_gl_error(GL_INVALID_ENUM)) {
+ if (!piglit_check_gl_error(GL_INVALID_ENUM))
return GL_FALSE;
- }
- }
- else {
+
+ } else {
/* INVALID_OPERATION is expected */
glGetFloatv(GL_TEXTURE_MATRIX, m);
- if (!piglit_check_gl_error(GL_INVALID_OPERATION)) {
+ if (!piglit_check_gl_error(GL_INVALID_OPERATION))
return GL_FALSE;
- }
}
}
@@ -281,9 +275,8 @@ test_texture_env(void)
for (i = 0; i < MaxTextureCombinedUnits; i++) {
glActiveTexture(GL_TEXTURE0 + i);
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, Random[i]);
- if (!piglit_check_gl_error(GL_NO_ERROR)) {
+ if (!piglit_check_gl_error(GL_NO_ERROR))
return GL_FALSE;
- }
}
/* check per-unit state */
@@ -299,9 +292,8 @@ test_texture_env(void)
}
/* there should be no errors at this point */
- if (!piglit_check_gl_error(GL_NO_ERROR)) {
+ if (!piglit_check_gl_error(GL_NO_ERROR))
return GL_FALSE;
- }
return GL_TRUE;
}
@@ -332,23 +324,24 @@ piglit_display(void)
}
-static void
-init(void)
+void
+piglit_init(int argc, char *argv[])
{
+ piglit_require_gl_version(13);
+ piglit_require_extension("GL_ARB_direct_state_access");
+
if (piglit_is_extension_supported("GL_ARB_vertex_shader")) {
glGetIntegerv(GL_MAX_TEXTURE_COORDS, &MaxTextureCoordUnits);
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &MaxTextureImageUnits);
glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &MaxTextureVertexUnits);
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &MaxTextureCombinedUnits);
- }
- else if (piglit_is_extension_supported("GL_ARB_fragment_shader") ||
- piglit_is_extension_supported("GL_ARB_fragment_program")) {
+ } else if (piglit_is_extension_supported("GL_ARB_fragment_shader") ||
+ piglit_is_extension_supported("GL_ARB_fragment_program")) {
glGetIntegerv(GL_MAX_TEXTURE_COORDS, &MaxTextureCoordUnits);
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &MaxTextureImageUnits);
MaxTextureVertexUnits = 0;
MaxTextureCombinedUnits = MaxTextureImageUnits;
- }
- else {
+ } else {
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &MaxTextureCoordUnits);
MaxTextureImageUnits =
MaxTextureCombinedUnits = MaxTextureCoordUnits;
@@ -370,14 +363,3 @@ init(void)
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
-
-
-void
-piglit_init(int argc, char *argv[])
-{
- piglit_require_gl_version(13);
- piglit_require_extension("GL_ARB_direct_state_access");
-
- init();
-}
-
--
2.1.0
More information about the Piglit
mailing list