mesa.git
12 years agost/mesa: fix a bug in and re-org setup_interleaved_attribs()
Brian Paul [Fri, 21 Oct 2011 16:09:48 +0000 (10:09 -0600)]
st/mesa: fix a bug in and re-org setup_interleaved_attribs()

We were mis-computing the size of the user-space vertex buffer in
some circumstances.  This led to a failed assertion at u_inlines.h:222
when using the VMware svga driver.

For example, if we had arrays such as:

array[0]: element_offset = 12, stride = 24
array[1]: element_offset = 0, stride = 24

We'd mistakenly compute 'bytes' to be 12 bytes too small.

I've reorganized the function too.  By time it's called, we know that
we've got interleaved arrays either all in one VBO or all in user memory
and the stride is equal for all arrays.

Move the code that lived inside the attr==0 test after the loop.

In the loop we compute the true vertex size.  That size factors into the
pipe->redefine_user_buffer() call later.  Using the vertex size instead
of array[0]'s element_offset fixes the failed assertion.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
12 years agoglsl: Short-circuit lower_if_to_cond_assign when MaxIfDepth is UINT_MAX.
Kenneth Graunke [Tue, 18 Oct 2011 22:04:37 +0000 (15:04 -0700)]
glsl: Short-circuit lower_if_to_cond_assign when MaxIfDepth is UINT_MAX.

Setting MaxIfDepth to UINT_MAX effectively means "don't lower anything."

Explicitly checking for this common case allows us to avoid walking the
IR, computing nesting levels, and so on.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Bryan Cain <bryancain3@gmail.com>
12 years agoi965: Set MaxIfDepth to UINT_MAX on Gen6+ and 16 on prior generations.
Kenneth Graunke [Tue, 20 Sep 2011 06:47:56 +0000 (23:47 -0700)]
i965: Set MaxIfDepth to UINT_MAX on Gen6+ and 16 on prior generations.

Commit 488fe51cf823ccd137c667f1e92dd86f8323b723 converted the EmitNoIfs
flag to MaxIfDepth, an unsigned integer saying "flatten if-statements
nested beyond this depth."

Unfortunately, i965 left this initialized to 0, which made ir_to_mesa
attempt to flatten all if-statements.  We didn't notice right away
because we usually throw away ir_to_mesa's code in favor of the native
VS and FS backends...but this still creates a lot of unnecessary work.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoapple: Use the correct (OpenGL.framework) glViewport and glScissor during init
Jeremy Huddleston [Fri, 21 Oct 2011 07:22:40 +0000 (00:22 -0700)]
apple: Use the correct (OpenGL.framework) glViewport and glScissor during init

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
12 years agoapple: Silence some debug spew
Jeremy Huddleston [Fri, 21 Oct 2011 05:54:08 +0000 (22:54 -0700)]
apple: Silence some debug spew

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
12 years agor600g: cleanup r600_reset_blittable_to_compressed
Marek Olšák [Fri, 21 Oct 2011 00:00:40 +0000 (02:00 +0200)]
r600g: cleanup r600_reset_blittable_to_compressed

12 years agost/mesa: Initialize variable.
Vinson Lee [Thu, 20 Oct 2011 23:52:53 +0000 (16:52 -0700)]
st/mesa: Initialize variable.

ptr is uninitialized if ib is NULL.

Fixes Coverity uninitialized pointer read defect.

Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
12 years agoAdd solaris detection for PIPE_ARCH_LITTLE_ENDIAN/PIPE_ARCH_BIG_ENDIAN
Alan Coopersmith [Tue, 18 Oct 2011 21:04:15 +0000 (14:04 -0700)]
Add solaris detection for PIPE_ARCH_LITTLE_ENDIAN/PIPE_ARCH_BIG_ENDIAN

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
12 years agoi965: Remove copy and pasted gen7_wm_constants state atom.
Kenneth Graunke [Wed, 19 Oct 2011 00:05:30 +0000 (17:05 -0700)]
i965: Remove copy and pasted gen7_wm_constants state atom.

Now that this is identical to gen6_wm_constants, just use that instead.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Use AUB_TRACE_WM_CONSTANTS in gen7_prepare_wm_push_constants.
Kenneth Graunke [Wed, 19 Oct 2011 00:05:29 +0000 (17:05 -0700)]
i965: Use AUB_TRACE_WM_CONSTANTS in gen7_prepare_wm_push_constants.

This makes it match gen6_prepare_wm_push_constants.  For some reason, it
had been using AUB_TRACE_NO_TYPE.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Fix incorrect dirty bit in gen6_prepare_wm_push_constants.
Kenneth Graunke [Wed, 19 Oct 2011 00:05:28 +0000 (17:05 -0700)]
i965: Fix incorrect dirty bit in gen6_prepare_wm_push_constants.

We definitely want CACHE_NEW_WM_PROG, not CACHE_NEW_VS_PROG.

NOTE: This is a candidate for the 7.11 branch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agor300g: don't return NULL in resource_from_handle if the resource is too small
Marek Olšák [Thu, 20 Oct 2011 21:14:36 +0000 (23:14 +0200)]
r300g: don't return NULL in resource_from_handle if the resource is too small

The DDX may allocate a buffer with a too small size.
Instead of failing, let's pretend everything's alright.

Such bugs should be fixed in the DDX, of course.

NOTE: This is a candidate for the stable branches.

12 years agodocs: document known issues with Viewperf 11
Brian Paul [Thu, 20 Oct 2011 21:13:17 +0000 (15:13 -0600)]
docs: document known issues with Viewperf 11

12 years agoi965/vs: Fix comparisons with uint negation.
Eric Anholt [Mon, 3 Oct 2011 22:31:52 +0000 (15:31 -0700)]
i965/vs: Fix comparisons with uint negation.

The condmod instruction ends up generating garbage condition codes,
because apparently the comparison happens on the accumulator value (33
bits for UD), not the truncated value that would be written.

Fixes vs-op-neg-*

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoi965/fs: Fix comparisions with uint negation.
Eric Anholt [Mon, 3 Oct 2011 22:12:10 +0000 (15:12 -0700)]
i965/fs: Fix comparisions with uint negation.

The condmod instruction ends up generating garbage condition codes,
because apparently the comparison happens on the accumulator value (33
bits for UD), not the truncated value that would be written.

Fixes fs-op-neg-*

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agod3d1x: make use of new query types
Christoph Bumiller [Sat, 15 Oct 2011 14:44:04 +0000 (16:44 +0200)]
d3d1x: make use of new query types

12 years agosoftpipe: implement/fix TIMESTAMP queries
Christoph Bumiller [Sat, 15 Oct 2011 14:35:27 +0000 (16:35 +0200)]
softpipe: implement/fix TIMESTAMP queries

12 years agogallium: add new query types and missing documentation
Christoph Bumiller [Thu, 20 Oct 2011 16:03:23 +0000 (18:03 +0200)]
gallium: add new query types and missing documentation

12 years agomesa: Fix detection of whether an ARB_vp is enabled for two sided lighting.
Eric Anholt [Tue, 18 Oct 2011 22:20:27 +0000 (15:20 -0700)]
mesa: Fix detection of whether an ARB_vp is enabled for two sided lighting.

When there is no ARB_vertex_program program enabled, the Current
pointer points at a default program, so we were always using
VERTEX_PROGRAM_TWO_SIDE, even for fixed function lighting.

Fixes piglit two-sided-lighting*

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agomesa: Round the argument to PixelStoref instead of truncating.
Eric Anholt [Tue, 18 Oct 2011 18:52:39 +0000 (11:52 -0700)]
mesa: Round the argument to PixelStoref instead of truncating.

From the GL 2.1 specification, page 114 (page 128 of the PDF):

    "The version of PixelStore that takes a floating-point value
     may be used to set any type of parameter; if the parameter is
     boolean, then it is set to FALSE if the passed value is 0.0
     and TRUE otherwise, while if the parameter is an integer, then
     the passed value is rounded to the nearest integer."

Fixes piglit roundmode-pixelstore.
Note: This is a candidate for the 7.11 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agomesa: handle PBO access error in display list mode
Yuanhan Liu [Wed, 19 Oct 2011 03:20:18 +0000 (11:20 +0800)]
mesa: handle PBO access error in display list mode

Simply generate GL_INVALID_OPERATION error at display list mode. As
explained by Brian, we are going to access PBO data at compile time.
No need to defer the error at execution time.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoi965: silence signed/unsigned comparison warning
Brian Paul [Sat, 15 Oct 2011 22:36:11 +0000 (16:36 -0600)]
i965: silence signed/unsigned comparison warning

Reviewed-by: Paul Berry <stereotype441@gmail.com>
12 years agost/mesa: remove primitive restart assertion
Brian Paul [Mon, 2 May 2011 19:19:09 +0000 (13:19 -0600)]
st/mesa: remove primitive restart assertion

Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
12 years agost/mesa: Don't have indices buffers map when calling draw
Jakob Bornecrantz [Wed, 20 Apr 2011 11:42:37 +0000 (12:42 +0100)]
st/mesa: Don't have indices buffers map when calling draw

12 years agost/mesa: Implement primitive restart in software
Jakob Bornecrantz [Fri, 15 Apr 2011 20:13:04 +0000 (21:13 +0100)]
st/mesa: Implement primitive restart in software

12 years agoswrast: fix float->uint conversion of gl_FragDepth
Brian Paul [Wed, 19 Oct 2011 15:29:38 +0000 (09:29 -0600)]
swrast: fix float->uint conversion of gl_FragDepth

Using IROUND() to convert a float depth value to a 32-bit uint Z value.
didn't work (it returns a signed value).  Just use a cast instead

Fixes piglit fbo-depth-array failure with swrast.

Note: this is a candidate for the 7.11 branch.

12 years agomesa: better debug messages in _mesa_test_texobj_completeness()
Brian Paul [Wed, 19 Oct 2011 15:20:47 +0000 (09:20 -0600)]
mesa: better debug messages in _mesa_test_texobj_completeness()

And use a gl_texture_image var to simplify the code a bit.

12 years agomesa/st: Backport WPOS adjustment fixes from st_mesa_to_tgsi.c to st_glsl_to_tgsi...
José Fonseca [Wed, 19 Oct 2011 14:45:58 +0000 (16:45 +0200)]
mesa/st: Backport WPOS adjustment fixes from st_mesa_to_tgsi.c to st_glsl_to_tgsi.cpp.

This is a trivial verbatim copy of the code from Christoph Bumiller's commit
f986a6560f3ee9a79b89e9409e3a9ac52b53315c.

Fixes fdo 39939 and 39942.

12 years agowinsys/svga: Remove some unneeded debug code
Thomas Hellstrom [Wed, 19 Oct 2011 11:49:09 +0000 (13:49 +0200)]
winsys/svga: Remove some unneeded debug code

This code isn't really relevant since the kernel takes care not
to destroy busy GMR buffers.

Also with the advent of fence objects, the code was incorrect since
it didn't refcount fence handles.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
12 years agoscons: Add uniform_query.cpp to SConscript.
Vinson Lee [Wed, 19 Oct 2011 01:39:11 +0000 (18:39 -0700)]
scons: Add uniform_query.cpp to SConscript.

12 years agomesa: handle the pbo case for save_Bitmap
Yuanhan Liu [Sat, 15 Oct 2011 14:44:18 +0000 (22:44 +0800)]
mesa: handle the pbo case for save_Bitmap

Wrap _mesa_unpack_bitmap to handle the case that data is stored in pixel
buffer object.

This would make calling Bitmap with data stored in PBO by display list work.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agomesa: fix inverted pbo test error at _mesa_GetnCompressedTexImageARB
Yuanhan Liu [Sun, 16 Oct 2011 01:35:33 +0000 (09:35 +0800)]
mesa: fix inverted pbo test error at _mesa_GetnCompressedTexImageARB

It seems like a typo.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agomesa: generate error if pbo offset is not aligned with the size of specified type
Yuanhan Liu [Mon, 17 Oct 2011 01:57:36 +0000 (09:57 +0800)]
mesa: generate error if pbo offset is not aligned with the size of specified type

v2: quote the spec; explicitly exclude the GL_BITMAP case to make code
    more readable. (comments from Ian)

v3: Cast the offset by GLintptr to remove the compile warning(comments
    from Brian).

    I also found that I should use _mesa_sizeof_packed_type() instead,
    as it includes packed pixel type, like GL_UNSIGNED_SHORT_5_6_5.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoi965: setup address rounding enable bits
Yuanhan Liu [Fri, 14 Oct 2011 05:47:10 +0000 (13:47 +0800)]
i965: setup address rounding enable bits

The patch(based on the reading of the emulator) came from while I was
trying to fix the oglc pbo texImage.1PBODefaults fail. This case
generates a texture with the width and height equal to window's width
and height respectively, then try to texture it on the whole window.
So, it's exactly one texel for one pixel.  And, the min filter and mag
filter are GL_LINEAR. It runs with swrast OK, as expected. But it failed
with i965 driver.

Well, you can't tell the difference from the screen, as the error is
quite tiny. From my digging, it seems that there are some tiny error
happened while getting tex address. This will break the one texel for
one pixel rule in this case. Thus the linear result is taken, with tiny
error.

This patch would fix all oglc pbo subcase fail with the same issue on
both ILK, SNB and IVB.

v2: comments from Ian, make the address_round filed assignment consistent.
    (the sampler is alread memset to 0 by the xxx_update_samper_state
     caller, so need to assign 0 first)

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
12 years agoi915: make i830/i915_hiz_resolve_noop() static
Brian Paul [Wed, 19 Oct 2011 01:11:29 +0000 (19:11 -0600)]
i915: make i830/i915_hiz_resolve_noop() static

12 years agomesa: use format string in _mesa_error() call to silence warning
Brian Paul [Wed, 19 Oct 2011 00:59:13 +0000 (18:59 -0600)]
mesa: use format string in _mesa_error() call to silence warning

12 years agoi965: remove unused vars in brw_set_ff_sync_message()
Brian Paul [Wed, 19 Oct 2011 00:58:51 +0000 (18:58 -0600)]
i965: remove unused vars in brw_set_ff_sync_message()

12 years agoglsl_to_tgsi: Use _mesa_generate_parameters_list_for_uniforms
Ian Romanick [Sun, 11 Sep 2011 21:17:21 +0000 (16:17 -0500)]
glsl_to_tgsi: Use _mesa_generate_parameters_list_for_uniforms

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Bryan Cain <bryancain3@gmail.com>
12 years agoir_to_mesa: Generate gl_program_parameter list by walking the GLSL IR.
Ian Romanick [Sat, 10 Sep 2011 01:27:36 +0000 (18:27 -0700)]
ir_to_mesa: Generate gl_program_parameter list by walking the GLSL IR.

Generate the program parameters list by walking the IR instead of by
walking the list of linked uniforms.  This simplifies the code quite a
bit, and is probably a bit more correct.  The list of linked uniforms
should really only be used by the GL API to interact with the
application.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: Bryan Cain <bryancain3@gmail.com>
Cc: Eric Anholt <eric@anholt.net>
12 years agoir_to_mesa: Move some things outside the 'extern "C"' blocks
Ian Romanick [Sun, 11 Sep 2011 21:10:33 +0000 (16:10 -0500)]
ir_to_mesa: Move some things outside the 'extern "C"' blocks

Having a few of these includes or forward declarations inside the
'extern "C"' block can cause problems later.  Specifically, it
prevents C++ linkage functions from being added to ir_to_mesa.h and
makes G++ angry if 'struct foo' is seen both inside and outside an
'extern "C"'.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Use glsl_type::gl_type in glGetActiveUniform
Ian Romanick [Wed, 7 Sep 2011 17:41:32 +0000 (10:41 -0700)]
mesa: Use glsl_type::gl_type in glGetActiveUniform

This has the same value has gl_program_parameter::DataType field.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Move _mesa_GetActiveUniformARB to uniform_query.cpp
Ian Romanick [Tue, 6 Sep 2011 22:30:54 +0000 (15:30 -0700)]
mesa: Move _mesa_GetActiveUniformARB to uniform_query.cpp

Fold _mesa_get_active_uniform into its only caller in the process.
More changes are coming soon.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Simplify uniform debug logging logic
Ian Romanick [Tue, 4 Oct 2011 23:58:21 +0000 (16:58 -0700)]
mesa: Simplify uniform debug logging logic

This simplificiation was enabled by the earlier refactors that
eliminated the references to the assembly shaders stored in the
gl_shader_program structure.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965: Disassemble Ivybridge Data Port/Data Cache messages.
Kenneth Graunke [Sat, 8 Oct 2011 08:31:11 +0000 (01:31 -0700)]
i965: Disassemble Ivybridge Data Port/Data Cache messages.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Document most of the brw_instruction message structs.
Kenneth Graunke [Sat, 8 Oct 2011 07:34:46 +0000 (00:34 -0700)]
i965: Document most of the brw_instruction message structs.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Rename pixel_scoreboard_clear to last_render_target for clarity.
Kenneth Graunke [Sat, 8 Oct 2011 05:26:40 +0000 (22:26 -0700)]
i965: Rename pixel_scoreboard_clear to last_render_target for clarity.

Finding this bit in the documentation proved challenging.  It wasn't in
the SEND instruction's message descriptor section, nor the data port
message descriptor section.  It turns out to be part of the Render
Target Write message's control bits, and in the documentation is named
"Last Render Target Select".

Shaders that use Multiple Render Targets should set this bit on the last
RT write, but not on any prior ones.

The GPU does update the Pixel Scoreboard appropriately, but doesn't
document this bit as directly causing a scoreboard clear.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Remove duplicate copies of mlen & rlen from instruction decode.
Kenneth Graunke [Sat, 8 Oct 2011 07:40:39 +0000 (00:40 -0700)]
i965: Remove duplicate copies of mlen & rlen from instruction decode.

After printing the details of a specific message, we always print out
the message length and response length with nice "mlen" and "rlen"
labels.

For Gen5+ URB writes, we were dumping mlen and rlen a second time:
urb 0 urb_write interleave used complete mlen 5, rlen 0 mlen 5 rlen 0

Also, for Gen6 data port messages, we were including mlen and rlen in
the tuple of undecipherable integers.

Both of these are completely redundant.  So, remove them.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Factor out code for setting Message Descriptors.
Kenneth Graunke [Sat, 8 Oct 2011 04:09:08 +0000 (21:09 -0700)]
i965: Factor out code for setting Message Descriptors.

Every brw_set_???_message function had duplicated code, per-generation,
to set the Message Descriptor and Extended Message Descriptor bits
(SFID, message length, response length, header present, end of thread).

However, these fields are actually specified as part of the SEND
instruction itself; individual types of messages don't even specify
them (except for header present, but that's in the same bit location).

Since these are exactly the same regardless of the message type, just
create a function to set them, using the generic message structs.  This
not only shortens the code, but hides a lot of the per-generation
complexity (like the SFID being in destreg__conditionalmod) in one spot.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Remove EOT parameter from brw_SAMPLE and brw_set_sampler_message.
Kenneth Graunke [Sat, 8 Oct 2011 04:55:30 +0000 (21:55 -0700)]
i965: Remove EOT parameter from brw_SAMPLE and brw_set_sampler_message.

The existing code asserted that eot == 0, as it doesn't make sense for
a thread to sample a texture as the last thing it does.

It doesn't make much sense to pass around a dead parameter either.
Especially for a function which already has a long parameter list.

So, remove the parameter and just set EOT to 0.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Document the brw_instruction Message Descriptor structures.
Kenneth Graunke [Sat, 8 Oct 2011 04:27:24 +0000 (21:27 -0700)]
i965: Document the brw_instruction Message Descriptor structures.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Rename BRW_MESSAGE_TARGET_* to BRW_SFID_* and document them.
Kenneth Graunke [Sat, 8 Oct 2011 03:55:35 +0000 (20:55 -0700)]
i965: Rename BRW_MESSAGE_TARGET_* to BRW_SFID_* and document them.

When reading the data port code, it was not clear to me what these
values meant, nor where I could find them in the documentation.
Especially since the latest BSpec and older PRMs document them in
radically different places...neither of which are near the descriptions
of individual messages.

Cite the documentation, and rename them to SFID to signify that these
are Shared Function IDs that one can read about in the GPU overview,
rather than arbitrary bitfields.  While we're add it, make them an enum.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Clarify check for which cache to use on Gen6 data port reads.
Kenneth Graunke [Sat, 8 Oct 2011 04:45:34 +0000 (21:45 -0700)]
i965: Clarify check for which cache to use on Gen6 data port reads.

Currently, we use the Render Cache for scratch access (read/write data)
and the Sampler Cache for all read only data (pull constants).

Reversing the condition here is clearer: if the caller requested the
Render Cache, use that.  Otherwise, they requested the Data Cache
(which does not exist on Gen6) or Sampler Cache, so use the Sampler
Cache.

This should not change behavior in any way.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965: Use Ivybridge's "Legacy Data Port" for reads/writes.
Kenneth Graunke [Sat, 8 Oct 2011 04:09:53 +0000 (21:09 -0700)]
i965: Use Ivybridge's "Legacy Data Port" for reads/writes.

Using the constant cache for reads isn't going to work for scratch
reads (variably-indexed arrays or register spills), as these aren't
constant at all.

Also, in the new VS backend, use the proper message number for OWord
Dual Block Write messages.  It's now 10, instead of 9.

+205 piglits.

NOTE: This is a candidate for the 7.11 branch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agosoftpipe: remove unused vars in softpipe_clear()
Brian Paul [Tue, 18 Oct 2011 14:27:52 +0000 (08:27 -0600)]
softpipe: remove unused vars in softpipe_clear()

12 years agoglsl: Stop tree grafting if a variable is overwritten as an 'out' param.
Kenneth Graunke [Thu, 22 Sep 2011 22:04:56 +0000 (15:04 -0700)]
glsl: Stop tree grafting if a variable is overwritten as an 'out' param.

While reviewing some compiler cleanups I'd sent out, Paul noticed that
tree grafting wasn't taking "out" parameters into account.

Further investigation revealed that it isn't strictly necessary: ir_call
ends basic blocks, and tree grafting currently only operates on basic
blocks.  So calls already kill grafts.

However, just to be safe, this patch makes "out" parameters explicitly
kill grafts.  Paul and I both prefer this.  It's a bit clearer.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
12 years agointel: Add 'mode' param to intel_region_map
Chad Versace [Thu, 22 Sep 2011 20:04:18 +0000 (13:04 -0700)]
intel: Add 'mode' param to intel_region_map

The 'mode' param is a bitset of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT.

A future commit will perform buffer resolves in intel_region_map().  So,
even though the access mode is irrelevant to the GTT, the extra
information allows us to intelligently avoid unneccessary buffer resolves.

Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agointel: Add HiZ operations to intel_context::vtbl for all drivers
Chad Versace [Tue, 20 Sep 2011 20:43:17 +0000 (13:43 -0700)]
intel: Add HiZ operations to intel_context::vtbl for all drivers

Add the following to the vtbl:
    hiz_resolve_depthbuffer
    hiz_resolve_hizbuffer

For all drivers for which HiZ is not enabled, the methods are set to be
no-ops. If HiZ is enabled, the methods are currently to set to empty
stubs.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agoi965: Initialize intel_context::vtbl after calling intelInitContext()
Chad Versace [Wed, 31 Aug 2011 19:16:13 +0000 (12:16 -0700)]
i965: Initialize intel_context::vtbl after calling intelInitContext()

intel_context::gen field is set by intelInitContext(). So, by calling
intelInitContext() before initializing the vtable, we can can construct
different vtables for different gens.

Specifically, this allows us to set the HiZ operations to be no-ops for
contexts for which HiZ is not enabled.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agointel: Fix scatter/gather for depthstencil textures
Chad Versace [Fri, 7 Oct 2011 19:12:46 +0000 (12:12 -0700)]
intel: Fix scatter/gather for depthstencil textures

During anholt's MapTextureImage refactoring, the call to
intel_tex_image_s8z24_create_renderbuffers was missplaced. It needs to
occur *after* the miptree is allocated.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agoi965/gen6: Fix segfault in prepare_blend_state()
Chad Versace [Sun, 9 Oct 2011 03:00:50 +0000 (20:00 -0700)]
i965/gen6: Fix segfault in prepare_blend_state()

Don't dereference the color buffer if one isn't attached.

This fixes the following Piglit tests in my experimental HiZ branch:
    glean/logicOp
    glean/paths

Note: This is a candidate for the stable branches.
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agovbo: Redeclare bind_array() as non-static vbo_bind_array()
Chad Versace [Thu, 6 Oct 2011 18:38:29 +0000 (11:38 -0700)]
vbo: Redeclare bind_array() as non-static vbo_bind_array()

This is necessary because i965 will need to call vbo_bind_array() when
cleaning up after a buffer resolve meta-op.

Detailed Explanation
--------------------
The vbo module tracks vertex attributes separately from the gl_context.
Specifically, the vbo module maintins vertex attributes in
vbo_exec_context::array::inputs, which is synchronized with
gl_context::Array::ArrayObj::VertexAttrib by vbo_bind_array().
vbo_draw_arrays() calls vbo_bind_array() to perform the synchronization
before calling the real draw call, vbo_context::draw_arrays.

Intel hardware accomplishes buffer resolves with a meta-op. Frequently,
that meta-op must be performed within glDraw* in the moment immediately
before the draw occurs (The hardware designers hate us...). After
performing the meta-op, but before calling vbo_bind_array(), the
gl_context's vertex attributes will have been restored to their original
state (that is, their state before the meta-op began), but the vbo
module's vertex attribute are those used in the last meta-op. Therefore we
must manually synchronize the two with vbo_bind_array() before continuing
with the original draw command (that is, the one requested with glDraw*).

See brw_predraw_resolve_buffers(), which will be added in a future commit.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agomesa: Add dd_function_table::PrepareExecBegin
Chad Versace [Thu, 29 Sep 2011 00:06:35 +0000 (17:06 -0700)]
mesa: Add dd_function_table::PrepareExecBegin

This hook allows the driver to prepare for a glBegin/glEnd.

i965 will use the hook to avoid avoid recursive calls to FLUSH_VERTICES
during a buffer resolve meta-op.

Detailed Justification
----------------------
When vertices are queued during a glBegin/glEnd block, those vertices must
of course be drawn before any rendering state changes. To enusure this,
Mesa calls FLUSH_VERTICES as a prehook to such state changes. Therefore,
FLUSH_VERTICES itself cannot change rendering state without falling into
a recursive trap.

This precludes meta-ops, namely i965 buffer resolves, from occuring while
any vertices are queued. To avoid that situation, i965 must satisfy the
following condition: that it queues no vertex if a buffer needs resolving.
To satisfy this, i965 will use the PrepareExecBegin hook to resolve all
buffers on entering a glBegin/glEnd block.

--------
v2: Don't add dd_function_table::CleanupExecEnd. Anholt and I discovered
    that hook to be unnecessary.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agoswrast: Fix fastpaths for glRead/WritePixels(GL_DEPTH_STENCIL)
Chad Versace [Fri, 7 Oct 2011 23:22:56 +0000 (16:22 -0700)]
swrast: Fix fastpaths for glRead/WritePixels(GL_DEPTH_STENCIL)

In some cases, Intel hardware requires that depth and stencil buffers be
separate. To accommodate swrast, i965 resorts to hackery that causes
a segfault in the fastpaths of draw_depth_stencil_pixels() and
read_depth_stencil_pixels().

The hack is that i965 sets framebuffer->Attachment[BUFFER_DEPTH].Renderbuffer
and framebuffer->Attachment[BUFFER_STENCIL].Renderbuffer to a dummy
renderbuffer for which the GetRow accessors and friends are null. The real
buffers are located at framebuffer->_DepthBuffer and framebuffer->_Stencilbuffer.

To fix the segault, this patch skips the fastpath if
framebuffer->Attachment[BUFFER_DEPTH].Renderbuffer->GetRow is null.

Note: This is a candidate for the 7.11 branch.
Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agometa: Bump MAX_META_OPS_DEPTH from 2 to 8
Chad Versace [Tue, 27 Sep 2011 23:23:29 +0000 (16:23 -0700)]
meta: Bump MAX_META_OPS_DEPTH from 2 to 8

When i965 uses (in the near future) meta-ops to perform buffer resolves,
the meta-op stack exceeds depth 2. I bumped it to 8 because... 8 is bigger
than 2, but not too big.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agometa: Add flag MESA_META_SELECT_FEEDBACK
Chad Versace [Fri, 7 Oct 2011 22:07:00 +0000 (15:07 -0700)]
meta: Add flag MESA_META_SELECT_FEEDBACK

If this flag is set, then _mesa_meta_begin/end will save/restore the state of
GL_SELECT and GL_FEEDBACK render modes.

Intel's future buffer resolve meta-ops will require this, since buffer resolves
may occur when the GL_RENDER_MODE is GL_SELECT.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agomesa: Declare _mesa_RenderMode as non-static
Chad Versace [Fri, 7 Oct 2011 22:45:51 +0000 (15:45 -0700)]
mesa: Declare _mesa_RenderMode as non-static

This is required in order for meta-ops to save/restore the GL_RENDER_MODE
state.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agointel: Convert from GLboolean to 'bool' from stdbool.h.
Kenneth Graunke [Fri, 7 Oct 2011 19:26:50 +0000 (12:26 -0700)]
intel: Convert from GLboolean to 'bool' from stdbool.h.

I initially produced the patch using this bash command:
for file in {intel,i915,i965}/*.{c,cpp,h}; do [ ! -h $file ] && sed -i
's/GLboolean/bool/g' $file && sed -i 's/GL_TRUE/true/g' $file && sed -i
's/GL_FALSE/false/g' $file; done

Then I manually added #include <stdbool.h> to fix compilation errors,
and converted a few functions back to GLboolean that were used in core
Mesa's function pointer table to avoid "incompatible pointer" warnings.

Finally, I cleaned up some whitespace issues introduced by the change.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chad Versace <chad@chad-versace.us>
Acked-by: Paul Berry <stereotype441@gmail.com>
12 years agomesa: Make the program texel offsets limits available with GLSL 1.30.
Eric Anholt [Sat, 15 Oct 2011 20:25:51 +0000 (13:25 -0700)]
mesa: Make the program texel offsets limits available with GLSL 1.30.

It was previously under gpu_shader4, but I'm pretty sure everyone's
going to be doing GLSL 1.30 first (since gpu_shader4 is basically 1.30
plus a bunch of extra stuff).

Fixes piglit glsl-1.30/texel-offset-limits.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agometa: Fix saving the active program
Neil Roberts [Tue, 18 Oct 2011 17:42:51 +0000 (18:42 +0100)]
meta: Fix saving the active program

When saving the active program in _mesa_meta_begin, it was actually
saving the fragment program instead. This means that if the
application binds a program that only has a vertex shader then when
the meta saved state is restored it will forget the bound program.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41969
Reviewed-by: Chad Versace <chad@chad-versace.us>
12 years agomesa: Convert fixed function fragment program generator to GLSL IR.
Eric Anholt [Mon, 1 Nov 2010 20:16:21 +0000 (13:16 -0700)]
mesa: Convert fixed function fragment program generator to GLSL IR.

This is a step towards providing a direct route for drivers accepting
GLSL IR for codegen.  Perhaps more importantly, it runs the fixed
function fragment program through the GLSL IR optimization.  Having
seen how easy it is to make ugly fixed function texenv code that can
do unnecessary work, this may improve real applicatinos.

12 years agomesa: Add a flag for shader programs to allow SSO linkage in GLES2.
Eric Anholt [Fri, 22 Jul 2011 19:57:47 +0000 (12:57 -0700)]
mesa: Add a flag for shader programs to allow SSO linkage in GLES2.

On converting fixed function programs to generate GLSL, the linker
became cranky that we were trying to make something that wasn't a
linked vertex+fragment program.  Given that the Mesa GLES2 drivers
also support desktop GL with EXT_sso, just telling the linker to shut
up seems like the easiest solution.

12 years agoglsl: Add gl_CurrentAttrib{Vert,Frag}MESA internal builtin uniforms.
Eric Anholt [Sun, 17 Jul 2011 00:41:26 +0000 (17:41 -0700)]
glsl: Add gl_CurrentAttrib{Vert,Frag}MESA internal builtin uniforms.

These will be used by the FF VS/FS to represent the current attributes
when they don't have an active vertex array.

12 years agoff_fragment_shader: Use FRAG_RESULT_COLOR to write all our colors at once.
Eric Anholt [Wed, 13 Jul 2011 22:52:04 +0000 (15:52 -0700)]
ff_fragment_shader: Use FRAG_RESULT_COLOR to write all our colors at once.

This is a slight simplification on the way to actually generating GLSL
fragment shaders.

12 years agosvga: Plug a fence leak
Thomas Hellstrom [Mon, 17 Oct 2011 12:24:14 +0000 (14:24 +0200)]
svga: Plug a fence leak

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
12 years agoi915g: Use the right shader limits.
Stéphane Marchesin [Tue, 18 Oct 2011 04:43:19 +0000 (21:43 -0700)]
i915g: Use the right shader limits.

12 years agoi915g: Add TODO.
Stéphane Marchesin [Sun, 16 Oct 2011 06:12:05 +0000 (23:12 -0700)]
i915g: Add TODO.

12 years agor600g: Use the bitfield define matching the register it is used for.
Mathias Fröhlich [Fri, 23 Sep 2011 17:43:31 +0000 (19:43 +0200)]
r600g: Use the bitfield define matching the register it is used for.

Fix a typo that should result in the same code.

12 years agost/xorg: fix build when /lib/gallium directory does not exist yet
Marcin Slusarz [Sun, 16 Oct 2011 18:13:49 +0000 (20:13 +0200)]
st/xorg: fix build when /lib/gallium directory does not exist yet

TARGET was not defined, so make checked directory instead of file

12 years agotargets/va/vdpau/xvmc: don't rebuild target lib every time
Marcin Slusarz [Sun, 16 Oct 2011 16:51:11 +0000 (18:51 +0200)]
targets/va/vdpau/xvmc: don't rebuild target lib every time

Dependency on target directory caused unnecessary relink. Remove them.

12 years agost/xorg: remove target library on make clean
Marcin Slusarz [Sun, 16 Oct 2011 12:37:36 +0000 (14:37 +0200)]
st/xorg: remove target library on make clean

12 years agogallium/targets: use c++ compiler for linking
Marcin Slusarz [Thu, 13 Oct 2011 19:45:45 +0000 (21:45 +0200)]
gallium/targets: use c++ compiler for linking

As pointed out by Michel Dänzer, gcc -lstdc++ doesn't work on all systems,
because it may require other libraries which are only pulled in implicitly
by g++. And libstdc++ is available only with GNU compiler.

Use c++ compiler for linking and remove redundant LDFLAGS += -lstdc++
all over the tree.

12 years agoAdd an autoconf option for mangling Mesa.
Tom Fogal [Mon, 10 Oct 2011 16:33:18 +0000 (10:33 -0600)]
Add an autoconf option for mangling Mesa.

In addition to setting up the flags correctly, this renames the
generated libraries to ensure they get 'Mangled' in the name.
This is very useful for distros and the like, where mangled Mesa
and non-mangled GL libraries typically need to be installed
side-by-side.

Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
12 years agor300/compiler: Try to eliminate REPL_ALPHA instructions
Tom Stellard [Sat, 15 Oct 2011 21:56:15 +0000 (17:56 -0400)]
r300/compiler: Try to eliminate REPL_ALPHA instructions

Scalar instruction that need to write to the xyz components of a
register must reserve the RGB instruction slot for a REPL_ALPHA
instruction.  With this commit, the scheduler will attempt to free
the RGB slot by moving the write to the w component of a register.

12 years agor300/compiler: More agressive RGB to Alpha conversions
Tom Stellard [Sat, 15 Oct 2011 21:55:40 +0000 (17:55 -0400)]
r300/compiler: More agressive RGB to Alpha conversions

12 years agor300/compiler: Only convert RGB->Alpha when optimizations are enabled
Tom Stellard [Sun, 16 Oct 2011 15:12:54 +0000 (08:12 -0700)]
r300/compiler: Only convert RGB->Alpha when optimizations are enabled

12 years agomesa: add a function to do the image data copy stuff for save_CompressedTex(Sub)Image
Yuanhan Liu [Fri, 14 Oct 2011 06:28:22 +0000 (14:28 +0800)]
mesa: add a function to do the image data copy stuff for save_CompressedTex(Sub)Image

Introuduce a simple function called copy_data to do the image data copy
stuff for all the save_CompressedTex*Image function. The function check
the NULL data case to avoid some potential segfault. This also would
make the code a bit simpler and less redundance.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoconfigure: Use -fno-builtin-memcmp.
José Fonseca [Fri, 14 Oct 2011 17:28:55 +0000 (18:28 +0100)]
configure: Use -fno-builtin-memcmp.

Issue spotted by Adam Jackson <ajax at redhat.com>.

http://lists.freedesktop.org/archives/mesa-dev/2011-June/009077.html

12 years agogallivm: Eliminate tgsi_util_get_full_src_register_sign_mode call.
José Fonseca [Sun, 16 Oct 2011 12:48:33 +0000 (13:48 +0100)]
gallivm: Eliminate tgsi_util_get_full_src_register_sign_mode call.

It complicates more than it simplifies, now that there's only one negate
bit on TGSI registers.

12 years agollvmpipe: Use lp_build_ifloor_fract for exp2 calculation.
José Fonseca [Sun, 16 Oct 2011 00:42:57 +0000 (01:42 +0100)]
llvmpipe: Use lp_build_ifloor_fract for exp2 calculation.

Instead of separate ifloor / fract calls.

No change for SSE4.1 code, but less FP<->SI conversions on non SSE4.1
systems.

12 years agoRevert "r300g: fix rendering with a non-zero index bias in draw_elements_immediate"
Marek Olšák [Sun, 16 Oct 2011 01:19:11 +0000 (03:19 +0200)]
Revert "r300g: fix rendering with a non-zero index bias in draw_elements_immediate"

This reverts commit 5506f6ef966b8883e575a3f60ce96ad42ee6ffd2.

It breaks more things than it fixes.

12 years agoswrast: Remove redundant term in logic expression
Chad Versace [Mon, 10 Oct 2011 22:02:22 +0000 (15:02 -0700)]
swrast: Remove redundant term in logic expression

Fix is in {read,draw}_depth_stencil_pixels().  If depthRb == stencilRb,
then it is redundant to check depthRb->x *and* stencilRb->x.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agoswrast: Fix fastpaths in glRead/WritePixels(GL_DEPTH_STENCIL)
Chad Versace [Mon, 10 Oct 2011 22:07:14 +0000 (15:07 -0700)]
swrast: Fix fastpaths in glRead/WritePixels(GL_DEPTH_STENCIL)

For glReadPixels, the user supplied pixels have format
GL_UNSIGNED_INT_24_8.  But, when the depthstencil buffer's format was
MESA_FORMAT_S8_Z24, the fastpath read from the buffer without reordering
the depth and stencil bits. To fix this, this patch just skips the
fastpath when the format is not MESA_FORMAT_Z24_S8.

The problem and fix for glWritePixels is analagous.

Fixes the Piglit tests below on i965/gen6 and causes no regressions.
   general/depthstencil-default_fb-drawpixels-24_8
   general/depthstencil-default_fb-readpixels-24_8
   EXT_packed_depth_stencil/fbo-depthstencil-GL_DEPTH24_STENCIL8-drawpixels-24_8
   EXT_packed_depth_stencil/fbo-depthstencil-GL_DEPTH24_STENCIL8-readpixels-24_8

Note: This is a candidate for the stable branches.
Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agonv50,nvc0: extend formats table for integer formats
Christoph Bumiller [Thu, 13 Oct 2011 16:05:33 +0000 (18:05 +0200)]
nv50,nvc0: extend formats table for integer formats

12 years agogallium: add PIPE_BIND_BLENDABLE flag
Christoph Bumiller [Thu, 13 Oct 2011 12:48:03 +0000 (14:48 +0200)]
gallium: add PIPE_BIND_BLENDABLE flag

This is required for an accurate implementation of d3d1x's
CheckFormatSupport query.

It also seems generally useful for state trackers, which could
choose alternative rendering paths or formats if blending would
come at a significant performance loss.

12 years agor300/compiler: Enable reg rename pass on r500 and run it before optimizations
Tom Stellard [Sat, 14 May 2011 06:29:50 +0000 (23:29 -0700)]
r300/compiler: Enable reg rename pass on r500 and run it before optimizations

The scheduler and the register allocator are now smart enough to handle
it.

12 years agor300/compiler: Implement the texture semaphore
Tom Stellard [Fri, 13 May 2011 06:13:21 +0000 (23:13 -0700)]
r300/compiler: Implement the texture semaphore

The texture semaphore allows for prefetching of texture data.  On my
RV515, this increases the FPS of Lightsmark by 33% (This is with the
reg_rename pass enabled, which is enabled in the next commit).

There is a new env variable now called RADEON_TEX_GROUP, which allows
you to specify the maximum number of texture lookups to do at once.
The default is 8, but different values could produce better results
for various application / card combinations.

12 years agor300/compiler: Don't pair output writes with GPR writes in the scheduler
Tom Stellard [Thu, 13 Oct 2011 23:32:35 +0000 (16:32 -0700)]
r300/compiler: Don't pair output writes with GPR writes in the scheduler

12 years agor300/compiler: Prevent regalloc from creating non-native swizzles
Tom Stellard [Sat, 14 May 2011 07:48:57 +0000 (00:48 -0700)]
r300/compiler: Prevent regalloc from creating non-native swizzles

12 years agor300/compiler: Allow merged instructions to be scheduled on demand
Tom Stellard [Thu, 12 May 2011 06:51:39 +0000 (23:51 -0700)]
r300/compiler: Allow merged instructions to be scheduled on demand

We no longer emit full instructions immediately after they have been
merged.  Instead merged instructions are added to the ready list and
the scheduler can commit them whenever it wants.

12 years agomesa/vbo: Treat attribute 0 and vertex as the same
Ian Romanick [Thu, 13 Oct 2011 23:13:51 +0000 (16:13 -0700)]
mesa/vbo: Treat attribute 0 and vertex as the same

This is supported by the pseudo-code on pages 27 and 28 (pages 41 and
42 of the PDF) of the OpenGL 2.1 spec.  The last part of the
implementation of ArrayElement is:

    if (generic attribute array 0 enabled) {
      if (generic vertex attribute 0 array normalization flag is set, and
  type is not FLOAT or DOUBLE)
VertexAttrib[size]N[type]v(0, generic vertex attribute 0 array element i);
      else
VertexAttrib[size][type]v(0, generic vertex attribute 0 array element i);
    } else if (vertex array enabled) {
      Vertex[size][type]v(vertex array element i);
    }

Page 23 (page 37 of the PDF) of the same spec says:

    "Setting generic vertex attribute zero specifies a vertex; the
    four vertex coordinates are taken from the values of attribute
    zero. A Vertex2, Vertex3, or Vertex4 command is completely
    equivalent to the corresponding VertexAttrib* command with an
    index of zero."

Fixes piglit test attribute0.

NOTE: This is a candidate for stable branches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>