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
6e01207d
Commit
6e01207d
authored
Aug 21, 2008
by
Emma Anholt
Browse files
Clean up gen-texsubimage: remove sleep in auto case, and use probe util func.
parent
9449827c
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/texturing/gen-texsubimage.c
View file @
6e01207d
...
...
@@ -63,44 +63,14 @@ static void display_mipmaps(int start_x, int start_y)
}
}
/**
* Returns whether the pixel at the coordinates matches the referenced color.
*
* Only the RGB channels are considered.
*/
static
GLboolean
probe_pixel
(
int
x
,
int
y
,
const
GLfloat
*
color
)
{
GLfloat
probe
[
4
],
delta
[
3
];
GLfloat
dmax
=
0
;
int
i
;
glReadPixels
(
x
,
y
,
1
,
1
,
GL_RGBA
,
GL_FLOAT
,
probe
);
for
(
i
=
0
;
i
<
3
;
i
++
)
{
delta
[
i
]
=
probe
[
i
]
-
color
[
i
];
if
(
dmax
<
fabs
(
delta
[
i
]))
dmax
=
fabs
(
delta
[
i
]);
}
if
(
dmax
>
.
02
)
{
printf
(
"Expected at (%d,%d): %f,%f,%f
\n
"
,
x
,
y
,
color
[
0
],
color
[
1
],
color
[
2
]);
printf
(
"Probed at (%d,%d): %f,%f,%f
\n
"
,
x
,
y
,
probe
[
0
],
probe
[
1
],
probe
[
2
]);
return
GL_FALSE
;
}
return
GL_TRUE
;
}
static
GLboolean
check_resulting_mipmaps
(
int
x
,
int
y
,
const
GLfloat
*
color
)
{
GLboolean
pass
=
GL_TRUE
;
int
i
;
for
(
i
=
256
;
i
>
4
;
i
/=
2
)
{
pass
=
pass
&&
probe_pixel
(
x
+
i
/
2
,
y
+
i
/
2
,
color
);
pass
=
pass
&&
piglit_probe_pixel_rgb
(
x
+
i
/
2
,
y
+
i
/
2
,
color
);
x
+=
i
;
}
...
...
@@ -175,7 +145,6 @@ static void display()
if
(
Automatic
)
printf
(
"PIGLIT: {'result': '%s' }
\n
"
,
pass
?
"pass"
:
"fail"
);
sleep
(
5
);
exit
(
pass
?
0
:
1
);
}
}
...
...
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