Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Mesa
piglit
Commits
a2c35c6f
Commit
a2c35c6f
authored
Dec 05, 2008
by
Emma Anholt
Browse files
Update glean tests to CVS HEAD from 2008-12-05.
parent
84f77805
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
tests/all.tests
View file @
a2c35c6f
...
...
@@ -38,6 +38,7 @@ glean['api2'] = GleanTest('api2')
glean
[
'makeCurrent'
]
=
GleanTest
(
'makeCurrent'
)
glean
[
'blendFunc'
]
=
GleanTest
(
'blendFunc'
)
glean
[
'depthStencil'
]
=
GleanTest
(
'depthStencil'
)
glean
[
'fbo'
]
=
GleanTest
(
'fbo'
)
glean
[
'fpexceptions'
]
=
GleanTest
(
'fpexceptions'
)
glean
[
'fragProg1'
]
=
GleanTest
(
'fragProg1'
)
# also add entire tests, because of interdependency bugs that only occur when several different FPs are used
glean
[
'getString'
]
=
GleanTest
(
'getString'
)
...
...
tests/glean/CMakeLists.txt
View file @
a2c35c6f
...
...
@@ -24,6 +24,7 @@ add_executable (glean
tchgperf.cpp
tdepthstencil.cpp
test.cpp
tfbo.cpp
tfpexceptions.cpp
tfragprog1.cpp
tgetstr.cpp
...
...
tests/glean/tapi2.cpp
View file @
a2c35c6f
...
...
@@ -571,7 +571,9 @@ API2Test::testUniformfFuncs(void)
renderQuad
(
pixel
);
if
(
!
equalColors
(
pixel
,
expected
))
{
REPORT_FAILURE
(
"glUniform[1234]f failed"
);
printf
(
"%f %f %f %f
\n
"
,
pixel
[
0
],
pixel
[
1
],
pixel
[
2
],
pixel
[
3
]);
//printf("found: %f %f %f %f\n", pixel[0], pixel[1], pixel[2], pixel[3]);
//printf("expected: %f %f %f %f\n", expected[0], expected[1], expected[2], expected[3]);
return
false
;
}
...
...
@@ -659,7 +661,7 @@ API2Test::testUniformiFuncs(void)
GLfloat
pixel
[
4
],
expected
[
4
];
GLint
expectedInt
[
4
];
// Test glUniform[1234]
f
()
// Test glUniform[1234]
i
()
expectedInt
[
0
]
=
1
;
expectedInt
[
1
]
=
2
;
expectedInt
[
2
]
=
3
;
...
...
@@ -675,11 +677,11 @@ API2Test::testUniformiFuncs(void)
renderQuad
(
pixel
);
if
(
!
equalColors
(
pixel
,
expected
))
{
REPORT_FAILURE
(
"glUniform[1234]i failed"
);
printf
(
"%f %f %f %f
\n
"
,
pixel
[
0
],
pixel
[
1
],
pixel
[
2
],
pixel
[
3
]);
//
printf("%f %f %f %f\n", pixel[0], pixel[1], pixel[2], pixel[3]);
return
false
;
}
// Test glUniform[1234]
f
v()
// Test glUniform[1234]
i
v()
GLint
u
[
4
];
expectedInt
[
0
]
=
9
;
expectedInt
[
1
]
=
8
;
...
...
@@ -700,7 +702,7 @@ API2Test::testUniformiFuncs(void)
renderQuad
(
pixel
);
if
(
!
equalColors
(
pixel
,
expected
))
{
REPORT_FAILURE
(
"glUniform[1234]i failed"
);
printf
(
"%f %f %f %f
\n
"
,
pixel
[
0
],
pixel
[
1
],
pixel
[
2
],
pixel
[
3
]);
//
printf("%f %f %f %f\n", pixel[0], pixel[1], pixel[2], pixel[3]);
return
false
;
}
...
...
tests/glean/tfbo.cpp
0 → 100644
View file @
a2c35c6f
This diff is collapsed.
Click to expand it.
tests/glean/tfbo.h
0 → 100644
View file @
a2c35c6f
// BEGIN_COPYRIGHT -*- glean -*-
//
// Copyrigth (C) 2007 Intel Corporation
// 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
//
// Authors:
// Shuang He <shuang.he@intel.com>
//
// tfbo.h: Test OpenGL Extension GL_EXT_framebuffer_objec
#ifndef __tfbo_h__
#define __tfbo_h__
#include "tmultitest.h"
namespace
GLEAN
{
#define windowSize 100
class
FBOTest
:
public
MultiTest
{
public:
FBOTest
(
const
char
*
testName
,
const
char
*
filter
,
const
char
*
extensions
,
const
char
*
description
)
:
MultiTest
(
testName
,
filter
,
extensions
,
description
)
{
}
virtual
void
runOne
(
MultiTestResult
&
r
,
Window
&
w
);
private:
typedef
bool
(
FBOTest
::*
TestFunc
)(
MultiTestResult
&
r
);
typedef
bool
(
FBOTest
::*
SubTestFunc
)(
void
);
GLfloat
tolerance
[
5
];
void
reset
(
void
);
bool
testFunctionality
(
MultiTestResult
&
r
);
bool
testPerformance
(
MultiTestResult
&
r
);
bool
testSanity
(
void
);
bool
testRender2SingleTexture
(
void
);
bool
testRender2MultiTexture
(
void
);
bool
testRender2depthTexture
(
void
);
bool
testRender2MipmapTexture
(
void
);
bool
testErrorHandling
(
void
);
void
runSubTests
(
MultiTestResult
&
r
);
bool
setup
(
void
);
bool
checkResult
(
const
GLfloat
exp
[
4
],
const
int
depth
,
const
int
stencil
)
const
;
bool
equalColors
(
const
GLfloat
a
[
4
],
const
GLfloat
b
[
4
])
const
;
void
reportFailure
(
const
char
*
msg
,
int
line
)
const
;
void
reportFailure
(
const
char
*
msg
,
GLenum
target
,
int
line
)
const
;
};
}
// namespace GLEAN
#endif // __tfbo_h__
tests/glean/tfragprog1.cpp
View file @
a2c35c6f
...
...
@@ -982,6 +982,9 @@ FragmentProgramTest::testProgram(const FragmentProgram &p)
void
FragmentProgramTest
::
runOne
(
MultiTestResult
&
r
,
Window
&
w
)
{
// to test a single sub-test, set the name here:
const
char
*
single
=
NULL
;
(
void
)
w
;
setup
();
...
...
@@ -989,14 +992,18 @@ FragmentProgramTest::runOne(MultiTestResult &r, Window &w)
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
);
glViewport
(
0
,
i
*
20
,
windowWidth
,
20
);
#endif
if
(
!
testProgram
(
Programs
[
i
]))
{
r
.
numFailed
++
;
}
else
{
r
.
numPassed
++
;
if
(
!
testProgram
(
Programs
[
i
]))
{
r
.
numFailed
++
;
}
else
{
r
.
numPassed
++
;
}
}
}
...
...
tests/glean/tglsl1.cpp
View file @
a2c35c6f
...
...
@@ -913,7 +913,7 @@ static const ShaderProgram Programs[] = {
NO_VERTEX_SHADER
,
"void main() {
\n
"
" float x = 1.0;
\n
"
" if (x) {
\n
"
" if (x
!= 0.0
) {
\n
"
" gl_FragColor = vec4(0.5, 0.0, 0.5, 0.0);
\n
"
" }
\n
"
"}
\n
"
,
...
...
@@ -993,7 +993,7 @@ static const ShaderProgram Programs[] = {
" sum += 0.1;
\n
"
" if (sum >= 0.499999)
\n
"
" break;
\n
"
" } while (
1
);
\n
"
" } while (
true
);
\n
"
" gl_FragColor = vec4(sum);
\n
"
"}
\n
"
,
{
0.5
,
0.5
,
0.5
,
0.5
},
...
...
@@ -1011,7 +1011,7 @@ static const ShaderProgram Programs[] = {
" if (sum < 0.499999)
\n
"
" continue;
\n
"
" break;
\n
"
" } while (
1
);
\n
"
" } while (
true
);
\n
"
" gl_FragColor = vec4(sum);
\n
"
"}
\n
"
,
{
0.5
,
0.5
,
0.5
,
0.5
},
...
...
@@ -1088,6 +1088,22 @@ static const ShaderProgram Programs[] = {
FLAG_NONE
},
#if 0 // XXX enable someday
{
"vector subscript *=",
NO_VERTEX_SHADER,
"void main() { \n"
" vec4 c = vec4(0.25, 0.5, 0.1, 0.1); \n"
" c[0] *= 4.0; \n"
" c[1] *= 2.0; \n"
" gl_FragColor = c; \n"
"} \n",
{ 1.0, 1.0, 0.1, 0.1 },
DONT_CARE_Z,
FLAG_NONE
},
#endif
// Equality/inequality tests==========================================
{
"equality (float, pass)"
,
...
...
@@ -1350,7 +1366,7 @@ static const ShaderProgram Programs[] = {
"void main() {
\n
"
" float x = 0.75;
\n
"
" // this should always be false
\n
"
" if (x <= 0.5 && ++x) {
\n
"
" if (x <= 0.5 && ++x
> 0.0
) {
\n
"
" x += 0.1;
\n
"
" }
\n
"
" gl_FragColor = vec4(x);
\n
"
...
...
@@ -1395,7 +1411,7 @@ static const ShaderProgram Programs[] = {
"void main() {
\n
"
" float x = 0.75;
\n
"
" // this should always be true
\n
"
" if (x >= 0.5 || ++x) {
\n
"
" if (x >= 0.5 || ++x
>= 0.0
) {
\n
"
" x += 0.1;
\n
"
" }
\n
"
" gl_FragColor = vec4(x);
\n
"
...
...
@@ -2172,10 +2188,10 @@ static const ShaderProgram Programs[] = {
" vec2 c = vec2( 3.0, 2.0);
\n
"
" bvec2 b1 = equal(a, b);
\n
"
" bvec2 b2 = notEqual(b, c);
\n
"
" gl_FragColor.x = b1.x;
\n
"
" gl_FragColor.y = b1.y;
\n
"
" gl_FragColor.z = b2.x;
\n
"
" gl_FragColor.w = b2.y;
\n
"
" gl_FragColor.x =
float(
b1.x
)
;
\n
"
" gl_FragColor.y =
float(
b1.y
)
;
\n
"
" gl_FragColor.z =
float(
b2.x
)
;
\n
"
" gl_FragColor.w =
float(
b2.y
)
;
\n
"
"}
\n
"
,
{
1.0
,
0.0
,
1.0
,
0.0
},
DONT_CARE_Z
,
...
...
@@ -3370,7 +3386,7 @@ GLSLTest::runOne(MultiTestResult &r, Window &w)
}
// If you just want to run a single sub-test, assign the name to singleTest.
const
char
*
singleTest
=
NULL
;
const
char
*
singleTest
=
getenv
(
"GLSL_TEST"
)
;
if
(
singleTest
)
{
for
(
int
i
=
0
;
Programs
[
i
].
name
;
i
++
)
{
if
(
strcmp
(
Programs
[
i
].
name
,
singleTest
)
==
0
)
{
...
...
tests/glean/tvertprog1.cpp
View file @
a2c35c6f
...
...
@@ -1013,20 +1013,118 @@ VertexProgramTest::testProgram(const VertexProgram &p)
return
true
;
}
void
VertexProgramTest
::
testBadProgram
(
MultiTestResult
&
result
)
{
const
GLfloat
r
=
0.25
;
GLenum
err
;
{
static
const
char
*
badprog
=
"!!ARBvp1.0
\n
"
"NOTANOPCODE;
\n
"
"MOV result.position, vertex.position;
\n
"
;
glProgramStringARB_func
(
GL_VERTEX_PROGRAM_ARB
,
GL_PROGRAM_FORMAT_ASCII_ARB
,
strlen
(
badprog
),
(
const
GLubyte
*
)
badprog
);
/* Test that an invalid program raises an error */
err
=
glGetError
();
if
(
err
!=
GL_INVALID_OPERATION
)
{
env
->
log
<<
"Unexpected OpenGL error state "
<<
(
int
)
err
<<
" with bad vertex program.
\n
"
;
env
->
log
<<
"Expected: "
<<
GL_INVALID_OPERATION
<<
"
\n
"
;
result
.
numFailed
++
;
while
(
err
!=
0
)
err
=
glGetError
();
}
else
{
result
.
numPassed
++
;
}
}
/* Check that we correctly produce GL_INVALID_OPERATION when rendering
* with an invalid (non-existant in this case) program.
*/
{
glBindProgramARB_func
(
GL_VERTEX_PROGRAM_ARB
,
99
);
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
);
glBegin
(
GL_POLYGON
);
glTexCoord2f
(
0
,
0
);
glVertex2f
(
-
r
,
-
r
);
glTexCoord2f
(
1
,
0
);
glVertex2f
(
r
,
-
r
);
glTexCoord2f
(
1
,
1
);
glVertex2f
(
r
,
r
);
glTexCoord2f
(
0
,
1
);
glVertex2f
(
-
r
,
r
);
glEnd
();
err
=
glGetError
();
if
(
err
!=
GL_INVALID_OPERATION
)
{
env
->
log
<<
"Unexpected OpenGL error state "
<<
(
int
)
err
<<
" in glBegin() with bad vertex program.
\n
"
;
env
->
log
<<
"Expected: "
<<
GL_INVALID_OPERATION
<<
"
\n
"
;
result
.
numFailed
++
;
while
(
err
!=
0
)
err
=
glGetError
();
}
else
{
result
.
numPassed
++
;
}
}
/* Similarly, test that glDrawArrays raises GL_INVALID_OPERATION
*/
{
static
const
GLfloat
vertcoords
[
4
][
3
]
=
{
{
-
r
,
-
r
,
0
},
{
r
,
-
r
,
0
},
{
r
,
r
,
0
},
{
-
r
,
r
,
0
}
};
glVertexPointer
(
3
,
GL_FLOAT
,
0
,
vertcoords
);
glEnable
(
GL_VERTEX_ARRAY
);
glDrawArrays
(
GL_POLYGON
,
0
,
4
);
err
=
glGetError
();
glDisable
(
GL_VERTEX_ARRAY
);
if
(
err
!=
GL_INVALID_OPERATION
)
{
env
->
log
<<
"Unexpected OpenGL error state "
<<
(
int
)
err
<<
" in glDrawArrays() with bad vertex program.
\n
"
;
env
->
log
<<
"Expected: "
<<
GL_INVALID_OPERATION
<<
"
\n
"
;
result
.
numFailed
++
;
while
(
err
!=
0
)
glGetError
();
}
else
{
result
.
numPassed
++
;
}
}
}
void
VertexProgramTest
::
runOne
(
MultiTestResult
&
r
,
Window
&
w
)
{
// to test a single sub-test, set the name here:
const
char
*
single
=
NULL
;
(
void
)
w
;
setup
();
for
(
int
i
=
0
;
Programs
[
i
].
name
;
i
++
)
{
if
(
!
testProgram
(
Programs
[
i
]))
{
r
.
numFailed
++
;
}
else
{
r
.
numPassed
++
;
if
(
!
single
||
strcmp
(
single
,
Programs
[
i
].
name
)
==
0
)
{
if
(
!
testProgram
(
Programs
[
i
]))
{
r
.
numFailed
++
;
}
else
{
r
.
numPassed
++
;
}
}
}
testBadProgram
(
r
);
r
.
pass
=
(
r
.
numFailed
==
0
);
}
...
...
tests/glean/tvertprog1.h
View file @
a2c35c6f
...
...
@@ -72,6 +72,7 @@ private:
bool
equalColors
(
const
GLfloat
a
[
4
],
const
GLfloat
b
[
4
],
int
flags
)
const
;
bool
equalDepth
(
GLfloat
z0
,
GLfloat
z1
)
const
;
bool
testProgram
(
const
VertexProgram
&
p
);
void
testBadProgram
(
MultiTestResult
&
result
);
void
reportFailure
(
const
char
*
programName
,
const
GLfloat
expectedColor
[
4
],
const
GLfloat
actualColor
[
4
]
)
const
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment