[1/2] util: make it easier to use probe functions on ES

Submitted by Ilia Mirkin on Feb. 13, 2019, 3:40 a.m.

Details

Message ID 20190213034014.18964-1-imirkin@alum.mit.edu
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Ilia Mirkin Feb. 13, 2019, 3:40 a.m.
With float color buffers, one can use glReadPixels with GL_FLOAT. Allow
that usage scenario.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
---
 tests/util/piglit-util-gl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index 3f2dcb9c0..64c6fdae6 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -1046,7 +1046,7 @@  read_pixels_float(GLint x, GLint y, GLsizei width, GLsizei height,
 	if (!pixels)
 		pixels = malloc(width * height * comps * sizeof(GLfloat));
 
-	if (!piglit_is_gles()) {
+	if (!piglit_is_gles() || piglit_is_extension_supported("GL_EXT_color_buffer_float")) {
 		glReadPixels(x, y, width, height, format, GL_FLOAT, pixels);
 		return pixels;
 	}
@@ -1068,7 +1068,8 @@  can_probe_ubyte()
 {
 	int r,g,b,a,read;
 
-	if (!piglit_is_extension_supported("GL_ARB_framebuffer_object"))
+	if (!piglit_is_extension_supported("GL_ARB_framebuffer_object") &&
+	    !(piglit_is_gles() && piglit_get_gl_version() >= 20))
 		return false;
 
 	glGetIntegerv(GL_READ_BUFFER, &read);

Comments

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>

On 2/13/19 5:40 AM, Ilia Mirkin wrote:
> With float color buffers, one can use glReadPixels with GL_FLOAT. Allow
> that usage scenario.
> 
> Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
> ---
>   tests/util/piglit-util-gl.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
> index 3f2dcb9c0..64c6fdae6 100644
> --- a/tests/util/piglit-util-gl.c
> +++ b/tests/util/piglit-util-gl.c
> @@ -1046,7 +1046,7 @@ read_pixels_float(GLint x, GLint y, GLsizei width, GLsizei height,
>   	if (!pixels)
>   		pixels = malloc(width * height * comps * sizeof(GLfloat));
>   
> -	if (!piglit_is_gles()) {
> +	if (!piglit_is_gles() || piglit_is_extension_supported("GL_EXT_color_buffer_float")) {
>   		glReadPixels(x, y, width, height, format, GL_FLOAT, pixels);
>   		return pixels;
>   	}
> @@ -1068,7 +1068,8 @@ can_probe_ubyte()
>   {
>   	int r,g,b,a,read;
>   
> -	if (!piglit_is_extension_supported("GL_ARB_framebuffer_object"))
> +	if (!piglit_is_extension_supported("GL_ARB_framebuffer_object") &&
> +	    !(piglit_is_gles() && piglit_get_gl_version() >= 20))
>   		return false;
>   
>   	glGetIntegerv(GL_READ_BUFFER, &read);
>