Skip to content
GitLab
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
f2f89f98
Commit
f2f89f98
authored
Aug 02, 2008
by
Nicolai Hähnle
Browse files
New test: general/windowoverlap
This is a regression test for the recently fixed KWin corruption bug.
parent
4affc65b
Changes
3
Hide whitespace changes
Inline
Side-by-side
tests/all.tests
View file @
f2f89f98
...
...
@@ -57,6 +57,7 @@ mesa['crossbar'] = PlainExecTest([testBinDir + 'crossbar', '-auto'])
general
=
Group
()
general
[
'linestipple'
]
=
PlainExecTest
([
testBinDir
+
'linestipple'
,
'-auto'
])
general
[
'texgen'
]
=
PlainExecTest
([
testBinDir
+
'texgen'
,
'-auto'
])
general
[
'windowoverlap'
]
=
PlainExecTest
([
testBinDir
+
'windowoverlap'
,
'-auto'
])
shaders
=
Group
()
shaders
[
'trinity-fp1'
]
=
PlainExecTest
([
testBinDir
+
'trinity-fp1'
,
'-auto'
])
...
...
tests/general/CMakeLists.txt
View file @
f2f89f98
...
...
@@ -20,3 +20,4 @@ link_libraries (
add_executable
(
linestipple linestipple.c
)
add_executable
(
texgen texgen.c
)
add_executable
(
windowoverlap windowoverlap.c
)
tests/general/windowoverlap.c
0 → 100644
View file @
f2f89f98
/*
* Copyright (c) The Piglit project 2008
*
* 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
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, 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 (including the next
* paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS 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.
*/
/**
* @file
* Test whether rendering does not bleed into areas outside the window.
* This is done by creating a subwindow and verifying that rendering in
* the main window vs. in the sub window is clipped correctly.
*
* This test was prompted by http://bugs.freedesktop.org/show_bug.cgi?id=16123
*/
#include
<assert.h>
#include
<string.h>
#include
<stdio.h>
#include
<stdlib.h>
#include
<math.h>
#include
<GL/glut.h>
#include
"piglit-util.h"
static
const
int
MainWidth
=
128
,
MainHeight
=
128
;
static
const
int
SubX
=
32
,
SubY
=
32
;
static
const
int
SubWidth
=
64
,
SubHeight
=
64
;
static
int
Automatic
=
0
;
static
int
CurrentTest
=
0
;
static
int
MainWindow
;
static
int
SubWindow
;
static
int
verify
(
float
mainr
,
float
maing
,
float
mainb
,
float
subr
,
float
subg
,
float
subb
,
const
char
*
testname
)
{
float
main
[
128
][
128
][
3
];
float
sub
[
64
][
64
][
3
];
int
x
,
y
;
glutSetWindow
(
MainWindow
);
glReadPixels
(
0
,
0
,
128
,
128
,
GL_RGB
,
GL_FLOAT
,
main
);
glutSetWindow
(
SubWindow
);
glReadPixels
(
0
,
0
,
64
,
64
,
GL_RGB
,
GL_FLOAT
,
sub
);
for
(
x
=
0
;
x
<
128
;
++
x
)
{
for
(
y
=
0
;
y
<
128
;
++
y
)
{
float
delta
;
if
(
x
>=
32
&&
x
<
96
&&
y
>=
32
&&
y
<
96
)
continue
;
delta
=
fabs
(
mainr
-
main
[
y
][
x
][
0
])
+
fabs
(
maing
-
main
[
y
][
x
][
1
])
+
fabs
(
mainb
-
main
[
y
][
x
][
2
]);
if
(
delta
>
0
.
01
)
{
printf
(
"Test %s: Fail at main window pixel %i,%i
\n
"
,
testname
,
x
,
y
);
printf
(
" Expected: %5.3f %5.2f %5.3f
\n
"
,
mainr
,
maing
,
mainb
);
printf
(
" Actual: %5.3f %5.2f %5.3f
\n
"
,
main
[
y
][
x
][
0
],
main
[
y
][
x
][
1
],
main
[
y
][
x
][
2
]);
return
0
;
}
}
}
for
(
x
=
0
;
x
<
64
;
++
x
)
{
for
(
y
=
0
;
y
<
64
;
++
y
)
{
float
delta
;
delta
=
fabs
(
subr
-
sub
[
y
][
x
][
0
])
+
fabs
(
subg
-
sub
[
y
][
x
][
1
])
+
fabs
(
subb
-
sub
[
y
][
x
][
2
]);
if
(
delta
>
0
.
01
)
{
printf
(
"Test %s: Fail at sub window pixel %i,%i
\n
"
,
testname
,
x
,
y
);
printf
(
" Expected: %5.3f %5.2f %5.3f
\n
"
,
subr
,
subg
,
subb
);
printf
(
" Actual: %5.3f %5.2f %5.3f
\n
"
,
sub
[
y
][
x
][
0
],
sub
[
y
][
x
][
1
],
sub
[
y
][
x
][
2
]);
return
0
;
}
}
}
return
1
;
}
static
void
test
()
{
int
success
;
glutSetWindow
(
MainWindow
);
glClearColor
(
1
,
0
,
0
,
0
);
glClear
(
GL_COLOR_BUFFER_BIT
);
glFinish
();
glutSetWindow
(
SubWindow
);
glClearColor
(
0
,
1
,
0
,
0
);
glClear
(
GL_COLOR_BUFFER_BIT
);
glFinish
();
success
=
success
&&
verify
(
1
,
0
,
0
,
0
,
1
,
0
,
"initial clear"
);
glutSetWindow
(
MainWindow
);
glClearColor
(
0
,
0
,
1
,
0
);
glClear
(
GL_COLOR_BUFFER_BIT
);
glFinish
();
success
=
success
&&
verify
(
0
,
0
,
1
,
0
,
1
,
0
,
"re-clear main window"
);
glutSetWindow
(
SubWindow
);
glColor3f
(
1
,
1
,
0
);
glBegin
(
GL_QUADS
);
glVertex2f
(
-
1
,
-
1
);
glVertex2f
(
2
,
-
1
);
glVertex2f
(
2
,
2
);
glVertex2f
(
-
1
,
2
);
glEnd
();
glFinish
();
success
=
success
&&
verify
(
0
,
0
,
1
,
1
,
1
,
0
,
"render in sub window"
);
glutSetWindow
(
MainWindow
);
glColor3f
(
0
,
1
,
1
);
glBegin
(
GL_QUADS
);
glVertex2f
(
-
1
,
-
1
);
glVertex2f
(
2
,
-
1
);
glVertex2f
(
2
,
2
);
glVertex2f
(
-
1
,
2
);
glEnd
();
glFinish
();
success
=
success
&&
verify
(
0
,
1
,
1
,
1
,
1
,
0
,
"render in main window"
);
if
(
Automatic
)
piglit_report_result
(
success
?
PIGLIT_SUCCESS
:
PIGLIT_FAILURE
);
}
static
void
RedisplayMain
(
void
)
{
test
();
}
static
void
RedisplaySub
(
void
)
{
test
();
}
static
void
Reshape
(
int
width
,
int
height
)
{
glViewport
(
0
,
0
,
width
,
height
);
glMatrixMode
(
GL_PROJECTION
);
glLoadIdentity
();
glOrtho
(
0
.
0
,
1
.
0
,
0
.
0
,
1
.
0
,
-
1
.
0
,
1
.
0
);
glMatrixMode
(
GL_MODELVIEW
);
glLoadIdentity
();
}
static
void
Key
(
unsigned
char
key
,
int
x
,
int
y
)
{
(
void
)
x
;
(
void
)
y
;
switch
(
key
)
{
case
27
:
exit
(
0
);
break
;
}
glutPostRedisplay
();
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
i
;
glutInit
(
&
argc
,
argv
);
if
(
argc
==
2
&&
!
strcmp
(
argv
[
1
],
"-auto"
))
Automatic
=
1
;
glutInitWindowPosition
(
0
,
0
);
glutInitWindowSize
(
MainWidth
,
MainHeight
);
glutInitDisplayMode
(
GLUT_RGB
);
glutCreateWindow
(
argv
[
0
]);
glutReshapeFunc
(
Reshape
);
glutDisplayFunc
(
RedisplayMain
);
if
(
!
Automatic
)
glutKeyboardFunc
(
Key
);
MainWindow
=
glutGetWindow
();
SubWindow
=
glutCreateSubWindow
(
MainWindow
,
SubX
,
SubY
,
SubWidth
,
SubHeight
);
glutReshapeFunc
(
Reshape
);
glutDisplayFunc
(
RedisplaySub
);
glutMainLoop
();
return
0
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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