[Piglit] [PATCH v2 04/15] nv_conditional_render: do not depend on float-textures
Erik Faye-Lund
erik.faye-lund at collabora.com
Wed Nov 7 21:14:09 UTC 2018
OpenGL is pretty flexible in how you can upload textures, but OpenGL ES
isn't. Let's change this to use unsigned byte texture components instead
of floats, to increase compatiblity.
Signed-off-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
---
tests/spec/nv_conditional_render/blitframebuffer.c | 3 ++-
tests/spec/nv_conditional_render/common.c | 8 ++++----
tests/spec/nv_conditional_render/common.h | 2 +-
tests/spec/nv_conditional_render/copyteximage.c | 2 +-
tests/spec/nv_conditional_render/copytexsubimage.c | 2 +-
tests/spec/nv_conditional_render/generatemipmap.c | 5 +++--
6 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/tests/spec/nv_conditional_render/blitframebuffer.c b/tests/spec/nv_conditional_render/blitframebuffer.c
index a35557805..062af4d48 100644
--- a/tests/spec/nv_conditional_render/blitframebuffer.c
+++ b/tests/spec/nv_conditional_render/blitframebuffer.c
@@ -64,6 +64,7 @@ piglit_display(void)
{
bool pass = true;
float green[4] = {0.0, 1.0, 0.0, 0.0};
+ GLubyte green_ub[4] = {0, 0xFF, 0, 0};
GLuint q, texture;
glClearColor(0.5, 0.5, 0.5, 0.5);
@@ -83,7 +84,7 @@ piglit_display(void)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- fill_tex(0, piglit_width, piglit_height / 2, green);
+ fill_tex(0, piglit_width, piglit_height / 2, green_ub);
glGenQueries(1, &q);
diff --git a/tests/spec/nv_conditional_render/common.c b/tests/spec/nv_conditional_render/common.c
index 4d6c03198..b183bfb36 100644
--- a/tests/spec/nv_conditional_render/common.c
+++ b/tests/spec/nv_conditional_render/common.c
@@ -26,12 +26,12 @@
#include "piglit-util-gl.h"
void
-fill_tex(int level, int w, int h, const float *color)
+fill_tex(int level, int w, int h, const unsigned char *color)
{
- GLfloat *data;
+ GLubyte *data;
int i;
- data = malloc(w * h * 4 * sizeof(GLfloat));
+ data = malloc(w * h * 4 * sizeof(GLubyte));
for (i = 0; i < 4 * w * h; i += 4) {
data[i + 0] = color[0];
data[i + 1] = color[1];
@@ -39,6 +39,6 @@ fill_tex(int level, int w, int h, const float *color)
data[i + 3] = color[3];
}
glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA, w, h, 0,
- GL_RGBA, GL_FLOAT, data);
+ GL_RGBA, GL_UNSIGNED_BYTE, data);
free(data);
}
diff --git a/tests/spec/nv_conditional_render/common.h b/tests/spec/nv_conditional_render/common.h
index fea961d6e..30a9f680f 100644
--- a/tests/spec/nv_conditional_render/common.h
+++ b/tests/spec/nv_conditional_render/common.h
@@ -26,6 +26,6 @@
#define COMMON_H
void
-fill_tex(int level, int w, int h, const float *color);
+fill_tex(int level, int w, int h, const unsigned char *color);
#endif /* COMMON_H */
diff --git a/tests/spec/nv_conditional_render/copyteximage.c b/tests/spec/nv_conditional_render/copyteximage.c
index 1a58e8e22..99e7ba449 100644
--- a/tests/spec/nv_conditional_render/copyteximage.c
+++ b/tests/spec/nv_conditional_render/copyteximage.c
@@ -47,7 +47,7 @@ enum piglit_result
piglit_display(void)
{
bool pass = true;
- float red[4] = {1.0, 0.0, 0.0, 0.0};
+ GLubyte red[4] = {0xFF, 0, 0, 0};
float green[4] = {0.0, 1.0, 0.0, 0.0};
GLuint q, texture;
diff --git a/tests/spec/nv_conditional_render/copytexsubimage.c b/tests/spec/nv_conditional_render/copytexsubimage.c
index c3fa82be0..71bf66b56 100644
--- a/tests/spec/nv_conditional_render/copytexsubimage.c
+++ b/tests/spec/nv_conditional_render/copytexsubimage.c
@@ -47,7 +47,7 @@ enum piglit_result
piglit_display(void)
{
bool pass = true;
- float red[4] = {1.0, 0.0, 0.0, 0.0};
+ GLubyte red[4] = {0xFF, 0, 0, 0};
float green[4] = {0.0, 1.0, 0.0, 0.0};
GLuint q, texture;
diff --git a/tests/spec/nv_conditional_render/generatemipmap.c b/tests/spec/nv_conditional_render/generatemipmap.c
index 7e2781fdd..1e148e5f8 100644
--- a/tests/spec/nv_conditional_render/generatemipmap.c
+++ b/tests/spec/nv_conditional_render/generatemipmap.c
@@ -51,8 +51,9 @@ enum piglit_result
piglit_display(void)
{
bool pass = true;
- float red[4] = {1.0, 0.0, 0.0, 0.0};
+ GLubyte red[4] = {0xFF, 0, 0, 0};
float green[4] = {0.0, 1.0, 0.0, 0.0};
+ GLubyte green_ub[4] = {0, 0xFF, 0, 0};
GLuint q, texture;
int tex_size = 64;
int i;
@@ -73,7 +74,7 @@ piglit_display(void)
for (i = 0; tex_size / (1 << i) > 0; i++) {
int level_size = tex_size / (1 << i);
- fill_tex(i, level_size, level_size, i == 0 ? green : red);
+ fill_tex(i, level_size, level_size, i == 0 ? green_ub : red);
}
glGenQueries(1, &q);
--
2.19.1
More information about the Piglit
mailing list