GL 3.2: Test framebuffer with layered attachments

Make sure layered rendering results in a complete framebuffer
status.

Also, when using layered rendering GL_FRAMEBUFFER_ATTACHMENT_LAYERED
should return as TRUE from glGetFramebufferAttachmentParameteriv.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
GL 3.2: Test layered framebuffer status

Make sure FB completeness works properly when attaching two
textures when using layered textures.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
GL 3.2: Test FramebufferTexture when texture value is zero

Verify proper texture state values are returned when a zero
texture is bound with FramebufferTexture.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Don't use dynamically sized arrays.

Fix MSVC build error.

get-active-attrib-returns-all-inputs.c(85) : error C2057: expected constant expression
get-active-attrib-returns-all-inputs.c(85) : error C2466: cannot allocate an array of constant size 0
get-active-attrib-returns-all-inputs.c(85) : error C2133: 'name' : unknown size

Cc: Vinson Lee <vlee@freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70015
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Vinson Lee <vlee@freedesktop.org>
arb_transform_feedback2: Require that xfb object names come from Gen

NVIDIA (304.64 on GTX 260) passes this test.  AMD has not been tested.

v2: Use 'id + 1' as the invalid ID instead of 47.  Paul pointed out that
the implementation could return 47 from glGenTransformFeedbacks.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Cc: Kenneth Graunke <kenneth@whitecape.org>
arb_transform_feedback2: Cannot bind an xfb object when one is already active

NVIDIA (304.64 on GTX 260) passes this test.  AMD has not been tested.

v2: Add an extra piglit_check_gl_error(0) to ensure that a later
piglit_check_gl_error(GL_INVALID_OPERATION) gets the error from the
correct call.  Fix the spec quotation.  Both suggested by Paul.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Cc: Kenneth Graunke <kenneth@whitecape.org>
arb_transform_feedback2: Misc. API query tests

This covers the transform feedback object state queries added in the
extension.  Other transform feedback queires should be covered by
existing EXT_transform_feedback tests.

NVIDIA (304.64 on GTX 260) passes this test.  AMD has not been tested.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Cc: Kenneth Graunke <kenneth@whitecape.org>
arb_transform_feedback2: Verify counting queries around pause and resume

NVIDIA (304.64 on GTX 260) passes this test.  AMD has not been tested.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Cc: Kenneth Graunke <kenneth@whitecape.org>
arb_transform_feedback2: Check switching active XFB objects while paused

The test methodology is:

    - Bind an XFB object, start XFB, draw something, pause XFB.

    - Bind a different XFB object, start XFB, draw someting, pause XFB.

    - Rebind the first XFB object, resume XFB, draw something, end XFB.

    - Rebind the second XFB object, resume XFB, draw something, end XFB.

    - Verify that all the expected data has landed in the expected
      places.

NVIDIA (304.64 on GTX 260) passes this test.  AMD has not been tested.

Mesa (i965_dri.so) fails the GLES3 version of the test, and, when
GL_ARB_transform_feedback2 is force-enabled, it fails the desktop GL
version as well.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Cc: Kenneth Graunke <kenneth@whitecape.org>
arb_texture_buffer_object: Verify some behavior when the extenion isn't supported

If the extension is not supported, applications should not be able to
bind to the texture target or the buffer object target.

v2: Add to all.tests.  Require GL version < 3.1 because the extension
became part of the core spec then.  Comments by Eric Anholt.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
glslparsertest: Reproduce a segfault in Mesa's GLSL linker

When there are way too many samplers, the linker misbehaves... walking
all over the stack and crashing.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
arb_get_program_binary: Verify glGet* doesn't over-run the buffer for binary format queries

This test works with both GL_PROGRAM_BINARY_FORMATS (from
ARB_get_program_binary) and GL_SHADER_BINARY_FORMATS (from
ARB_ES2_compatibility).  Mesa fails GL_SHADER_BINARY_FORMATS because it
generates an error (!) for the queries.  Fix the error causes it to
over-run the buffer.  I suspect the over-run will happen in an ES2 with
Mesa as-is.

v2: Use less terse function and parameter names.  Avoid the use of
rand().  Both suggested by Paul.  Also move the empty piglit_display
function to the end of the file.  This matches changes in the piglit
test convention that were adopted after this test was initially written.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
arb_get_program_binary: Execercise GL_PROGRAM_BINARY_RETRIEVABLE_HINT

This test fails on NVIDIA (304.64 on GTX 260).  It fails because the
value of GL_PROGRAM_BINARY_RETRIEVABLE_HINT is not "patched" by
glLinkProgram.  The spec is a little unclear on this topic, and I filed
a bug in the Khronos bugzilla.  After some discussion about which state
should be latches vs. live, the consensus was that
GL_PROGRAM_BINARY_RETRIEVABLE_HINT should be latched.  Updated language
has been proposed, but a new spec has not been spun.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Cc: Wen Su <WSu@nvidia.com>
arb_get_program_binary: Add misc. API error tests for this extension

This test fails on NVIDIA (304.64 on GTX 260):

   - GL_INVALID_VALUE is not generated for specifying values other than
     GL_TRUE or GL_FALSE for GL_PROGRAM_BINARY_RETRIEVABLE_HINT.

   - GL_INVALID_VALUE is not generated for specifying a negative bufSize
     for glGetProgramBinary.  GL_INVALID_OPERATION is generated instead.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Cc: Wen Su <WSu@nvidia.com>
Test some interactions with multiple inout parameters

There are several variations of

void foo(inout int i, inout float f);
...
foo(i, f[i]);

that Mesa's GLSL compiler gets wrong.  NVIDIA (304.64 on GTX 260) fails
vs-inout-index-inout-mat2-col.shader_test and
vs-inout-index-inout-mat2-row.shader_test, but passes the others.

v2: Use 'probe all rgb' and make vs-inout-index-inout-mat2-col use u=1
like the other tests.  Both items were suggested by Eric Anholt.  I use
'probe all rgb' because the tests actually write 0 for alpha, but
shader_runner doesn't always get an RGBA visual (so alpha will be 0 or
1).  Also, add two simpler tests vs-out-vec4 and vs-inout-vec4.  This
currently pass, but a patch series I have in progress had broken them.

v3: Fix a typo in the 'probe all' line of
vs-inout-index-inout-mat2-col.shader_test and a typo in the commit
message.  Both noticed by Paul.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Cc: Wen Su <WSu@nvidia.com>
arb_gpu_shader5: Add uaddCarry fragment shader execution test.
arb_gpu_shader5: Test using only the addition from uaddCarry in the fs.
arb_gpu_shader5: Test using only the carry from uaddCarry in the fs.
arb_gpu_shader5: Add usubBorrow fragment shader execution test.
arb_gpu_shader5: Test using only the subtraction from usubBorrow in the fs.