profile/ivi/mesa.git
12 years agoglsl: Remove resource count checks from ir_to_mesa and st_glsl_to_tgsi
Ian Romanick [Tue, 8 Nov 2011 22:04:59 +0000 (14:04 -0800)]
glsl: Remove resource count checks from ir_to_mesa and st_glsl_to_tgsi

These checks are now performed by the linker.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agolinker: Validate resource usage in the linker
Ian Romanick [Tue, 8 Nov 2011 20:37:19 +0000 (12:37 -0800)]
linker: Validate resource usage in the linker

This is also done in ir_to_mesa and st_glsl_to_tgsi, but that code
will be removed soon.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agolinker: Count the number of uniform components used by a shader during linking
Ian Romanick [Tue, 8 Nov 2011 20:30:58 +0000 (12:30 -0800)]
linker: Count the number of uniform components used by a shader during linking

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agolinker: Count the number of samplers used by a shader during linking
Ian Romanick [Tue, 8 Nov 2011 19:58:47 +0000 (11:58 -0800)]
linker: Count the number of samplers used by a shader during linking

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agometa: Fix restoring of fixed function texture enables.
Eric Anholt [Thu, 10 Nov 2011 20:44:47 +0000 (12:44 -0800)]
meta: Fix restoring of fixed function texture enables.

If they were disabled on entry, and we enabled one (like for
BlitFramebuffer), we wouldn't disable it on the way out.  Retain the
attempted optimization here (don't keep calling to set each bit for
changes that won't matter) by just setting the bits directly with
appropriate flushing.

Fixes misrendering on the second draw of piglit fbo-blit.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agometa: Don't forget to flag state when restoring texobjects.
Eric Anholt [Thu, 10 Nov 2011 20:31:11 +0000 (12:31 -0800)]
meta: Don't forget to flag state when restoring texobjects.

It's unlikely that we changed the object but no other texture
parameter, but be correct anyway.  Noticed by inspection.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agost/mesa: fix system value to semantic mapping
Christoph Bumiller [Fri, 11 Nov 2011 22:18:26 +0000 (23:18 +0100)]
st/mesa: fix system value to semantic mapping

Broken by addition of SYSTEM_VALUE_VERTEX_ID in
919c53e87a1f6f5322bc1f1486bb3e6b954b00d5.

12 years agogallium: add TGSI_SEMANTIC_VERTEXID
Christoph Bumiller [Mon, 14 Nov 2011 17:12:46 +0000 (18:12 +0100)]
gallium: add TGSI_SEMANTIC_VERTEXID

12 years agor600g: mask write for fake VS export components
Vadim Girlin [Thu, 6 Oct 2011 05:05:23 +0000 (09:05 +0400)]
r600g: mask write for fake VS export components

12 years agor600g: fix op3 & write in merge_inst_groups
Vadim Girlin [Thu, 6 Oct 2011 05:04:41 +0000 (09:04 +0400)]
r600g: fix op3 & write in merge_inst_groups

12 years agor600g: set max max tex/vtx instructions count to 16 for cayman
Alex Deucher [Mon, 14 Nov 2011 16:01:00 +0000 (11:01 -0500)]
r600g: set max max tex/vtx instructions count to 16 for cayman

Cayman is 16 as well.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agor600g: set max tex/vtx instructions count to 16 for evergreen
Vadim Girlin [Sat, 15 Oct 2011 01:47:49 +0000 (05:47 +0400)]
r600g: set max tex/vtx instructions count to 16 for evergreen

According to evergreen-isa doc 16 is max value for evergreen.
More than 16 doesn't work for me.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
12 years agoradeon: further cleanup of shared code
Fabio Pedretti [Mon, 14 Nov 2011 15:54:19 +0000 (10:54 -0500)]
radeon: further cleanup of shared code

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agoradeon: add some missing FireMV pci ids
Alex Deucher [Mon, 14 Nov 2011 14:56:19 +0000 (09:56 -0500)]
radeon: add some missing FireMV pci ids

Note: this is a candidate for the stable branches.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agomesa/st: Flush stdout after pritingin the GLSL.
José Fonseca [Mon, 14 Nov 2011 14:43:25 +0000 (14:43 +0000)]
mesa/st: Flush stdout after pritingin the GLSL.

Otherwise it gets all garbled with stderr.

12 years agoglsl: Add missing ';' in action statement.
José Fonseca [Mon, 14 Nov 2011 14:14:45 +0000 (14:14 +0000)]
glsl: Add missing ';' in action statement.

Addresses the warnings:

  warning: a `;' might be needed at the end of action code
  warning: future versions of Bison will not add the `;'

12 years agollvmpipe: Silent warnings about undeclared llvmpipe_check_render_cond.
José Fonseca [Mon, 14 Nov 2011 13:50:33 +0000 (13:50 +0000)]
llvmpipe: Silent warnings about undeclared llvmpipe_check_render_cond.

12 years agoutil: Avoid signed/unsigned comparison in u_trim_pipe_prim().
José Fonseca [Fri, 11 Nov 2011 08:25:13 +0000 (08:25 +0000)]
util: Avoid signed/unsigned comparison in u_trim_pipe_prim().

12 years agollvmpipe: Remove unused variables.
José Fonseca [Wed, 9 Nov 2011 19:40:09 +0000 (19:40 +0000)]
llvmpipe: Remove unused variables.

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agollvmpipe: Make more resilient to out-of-memory situations.
José Fonseca [Wed, 9 Nov 2011 19:29:37 +0000 (19:29 +0000)]
llvmpipe: Make more resilient to out-of-memory situations.

Most of the code was alright, but we were missing a few paths.

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agodraw: Handle failure to allocate aligned_constant_storage.
José Fonseca [Wed, 9 Nov 2011 18:58:28 +0000 (18:58 +0000)]
draw: Handle failure to allocate aligned_constant_storage.

Also, actually update const_storage_size, therefore avoiding to
unnecessarily reallocate aligned_constant_storage every single time
draw_vs_set_constants() is called.

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agogallivm: Remove duplicate statement.
José Fonseca [Mon, 7 Nov 2011 19:45:41 +0000 (19:45 +0000)]
gallivm: Remove duplicate statement.

ary_ge_arx_arz is already set earlier.

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agogallivm: Include stddef.h before the LLVM C++ headers.
José Fonseca [Tue, 8 Nov 2011 17:09:37 +0000 (17:09 +0000)]
gallivm: Include stddef.h before the LLVM C++ headers.

Necessary with build against LLVM 2.6, with recent gcc, as LLVM headers
depend on ptrdiff_t but don't properly include stddef.h

12 years agollvmpipe: fix unswizzle of packed float types.
Dave Airlie [Mon, 14 Nov 2011 09:34:07 +0000 (09:34 +0000)]
llvmpipe: fix unswizzle of packed float types.

I messed up adding the ubyte->float conversion.

This fixes getteximage-formats

https://bugs.freedesktop.org/show_bug.cgi?id=42837

Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agor600g: properly handle cayman in is_alu_vec_unit_inst()
Alex Deucher [Sun, 13 Nov 2011 22:46:01 +0000 (17:46 -0500)]
r600g: properly handle cayman in is_alu_vec_unit_inst()

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agor600g: fix cb offset for flushed_depth_texture
Vadim Girlin [Sat, 12 Nov 2011 18:23:45 +0000 (22:23 +0400)]
r600g: fix cb offset for flushed_depth_texture

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
12 years agor600g: fix stencil buffer ref counting on evergreen
Vadim Girlin [Sat, 12 Nov 2011 18:23:34 +0000 (22:23 +0400)]
r600g: fix stencil buffer ref counting on evergreen

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
12 years agor600g: lazy load for AR register
Vadim Girlin [Sun, 13 Nov 2011 18:08:33 +0000 (22:08 +0400)]
r600g: lazy load for AR register

Emit MOVA* instruction only when AR is used.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
12 years agor600g: include INTERP_[XY|ZW] in is_alu_vec_unit_inst
Vadim Girlin [Sun, 13 Nov 2011 09:55:52 +0000 (13:55 +0400)]
r600g: include INTERP_[XY|ZW] in is_alu_vec_unit_inst

This will disallow moving them to the trans slot in merge_inst_groups

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
12 years agoglcpp: Add GL_ARB_draw_instanced #define.
Morgan Armand [Fri, 11 Nov 2011 11:26:54 +0000 (12:26 +0100)]
glcpp: Add GL_ARB_draw_instanced #define.

12 years agoi965: Don't try to normalize cubemap coordinates for textureSize.
Kenneth Graunke [Wed, 9 Nov 2011 09:09:03 +0000 (01:09 -0800)]
i965: Don't try to normalize cubemap coordinates for textureSize.

Although textureSize is represented as an ir_texture with op == ir_txs,
it doesn't have a coordinate, so normalizing it doesn't make sense.

Fixes crashes in oglconform glsl-bif-tex-size basic.samplerCube.* tests.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agomesa: Fix glFramebufferTexture*() for depth and stencil attachments
Chad Versace [Thu, 10 Nov 2011 18:19:20 +0000 (10:19 -0800)]
mesa: Fix glFramebufferTexture*() for depth and stencil attachments

This patch solves three bugs.

1. When a texture was attached to the GL_DEPTH_STENCIL_ATTACHMENT point,
Mesa attached the texture only to the depth attachment point
    gl_framebuffer::Attachment[BUFFER_DEPTH]
and failed to attach it to the stencil attachment point
    gl_framebuffer::Attachment[BUFFER_STENCIL]

2. When a texture was attached to the GL_DEPTH_ATTACHMENT point and then
later attached to the GL_STENCIL_ATTACHMENT point, Mesa created two
separate renderbuffer wrappers. This caused a GL error in
glGetFramebufferAttachmentParameteriv().

3. Same as 2, but with depth and stencil juxtaposed.

Fixes Piglit test ARB_framebuffer_object/same-attachment-glFramebufferTexture2D-GL_DEPTH_STENCIL

Note: This is a candidate for the stable branches.
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
12 years agoi965: Expose GLSL 1.30 on gen6+.
Eric Anholt [Wed, 9 Nov 2011 03:17:47 +0000 (19:17 -0800)]
i965: Expose GLSL 1.30 on gen6+.

With the gl_VertexID support, everything required should now be
supported.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoi965: Add support for gl_VertexID and gl_InstanceID.
Eric Anholt [Wed, 9 Nov 2011 02:50:09 +0000 (18:50 -0800)]
i965: Add support for gl_VertexID and gl_InstanceID.

The compiler setup for these VF-uploaded attributes looks a little
cheesy with mixing system values and real VBO-sourced attributes.  It
would be nice if we could just compute the ATTR[] map to GRF index up
front and use it at visit time instead of using ir->location in the
ATTR file.  However, we don't know the reg_offset at
visit(ir_variable *) time, so we can't do the mapping that early.

Fixes piglit vertexid test.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoi965: Replace a should-never-happen fallback with asserts where it matters.
Eric Anholt [Wed, 9 Nov 2011 02:07:15 +0000 (18:07 -0800)]
i965: Replace a should-never-happen fallback with asserts where it matters.

We only allow 16 vec4s of attributes in our GLSL/ARB_vp programs, and
1 more element will get used for gl_VertexID/gl_InstanceID.  So it
should never have been possible to hit this fallback, unless there was
another bug.  If you do hit this, you're probably using gl_VertexID
and falling back to swrast won't work for you anyway.

This also updates the limits for gen6+.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa: Make gl_VertexID be a system value like gl_InstanceID.
Eric Anholt [Tue, 8 Nov 2011 22:49:07 +0000 (14:49 -0800)]
mesa: Make gl_VertexID be a system value like gl_InstanceID.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglsl: Move builtin_variables.h into .cpp.
Eric Anholt [Tue, 8 Nov 2011 22:46:25 +0000 (14:46 -0800)]
glsl: Move builtin_variables.h into .cpp.

This used to be script-generated, but now it's just a bunch of static
variables in a .h file for no good reason.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoglsl: Move ir_variable.cpp to builtin_variables.cpp.
Eric Anholt [Tue, 8 Nov 2011 22:44:18 +0000 (14:44 -0800)]
glsl: Move ir_variable.cpp to builtin_variables.cpp.

It's only about builtins, not variables in general.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agostate_tracker: remove written but never used variable.
Mathias Fröhlich [Sun, 23 Oct 2011 15:59:20 +0000 (17:59 +0200)]
state_tracker: remove written but never used variable.

12 years agoradeon: fix build.
Dave Airlie [Fri, 11 Nov 2011 15:55:52 +0000 (15:55 +0000)]
radeon: fix build.

I had a later patch remove this code, but cherry-picked across it.

Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agoradeon: drop unused constant_cliprect field
Dave Airlie [Thu, 10 Nov 2011 15:36:07 +0000 (15:36 +0000)]
radeon: drop unused constant_cliprect field

12 years agoradeon: disable texobj state for 3d texture
Dave Airlie [Thu, 10 Nov 2011 13:47:55 +0000 (13:47 +0000)]
radeon: disable texobj state for 3d texture

for 3d texture fallback, disable the texobj state.

Signed-off-by : Dave Airlie <airlied@redhat.com>

12 years agoradeon: use meta bitmap
Dave Airlie [Wed, 9 Nov 2011 13:48:50 +0000 (13:48 +0000)]
radeon: use meta bitmap

Now that the stride bug is fixed, enable Bitmap via meta mode.

Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agoradeon: fix bug with wrong stride being used for rectangluar textures.
Dave Airlie [Thu, 10 Nov 2011 13:46:25 +0000 (13:46 +0000)]
radeon: fix bug with wrong stride being used for rectangluar textures.

This broke the meta bitmap code when it was enabled.

Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agoi965: remove #include of api_noop.h
Brian Paul [Fri, 11 Nov 2011 14:23:45 +0000 (07:23 -0700)]
i965: remove #include of api_noop.h

12 years agoxlib: set alpha to 0xff when mapping RGB pixmaps
Brian Paul [Fri, 11 Nov 2011 01:00:24 +0000 (18:00 -0700)]
xlib: set alpha to 0xff when mapping RGB pixmaps

Fixes a bunch of conform regressions.

12 years agoswrast: avoid calling _mesa_get_srgb_format_linear() inside a loop
Brian Paul [Fri, 11 Nov 2011 00:59:43 +0000 (17:59 -0700)]
swrast: avoid calling _mesa_get_srgb_format_linear() inside a loop

12 years agoswrast: remove bogus assertion
Brian Paul [Fri, 11 Nov 2011 00:12:15 +0000 (17:12 -0700)]
swrast: remove bogus assertion

It would fail for images that were never allocated (and wouldn't be
used during rendering).

12 years agosvga: don't crash/assert if we fail to allocate a vertex buffer
Brian Paul [Thu, 10 Nov 2011 16:54:26 +0000 (09:54 -0700)]
svga: don't crash/assert if we fail to allocate a vertex buffer

v2: check if pipe_buffer_map() returns NULL, and return NULL from
svga_vbuf_render_map_vertices().  Per Jose's suggestion.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
12 years agodraw: handle out of memory conditions
Brian Paul [Thu, 10 Nov 2011 16:51:57 +0000 (09:51 -0700)]
draw: handle out of memory conditions

If the vbuf backend fails to allocate a vertex buffer, don't crash
or assert.

12 years agoutil: check for null vertex buffer object in blit code
Brian Paul [Thu, 10 Nov 2011 16:51:11 +0000 (09:51 -0700)]
util: check for null vertex buffer object in blit code

Don't crash if we fail to allocate a vertex buffer.

12 years agost/mesa: fix OOM failure in bitmap code
Brian Paul [Thu, 10 Nov 2011 16:50:42 +0000 (09:50 -0700)]
st/mesa: fix OOM failure in bitmap code

12 years agovbo: better handling of VBO allocation failures
Brian Paul [Thu, 10 Nov 2011 16:47:37 +0000 (09:47 -0700)]
vbo: better handling of VBO allocation failures

Previously, if we failed to allocate a VBO (either for display list
compilation or immediate mode rendering) we'd eventually segfault
when trying to map the non-existant buffer or in a glVertex/Color/etc
call when we hit a null pointer.

Now we don't try to map non-existant buffers and if we do fail to
allocate a VBO we plug in no-op functions for glVertex/Color/etc
so we don't segfault.

12 years agomesa: replace api_noop.[ch] with vbo_noop.[ch]
Brian Paul [Thu, 10 Nov 2011 00:22:47 +0000 (17:22 -0700)]
mesa: replace api_noop.[ch] with vbo_noop.[ch]

None of the code in api_noop.c was used anymore.  The new vbo_noop.c
functions are true no-ops.  They'll be used to no-op glBegin/End functions
when we run out of VBO memory.

12 years agovbo: pull some code from api_noop.c into vbo module
Brian Paul [Thu, 10 Nov 2011 00:35:57 +0000 (17:35 -0700)]
vbo: pull some code from api_noop.c into vbo module

Only a handful of functions from api_noop.c are actually used by
the VBO module.  Move them to the VBO module.  With this change,
none of the code in api_noop.c is actually used anymore.

12 years agomesa: remove ancient, unused gl_free_control_points prototoype
Brian Paul [Wed, 9 Nov 2011 21:41:03 +0000 (14:41 -0700)]
mesa: remove ancient, unused gl_free_control_points prototoype

12 years agodocs: add another viewperf issue
Brian Paul [Wed, 9 Nov 2011 20:32:18 +0000 (13:32 -0700)]
docs: add another viewperf issue

12 years agoi965: Make Gen6+ renderbuffer surface updates not depend on NEW_COLOR.
Kenneth Graunke [Thu, 10 Nov 2011 05:32:17 +0000 (21:32 -0800)]
i965: Make Gen6+ renderbuffer surface updates not depend on NEW_COLOR.

NEW_COLOR is only needed on Gen4-5 as brw_update_renderbuffer_surfaces
only uses ctx->Color when intel->gen < 6.

This should reduce unnecessary state updates.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Reorder state atom lists so all the surface state is together.
Kenneth Graunke [Thu, 10 Nov 2011 05:29:54 +0000 (21:29 -0800)]
i965: Reorder state atom lists so all the surface state is together.

Not strictly necessary, but seems like a good idea.

Suggested-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoglsl: Handle constant expressions involving ir_binop_equal/nequal.
Kenneth Graunke [Wed, 9 Nov 2011 08:58:21 +0000 (00:58 -0800)]
glsl: Handle constant expressions involving ir_binop_equal/nequal.

Constant expressions which called GLSL's equal() and notEqual()
built-ins on bvecs would hit an assertion failure; we simply forgot to
implement them for booleans.

NOTE: This is a candidate for stable release branches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
12 years agoglsl: Remove textureGradOffset built-ins taking samplerCube parameters.
Kenneth Graunke [Thu, 10 Nov 2011 05:57:12 +0000 (21:57 -0800)]
glsl: Remove textureGradOffset built-ins taking samplerCube parameters.

These simply don't exist in the 1.30 specification---none of the Offset
variants allow samplerCube.  This must have been a cut and paste error
from textureGrad, which /does/ allow cubemaps.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
12 years agoglsl: Fix misnamed textureProjOffset prototypes in built-in profiles.
Kenneth Graunke [Thu, 10 Nov 2011 05:54:26 +0000 (21:54 -0800)]
glsl: Fix misnamed textureProjOffset prototypes in built-in profiles.

Due to a cut and paste error, these were accidentally misnamed
textureProj() rather than textureProjOffset().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
12 years agoglsl: Remove texture built-ins with 'bias' from 1.30 VS profile.
Kenneth Graunke [Wed, 26 Oct 2011 20:12:18 +0000 (13:12 -0700)]
glsl: Remove texture built-ins with 'bias' from 1.30 VS profile.

From the GLSL 1.30 spec, section 8.7 "Texture Lookup Functions":
"In all functions below, the bias parameter is optional for fragment
 shaders.  The bias parameter is not accepted in a vertex shader."

This was a cut and paste mistake.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
12 years agoi965: Put a proper sampler count in 3DSTATE_VS.
Kenneth Graunke [Fri, 28 Oct 2011 06:04:00 +0000 (23:04 -0700)]
i965: Put a proper sampler count in 3DSTATE_VS.

See similar code for 3DSTATE_WM.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Upload SAMPLER_STATE pointers for the VS on Ivybridge.
Kenneth Graunke [Mon, 7 Nov 2011 06:51:53 +0000 (22:51 -0800)]
i965: Upload SAMPLER_STATE pointers for the VS on Ivybridge.

See similar code in gen7_wm_state.c.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Move and rename "wm sampler" fields to just "sampler".
Kenneth Graunke [Fri, 28 Oct 2011 05:49:09 +0000 (22:49 -0700)]
i965: Move and rename "wm sampler" fields to just "sampler".

brw_wm_samplers actually enables any active samplers regardless of what
pipeline stage is using them, so it doesn't make much sense for it to be
WM-specific.  So, rename it to "brw_samplers."

To properly generalize it, move sampler_count and sampler_offset from
brw_context::wm to a new brw_context::sampler that can be shared without
looking strange.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Clean up code for VS pull constant surface creation.
Kenneth Graunke [Mon, 7 Nov 2011 06:41:26 +0000 (22:41 -0800)]
i965: Clean up code for VS pull constant surface creation.

Like for the WM pull constants, we can merge the former prepare/emit
stages into one tracked state atom.  Furthermore, the code that used to
handle the binding table was removed in the last commit, leaving some
rather silly looking short functions that can easily be folded in.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Use a single binding table for all pipeline stages.
Kenneth Graunke [Sun, 30 Oct 2011 23:03:13 +0000 (16:03 -0700)]
i965: Use a single binding table for all pipeline stages.

Although the hardware supports separate binding tables for each pipeline
stage, we don't see much advantage over a single shared table.

Consider the contents of the binding table:
- Textures (16)
- Draw buffers (8)
- Pull constant buffers (1 for VS, 1 for WM)

OpenGL's texture bindings are global: the same set of textures is
available to all shader targets.  So our binding table entries for
textures would be exactly the same in every table.

There are only two pull constant buffers (not many), and although draw
buffers aren't interesting to the VS, it shouldn't hurt to have them in
the table.  The hardware supports up to 254 binding table entries, and
we currently only use 26.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
12 years agoi965: Split brw_wm_surfaces state into renderbuffer and texture atoms.
Kenneth Graunke [Wed, 2 Nov 2011 20:50:02 +0000 (13:50 -0700)]
i965: Split brw_wm_surfaces state into renderbuffer and texture atoms.

First, the texturing setup code is relevant for all pipeline stages,
while renderbuffer surfaces are only used by the WM.

Secondly, renderbuffer and texture setup depends on a different set of
dirty bits.  There's no reason to walk the array of textures when
changing draw buffers, or vice-versa.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
12 years agoi965: Combine the two WM pull constant tracked state atoms.
Kenneth Graunke [Tue, 1 Nov 2011 23:19:39 +0000 (16:19 -0700)]
i965: Combine the two WM pull constant tracked state atoms.

These were only split for historical reasons: brw_wm_constants used to
be the "prepare" step, while brw_wm_constant_surface was "emit".  Now
that both happen at emit time, it makes sense to combine them.

Call the newly combined state atom "brw_wm_pull_constants" to indicate
help distinguish it from the Gen6+ atoms that handle push constants.

Finally, remove the BRW_NEW_WM_CONSTBUF dirty bit entirely now that it's
never flagged nor used.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
12 years agoi965: Rename gen6_*_constants tracked state atoms to "push_constants".
Kenneth Graunke [Fri, 4 Nov 2011 05:41:37 +0000 (22:41 -0700)]
i965: Rename gen6_*_constants tracked state atoms to "push_constants".

When reading the "brw_wm_constants" and "gen6_wm_constants" atoms
side-by-side, I initially failed to notice the crucial difference:
the Gen6 atoms are for Push Constants, while brw_wm_constants handles
Pull Constants.  (Gen4/5 Push Constants are handled by "brw_curbe.")

Renaming these should clarify the code and save me from constant
confusion over the fact that "gen6_wm_constants" isn't just a newer
version of "brw_wm_constants."

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
12 years agoi965: Remove nr_surfaces computation from brw_update_wm_surfaces.
Kenneth Graunke [Tue, 1 Nov 2011 23:08:03 +0000 (16:08 -0700)]
i965: Remove nr_surfaces computation from brw_update_wm_surfaces.

This code is fairly fragile, as it depends on the ordering of the
entries in the binding table, which will change soon.

Also, stop listening on the BRW_NEW_WM_CONSTBUF dirty bit as it's no
longer required.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
12 years agoi965: Use 0 for the number of binding table entries in 3DSTATE_(VS|WM).
Kenneth Graunke [Tue, 1 Nov 2011 17:54:08 +0000 (10:54 -0700)]
i965: Use 0 for the number of binding table entries in 3DSTATE_(VS|WM).

These fields control how many entries the hardware prefetches into the
state cache, so they only impact performance, not correctness.  However,
it's not clear how to use this in a way that's beneficial.

According to the documentation, kernels "using a large number" of
entries may wish to program this to zero to avoid thrashing the cache;
it's unclear how many is too many.  Also, Ironlake's WM was missing this
feature entirely---the count had to be zero.

The dirty bit tracking to handle this complicates the surface state
and binding table setup; removing it should simplify things and make
future refactoring easier.  So just set 0 for the number of entries
rather than trying to compute and track it.

Appears to have no impact on Nexuiz and OpenArena on Sandybridge.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
12 years agoi965: Remove outdated comment about CACHE_NEW_SURF_BIND dirty bit.
Kenneth Graunke [Tue, 1 Nov 2011 17:34:27 +0000 (10:34 -0700)]
i965: Remove outdated comment about CACHE_NEW_SURF_BIND dirty bit.

The comment states that brw_update_vs_constant_surface produces a
CACHE_NEW_SURF_BIND dirty bit, but it doesn't.   In fact, that bit
no longer even exists.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
12 years agoi965: Remove BRW_NEW_NR_VS_SURFACES dirty bit from brw_vs_surfaces.
Kenneth Graunke [Tue, 8 Nov 2011 19:32:52 +0000 (11:32 -0800)]
i965: Remove BRW_NEW_NR_VS_SURFACES dirty bit from brw_vs_surfaces.

brw_vs_surfaces _produces_ the BRW_NEW_NR_VS_SURFACES dirty bit, so it
makes no sense for it to subscribe to it.

Fixes an assertion failure in many piglit tests when INTEL_DEBUG is set:
  brw_state_upload.c:484: void brw_upload_state(struct brw_context *):
  Assertion `!check_state(&examined, &generated)' failed.

One such piglit test is vs-uniform-array-mat2-col-rd.shader_test.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
12 years agoi965: Add missing CACHE_NEW_WM_PROG dirty bit to WM pull constants.
Kenneth Graunke [Tue, 8 Nov 2011 19:21:00 +0000 (11:21 -0800)]
i965: Add missing CACHE_NEW_WM_PROG dirty bit to WM pull constants.

Comparing brw_upload_vs_pull_constants and brw_upload_wm_pull_constants,
it became evident that something was amiss: the VS code had both
CACHE_NEW_VS_PROG and BRW_NEW_VERTEX_PROGRAM, while the WM code was
missing the CACHE_NEW_WM_PROG flag.

Not observed to fix anything, but likely necessary.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
12 years agoi965: Use new vtable entries for surface state updating functions.
Kenneth Graunke [Tue, 1 Nov 2011 22:41:48 +0000 (15:41 -0700)]
i965: Use new vtable entries for surface state updating functions.

Now that we have vtable entries in place, we should use them.  This
allows us to drop the cut and pasted Gen7 brw_tracked_state atoms as
they now do exactly the same thing as their brw_wm_surface_state
counterparts.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Add new vtable entries for surface state updating functions.
Kenneth Graunke [Tue, 1 Nov 2011 21:30:26 +0000 (14:30 -0700)]
i965: Add new vtable entries for surface state updating functions.

Gen7+ SURFACE_STATE is different from Gen4-6, so we need separate
per-generation functions for creating and updating it.  However, the
usage is the same, and callers just want to utilize the appropriate
functions with minimal pain.  So, put them in the vtable.

Since these take a brw_context pointer and are only used on Gen4, just
add a forward declaration.  This is the simplest (if not cleanest)
solution.  It would be nicer to have a i965-specific vtable, but that's
a refactor for another day.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agor600g: don't set the query result to 0 after a call to get_query_result
Marek Olšák [Thu, 10 Nov 2011 22:55:49 +0000 (23:55 +0100)]
r600g: don't set the query result to 0 after a call to get_query_result

get_query_result doesn't reset the result. Only begin_query does.

12 years agor600g: the type of OCCLUSION_PREDICATE result should be boolean
Marek Olšák [Thu, 10 Nov 2011 22:38:31 +0000 (23:38 +0100)]
r600g: the type of OCCLUSION_PREDICATE result should be boolean

12 years agomesa: silence uninitialized var warning
Brian Paul [Thu, 10 Nov 2011 22:56:04 +0000 (15:56 -0700)]
mesa: silence uninitialized var warning

12 years agoradeon: silence initializer warnings
Brian Paul [Thu, 10 Nov 2011 22:55:46 +0000 (15:55 -0700)]
radeon: silence initializer warnings

12 years agodraw/llvm: silence uninitialized variable warnings
Brian Paul [Thu, 10 Nov 2011 22:55:13 +0000 (15:55 -0700)]
draw/llvm: silence uninitialized variable warnings

12 years agoradeon: silence unused var warnings
Brian Paul [Thu, 10 Nov 2011 22:54:34 +0000 (15:54 -0700)]
radeon: silence unused var warnings

12 years agoegl: silence unused var warning
Brian Paul [Thu, 10 Nov 2011 22:54:15 +0000 (15:54 -0700)]
egl: silence unused var warning

12 years agomklib: fix static lib building by filtering out -L, -l options
Wayne E. Robertz [Thu, 10 Nov 2011 22:21:14 +0000 (15:21 -0700)]
mklib: fix static lib building by filtering out -L, -l options

Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agor600g: implement PIPE_QUERY_OCCLUSION_PREDICATE
Marek Olšák [Thu, 10 Nov 2011 22:11:57 +0000 (23:11 +0100)]
r600g: implement PIPE_QUERY_OCCLUSION_PREDICATE

12 years agor300g: fix query result of GPU_FINISHED
Marek Olšák [Thu, 10 Nov 2011 21:58:34 +0000 (22:58 +0100)]
r300g: fix query result of GPU_FINISHED

12 years agor300g: implement PIPE_QUERY_GPU_FINISHED
Marek Olšák [Thu, 10 Nov 2011 21:25:21 +0000 (22:25 +0100)]
r300g: implement PIPE_QUERY_GPU_FINISHED

12 years agor300g: implement PIPE_QUERY_OCCLUSION_PREDICATE
Marek Olšák [Thu, 10 Nov 2011 20:18:10 +0000 (21:18 +0100)]
r300g: implement PIPE_QUERY_OCCLUSION_PREDICATE

12 years agollvmpipe/u_format: add support for EXT_texture_shared_exponent + EXT_packed_float
Dave Airlie [Mon, 7 Nov 2011 19:22:01 +0000 (19:22 +0000)]
llvmpipe/u_format: add support for EXT_texture_shared_exponent + EXT_packed_float

These two are fairly unique types so add specific cases for decoding them.

Passes piglit fbo-clear-format and fbo-generatemipmap-format tests for these
two extensions.

Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agollvmpipe: add NV_conditional_render support.
Dave Airlie [Mon, 7 Nov 2011 17:31:49 +0000 (17:31 +0000)]
llvmpipe: add NV_conditional_render support.

This ports the softpipe NV_conditional_render support to llvmpipe.

This passes the nv_conditional_render-* piglit tests.

Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agor600g: remove useless texture barrier
Marek Olšák [Thu, 10 Nov 2011 17:47:20 +0000 (18:47 +0100)]
r600g: remove useless texture barrier

12 years agor600g: flush the whole context when CS is full, not just hw_context
Marek Olšák [Thu, 10 Nov 2011 17:42:10 +0000 (18:42 +0100)]
r600g: flush the whole context when CS is full, not just hw_context

Because we disable render condition in r600_flush, but not in r600_context_flush.

12 years agor600g: turn some CS overflow checks into assertions
Marek Olšák [Thu, 10 Nov 2011 16:52:36 +0000 (17:52 +0100)]
r600g: turn some CS overflow checks into assertions

They're not really exhaustive and not so useful either.

12 years agor600g: put the rest of CS overflow checks in r600_need_cs_space
Marek Olšák [Thu, 10 Nov 2011 16:41:44 +0000 (17:41 +0100)]
r600g: put the rest of CS overflow checks in r600_need_cs_space

12 years agor600g: flush caches regardless of render condition
Marek Olšák [Thu, 10 Nov 2011 14:54:17 +0000 (15:54 +0100)]
r600g: flush caches regardless of render condition

What if somebody enables render condition just before we flush...

12 years agor600g: disable render condition at the end of CS, re-enable at the beginning
Marek Olšák [Thu, 10 Nov 2011 14:50:06 +0000 (15:50 +0100)]
r600g: disable render condition at the end of CS, re-enable at the beginning

12 years agor600g: don't suspend queries if they have already been suspended by blitter
Marek Olšák [Thu, 10 Nov 2011 14:22:34 +0000 (15:22 +0100)]
r600g: don't suspend queries if they have already been suspended by blitter

And add some assertions.

12 years agor600g: properly reserve CS space for queries_suspend
Marek Olšák [Thu, 10 Nov 2011 14:00:11 +0000 (15:00 +0100)]
r600g: properly reserve CS space for queries_suspend