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
da8de422
Commit
da8de422
authored
Feb 18, 2011
by
Marek Olšák
Browse files
util: add function for checking whether 2 halves of window are equal
parent
28659196
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/util/piglit-util.c
View file @
da8de422
...
...
@@ -442,6 +442,38 @@ int piglit_probe_texel_rgb(int target, int level, int x, int y,
return
0
;
}
int
piglit_probe_rect_halves_equal_rgba
(
int
x
,
int
y
,
int
w
,
int
h
)
{
int
i
,
j
,
p
,
wh
=
w
/
2
;
GLfloat
*
probe1
,
*
probe2
;
GLfloat
*
pixels
=
malloc
(
w
*
h
*
4
*
sizeof
(
float
));
glReadPixels
(
x
,
y
,
w
,
h
,
GL_RGBA
,
GL_FLOAT
,
pixels
);
for
(
j
=
0
;
j
<
h
;
j
++
)
{
for
(
i
=
0
;
i
<
wh
;
i
++
)
{
probe1
=
&
pixels
[(
j
*
w
+
i
)
*
4
];
probe2
=
&
pixels
[(
j
*
w
+
wh
+
i
)
*
4
];
for
(
p
=
0
;
p
<
4
;
++
p
)
{
if
(
fabs
(
probe1
[
p
]
-
probe2
[
p
])
>=
tolerance
[
p
])
{
printf
(
"Probe at (%i,%i)
\n
"
,
x
+
i
,
y
+
j
);
printf
(
" Left: %f %f %f %f
\n
"
,
probe1
[
0
],
probe1
[
1
],
probe1
[
2
],
probe1
[
3
]);
printf
(
" Right: %f %f %f %f
\n
"
,
probe2
[
0
],
probe2
[
1
],
probe2
[
2
],
probe2
[
3
]);
free
(
pixels
);
return
0
;
}
}
}
}
free
(
pixels
);
return
1
;
}
int
piglit_use_fragment_program
(
void
)
{
static
const
char
source
[]
=
...
...
tests/util/piglit-util.h
View file @
da8de422
...
...
@@ -96,6 +96,7 @@ int piglit_probe_texel_rgba(int target, int level, int x, int y,
const
float
*
expected
);
int
piglit_probe_pixel_depth
(
int
x
,
int
y
,
float
expected
);
int
piglit_probe_rect_depth
(
int
x
,
int
y
,
int
w
,
int
h
,
float
expected
);
int
piglit_probe_rect_halves_equal_rgba
(
int
x
,
int
y
,
int
w
,
int
h
);
int
piglit_use_fragment_program
(
void
);
int
piglit_use_vertex_program
(
void
);
...
...
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