Commit bba2a8ed authored by Marek Olšák's avatar Marek Olšák

util: make piglit_rgbw_texture set unclamped pixels when requested

parent 006dca5d
......@@ -144,7 +144,7 @@ create_tex(GLenum internalformat, GLenum baseformat)
} else {
tex = piglit_rgbw_texture(internalformat,
tex_width, tex_height, GL_FALSE,
GL_TRUE);
GL_TRUE, GL_UNSIGNED_NORMALIZED);
format = GL_RGBA;
type = GL_FLOAT;
}
......
......@@ -151,5 +151,5 @@ piglit_init(int argc, char **argv)
piglit_EnableVertexAttribArray(0);
piglit_EnableVertexAttribArray(1);
tex = piglit_rgbw_texture(GL_RGBA8, 64, 64, GL_FALSE, GL_TRUE);
tex = piglit_rgbw_texture(GL_RGBA8, 64, 64, GL_FALSE, GL_TRUE, GL_UNSIGNED_NORMALIZED);
}
......@@ -48,7 +48,7 @@ piglit_display(void)
GLuint tex;
glActiveTexture(GL_TEXTURE1);
tex = piglit_rgbw_texture(GL_RGBA, 8, 8, GL_FALSE, GL_FALSE);
tex = piglit_rgbw_texture(GL_RGBA, 8, 8, GL_FALSE, GL_FALSE, GL_UNSIGNED_NORMALIZED);
glEnable(GL_TEXTURE_2D);
glMatrixMode(GL_TEXTURE);
......
......@@ -50,7 +50,7 @@ piglit_display(void)
GLuint tex;
glActiveTexture(GL_TEXTURE1);
tex = piglit_rgbw_texture(GL_RGBA, 8, 8, GL_FALSE, GL_FALSE);
tex = piglit_rgbw_texture(GL_RGBA, 8, 8, GL_FALSE, GL_FALSE, GL_UNSIGNED_NORMALIZED);
glEnable(GL_TEXTURE_2D);
glMatrixMode(GL_TEXTURE);
......
......@@ -777,7 +777,7 @@ piglit_display(void)
"texture rgbw %d ( %d , %d )",
&tex, &w, &h) == 3) {
glActiveTexture(GL_TEXTURE0 + tex);
piglit_rgbw_texture(GL_RGBA, w, h, GL_FALSE, GL_FALSE);
piglit_rgbw_texture(GL_RGBA, w, h, GL_FALSE, GL_FALSE, GL_UNSIGNED_NORMALIZED);
glEnable(GL_TEXTURE_2D);
} else if (sscanf(line,
"texture checkerboard %d %d ( %d , %d ) "
......
......@@ -106,7 +106,7 @@ piglit_display(void)
/* First: the base texture. */
tex = piglit_rgbw_texture(GL_RGBA, TEXSIZE, TEXSIZE,
GL_FALSE, GL_FALSE);
GL_FALSE, GL_FALSE, GL_UNSIGNED_NORMALIZED);
glActiveTexture(tex_unit);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, tex);
......
......@@ -111,11 +111,11 @@ piglit_display(void)
glClear(GL_COLOR_BUFFER_BIT);
tex = piglit_rgbw_texture(GL_COMPRESSED_RGB_FXT1_3DFX, SIZE, SIZE,
GL_TRUE, GL_FALSE);
GL_TRUE, GL_FALSE, GL_UNSIGNED_NORMALIZED);
display_mipmaps(10, 10 + (10 + SIZE) * 0);
glDeleteTextures(1, &tex);
tex = piglit_rgbw_texture(GL_COMPRESSED_RGBA_FXT1_3DFX, SIZE, SIZE,
GL_TRUE, GL_FALSE);
GL_TRUE, GL_FALSE, GL_UNSIGNED_NORMALIZED);
display_mipmaps(10, 10 + (10 + SIZE) * 1);
glDeleteTextures(1, &tex);
......
......@@ -110,19 +110,19 @@ piglit_display(void)
glClear(GL_COLOR_BUFFER_BIT);
tex = piglit_rgbw_texture(GL_COMPRESSED_RGB_S3TC_DXT1_EXT, SIZE, SIZE,
GL_TRUE, GL_FALSE);
GL_TRUE, GL_FALSE, GL_UNSIGNED_NORMALIZED);
display_mipmaps(10, 10 + (10 + SIZE) * 0);
glDeleteTextures(1, &tex);
tex = piglit_rgbw_texture(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, SIZE, SIZE,
GL_TRUE, GL_FALSE);
GL_TRUE, GL_FALSE, GL_UNSIGNED_NORMALIZED);
display_mipmaps(10, 10 + (10 + SIZE) * 1);
glDeleteTextures(1, &tex);
tex = piglit_rgbw_texture(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, SIZE, SIZE,
GL_TRUE, GL_FALSE);
GL_TRUE, GL_FALSE, GL_UNSIGNED_NORMALIZED);
display_mipmaps(10, 10 + (10 + SIZE) * 2);
glDeleteTextures(1, &tex);
tex = piglit_rgbw_texture(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, SIZE, SIZE,
GL_TRUE, GL_FALSE);
GL_TRUE, GL_FALSE, GL_UNSIGNED_NORMALIZED);
display_mipmaps(10, 10 + (10 + SIZE) * 3);
glDeleteTextures(1, &tex);
......
......@@ -92,7 +92,7 @@ piglit_display(void)
float white[4] = {1.0, 1.0, 1.0, 1.0};
tex = piglit_rgbw_texture(GL_RGBA, TEXSIZE, TEXSIZE,
GL_FALSE, GL_FALSE);
GL_FALSE, GL_FALSE, GL_UNSIGNED_NORMALIZED);
glActiveTexture(GL_TEXTURE1);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, tex);
......
......@@ -701,7 +701,7 @@ piglit_checkerboard_texture(GLuint tex, unsigned level,
*/
GLuint
piglit_rgbw_texture(GLenum format, int w, int h, GLboolean mip,
GLboolean alpha)
GLboolean alpha, GLenum basetype)
{
GLfloat *data;
int size, x, y, level;
......@@ -718,6 +718,32 @@ piglit_rgbw_texture(GLenum format, int w, int h, GLboolean mip,
white[3] = 1.0;
}
switch (basetype) {
case GL_UNSIGNED_NORMALIZED:
break;
case GL_SIGNED_NORMALIZED:
for (x = 0; x < 4; x++) {
red[x] = red[x] * 2 - 1;
green[x] = green[x] * 2 - 1;
blue[x] = blue[x] * 2 - 1;
white[x] = white[x] * 2 - 1;
}
break;
case GL_FLOAT:
for (x = 0; x < 4; x++) {
red[x] = red[x] * 10 - 5;
green[x] = green[x] * 10 - 5;
blue[x] = blue[x] * 10 - 5;
white[x] = white[x] * 10 - 5;
}
break;
default:
assert(0);
}
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
......
......@@ -138,7 +138,7 @@ GLuint piglit_checkerboard_texture(GLuint tex, unsigned level,
unsigned horiz_square_size, unsigned vert_square_size,
const float *black, const float *white);
GLuint piglit_rgbw_texture(GLenum format, int w, int h, GLboolean mip,
GLboolean alpha);
GLboolean alpha, GLenum basetype);
GLuint piglit_depth_texture(GLenum format, int w, int h, GLboolean mip);
void piglit_set_tolerance_for_bits(int rbits, int gbits, int bbits, int abits);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment