cl-api-get-platform-ids: Initialize variable.

Fix clang sometimes-uninitialized warning.

get-platform-ids.c:62:5: warning: variable 'platforms' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
        if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
get-platform-ids.c:93:30: note: uninitialized use occurs here
        errNo = clGetPlatformIDs(0, platforms, NULL);
                                    ^~~~~~~~~
get-platform-ids.c:62:2: note: remove the 'if' if its condition is always false
        if(!piglit_cl_check_error(errNo, CL_SUCCESS)) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
get-platform-ids.c:56:27: note: initialize the variable 'platforms' to silence this warning
        cl_platform_id* platforms;
                                 ^
                                  = NULL

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
cl: Fix out-of-bounds write in get-num-groups

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
util/gl: Fix piglit_is_gles to return true for "OpenGL ES-CM 1.1 ..."

Piglit looked for a GL_VERSION starting with "OpenGL ES ", which did not
match "OpenGL ES-CM 1.1 Mesa 10.2.1".  Stop requiring the trailing
space.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
util/gl: Unify piglit_num_components between GL and GLES

The unified implementation handles all the GLenum values expected by
either.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
util/gl: Move piglit_get_luminance_intensity_bits to GL common code

This doesn't need to remain in the GL-specific utility library.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
util/gl: Unify projection utility functions across GL and GLES

piglit_gen_ortho_projection and piglit_ortho_projection already had a
similar implementation for GL and GLES1; common it up and remove the
ifdefs.

Move piglit_frustum_projection out of GL-only code as well, and add
support for GLES1 using glFrustumf.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
util/gl: Unify piglit_probe_pixel_* and piglit_probe_rect_* between GL and GLES

Introduce a new internal helper, piglit_read_pixels_float, that always
returns floats.  On GL it just calls glReadPixels with GL_FLOAT; on GLES
it uses GL_UNSIGNED_BYTE and converts.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
util/gl: Unify piglit_probe_image_* functions between GL and GLES

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
util/gl: Unify piglit_escape_exit_key between GL and GLES

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
util/gl: Move piglit_probe_texel_* functions to GL common code

These don't need to remain in the GL-specific utility library.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
util/gl: Move remaining piglit_probe_* functions to GL common code

These don't need to remain in the GL-specific utility library.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
util/gl: Move piglit program helper functions to GL common code

These don't need to remain in the GL-specific utility library.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
util/gl: Move piglit_draw_triangle* helper functions to GL common code

These don't need to remain in the GL-specific utility library.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
util/gl: Unify piglit_checkerboard_texture between GL and GLES

In the GLES implementation, factor out the conversion of the white and
black pixel values from float to ubyte outside the loop.  That then
unifies the loop between the two implementations.

Update the documentation to note that piglit_checkerboard_texture sets
GL_CLAMP_TO_EDGE on GLES, not GL_CLAMP_TO_BORDER as it does on GL.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
util/gl: Factor out image generation from GLES piglit_rgbw_texture into a helper

This moves the GLES implementation of piglit_rgbw_texture much closer to
the GL version.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
util/gl: Move piglit_miptree_texture to GL common code

This doesn't need to remain in the GL-specific utility library.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
util/gl: Unify piglit_rgbw_texture between GL and GLES; drop piglit-util-gles.c

With the image generation factored out to piglit_rgbw_image and
piglit_rgbw_image_ubyte, the remainder of the implementation becomes
common between GL and GLES.

This eliminates the last helper function from piglit-util-gles.c, so
drop it.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
util/gl: Move the remaining piglit-util-gl functions into piglit-util-gl-common

Drop the now-empty piglit-util-gl.c.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
oes_draw_texture: Fix piglit_rgbw_texture() call

Specify the data type, s/0/GL_UNSIGNED_BYTE/. The call worked because
piglit_rgbw() ignores the type parameter on GLES.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
util/gl: Remove GLES case from piglit_rgbw_texture()

In GLES, piglit_rgbw_texture() ignored the data type parameter and
assumed it was GL_UNSIGNED_BYTE. Remove the GLES-specific assumption and
respect the parameter on GL and GLES.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>