[Piglit] [PATCH 37/37] glean: delete the now empty tfragprog1.cpp
Dylan Baker
dylan at pnwbakers.com
Mon May 2 21:59:39 UTC 2016
This removes the last remnants of tfragprog1.{cpp,h}. There are already
no tests in the file, so this just rips out the last of the skeleton of
the test.
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
tests/all.py | 4 -
tests/glean/CMakeLists.gl.txt | 1 -
tests/glean/tfragprog1.cpp | 326 ------------------------------------------
tests/glean/tfragprog1.h | 92 ------------
4 files changed, 423 deletions(-)
delete mode 100644 tests/glean/tfragprog1.cpp
delete mode 100644 tests/glean/tfragprog1.h
diff --git a/tests/all.py b/tests/all.py
index 8a67a18..45947cc 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -375,9 +375,6 @@ glean_glsl_tests = ['Primary plus secondary color',
'varying read but not written',
'texcoord varying']
-glean_fp_tests = [
-]
-
glean_vp_tests = ['ABS test',
'ADD test',
'ARL test',
@@ -422,7 +419,6 @@ glean_vp_tests = ['ABS test',
'Infinity and nan test']
for pairs in [(['glsl1'], glean_glsl_tests),
- (['fragProg1'], glean_fp_tests),
(['vertProg1'], glean_vp_tests)]:
for prefix, name in itertools.product(*pairs):
groupname = grouptools.join('glean', '{0}-{1}'.format(prefix, name))
diff --git a/tests/glean/CMakeLists.gl.txt b/tests/glean/CMakeLists.gl.txt
index 576cde1..14a2b33 100644
--- a/tests/glean/CMakeLists.gl.txt
+++ b/tests/glean/CMakeLists.gl.txt
@@ -31,7 +31,6 @@ piglit_add_executable (glean
tbinding.cpp
test.cpp
tfbo.cpp
- tfragprog1.cpp
tglsl1.cpp
tmultitest.cpp
tpixelformats.cpp
diff --git a/tests/glean/tfragprog1.cpp b/tests/glean/tfragprog1.cpp
deleted file mode 100644
index 248169a..0000000
--- a/tests/glean/tfragprog1.cpp
+++ /dev/null
@@ -1,326 +0,0 @@
-// BEGIN_COPYRIGHT -*- glean -*-
-//
-// Copyright (C) 1999 Allen Akin All Rights Reserved.
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the
-// Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-// KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
-// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ALLEN AKIN BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 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.
-//
-// END_COPYRIGHT
-
-// tfragprog.cpp: Test GL_ARB_fragment_program extension.
-// Brian Paul 22 October 2005
-//
-// This is pretty simple. Specific fragment programs are run, we read back
-// the framebuffer color and compare the color to the expected result.
-// Pretty much any fragment program can be tested in the manner.
-// Ideally, an additional fragment program test should be developed which
-// exhaustively tests instruction combinations with all the various swizzle
-// and masking options, etc.
-// But this test is good for regression testing to be sure that particular or
-// unique programs work correctly.
-
-#include <cstdlib>
-#include <cstring>
-#include <cassert>
-#include <cmath>
-#include <math.h>
-#include "tfragprog1.h"
-
-
-namespace GLEAN {
-
-// Clamp X to [0, 1]
-#define CLAMP01( X ) ( (X)<(0.0) ? (0.0) : ((X)>(1.0) ? (1.0) : (X)) )
-// Absolute value
-#define ABS(X) ( (X) < 0.0 ? -(X) : (X) )
-// Max
-#define MAX( A, B ) ( (A) > (B) ? (A) : (B) )
-// Min
-#define MIN( A, B ) ( (A) < (B) ? (A) : (B) )
-// Duplicate value four times
-#define SMEAR(X) (X), (X), (X), (X)
-
-#define DONT_CARE_Z -1.0
-#define DONT_CARE_COLOR -1.0
-
-#define FRAGCOLOR { 0.25, 0.75, 0.5, 0.25 }
-#define PARAM0 { 0.0, 0.0, 0.0, 0.0 }
-#define PARAM1 { 0.5, 0.25, 1.0, 0.5 }
-#define PARAM2 { -1.0, 0.0, 0.25, -0.5 }
-static const GLfloat FragColor[4] = FRAGCOLOR;
-static const GLfloat Param0[4] = PARAM0;
-static const GLfloat Param1[4] = PARAM1;
-static const GLfloat Param2[4] = PARAM2;
-static GLfloat InfNan[4];
-static GLfloat FogColor[4] = {1.0, 1.0, 0.0, 0.0};
-static GLfloat FogStart = 10.0;
-static GLfloat FogEnd = 100.0;
-static GLfloat FogDensity = 0.03;
-static GLfloat FogCoord = 50.0; /* Between FogStart and FogEnd */
-
-
-// These are the specific fragment programs which we'll test
-// Alphabetical order, please
-static const FragmentProgram Programs[] = {
- { NULL, NULL, {0,0,0,0}, 0 } // end of list sentinal
-};
-
-
-
-void
-FragmentProgramTest::setup(void)
-{
- // setup Infinity, Nan values
- int nan;
- float *nanPtr;
-
- nan = (0xff << 23) | (1 << 0);
- nanPtr = (float *) &nan;
- InfNan[0] = HUGE_VAL;
- InfNan[1] = -HUGE_VAL;
- InfNan[2] = (float) (*nanPtr);
- InfNan[3] = 1.0 / HUGE_VAL;
-
- // get function pointers
-
- GLuint progID;
- glGenProgramsARB(1, &progID);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, progID);
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- // load program inputs
- glColor4fv(FragColor);
- glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 0, Param0);
- glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 1, Param1);
- glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 2, Param2);
- glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 9, InfNan);
-
- GLenum err = glGetError();
- assert(!err); // should be OK
-
- // setup vertex transform (we'll draw a quad in middle of window)
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
-#if DEVEL_MODE
- glOrtho(-1.0, 1.0, -1.0, 1.0, 0.0, 1.0);
-#else
- glOrtho(-4.0, 4.0, -4.0, 4.0, 0.0, 1.0);
-#endif
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glDrawBuffer(GL_FRONT);
- glReadBuffer(GL_FRONT);
-
- // other GL state
- glFogf(GL_FOG_START, FogStart);
- glFogf(GL_FOG_END, FogEnd);
- glFogf(GL_FOG_DENSITY, FogDensity);
- glFogfv(GL_FOG_COLOR, FogColor);
- glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
- glFogCoordf(FogCoord);
-
- // compute error tolerances (may need fine-tuning)
- int bufferBits[5];
- glGetIntegerv(GL_RED_BITS, &bufferBits[0]);
- glGetIntegerv(GL_GREEN_BITS, &bufferBits[1]);
- glGetIntegerv(GL_BLUE_BITS, &bufferBits[2]);
- glGetIntegerv(GL_ALPHA_BITS, &bufferBits[3]);
- glGetIntegerv(GL_DEPTH_BITS, &bufferBits[4]);
-
- tolerance[0] = 2.0 / (1 << bufferBits[0]);
- tolerance[1] = 2.0 / (1 << bufferBits[1]);
- tolerance[2] = 2.0 / (1 << bufferBits[2]);
- if (bufferBits[3])
- tolerance[3] = 2.0 / (1 << bufferBits[3]);
- else
- tolerance[3] = 1.0;
- if (bufferBits[4])
- tolerance[4] = 16.0 / (1 << bufferBits[4]);
- else
- tolerance[4] = 1.0;
-}
-
-
-void
-FragmentProgramTest::reportFailure(const char *programName,
- const GLfloat expectedColor[4],
- const GLfloat actualColor[4] ) const
-{
- env->log << "FAILURE:\n";
- env->log << " Program: " << programName << "\n";
- env->log << " Expected color: ";
- env->log << expectedColor[0] << ", ";
- env->log << expectedColor[1] << ", ";
- env->log << expectedColor[2] << ", ";
- env->log << expectedColor[3] << "\n";
- env->log << " Observed color: ";
- env->log << actualColor[0] << ", ";
- env->log << actualColor[1] << ", ";
- env->log << actualColor[2] << ", ";
- env->log << actualColor[3] << "\n";
-}
-
-
-void
-FragmentProgramTest::reportZFailure(const char *programName,
- GLfloat expectedZ, GLfloat actualZ) const
-{
- env->log << "FAILURE:\n";
- env->log << " Program: " << programName << "\n";
- env->log << " Expected Z: " << expectedZ << "\n";
- env->log << " Observed Z: " << actualZ << "\n";
-}
-
-
-// Compare actual and expected colors
-bool
-FragmentProgramTest::equalColors(const GLfloat act[4], const GLfloat exp[4]) const
-{
- if (fabsf(act[0] - exp[0]) > tolerance[0] && exp[0] != DONT_CARE_COLOR)
- return false;
- if (fabsf(act[1] - exp[1]) > tolerance[1] && exp[1] != DONT_CARE_COLOR)
- return false;
- if (fabsf(act[2] - exp[2]) > tolerance[2] && exp[2] != DONT_CARE_COLOR)
- return false;
- if (fabsf(act[3] - exp[3]) > tolerance[3] && exp[3] != DONT_CARE_COLOR)
- return false;
- return true;
-}
-
-
-bool
-FragmentProgramTest::equalDepth(GLfloat z0, GLfloat z1) const
-{
- if (fabsf(z0 - z1) > tolerance[4])
- return false;
- else
- return true;
-}
-
-
-bool
-FragmentProgramTest::testProgram(const FragmentProgram &p)
-{
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB,
- GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(p.progString),
- (const GLubyte *) p.progString);
-
- GLenum err = glGetError();
- if (err) {
- env->log << "OpenGL error " << (int) err << "\n";
- env->log << "Invalid Fragment Program:\n";
- env->log << p.progString;
- env->log << glGetString(GL_PROGRAM_ERROR_STRING_ARB) << "\n";
- return false;
- }
-
- // to avoid potential issue with undefined result.depth.z
- if (p.expectedZ == DONT_CARE_Z)
- glDisable(GL_DEPTH_TEST);
- else
- glEnable(GL_DEPTH_TEST);
-
-#if !DEVEL_MODE
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-#endif
- glBegin(GL_POLYGON);
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- glEnd();
-
-#if !DEVEL_MODE
- GLfloat pixel[4];
- glReadPixels(windowWidth / 2, windowHeight / 2, 1, 1,
- GL_RGBA, GL_FLOAT, pixel);
-
- if (0) // debug
- printf("%s: Expect: %.3f %.3f %.3f %.3f found: %.3f %.3f %.3f %.3f\n",
- p.name,
- p.expectedColor[0], p.expectedColor[1],
- p.expectedColor[2], p.expectedColor[3],
- pixel[0], pixel[1], pixel[2], pixel[3]);
-
- if (!equalColors(pixel, p.expectedColor)) {
- reportFailure(p.name, p.expectedColor, pixel);
- return false;
- }
-
- if (p.expectedZ != DONT_CARE_Z) {
- GLfloat z;
- glReadPixels(windowWidth / 2, windowHeight / 2, 1, 1,
- GL_DEPTH_COMPONENT, GL_FLOAT, &z);
- if (!equalDepth(z, p.expectedZ)) {
- reportZFailure(p.name, p.expectedZ, z);
- return false;
- }
- }
-#endif
- return true;
-}
-
-void
-FragmentProgramTest::runOne(MultiTestResult &r, Window &w)
-{
- // to test a single sub-test, set the name here:
- const char *single = getenv("PIGLIT_TEST");
-
- (void) w;
- setup();
-
-#if DEVEL_MODE
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-#endif
- for (int i = 0; Programs[i].name; i++) {
-
- if (!single || strcmp(single, Programs[i].name) == 0) {
-
-#if DEVEL_MODE
- glViewport(0, i * 20, windowWidth, 20);
-#endif
- if (!testProgram(Programs[i])) {
- r.numFailed++;
- }
- else {
- r.numPassed++;
- }
- }
- }
-
-#if DEVEL_MODE
- glFinish();
- sleep(100);
-#endif
- r.pass = (r.numFailed == 0);
-}
-
-
-// The test object itself:
-FragmentProgramTest fragmentProgramTest("fragProg1", "window, rgb, z",
- "GL_ARB_fragment_program",
- "Fragment Program test 1: test a specific set of fragment programs.\n");
-
-
-
-} // namespace GLEAN
diff --git a/tests/glean/tfragprog1.h b/tests/glean/tfragprog1.h
deleted file mode 100644
index 2e795eb..0000000
--- a/tests/glean/tfragprog1.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// BEGIN_COPYRIGHT -*- glean -*-
-//
-// Copyright (C) 1999 Allen Akin All Rights Reserved.
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the
-// Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-// KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
-// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ALLEN AKIN BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 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.
-//
-// END_COPYRIGHT
-
-// tfragprog.h: Test GL_ARB_fragment_program extension.
-// Brian Paul 22 October 2005
-
-#ifndef __tfragprog_h__
-#define __tfragprog_h__
-
-// If DEVEL_MODE==1 we generate a tall window of color swatches, one per
-// fragment program, which can be eyeballed against a reference image.
-// Use this if glReadPixels functionality is not working yet.
-#undef windowWidth
-#undef windowHeight
-#define DEVEL_MODE 0
-#if DEVEL_MODE
-#define windowWidth 200
-#define windowHeight 850
-#else
-#define windowWidth 100
-#define windowHeight 100
-#endif
-
-
-#include "tmultitest.h"
-
-namespace GLEAN {
-
-
-class FragmentProgram
-{
-public:
- const char *name;
- const char *progString;
- GLfloat expectedColor[4];
- GLfloat expectedZ;
-};
-
-
-class FragmentProgramTest: public MultiTest
-{
-public:
- FragmentProgramTest(const char* testName, const char* filter,
- const char *extensions, const char* description):
- MultiTest(testName, filter, extensions, description),
- tolerance()
- {
- }
-
- virtual void runOne(MultiTestResult &r, Window &w);
-
-private:
- GLfloat tolerance[5];
- void setup(void);
- bool equalColors(const GLfloat a[4], const GLfloat b[4]) const;
- bool equalDepth(GLfloat z0, GLfloat z1) const;
- bool testProgram(const FragmentProgram &p);
- void reportFailure(const char *programName,
- const GLfloat expectedColor[4],
- const GLfloat actualColor[4] ) const;
- void reportZFailure(const char *programName,
- GLfloat expectedZ, GLfloat actualZ) const;
-};
-
-} // namespace GLEAN
-
-#endif // __tfragprog_h__
--
2.8.2
More information about the Piglit
mailing list