mesa.git
13 years agogallium: add initial pure integer support (v2)
Dave Airlie [Mon, 19 Sep 2011 14:04:48 +0000 (15:04 +0100)]
gallium: add initial pure integer support (v2)

This add support for unsigned/signed integer types via adding a 'pure' bit
in the format description table. It adds 4 new u_format get/put hooks,
for get/put uint and get/put sint so that accessors can get native access
to the integer bits. This is used to avoid precision loss via float converting
paths.

It doesn't add any float fetchers for these types at the moment, GL doesn't
require float fetching from these types and I expect we'll introduce a lot
of hidden bugs if we start allowing such conversions without an API mandating
it.

It adds all formats from EXT_texture_integer and EXT_texture_rg.

0 regressions on llvmpipe here with this.

(there is some more follow on code in my gallium-int-work branch, bringing
 softpipe and mesa to a pretty integer clean state)

v2: fixup python generator to get signed->unsigned and unsigned->signed
fetches working.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agomesa/texformat: add integer fallbacks to other formats
Dave Airlie [Wed, 5 Oct 2011 18:21:32 +0000 (19:21 +0100)]
mesa/texformat: add integer fallbacks to other formats

This fixes up the integer format choosing to pick the closest mesa format
then the most likely fallback.

(the formatting in this file needs cleaning in another patch).

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agomesa: add packing for int/uint
Dave Airlie [Mon, 19 Sep 2011 14:06:13 +0000 (15:06 +0100)]
mesa: add packing for int/uint

This just adds a simple packing for GL_UNSIGNED_INT/GL_INT destination formats.
This is enough for at least the gallium drivers to pack both unsigned and signed types for read pixels.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agou_format: add inline helper to find first non void channel
Dave Airlie [Sat, 8 Oct 2011 16:41:33 +0000 (17:41 +0100)]
u_format: add inline helper to find first non void channel

This is used in a few places in drivers as well, also the integer support
can use it as well.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agoi965: Fix inconsistent indentation in brw_eu_emit.c.
Kenneth Graunke [Fri, 7 Oct 2011 18:59:06 +0000 (11:59 -0700)]
i965: Fix inconsistent indentation in brw_eu_emit.c.

Most of these functions used three spaces for the first level of
indentation, but four spaces for the next level.  One used tabs and then
three spaces.  Some used 3/4 in a then block but 3/3 in the else block.

Normally I try to avoid field days like this, but since the functions
were so inconsistent, even internally, it was making it difficult to
edit without introducing spurious whitespace changes.

So, just get it over with.  git diff -b shows 0 lines changed.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agor300g: remove unused r300_resource::tex_offset
Marek Olšák [Fri, 7 Oct 2011 23:06:36 +0000 (01:06 +0200)]
r300g: remove unused r300_resource::tex_offset

13 years agoglsl: Remove unused method ir_variable::component_slots
Ian Romanick [Tue, 6 Sep 2011 23:11:14 +0000 (16:11 -0700)]
glsl: Remove unused method ir_variable::component_slots

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: Silence several 'warning: unused parameter' in _mesa_GetnUniformdvARB
Ian Romanick [Wed, 7 Sep 2011 19:39:47 +0000 (12:39 -0700)]
mesa: Silence several 'warning: unused parameter' in _mesa_GetnUniformdvARB

This function isn't implemented yet, so none of its parameters are
used yet.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: Remove unused function _mesa_append_uniform
Ian Romanick [Sat, 27 Aug 2011 05:58:51 +0000 (22:58 -0700)]
mesa: Remove unused function _mesa_append_uniform

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: Simplify calling Driver.ProgramStringNotify after previous refactors
Ian Romanick [Sat, 20 Aug 2011 23:07:10 +0000 (16:07 -0700)]
mesa: Simplify calling Driver.ProgramStringNotify after previous refactors

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
13 years agomesa: Simplify destroy_shader_program_variants_cb after previous refactors
Ian Romanick [Sat, 20 Aug 2011 23:06:34 +0000 (16:06 -0700)]
mesa: Simplify destroy_shader_program_variants_cb after previous refactors

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: Simplify validate_shader_program after previous refactors
Ian Romanick [Sat, 20 Aug 2011 23:05:43 +0000 (16:05 -0700)]
mesa: Simplify validate_shader_program after previous refactors

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: Use gl_shader_program::_LinkedShaders instead of FragmentProgram
Ian Romanick [Sat, 20 Aug 2011 22:00:36 +0000 (15:00 -0700)]
mesa: Use gl_shader_program::_LinkedShaders instead of FragmentProgram

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: Use gl_shader_program::_LinkedShaders instead of GeometryProgram
Ian Romanick [Sat, 20 Aug 2011 21:26:12 +0000 (14:26 -0700)]
mesa: Use gl_shader_program::_LinkedShaders instead of GeometryProgram

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: Use gl_shader_program::_LinkedShaders instead of VertexProgram
Ian Romanick [Sat, 20 Aug 2011 20:51:36 +0000 (13:51 -0700)]
mesa: Use gl_shader_program::_LinkedShaders instead of VertexProgram

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: Close Doxygen group
Chad Versace [Fri, 7 Oct 2011 20:16:01 +0000 (13:16 -0700)]
mesa: Close Doxygen group

In dd_function_table, close the Doxygen group beginning with
   \name Support for multiple T&L engines

13 years agou_blitter: bind a NULL geometry shader
Marek Olšák [Fri, 7 Oct 2011 17:28:19 +0000 (19:28 +0200)]
u_blitter: bind a NULL geometry shader

13 years agou_blitter: cleanup checking for and restoring saved states
Marek Olšák [Fri, 7 Oct 2011 17:10:41 +0000 (19:10 +0200)]
u_blitter: cleanup checking for and restoring saved states

13 years agor300g: disable stream output on SWTCL chipsets
Marek Olšák [Thu, 6 Oct 2011 16:29:02 +0000 (18:29 +0200)]
r300g: disable stream output on SWTCL chipsets

Unimplemented and not so useful for this driver.

13 years agoi915g: Add two new unsupported PIPE_CAPs.
Stéphane Marchesin [Fri, 7 Oct 2011 22:14:39 +0000 (15:14 -0700)]
i915g: Add two new unsupported PIPE_CAPs.

13 years agoi915,i830: Remove dead HiZ assertions in *update_draw_buffer()
Chad Versace [Fri, 7 Oct 2011 17:26:12 +0000 (10:26 -0700)]
i915,i830: Remove dead HiZ assertions in *update_draw_buffer()

i915 and i830 hardware doesn't have HiZ, so remove all HiZ related
assertions from *update_draw_buffer().

I've removed the dead format checks completely rather than replace them
with more appropriate checks. This doesn't reduce "assertion coverage",
however, because when I added these HiZ related assertions in c8fdf66
there were no pre-existing checks there.

Signed-off-by: Chad Versace <chad@chad-versace.us>
13 years agotnl: fix result vector allocation regression
Brian Paul [Fri, 7 Oct 2011 16:55:43 +0000 (10:55 -0600)]
tnl: fix result vector allocation regression

We need to allocate all the output vectors.
Fixes a regression from commit f7f678331d5e95d2266fe6b3ea1cfa47d6421065
Fixes fd.o bugs 41441 and 41492.

13 years agoi965: make swizzle_for_size() return unsigned
Brian Paul [Fri, 7 Oct 2011 16:38:30 +0000 (10:38 -0600)]
i965: make swizzle_for_size() return unsigned

Silences a warning about comparing to an unsigned variable.  It looks like
the result of swizzle_for_size() is always assigned to unsigned vars.

Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agoi965: make size_swizzles[] static const
Brian Paul [Fri, 7 Oct 2011 16:38:30 +0000 (10:38 -0600)]
i965: make size_swizzles[] static const

Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agoi965: silence unused var warnings in non-debug builds
Brian Paul [Fri, 7 Oct 2011 16:38:30 +0000 (10:38 -0600)]
i965: silence unused var warnings in non-debug builds

Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agointel: silence uninitialized var warning
Brian Paul [Fri, 7 Oct 2011 16:38:30 +0000 (10:38 -0600)]
intel: silence uninitialized var warning

Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agomesa: fix software mipmap generation code for packed Z/stencil formats
Brian Paul [Thu, 6 Oct 2011 22:52:36 +0000 (16:52 -0600)]
mesa: fix software mipmap generation code for packed Z/stencil formats

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

Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agor300: fix incompatible pointer type warnings
Brian Paul [Fri, 7 Oct 2011 14:22:35 +0000 (08:22 -0600)]
r300: fix incompatible pointer type warnings

13 years agomesa: update gl_texture_image comments
Brian Paul [Fri, 7 Oct 2011 14:22:35 +0000 (08:22 -0600)]
mesa: update gl_texture_image comments

13 years agoswrast: s/FetchTexelf/FetchTexel/
Brian Paul [Fri, 7 Oct 2011 14:22:35 +0000 (08:22 -0600)]
swrast: s/FetchTexelf/FetchTexel/

13 years agoswrast: silence unused var warnings in non-debug builds
Brian Paul [Fri, 7 Oct 2011 14:22:35 +0000 (08:22 -0600)]
swrast: silence unused var warnings in non-debug builds

13 years agoswrast: remove unused swrast_texture_image::FetchTexelc method
Brian Paul [Fri, 7 Oct 2011 14:22:35 +0000 (08:22 -0600)]
swrast: remove unused swrast_texture_image::FetchTexelc method

We only use the float-valued function now.

13 years agomesa: fix image unpacking when storing compressed textures
Brian Paul [Fri, 7 Oct 2011 14:14:46 +0000 (08:14 -0600)]
mesa: fix image unpacking when storing compressed textures

This fixes failures found with the new piglit texsubimage test.

Two things were broken:
1. The dxt code doesn't handle sources images where width != row stride.
   Check for that and take the _mesa_make_temp_ubyte_image() path to get
   an image where width = rowstride.
2. If we don't take the _mesa_make_temp_ubyte_image() path we need to
   take the source image unpacking parameters into account in order to
   get the proper starting memory address of the source texels.

Note: This is a candidate for the 7.11 branch.

13 years agoi915g: handle seperate stencil clear
Daniel Vetter [Sun, 25 Sep 2011 16:49:02 +0000 (18:49 +0200)]
i915g: handle seperate stencil clear

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
13 years agoi915g: actually try to clear 16bit depth bufs
Daniel Vetter [Sun, 25 Sep 2011 16:35:12 +0000 (18:35 +0200)]
i915g: actually try to clear 16bit depth bufs

... with the right value.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
13 years agoi915g: hw can't fastclear both depth and color when bbp doesn't match
Daniel Vetter [Sun, 25 Sep 2011 16:14:16 +0000 (18:14 +0200)]
i915g: hw can't fastclear both depth and color when bbp doesn't match

Do it in two passes in that case.

v2: Don't forget to handle stencil clears.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
13 years agoi915g: disable scissor in fast clear
Daniel Vetter [Sun, 25 Sep 2011 16:02:34 +0000 (18:02 +0200)]
i915g: disable scissor in fast clear

Docs say this is obeyed.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
13 years agoi915g: add some obscure sampler formats
Daniel Vetter [Sun, 25 Sep 2011 13:54:30 +0000 (15:54 +0200)]
i915g: add some obscure sampler formats

4bit palette ftw!

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
13 years agoi915g: fixup clear params emission
Daniel Vetter [Sun, 25 Sep 2011 13:53:55 +0000 (15:53 +0200)]
i915g: fixup clear params emission

Docs say that default shader input color input need to be spec
as ARGB8888. And a clear rect prim essentially uses this value
instead of default diffuse. Depth on the other hands is an ieee
32 bit float. Clear stencil is U8.

Completely different are the clear values for zone init prims.
These are speced in the actual output pixel layout (and need
to be repeated for 16 bit formats).

Clear up the confusion by adding some comments.

v2: Retain the target swizzling support added by Stephan Marchesin.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
13 years agoi915g: make fixup swizzle into a real hw state
Daniel Vetter [Mon, 26 Sep 2011 07:47:38 +0000 (09:47 +0200)]
i915g: make fixup swizzle into a real hw state

This way it can be reused in the fastclear path.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
13 years agoglsl: Remove version check when looking for identifiers containing "__".
Jason Wood [Fri, 7 Oct 2011 05:37:48 +0000 (22:37 -0700)]
glsl: Remove version check when looking for identifiers containing "__".

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi915g: Announce GL 2.0.
Stéphane Marchesin [Fri, 7 Oct 2011 03:36:47 +0000 (20:36 -0700)]
i915g: Announce GL 2.0.

We leave the debug code in place to troubleshoot issues while we complete the transition. That code might be removed after that.

13 years agoi965 Gen6+: De-compact clip planes.
Paul Berry [Tue, 27 Sep 2011 19:57:08 +0000 (12:57 -0700)]
i965 Gen6+: De-compact clip planes.

Previously, if the user enabled a non-consecutive set of clip planes
(e.g. 0, 1, and 3), the driver would compact them down to a
consecutive set starting at 0.  This optimization was of dubious
value, and complicated the implementation of gl_ClipDistance.

This patch changes the driver so that with Gen6 and later chipsets, we
no longer compact the clip planes.  However, we still discard any clip
planes beyond the highest number that is in use, so performance should
not be affected for applications that use clip planes consecutively
from 0.

With chipsets previous to Gen6, we still compact the clip planes,
since the pre-Gen6 clipper thread relies on this behavior.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965 VS: Change nr_userclip to nr_userclip_planes.
Paul Berry [Thu, 29 Sep 2011 22:36:41 +0000 (15:36 -0700)]
i965 VS: Change nr_userclip to nr_userclip_planes.

The only remaining uses of brw_vs_prog_key::nr_userclip only occurred
when using clip planes (as opposed to gl_ClipDistance).  This patch
renames the value to nr_userclip_planes and sets it to zero when
gl_ClipDistance is in use.  This avoids unnecessary VS recompiles.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Make brw_compute_vue_map's userclip dependency a boolean.
Paul Berry [Tue, 27 Sep 2011 19:33:28 +0000 (12:33 -0700)]
i965: Make brw_compute_vue_map's userclip dependency a boolean.

Previously, brw_compute_vue_map required an argument indicating the
number of clip planes in use, but all it did with it was check if it
was nonzero.

This patch changes brw_compute_vue_map to take a boolean instead.
This allows us to avoid some unnecessary recompilation of the Gen4/5
GS and SF threads.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Move ClipPlanesEnabled state to VS cache key.
Paul Berry [Wed, 28 Sep 2011 18:26:57 +0000 (11:26 -0700)]
i965: Move ClipPlanesEnabled state to VS cache key.

Previous to this patch, setup_uniform_clipplane_values() was setting
up clip plane uniforms based on ctx->Transform.ClipPlanesEnabled, a
piece of state not stored in the vertex shader cache key.  As a
result, a change to this piece of state might not trigger a necessary
vertex shader recompile.

The patch adds a field to the vertex shader cache key,
userclip_planes_enabled, to store the current value of
ctx->Transform.ClipPlanesEnabled.  Also, it changes
setup_uniform_clipplane_values() to read from this new field, so that
it's manifestly clear that the vertex shader isn't depending on state
not stored in the cache key.

Note: when the vertex shader uses gl_ClipDistance, the VS backend
doesn't need to know which clip planes are in use, so we leave the
field as zero in that case to avoid unnecessary recompiles.

Fixes Piglit test vs-clip-vertex-enables.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Rearrange VS cache key struct.
Paul Berry [Thu, 29 Sep 2011 21:16:29 +0000 (14:16 -0700)]
i965: Rearrange VS cache key struct.

No functional change.  This patch rearranges the struct
brw_vs_prog_key so that the two fields related to clipping are
together, and documents those fields.  This should make the patches
that follow easier to comprehend, since they add additional
clipping-related fields to this structure.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agomesa: Create _mesa_bitcount_64() to replace i965's brw_count_bits()
Paul Berry [Wed, 28 Sep 2011 20:18:09 +0000 (13:18 -0700)]
mesa: Create _mesa_bitcount_64() to replace i965's brw_count_bits()

The i965 driver already had a function to count bits in a 64-bit uint
(brw_count_bits()), but it was buggy (it only counted the bottom 32
bits) and it was clumsy (it had a strange and broken fallback for
non-GCC-like compilers, which fortunately was never used).  Since Mesa
already has a _mesa_bitcount() function, it seems better to just
create a _mesa_bitcount_64() function rather than special-case this in
the i965 driver.

This patch creates the new _mesa_bitcount_64() function and rewrites
all of the old brw_count_bits() calls to refer to it.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agomesa/es: Allow GL_CLIP_PLANE0+6 and GL_CLIP_PLANE0+7.
Kenneth Graunke [Tue, 4 Oct 2011 18:29:08 +0000 (11:29 -0700)]
mesa/es: Allow GL_CLIP_PLANE0+6 and GL_CLIP_PLANE0+7.

Fixes the ES1 conformance 'userclip' test, which broke when we increased
MAX_CLIP_PLANES to 8.  Core Mesa already validates incoming values
against MAX_CLIP_PLANES; we just need the ES wrapper to pass everything
through.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agomesa/get: Move MAX_LIGHTS from GL/ES2 to GL/ES1.
Kenneth Graunke [Mon, 3 Oct 2011 21:28:43 +0000 (14:28 -0700)]
mesa/get: Move MAX_LIGHTS from GL/ES2 to GL/ES1.

It's required for ES 1.0 and 1.1, and isn't specified for ES 2.

While the comment says Mesa depends on it internally, removing it from
ES2 doesn't seem to regress any Piglit or ES2 conformance tests.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agometa: Don't enable TEXTURE_RECTANGLE when it's unsupported.
Kenneth Graunke [Mon, 3 Oct 2011 21:01:59 +0000 (14:01 -0700)]
meta: Don't enable TEXTURE_RECTANGLE when it's unsupported.

In particular, drivers don't enable this in ES 1.1 contexts.

Prior to this, none of the OpenGL ES 1.1 conformance tests passed.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoi915g: Silence warning.
Stéphane Marchesin [Thu, 6 Oct 2011 08:02:02 +0000 (01:02 -0700)]
i915g: Silence warning.

We still need to investigate LIS7 though.

13 years agoi915g: Fix comment.
Stéphane Marchesin [Sat, 24 Sep 2011 19:56:22 +0000 (12:56 -0700)]
i915g: Fix comment.

13 years agomesa: remove some unneeded forward struct declarations
Brian Paul [Thu, 6 Oct 2011 03:43:43 +0000 (21:43 -0600)]
mesa: remove some unneeded forward struct declarations

13 years agost/mesa: fix comment
Brian Paul [Thu, 6 Oct 2011 03:43:21 +0000 (21:43 -0600)]
st/mesa: fix comment

13 years agomesa: remove unused _mesa_rescale_teximage2d() function
Brian Paul [Thu, 6 Oct 2011 03:14:37 +0000 (21:14 -0600)]
mesa: remove unused _mesa_rescale_teximage2d() function

It was only used by the old tdfx driver, IIRC.

13 years agomesa: remove unused gl_texture_image::DriverData field
Brian Paul [Thu, 6 Oct 2011 03:14:37 +0000 (21:14 -0600)]
mesa: remove unused gl_texture_image::DriverData field

Was only used by some older/removed DRI drivers.

13 years agost/mesa: don't use gl_texture_image::RowStride
Brian Paul [Thu, 6 Oct 2011 03:14:37 +0000 (21:14 -0600)]
st/mesa: don't use gl_texture_image::RowStride

It's always the same as the texture width.

13 years agost/mesa: completely stop using gl_texture_image::Data
Brian Paul [Wed, 5 Oct 2011 00:26:39 +0000 (18:26 -0600)]
st/mesa: completely stop using gl_texture_image::Data

Instead, use the new st_texture_image::TexData field to hold texture
images that don't fit the parent object's mipmap buffer.

13 years agost/mesa: stop using gl_texture_image::Data when mapping/unmapping textures
Brian Paul [Wed, 5 Oct 2011 00:26:39 +0000 (18:26 -0600)]
st/mesa: stop using gl_texture_image::Data when mapping/unmapping textures

Since core Mesa no longer depends on gl_texture_image::Data pointing to
mapped texture buffers we don't have to mess with it all over the place
in the state tracker.  Now Data is only used to point to malloc'd memory
that holds images which don't fit in the texture object's mipmap buffer.

13 years agomesa: get rid of imageOffsets arrays in texstore code
Brian Paul [Wed, 5 Oct 2011 00:26:39 +0000 (18:26 -0600)]
mesa: get rid of imageOffsets arrays in texstore code

These were used to find the start of a 3D image slice (or 2D array texture
slice) given a base address.  Instead, use a simple array of address of
image slices instead.

This is a step toward getting rid of the gl_texture_image::ImageOffsets
field.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agost/glx: remove the duplicated Drawable member.
Stéphane Marchesin [Thu, 6 Oct 2011 00:36:32 +0000 (17:36 -0700)]
st/glx: remove the duplicated Drawable member.

If you want to access it, you should use the Drawable in xlib_drawable instead.

13 years agoglsl: Consider "__" in identifers as reserved.
Eric Anholt [Mon, 3 Oct 2011 23:27:59 +0000 (16:27 -0700)]
glsl: Consider "__" in identifers as reserved.

Fixes double-underscore-*.frag.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoswrast: update texfetch_funcs table for new int/uint formats
Brian Paul [Wed, 5 Oct 2011 19:35:33 +0000 (13:35 -0600)]
swrast: update texfetch_funcs table for new int/uint formats

This only adds dummy entries to the table to fix failed assertions.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=41491

13 years agoi965 Gen6: Implement gl_ClipVertex.
Paul Berry [Mon, 26 Sep 2011 20:43:04 +0000 (13:43 -0700)]
i965 Gen6: Implement gl_ClipVertex.

This patch implements proper support for gl_ClipVertex by causing the
new VS backend to populate the clip distance VUE slots using
VERT_RESULT_CLIP_VERTEX when appropriate, and by using the
untransformed clip planes in ctx->Transform.EyeUserPlane rather than
the transformed clip planes in ctx->Transform._ClipUserPlane when a
GLSL-based vertex shader is in use.

When not using a GLSL-based vertex shader, we use
ctx->Transform._ClipUserPlane (which is what we used prior to this
patch).  This ensures that clipping is still performed correctly for
fixed function and ARB vertex programs.  A new function,
brw_select_clip_planes() is used to determine whether to use
_ClipUserPlane or EyeUserPlane, so that the logic for making this
decision is shared between the new and old vertex shaders.

Fixes the following Piglit tests on i965 Gen6:
- vs-clip-vertex-const-accept
- vs-clip-vertex-const-reject
- vs-clip-vertex-different-from-position
- vs-clip-vertex-equal-to-position
- vs-clip-vertex-homogeneity
- vs-clip-based-on-position
- vs-clip-based-on-position-homogeneity
- clip-plane-transformation clipvert_pos
- clip-plane-transformation pos_clipvert
- clip-plane-transformation pos

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agomesa: Add a gl_vert_result for gl_ClipVertex.
Paul Berry [Mon, 26 Sep 2011 20:15:57 +0000 (13:15 -0700)]
mesa: Add a gl_vert_result for gl_ClipVertex.

Before this patch, clip planes didn't work properly in Mesa when using
vertex shaders, because Mesa assigned both gl_ClipVertex and
gl_Position to the same gl_vert_result (VERT_RESULT_HPOS).  As a
result, backends couldn't distinguish between the two variables, so
any shader that wrote different values to them would fail to work
properly.

This patch paves the way for proper support of gl_ClipVertex by
creating a new enumerated value in gl_vert_result for it
(VERT_RESULT_CLIP_VERTEX).  After this patch, a back-end may add
support for gl_ClipVertex using the following algorithm:

- If using a user-supplied GLSL vertex shader:
  - If the bit corresponding to VERT_RESULT_CLIP_VERTEX is set in
    gl_program::OutputsWritten:
    - Clip using the vertex shader output VERT_RESULT_CLIP_VERTEX and
      the clip planes defined in gl_context::Transform.EyeUserPlane.
  - Else:
    - Clip using the vertex shader output VERT_RESULT_HPOS and the
      clip planes defined in gl_context::Transform.EyeUserPlane.
- Else (either using fixed function or an ARB vertex program):
  - Clip using the vertex shader output VERT_RESULT_HPOS and the clip
    planes defined in gl_context::Transform._ClipUserPlane (*)

where (*) represents the normal Mesa behavior before this patch.

An example of implementing the above algorithm can be found in the
patch that follows this one, which implements gl_ClipVertex in i965
Gen6.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agollvmpipe: Fix the 4 planes (lines) case properly.
José Fonseca [Wed, 5 Oct 2011 12:27:08 +0000 (13:27 +0100)]
llvmpipe: Fix the 4 planes (lines) case properly.

The previous change was not effective for lines, because there is no
4 planes 4x4 block rasterization path: it is handled by the 16x16 block
case too, and the 16x16 block was not being budged as it should.

This fixes assertion failures on line rasterization.

13 years agollvmpipe: Ensure the 16x16 special rasterization path does not touch outside the...
José Fonseca [Wed, 5 Oct 2011 10:31:15 +0000 (11:31 +0100)]
llvmpipe: Ensure the 16x16 special rasterization path does not touch outside the tile.

llvmpipe has a few special rasterization paths for triangles contained in
16x16 blocks, but it allows the 16x16 block to be aligned only to a 4x4
grid.

Some 16x16 blocks could actually intersect the tile
if the triangle is 16 pixels in one dimension but 4 in the other, causing
a buffer overflow.

The fix consists of budging the 16x16 blocks back inside the tile.

13 years agomesa: update fbo format tablet for integer types.
Dave Airlie [Tue, 4 Oct 2011 19:59:40 +0000 (20:59 +0100)]
mesa: update fbo format tablet for integer types.

This updates the fbo format table for the integer types.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agomesa/texstore: add texstore paths for all the integer types.
Dave Airlie [Sat, 1 Oct 2011 12:44:49 +0000 (13:44 +0100)]
mesa/texstore: add texstore paths for all the integer types.

This just adds the entries to the table and fixes the asserts up.

The int32 one is definitely wrong, since it uses a float temp
which will lose precision, but its no worse than now.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agomesa/texformat: update choose_tex_format for integer types.
Dave Airlie [Fri, 30 Sep 2011 07:41:20 +0000 (08:41 +0100)]
mesa/texformat: update choose_tex_format for integer types.

This adds the integer types to the tex format chooser.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agomesa/formats: add rest of integer formats.
Dave Airlie [Mon, 26 Sep 2011 20:14:10 +0000 (21:14 +0100)]
mesa/formats: add rest of integer formats.

This is taken from reading EXT_texture_integer + EXT_texture_rg in combination,

Comments on necessity of each format, naming of formats and bugs in the
formats tables please.

Is there any formats I've missed?

Eric looked over this to make sure its consistent at least.

As I've changed the ordering of things in the format table, the follow
patches are required to avoid regression.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agotexstore: create texstore table on first access.
Dave Airlie [Wed, 5 Oct 2011 12:18:17 +0000 (13:18 +0100)]
texstore: create texstore table on first access.

As per Brian's suggestion we can generate this table at first start
to make sure its correct. This is a sad workaround for compilers which
don't support named initialiser. (its 2011).

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agoglsl: Remove unneeded headers.
Stéphane Marchesin [Wed, 5 Oct 2011 01:03:22 +0000 (18:03 -0700)]
glsl: Remove unneeded headers.

13 years agoegl: restore missing \ in Makefile
Brian Paul [Tue, 4 Oct 2011 22:53:46 +0000 (16:53 -0600)]
egl: restore missing \ in Makefile

13 years agor200/r300/r600: remove dangling radeon_tex_getimage.c symlinks.
Paul Berry [Wed, 28 Sep 2011 19:58:13 +0000 (12:58 -0700)]
r200/r300/r600: remove dangling radeon_tex_getimage.c symlinks.

Commit d1fda903 (radeon: Drop mapping we were doing around
glGetTexImage()) removed the common Radeon source file
radeon_tex_getimage.c, and pulled it out of the r200, r300, r600, and
radeon makefiles.  But it left behind the symlinks that were being
used to share that file among the four directories.

This patch removes the dangling symlinks.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoglapi: Enclose glapi.h in an extern "C" block when included by C++.
Kenneth Graunke [Tue, 4 Oct 2011 09:53:45 +0000 (02:53 -0700)]
glapi: Enclose glapi.h in an extern "C" block when included by C++.

Fixes a build failure introduced in commit
b7fa0d0727a3a9e1f64d3cfc7a0f157b35dec09e.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-and-tested-by: Paul Berry <stereotype441@gmail.com>
13 years agoscons: add new files to src/mesa/SConscript
Brian Paul [Tue, 4 Oct 2011 21:59:09 +0000 (15:59 -0600)]
scons: add new files to src/mesa/SConscript

13 years agosoftpipe: fix Z interpolation invariance bug
Brian Paul [Tue, 4 Oct 2011 21:01:05 +0000 (15:01 -0600)]
softpipe: fix Z interpolation invariance bug

We want quad/pixel Z values to be interpolated exactly the same for
multi-pass algorithms.  Because of how the optimized Z-test code is
written, we can't cull the first quad in a run even if it's totally
killed.  See the comment for more info.

NOTE: This is a candidate for the 7.11 branch.

13 years agosoftpipe: add check for DO_PSTIPPLE_IN_HELPER_MODULE
Brian Paul [Tue, 4 Oct 2011 20:45:13 +0000 (14:45 -0600)]
softpipe: add check for DO_PSTIPPLE_IN_HELPER_MODULE

We only want to generate the fragment shader variant that does
stippling if DO_PSTIPPLE_IN_HELPER_MODULE is being used.

13 years agomesa: Remove unused gl_program::Attributes
Ian Romanick [Thu, 18 Aug 2011 22:43:50 +0000 (15:43 -0700)]
mesa: Remove unused gl_program::Attributes

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: Determine GL_ACTIVE_ATTRIBUTE_MAX_LENGTH by walking the GLSL IR.
Ian Romanick [Thu, 18 Aug 2011 22:27:18 +0000 (15:27 -0700)]
mesa: Determine GL_ACTIVE_ATTRIBUTE_MAX_LENGTH by walking the GLSL IR.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: Determine GL_ACTIVE_ATTRIBUTES by walking the GLSL IR.
Ian Romanick [Thu, 18 Aug 2011 22:22:21 +0000 (15:22 -0700)]
mesa: Determine GL_ACTIVE_ATTRIBUTES by walking the GLSL IR.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: Remove unused gl_shader_program::Attributes
Ian Romanick [Thu, 18 Aug 2011 22:08:51 +0000 (15:08 -0700)]
mesa: Remove unused gl_shader_program::Attributes

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: Make _mesa_GetActiveAttribARB use the attributes in the shader IR
Ian Romanick [Thu, 18 Aug 2011 22:06:07 +0000 (15:06 -0700)]
mesa: Make _mesa_GetActiveAttribARB use the attributes in the shader IR

Instead of relying on the mirror in the Mesa IR assembly shader, just
use the variables actually stored in the GLSL IR.  This will be a bit
slower, but nobody cares about the performance of glGetActiveAttrib.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: Move _mesa_GetActiveAttribARB to shader_query.cpp
Ian Romanick [Wed, 17 Aug 2011 22:44:48 +0000 (15:44 -0700)]
mesa: Move _mesa_GetActiveAttribARB to shader_query.cpp

This just folds get_active_attrib into _mesa_GetActiveAttribARB
and moves the resulting function function to the other source file.
More changes are coming soon.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agolinker: Use gl_shader_program::AttributeBindings for attrib locations
Ian Romanick [Wed, 17 Aug 2011 22:40:03 +0000 (15:40 -0700)]
linker: Use gl_shader_program::AttributeBindings for attrib locations

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: Add gl_shader_program::AttributeBindings
Ian Romanick [Wed, 17 Aug 2011 22:38:53 +0000 (15:38 -0700)]
mesa: Add gl_shader_program::AttributeBindings

This currently mirrors the state tracking
gl_shader_program::Attributes, but I'm working towards eliminating
that.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: Move _mesa_BindAttribLocationARB to shader_query.cpp
Ian Romanick [Wed, 17 Aug 2011 22:35:09 +0000 (15:35 -0700)]
mesa: Move _mesa_BindAttribLocationARB to shader_query.cpp

This just folds bind_attrib_location into _mesa_BindAttribLocationARB
and moves the resulting function function to the other source file.
More changes are coming soon.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: Add string_to_uint_map facade class
Ian Romanick [Fri, 30 Sep 2011 21:58:29 +0000 (14:58 -0700)]
mesa: Add string_to_uint_map facade class

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
13 years agomesa: Add hash_table_replace
Ian Romanick [Wed, 17 Aug 2011 18:51:15 +0000 (11:51 -0700)]
mesa: Add hash_table_replace

hash_table_replace doesn't use get_node to avoid having to hash the key twice.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: Move _mesa_GetAttribLocationARB to shader_query.cpp
Ian Romanick [Tue, 16 Aug 2011 19:51:25 +0000 (12:51 -0700)]
mesa: Move _mesa_GetAttribLocationARB to shader_query.cpp

This allows querying the linked shader itself rather than the Mesa IR.
This is the first step towards removing gl_program::Attributes.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoglsl: Delete symbol table in post-link shaders
Ian Romanick [Fri, 30 Sep 2011 21:21:10 +0000 (14:21 -0700)]
glsl: Delete symbol table in post-link shaders

The symbol table in the linked shaders may contain references to
variables that were removed (e.g., unused uniforms).  Since it may
contain junk, there is no possible valid use.  Delete it and set the
pointer to NULL.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoglapi: regen API files for new extension
Ian Romanick [Tue, 20 Sep 2011 16:58:26 +0000 (09:58 -0700)]
glapi: regen API files for new extension

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agomesa: Remove ARB_draw_buffers extension enable flag
Ian Romanick [Sun, 2 Oct 2011 22:22:18 +0000 (15:22 -0700)]
mesa: Remove ARB_draw_buffers extension enable flag

All drivers in Mesa have supported this extension for eons.  This
extension is an optional features in desktop OpenGL (via
GL_ARB_draw_buffers) and OpenGL ES 2.x (via GL_NV_draw_buffers).

The extension is not usable in OpenGL ES 1.x.  There is no
glDrawBuffers* entry point in OpenGL ES 1.x contexts, and glGet*v
generate errors when MAX_DRAW_BUFFERS or DRAW_BUFFERi is queried.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agomesa: Advertise NV_fbo_color_attachments on OpenGL ES 2.0
Ian Romanick [Tue, 20 Sep 2011 21:48:56 +0000 (14:48 -0700)]
mesa: Advertise NV_fbo_color_attachments on OpenGL ES 2.0

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agomesa: Advertise NV_draw_buffers in OpenGL ES 2.0
Ian Romanick [Tue, 20 Sep 2011 16:47:52 +0000 (09:47 -0700)]
mesa: Advertise NV_draw_buffers in OpenGL ES 2.0

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agomesa/es: Allow querying GL_DRAW_BUFFERi in OpenGL ES 2.0
Ian Romanick [Sun, 2 Oct 2011 22:27:22 +0000 (15:27 -0700)]
mesa/es: Allow querying GL_DRAW_BUFFERi in OpenGL ES 2.0

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agomesa/es: Allow querying GL_MAX_COLOR_ATTACHMENTS in OpenGL ES 2.0
Ian Romanick [Sun, 2 Oct 2011 22:12:11 +0000 (15:12 -0700)]
mesa/es: Allow querying GL_MAX_COLOR_ATTACHMENTS in OpenGL ES 2.0

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agomesa/es: Allow other color attachments in OpenGL ES 2.0
Ian Romanick [Sun, 2 Oct 2011 22:03:07 +0000 (15:03 -0700)]
mesa/es: Allow other color attachments in OpenGL ES 2.0

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