arb_transform_feedback3: add test for buffer binding with invalid index

Passes on NVIDIA (304.88 on GTX 660) and on Ivy Bridge.

v2 (Ian):
   - ask the driver the maximum amount of streams supported
     instead of treating 'GL_MAX_TRANSFORM_FEEDBACK_BUFFERS' as the
     value.
   - keep on trying the different combinations even if one of them
     fails.
   - try also maximum allowed for success
   - used size 'sizeof(GLfloat)' instead of '1' for
     'glBindBufferRange()'. Otherwise even the positive case of
     maximum supported fails on NVIDIA.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
arb_transform_feedback3: add test for querying with invalid index

Passes on NVIDIA (304.88 on GTX 660) and on Ivy Bridge.

v2 (Ian):
   - ask the driver the maximum amount of streams supported
     instead of treating 'GL_MAX_VERTEX_STREAMS' as the value.
   - keep on trying the different combinations even if one of them
     fails.
   - try also maximum allowed for success
   - added to all.tests

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
arb_transform_feedback3: add test for ending non-active query

Passes on NVIDIA (304.88 on GTX 660) and on Ivy Bridge.

v2 (Ian): added to all.tests

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
arb_transform_feedback3: add test trying to draw an invalid stream

Passes on NVIDIA (304.88 on GTX 660).

v2:
   - setup a shader program and vertex buffer object in order
     to really test the invalid stream argument (Ian)
   - add requirement for arb_gpu_shader5

v3:
   - introduce the common header file with pass-thru vertex
     shader text -> needed for rebase

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
arb_transform_feedback3: add test trying to set invalid varyings

Non-existing program case crashes on NVIDIA (319.60 on GTX 660)
but exceeding maximum attribute case passes. Both cases pass on
Ivy Bridge.

v2 (Ian):
   - drop the unnecessary helper variable when setting up
     the array of varying names
   - drop "piglit_require_GLSL_version(150)" as the test already
     requires GL 3.2

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
arb_transform_feedback3: add test trying to set invalid separate mode

Passes on NVIDIA (304.88 on GTX 660) and on Ivy Bridge.

v2 (Ian):
   - drop "piglit_require_GLSL_version(150)" as the test already
     requires 3.2
   - drop doxygen comment style where not necessary
   - let 'asprintf()' allocate space for the generated varying
     names insetad of using one larger chunk and managing it
     manually
   - added the mandatory (max_vertices = 1) into the output layout
     declaration

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
util: buffer object probe

Make feedback buffer probe accessible also for other tests.
Original behavior is altered not to print matching values
anymore.

v2:
   - call piglit_probe_buffer() instead of thin wrapper (Ian)
   - use bool instead of GLboolean

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
arb_transform_feedback3: add test for interleaved in two buffers

Passes on NVIDIA (304.88 on GTX 660). The vertex shader case
also passed on Ivy Bridge (geometry shader cases are skipped
as the require the invocation id provided by gpu_shader5).

v2:
   - tests also multiple geometry shader invocations outputting
     into same buffer(s)
   - checks also the primitive write counter
   - fixed indentation: spaces -> tabs (Ian)
   - require core/compatibility version 3.2 instead of
     ARB_geometry_shader4 which is not going to be supported by
     mesa (Ian)
   - drop _EXT, use core names instead (Ian)
   - now using piglit_build_simple_program_multiple_shaders()

v3:
   - added calls to glDeleteBuffers(), glDeleteQueries() and
     glDeleteVertexArrays()
   - do not require arb_gpu_shader5 for the vertex shader case
   - fixed zero buffer size in vertex shader case

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
GL: Verify that when GL_COORD_REPLACE is set, fragment shader texture coordinates do not get eliminated.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
GL_ARB_base_instance: Verify that the baseinstance setting does not affect the value of gl_InstanceID.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Test that VertexAttribP*() must use one of the appropriate types.

v2: change context

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Test that if VertexAttribPointer uses a packed type, size must be 4 or BGRA.

v2: change context

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
HACKING: Add more details to HACKING file.

Signed-off-by: Frank Henigman <fjhenigman@google.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
util/gl: Define GL_GLEXT_PROTOTYPES for all GLES1 tests

If you're writing a test, you want the extension prototypes defined.
Each GLES1 test shouldn't need to define this.

To fix this, define GL_GLEXT_PROTOTYPES in gl_wrap.h. This makes
Piglit's behavior for GLES1 more closely match its behavior for
GL/GLES2/GLES3.  because gl_wrap.h *does* define the extension
prototypes for those non-GLES1 apis.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
util/egl: Include eglext.h from piglit-util-egl.h

If you're writing an EGL test, you likely want access to the extensions.

This makes piglit-util-egl.h's behavior match that of
piglit-util-gl-common.h, which defines (transitively through
gl_wrap.h) all the GL/GLES extensions.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
ext_image_dma_buf_import: Cleanup up #includes

A following commit will move piglit's EGL utilities from
libpiglitutil_gl to libpiglitutil. As a consequence, the dma_buf tests
will need to include piglit-util-gl-common.h in addition to
piglit-util-egl.h, otherwise the build will break.

While we're touching the #includes in the dma_buf tests, we might as
well also clean up the #includes by removing redundancy.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
util: Move EGL utilities from libpiglitutil_gl to libpiglitutil

Many EGL tests make no GL calls. By moving the EGL utilities from
libpiglitutil_gl (which links to libGL) to libpiglitutil (which links to
no GL library), we become one step closer to enabling the EGL tests on
platforms that have OpenGL ES but not OpenGL.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
egl: Fix CMake traversal into egl/spec dir

CMake should traverse into subdirectories independent of the current
API. That is, the generic CMakeLists.txt should call
add_subdirectory(xxx), not the api-specific CMakeLists.$api.txt.  For
precedent, see tests/spec/CMakeLists.txt.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
arb_viewport_array: Only specify 150 for shader version

These tests are expected to run with OpenGL 3.2, so
we should only use #version 150. We also need to
enable the GL_ARB_viewport_array extension in the
geometry shader.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Tested-by: Jon Ashburn <jon@lunarg.com>
ARB_viewport_array: Fix minmax test for piglit_require_extension

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>