Commit f63c6796 authored by Chad Versace's avatar Chad Versace

tests: Remove all uses of glutBitmapCharacter

I'm trying to transition Piglit from using GLUT to using Waffle. This
requires killing all uses of GLUT functions, one-by-one.

Only three tests used glutBitmapCharacter,
    texturing/getteximage-formats
    texturing/texture-packed-formats
    texturing/texwrap
and the test results were not affected by the function. It was used only
in non-auto mode to print information about the texture format to the
window.

These tests were removed from the build when using Waffle, since
glut_waffle does not implement glutBitmapCharacter. This patch returns
them to the build.
Acked-by: Eric Anholt's avatarEric Anholt <eric@anholt.net>
Tested-by: Paul Berry's avatarPaul Berry <stereotype441@gmail.com>
Reviewed-and-tested-by: Jordan Justen's avatarJordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke's avatarKenneth Graunke <kenneth@whitecape.org>
Signed-off-by: default avatarChad Versace <chad.versace@linux.intel.com>
parent 4f79da52
......@@ -10,13 +10,6 @@ link_libraries (
${OPENGL_glu_LIBRARY}
)
if(NOT USE_WAFFLE)
# These tests use glutBitmapCharacter.
piglit_add_executable (getteximage-formats getteximage-formats.c)
piglit_add_executable (texture-packed-formats texture-packed-formats.c)
piglit_add_executable (texwrap texwrap.c)
endif(NOT USE_WAFFLE)
piglit_add_executable (1-1-linear-texture 1-1-linear-texture.c)
piglit_add_executable (array-depth-roundtrip array-depth-roundtrip.c)
piglit_add_executable (array-texture array-texture.c)
......@@ -35,6 +28,7 @@ piglit_add_executable (gen-compressed-teximage gen-compressed-teximage.c)
piglit_add_executable (gen-nonzero-unit gen-nonzero-unit.c)
piglit_add_executable (gen-teximage gen-teximage.c)
piglit_add_executable (gen-texsubimage gen-texsubimage.c)
piglit_add_executable (getteximage-formats getteximage-formats.c)
piglit_add_executable (getteximage-simple getteximage-simple.c)
piglit_add_executable (getteximage-luminance getteximage-luminance.c)
piglit_add_executable (incomplete-texture incomplete-texture.c)
......@@ -74,6 +68,8 @@ piglit_add_executable (texdepth texdepth.c)
piglit_add_executable (teximage-errors teximage-errors.c)
piglit_add_executable (texrect-many texrect-many.c)
piglit_add_executable (texredefine texredefine.c)
piglit_add_executable (texture-packed-formats texture-packed-formats.c)
piglit_add_executable (texwrap texwrap.c)
piglit_add_executable (depth-tex-modes depth-tex-modes.c depth-tex-modes-common.c)
piglit_add_executable (depth-tex-modes-rg depth-tex-modes-rg.c depth-tex-modes-common.c)
piglit_add_executable (depth-tex-modes-glsl depth-tex-modes-glsl.c)
......
......@@ -82,36 +82,6 @@ make_texture_image(GLenum intFormat, GLubyte upperRightTexel[4])
return glGetError() == GL_NO_ERROR;
}
static void
print(int x, int y, const char *s)
{
glColor3f(1, 1, 1);
glWindowPos2iARB(x, y);
while (*s) {
glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
s++;
}
}
static void
draw_format_text(const struct test_desc *test,
const struct format_desc *fmt)
{
char s[200];
sprintf(s, "%s: %s", test->param, fmt->name);
print(10, piglit_height - 20, s);
}
static void
draw_unsupported(void)
{
print(10, piglit_height - 40, "Not supported by test");
}
static GLfloat
ubyte_to_float(GLubyte b, GLint bits)
{
......@@ -352,19 +322,12 @@ test_format(const struct test_desc *test,
glClear(GL_COLOR_BUFFER_BIT);
if (!piglit_automatic) {
draw_format_text(test, fmt);
}
if (fmt->internalformat == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT ||
fmt->internalformat == GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT) {
/* The RGBA_DXT1 formats seem to expose a Mesa/libtxc_dxtn bug.
* Just skip them for now. Testing the other compressed formats
* is good enough.
*/
draw_unsupported();
}
else {
/* The RGBA_DXT1 formats seem to expose a Mesa/libtxc_dxtn bug.
* Just skip them for now. Testing the other compressed formats
* is good enough.
*/
if (fmt->internalformat != GL_COMPRESSED_RGBA_S3TC_DXT1_EXT &&
fmt->internalformat != GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT) {
/* init texture image */
if (!make_texture_image(fmt->internalformat, upperRightTexel))
return GL_TRUE; /* unsupported = OK */
......@@ -383,9 +346,6 @@ test_format(const struct test_desc *test,
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
if (!piglit_automatic)
print(x, y - 18, "Textured Quad");
x += TEX_WIDTH + 20;
level = 0;
......@@ -405,17 +365,6 @@ test_format(const struct test_desc *test,
glDisable(GL_BLEND);
assert(!glIsEnabled(GL_TEXTURE_2D));
if (!piglit_automatic) {
if (level == 0) {
print(x, y - 18, "glGetTexImage");
print(x, y - 30, "level 0");
}
else {
char s[10];
sprintf(s, "%d", level);
print(x, y - 18, s);
}
}
if (level <= 2) {
GLint rx = x + w-1;
......@@ -513,8 +462,6 @@ piglit_display(void)
}
else {
glClear(GL_COLOR_BUFFER_BIT);
draw_format_text(set, &set->format[format_index]);
draw_unsupported();
piglit_present_results();
}
}
......
......@@ -44,9 +44,6 @@ PIGLIT_GL_TEST_MAIN(
620 /*window_height*/,
GLUT_RGB | GLUT_DOUBLE)
static GLboolean PrintInfo = GL_TRUE;
struct pixel_format {
const char *name;
GLenum format;
......@@ -143,16 +140,6 @@ static const struct name_format IntFormats[] = {
static GLboolean Blend = GL_FALSE; /* XXX not used at this time */
static void
PrintString(const char *s)
{
while (*s) {
glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
s++;
}
}
static void
MakeTexture(GLuint dims, const struct pixel_format *format,
GLenum intFormat, GLboolean swap)
......@@ -261,7 +248,6 @@ Test(GLuint intFmt, GLuint dims)
{
static const float red[4] = {1, 0, 0, 1};
static const float green[4] = {0, 1, 0, 1};
char s[1000];
int w = 350, h = 20;
int i, swap;
GLboolean pass = GL_TRUE;
......@@ -308,13 +294,6 @@ Test(GLuint intFmt, GLuint dims)
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
if (PrintInfo) {
glColor3f(0, 0, 0);
glRasterPos2i(8, 6);
PrintString(Formats[i].name);
}
glPopMatrix();
/* test rendering */
......@@ -332,51 +311,11 @@ Test(GLuint intFmt, GLuint dims)
}
}
if (PrintInfo) {
i = NUM_FORMATS;
glPushMatrix();
glTranslatef(2, i * (h + 2), 0);
glColor3f(1, 1, 1);
glRasterPos2i(8, 6);
PrintString("Normal");
glRasterPos2i(w + 2, 6);
PrintString("Byte Swapped");
glPopMatrix();
glPushMatrix();
glTranslatef(2, (i + 1) * (h + 2), 0);
glRasterPos2i(8, 6);
sprintf(s, "Internal Texture Format: %s (%d of %u)",
IntFormats[intFmt].name, intFmt + 1,
(unsigned) NUM_INT_FORMATS);
PrintString(s);
glPopMatrix();
glPushMatrix();
glTranslatef(2, (i + 2) * (h + 2), 0);
glRasterPos2i(8, 6);
if (dims == 3)
PrintString("Target: GL_TEXTURE_3D");
else
PrintString("Target: GL_TEXTURE_2D");
glPopMatrix();
glPushMatrix();
glTranslatef(2, (i + 3) * (h + 2), 0);
glRasterPos2i(8, 6);
if (Blend)
PrintString("Blend: Yes");
else
PrintString("Blend: No");
glPopMatrix();
}
piglit_present_results();
return pass;
}
enum piglit_result
piglit_display(void)
{
......@@ -414,7 +353,5 @@ piglit_init(int argc, char **argv)
glTexParameteri(GL_TEXTURE_3D, 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);
PrintInfo = !piglit_automatic;
}
......@@ -393,15 +393,6 @@ PIGLIT_GL_TEST_MAIN(
extern int piglit_automatic;
static void print_string(const char *s)
{
while (*s) {
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10, (int) *s);
s++;
}
}
static void sample_nearest(int x, int y, int z,
GLenum wrap_mode, GLenum filter,
unsigned char pixel[4])
......@@ -724,7 +715,6 @@ static void draw()
glWindowPos2iARB(offset * (TILE_SIZE + TILE_SPACE) + 5,
5 + ((offset & 1) * 15));
print_string(wrap_modes[i].name);
offset++;
}
}
......
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