mesa.git
13 years agor300g: use u_vbuf_mgr to set/get the index buffer
Marek Olšák [Sun, 20 Nov 2011 02:43:11 +0000 (03:43 +0100)]
r300g: use u_vbuf_mgr to set/get the index buffer

13 years agou_vbuf_mgr: add set_index_buffer function
Marek Olšák [Sun, 20 Nov 2011 02:36:49 +0000 (03:36 +0100)]
u_vbuf_mgr: add set_index_buffer function

It will use the index buffer soon.

13 years agou_vbuf_mgr: add comments
Marek Olšák [Sun, 20 Nov 2011 02:24:00 +0000 (03:24 +0100)]
u_vbuf_mgr: add comments

13 years agou_vbuf_mgr: don't upload user buffers which have been uploaded by translate
Marek Olšák [Sun, 20 Nov 2011 01:30:36 +0000 (02:30 +0100)]
u_vbuf_mgr: don't upload user buffers which have been uploaded by translate

13 years agor600g: set MIN/MAX_VTX_INDX to 0 and ~0, respectively
Marek Olšák [Sat, 19 Nov 2011 23:18:48 +0000 (00:18 +0100)]
r600g: set MIN/MAX_VTX_INDX to 0 and ~0, respectively

The CS checker doesn't check the regs and the state-tracker-provided values
are not to be trusted.

This also removes the hack for non-zero index bias.

13 years agor300g: always set VF_MIN_VTX_INDX to 0
Marek Olšák [Sat, 19 Nov 2011 22:54:31 +0000 (23:54 +0100)]
r300g: always set VF_MIN_VTX_INDX to 0

It's not really useful to have non-zero there.

13 years agoi965: Remove unused file brw_fallback.h.
Kenneth Graunke [Sat, 19 Nov 2011 22:37:31 +0000 (14:37 -0800)]
i965: Remove unused file brw_fallback.h.

13 years agogallium/docs: remove obsolete documentation
Marek Olšák [Sat, 19 Nov 2011 18:40:26 +0000 (19:40 +0100)]
gallium/docs: remove obsolete documentation

13 years agomesa: set the gl_FragDepth layout in the GLSL linker
Marek Olšák [Fri, 18 Nov 2011 14:00:10 +0000 (15:00 +0100)]
mesa: set the gl_FragDepth layout in the GLSL linker

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoglsl: when cloning a variable, copy the depth layout too
Marek Olšák [Sat, 19 Nov 2011 13:30:13 +0000 (14:30 +0100)]
glsl: when cloning a variable, copy the depth layout too

This fixes AMD_conservative_depth.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: handle MapRenderbuffer() failures in glReadPixels
Brian Paul [Fri, 18 Nov 2011 00:20:05 +0000 (17:20 -0700)]
mesa: handle MapRenderbuffer() failures in glReadPixels

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: make slow_read_rgba_pixels() a void function
Brian Paul [Sat, 19 Nov 2011 00:39:01 +0000 (17:39 -0700)]
mesa: make slow_read_rgba_pixels() a void function

The boolean return value was ignored by the caller.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: define, use _mesa_is_cube_face() in several places
Brian Paul [Sat, 19 Nov 2011 00:39:00 +0000 (17:39 -0700)]
mesa: define, use _mesa_is_cube_face() in several places

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agost/mesa: rewrite the primitive restart fallback code
Brian Paul [Fri, 18 Nov 2011 14:39:03 +0000 (07:39 -0700)]
st/mesa: rewrite the primitive restart fallback code

Previously we were mapping/unmapping the index buffer each time we
found the restart index in the buffer.  This is bad when the restart
index is frequently used.  Now just map the index buffer once, scan
it to produce a list of sub-primitives, unmap the buffer, then draw
the sub-primitives.

Also, clean up the logic of testing for indexed primitives and calling
handle_fallback_primitive_restart().  Don't call it for non-indexed
primitives.

v2: per Jose, only map the relevant part of the index buffer with
pipe_buffer_map_range()

Reviewed-by: José Fonseca <jfonseca@vmware.com>
13 years agodocs: Add 7.11.1 release md5sums
Ian Romanick [Thu, 17 Nov 2011 20:12:34 +0000 (12:12 -0800)]
docs: Add 7.11.1 release md5sums
(cherry picked from commit 228da884c9bfe9258cc26e741f41b273aa3e668a)

13 years agodocs: Add news items for 7.11 and 7.11.1 releases
Ian Romanick [Thu, 17 Nov 2011 20:00:18 +0000 (12:00 -0800)]
docs: Add news items for 7.11 and 7.11.1 releases

13 years agodocs: Import 7.11 release notes from branch
Ian Romanick [Thu, 17 Nov 2011 19:59:50 +0000 (11:59 -0800)]
docs: Import 7.11 release notes from branch

13 years agodocs: Import 7.11.1 release notes from branch
Ian Romanick [Thu, 17 Nov 2011 19:45:06 +0000 (11:45 -0800)]
docs: Import 7.11.1 release notes from branch

13 years agoi965/gen4: Fix sampling from integer textures.
Eric Anholt [Thu, 10 Nov 2011 00:07:57 +0000 (16:07 -0800)]
i965/gen4: Fix sampling from integer textures.

On original gen4, the surface format didn't determine the return data
type from sampling like it does on g45 and later.

Fixes GL_EXT_texture_integer/texture_integer_glsl130

Reviewed-by: Paul Berry <stereotype441@gmail.com>
13 years agor600g: don't change the order of writes in merge_inst_group
Vadim Girlin [Wed, 16 Nov 2011 23:33:57 +0000 (03:33 +0400)]
r600g: don't change the order of writes in merge_inst_group

Merge may produce incorrect order of operations for r600-eg:

x: inst1 R0.x, ... ;  //from current group
...
t: inst0 R0.x, ... ;  //from previous group, same destination

Result of inst1 will be lost.

So compare destinations and don't allow this.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
13 years agoRevert "read_rgba_pixels: Don't force clamping if the renderbuffer is normalized."
Michel Dänzer [Thu, 17 Nov 2011 14:04:40 +0000 (15:04 +0100)]
Revert "read_rgba_pixels: Don't force clamping if the renderbuffer is normalized."

This reverts commit b11c16752a18ef8dfb96d9f0ead6ecb62bde6773.

Breaks at least luminance destination formats.

13 years agoread_rgba_pixels: Don't force clamping if the renderbuffer is normalized.
Michel Dänzer [Wed, 16 Nov 2011 16:39:50 +0000 (17:39 +0100)]
read_rgba_pixels: Don't force clamping if the renderbuffer is normalized.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agonvc0: add support for GF119 (NVD9)
Ben Skeggs [Thu, 17 Nov 2011 00:17:06 +0000 (10:17 +1000)]
nvc0: add support for GF119 (NVD9)

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agomesa: initialize stencilMap, Stride if stencilRb==depthRb
Brian Paul [Wed, 16 Nov 2011 16:58:45 +0000 (09:58 -0700)]
mesa: initialize stencilMap, Stride if stencilRb==depthRb

13 years agomesa: Only update sampler uniforms that are used by the shader stage
Ian Romanick [Thu, 10 Nov 2011 20:32:35 +0000 (12:32 -0800)]
mesa: Only update sampler uniforms that are used by the shader stage

Previously a vertex shader that used no samplers would get updated (by
calling the driver's ProgramStringNotify) when a sampler in the
fragment shader was updated.  This was discovered while investigating
some spurious code generation for shaders in Cogs.  The behavior in
Cogs is especially pessimal because it ping-pongs sampler uniform
settings:

    glUniform1i(sampler1, 0);
    glUniform1i(sampler2, 1);
    draw();
    glUniform1i(sampler1, 1);
    glUniform1i(sampler2, 0);
    draw();
    glUniform1i(sampler1, 0);
    glUniform1i(sampler2, 1);
    draw();
    // etc.

ProgramStringNotify is still too big of a hammer.  Applications like
Cogs will still defeat the shader cache.  A lighter-weight mechanism
that can work with the shader cache is needed.  However, this patch at
least restores the previous behavior.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: don't map depth+stencil buffer twice in glReadPixels()
Brian Paul [Wed, 16 Nov 2011 14:47:51 +0000 (07:47 -0700)]
mesa: don't map depth+stencil buffer twice in glReadPixels()

In slow_read_depth_stencil_pixels_separate() we might have separate
depth and stencil buffers or a combined buffer.  In the later case,
don't map the buffer twice.  This function is used when the depth
scale/bias pixel transfer values are not the defaults.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=42963

Reviewed-by: José Fonseca <jfonseca@vmware.com>
13 years agoi965: Fix inconsistent indentation in brw_gs_emit.c.
Kenneth Graunke [Mon, 14 Nov 2011 06:41:06 +0000 (22:41 -0800)]
i965: Fix inconsistent indentation in brw_gs_emit.c.

13 years agoglsl: Add missing textureSize(samplerCubeShadow, int) variant.
Kenneth Graunke [Tue, 15 Nov 2011 01:23:44 +0000 (17:23 -0800)]
glsl: Add missing textureSize(samplerCubeShadow, int) variant.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agomesa: do not skip att and spot calculation for infinite light
Yuanhan Liu [Wed, 16 Nov 2011 03:29:08 +0000 (11:29 +0800)]
mesa: do not skip att and spot calculation for infinite light

glspec doesn't say that we should skip the attenuation and spot
calculation for infinite light(Ppli.w == 0). Instead, it gives a same
formula to do the light calculation for both finite light and infinite
light(see page 62 of glspec 2.1.pdf)

Also from the formula (2.4) at page 62 of glspec 2.1.pdf, we can skip
attenuation calculation if Ppli.w == 0.

This would fix all the intel oglc l_sed fail subcases and introduces no
intel oglc regressions.

v2: fix an wrong intendation(comments from Brian).

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Brian Paul <brianp@vmware.com>
13 years agomesa: make sure all lighting tables are updated before the computation
Yuanhan Liu [Tue, 15 Nov 2011 07:40:53 +0000 (15:40 +0800)]
mesa: make sure all lighting tables are updated before the computation

Make sure all lighting tables are updated before using the table to
calculate something, say using _SpotExpTable to calculate
_VP_inf_spot_attenuation.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agomesa: Fix a couple of missed conversion to arrays in format_unpack.
Eric Anholt [Tue, 15 Nov 2011 20:22:15 +0000 (12:22 -0800)]
mesa: Fix a couple of missed conversion to arrays in format_unpack.

Fixes regression in piglit:
ARB_color_buffer_float/GL_RGBA16F-getteximage
ARB_color_buffer_float/GL_RGBA16F-readpixels
ARB_color_buffer_float/GL_RGBA32F-getteximage
ARB_color_buffer_float/GL_RGBA32F-readpixels

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agomesa: Include R/RG integer textures in _mesa_is_integer_format.
Eric Anholt [Fri, 4 Nov 2011 22:12:30 +0000 (15:12 -0700)]
mesa: Include R/RG integer textures in _mesa_is_integer_format.

Fixes some spurious GL errors in the upcoming
gl-3.0-required-sized-formats piglit test.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agointel: Fix separate stencil in builtin DRI2 backend
Chad Versace [Tue, 15 Nov 2011 15:08:49 +0000 (07:08 -0800)]
intel: Fix separate stencil in builtin DRI2 backend

intelAllocateBuffer() was oblivious to separate stencil buffers.  This
patch fixes it to allocate a non-tiled stencil buffer with special pitch,
just as the DDX does.

Without this, any app that attempted to create an EGL surface with stencil
bits would crash. Of course, this affected only environments that used the
builtin DRI2 backend, such as Android and Wayland.

Fixes GLBenchmark2.1 on Android on gen7.

Note: This is a candidate for the 7.11 branch.
Tested-by: Louie Tsaie <louie.tsai@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Fix region dimensions for stencil buffers received from DDX
Chad Versace [Tue, 15 Nov 2011 15:21:25 +0000 (07:21 -0800)]
intel: Fix region dimensions for stencil buffers received from DDX

I changed the dimensions of the stencil buffer's region, as allocated by
the DDX, at xf86-video-intel commit
   commit 3e55f3e88b40471706d5cd45c4df4010f8675c75
   dri: Do not tile stencil buffer
But I forgot to make the analogous update to the Intel DRI2 glue in Mesa.
This patch makes that update.

Surprisingly, the mismatch did not cause any bugs. But the mismatch, if
left unfixed, *would* create bugs in the next commit.

Note: This is a candidate for the 7.11 branch.
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Simplify stencil detiling arithmetic
Chad Versace [Tue, 15 Nov 2011 15:10:18 +0000 (07:10 -0800)]
intel: Simplify stencil detiling arithmetic

When calculating the y offset needed for detiling window system stencil
buffers, replace the term
   region->height * 2 + region->height % 2 - 1
with
   rb->Height - 1 .

The two terms are incidentally equivalent due to some out-of-date,
incorrect code in the Intel DRI2 glue for DDX. (See
intel_process_dri2_buffer_with_separate_stencil(), line ``buffer_height /=
2;``).

Note: This is a candidate for the 7.11 branch (only the intel_span.c hunk).
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agoradeon: use _mesa_readpixels() instead of _swrast_ReadPixels()
Brian Paul [Tue, 15 Nov 2011 15:10:24 +0000 (08:10 -0700)]
radeon: use _mesa_readpixels() instead of _swrast_ReadPixels()

13 years agoi965: use _mesa_readpixels() instead of _swrast_ReadPixels()
Brian Paul [Tue, 15 Nov 2011 15:07:08 +0000 (08:07 -0700)]
i965: use _mesa_readpixels() instead of _swrast_ReadPixels()

13 years agomesa: convert unpack functions to operate on an array of values
Brian Paul [Sat, 12 Nov 2011 21:43:03 +0000 (14:43 -0700)]
mesa: convert unpack functions to operate on an array of values

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agomesa: new BYTE/SHORT_TO_FLOATZ() macros
Brian Paul [Sat, 12 Nov 2011 18:50:32 +0000 (11:50 -0700)]
mesa: new BYTE/SHORT_TO_FLOATZ() macros

Rather than redefining the BYTE/SHORT_TO_FLOAT macros, just define new
ones with different names.  These macros preserve zero when converting.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agomesa: move CEILING() macro into macros.h
Brian Paul [Sat, 12 Nov 2011 18:50:32 +0000 (11:50 -0700)]
mesa: move CEILING() macro into macros.h

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agomesa: remove unused macros in macros.h
Brian Paul [Sat, 12 Nov 2011 18:50:32 +0000 (11:50 -0700)]
mesa: remove unused macros in macros.h

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agomesa: consolidate cases in _mesa_components_in_format()
Brian Paul [Sat, 12 Nov 2011 18:50:32 +0000 (11:50 -0700)]
mesa: consolidate cases in _mesa_components_in_format()

and _mesa_sizeof_packed_type()

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoswrast: fix glReadPixels from texture attachment
Brian Paul [Sat, 12 Nov 2011 18:50:32 +0000 (11:50 -0700)]
swrast: fix glReadPixels from texture attachment

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

13 years agost/mesa: check for missing VBO in setup_interleaved_attribs()
Brian Paul [Mon, 14 Nov 2011 15:27:13 +0000 (08:27 -0700)]
st/mesa: check for missing VBO in setup_interleaved_attribs()

This fixes a crash with the piglit vbo-too-small test.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
13 years agoutil/draw: replace assertions with conditionals in util_draw_max_index()
Brian Paul [Sat, 12 Nov 2011 18:50:32 +0000 (11:50 -0700)]
util/draw: replace assertions with conditionals in util_draw_max_index()

Don't assert/die if a VBO is too small.  Return zero instead.  For
debug builds, emit a warning message since this is an unusual situation
that might indicate that there's a bug in the app.

Note that util_draw_max_index() now returns max_index+1 instead of
max_index.  This lets us return zero to indicate that one of the VBOs
is too small to draw anything.

Fixes a failure with the new piglit vbo-too-small test.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
13 years agost/mesa: remove most of the ReadPixels code
Brian Paul [Mon, 14 Nov 2011 20:06:29 +0000 (13:06 -0700)]
st/mesa: remove most of the ReadPixels code

We can use the core Mesa code for glReadPixels now.  We just have to
validate state and flush the bitmap cache before reading.

13 years agost/mesa: remove dependencies on code in st_cb_readpixels.c
Brian Paul [Sat, 12 Nov 2011 18:50:32 +0000 (11:50 -0700)]
st/mesa: remove dependencies on code in st_cb_readpixels.c

st_cb_readpixels.c is going away next.

Acked-by: Eric Anholt <eric@anholt.net>
13 years agomesa: remove _swrast_ReadPixels()
Brian Paul [Sat, 12 Nov 2011 18:50:31 +0000 (11:50 -0700)]
mesa: remove _swrast_ReadPixels()

We use the code in main/readpix.c now.

Acked-by: Eric Anholt <eric@anholt.net>
13 years agomesa: use _mesa_readpixels() as default driver hook
Brian Paul [Sat, 12 Nov 2011 18:50:31 +0000 (11:50 -0700)]
mesa: use _mesa_readpixels() as default driver hook

Acked-by: Eric Anholt <eric@anholt.net>
13 years agomesa: move swrast ReadPixels code into core Mesa
Brian Paul [Sat, 12 Nov 2011 18:50:31 +0000 (11:50 -0700)]
mesa: move swrast ReadPixels code into core Mesa

The swrast ReadPixels code has no dependencies on swrast since moving
to Map/UnmapRenderbuffer().  We'll be able to remove s_readpix.c and
remove the state tracker's glReadPixels code next.

Acked-by: Eric Anholt <eric@anholt.net>
13 years agost/mesa: check renderbuffer orientation in st_MapRenderbuffer()
Brian Paul [Sat, 12 Nov 2011 18:50:31 +0000 (11:50 -0700)]
st/mesa: check renderbuffer orientation in st_MapRenderbuffer()

We'll soon be able to use these for a core Mesa implementation of
glReadPixels.

Acked-by: Eric Anholt <eric@anholt.net>
13 years agomesa: remove support for software alpha buffers
Brian Paul [Sat, 12 Nov 2011 18:50:31 +0000 (11:50 -0700)]
mesa: remove support for software alpha buffers

This was only used by the xlib driver to add an alpha channel to the
front/window color buffer.  This was no longer going to work well with
the move to direct mapping of renderbuffers.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoxlib: remove xm_image.[ch] files
Brian Paul [Sat, 12 Nov 2011 18:50:31 +0000 (11:50 -0700)]
xlib: remove xm_image.[ch] files

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoxlib: remove a ton of old xlib driver cruft
Brian Paul [Sat, 12 Nov 2011 18:50:31 +0000 (11:50 -0700)]
xlib: remove a ton of old xlib driver cruft

The days of 1-bpp, 8-bpp and dithering are long behind us.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoxlib: use MESA_FORMAT_XRGB8888 for pixmap surfaces
Brian Paul [Sat, 12 Nov 2011 18:50:31 +0000 (11:50 -0700)]
xlib: use MESA_FORMAT_XRGB8888 for pixmap surfaces

We no longer have software-allocated alpha buffers so we can forget
about the alpha channel.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoxlib: remove software alpha buffer support
Brian Paul [Sat, 12 Nov 2011 18:50:31 +0000 (11:50 -0700)]
xlib: remove software alpha buffer support

Seldom used and this won't work when we move to using Map/UnmapRenderbuffer
everywhere.  This will let us remove a bunch of core Mesa code too.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agomesa: replace GLstencil with GLubyte
Brian Paul [Fri, 11 Nov 2011 14:30:18 +0000 (07:30 -0700)]
mesa: replace GLstencil with GLubyte

13 years agointel: Fix intel_map_renderbuffer() for depthstencil buffers with separate stencil
Chad Versace [Mon, 14 Nov 2011 01:36:30 +0000 (17:36 -0800)]
intel: Fix intel_map_renderbuffer() for depthstencil buffers with separate stencil

For a depthstencil buffer with separate stencil,
intel_renderbuffer::region is null. (The regions are kept in hidden depth
and stencil buffers). Since the region is null, intel_map_renderbuffer()
assumed there was no data and returned a null map pointer, which in turn
was dereferenced (!) by MapRenderbuffer's caller.

This patch fixes intel_map_renderbuffer() to map the hidden depth buffer
through the GTT and return that as the mapped pointer. Also, the stencil
bits are scattered and gathered when needed.

Fixes the following Piglit tests on gen7:
    fbo/fbo-readpixels-depth-formats
    hiz/hiz-depth-read-fbo-d24s8
    hiz/hiz-stencil-read-fbo-d24s8
    EXT_packed_depth_stencil/fbo-clear-formats
    EXT_packed_depth_stencil/fbo-depth-GL_DEPTH24_STENCIL8-blit
    EXT_packed_depth_stencil/fbo-depth-GL_DEPTH24_STENCIL8-drawpixels
    EXT_packed_depth_stencil/fbo-depth-GL_DEPTH24_STENCIL8-readpixels
    EXT_packed_depth_stencil/fbo-depthstencil-GL_DEPTH24_STENCIL8-readpixels-24_8
    EXT_packed_depth_stencil/fbo-depthstencil-GL_DEPTH24_STENCIL8-readpixels-FLOAT-and-USHORT
    EXT_packed_depth_stencil/fbo-stencil-GL_DEPTH24_STENCIL8-readpixels

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Fix software detiling of system stencil buffers
Chad Versace [Fri, 11 Nov 2011 02:39:25 +0000 (18:39 -0800)]
intel: Fix software detiling of system stencil buffers

If a window system stencil buffer had a region with odd height, then the
calculated y offset needed for software detiling was off by one.  The bug
existed in intel_{map,unmap}_renderbuffer_s8() and in the intel_span.c
accessors.

Fixes the following Piglit tests on gen7:
    general/depthstencil-default_fb-readpixels-24_8
    general/depthstencil-default_fb-readpixels-FLOAT-and-USHORT

Fixes SIGABRT in the following Piglit tests on gen7:
    general/depthstencil-default_fb-blit
    general/depthstencil-default_fb-copypixels
    general/depthstencil-default_fb-drawpixels-24_8
    general/depthstencil-default_fb-drawpixels-FLOAT-and-USHORT

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Fix intel_unmap_renderbuffer_s8()
Chad Versace [Thu, 10 Nov 2011 19:04:17 +0000 (11:04 -0800)]
intel: Fix intel_unmap_renderbuffer_s8()

When gathering the temporary buffer's pixles into the gem buffer, we had
the two buffers juxtaposed. Oops.

Fixes the following Piglit tests on gen7:
   general/GL_SELECT - alpha-test enabled
   general/GL_SELECT - depth-test enabled
   general/GL_SELECT - no test function
   general/GL_SELECT - scissor-test enabled
   general/GL_SELECT - stencil-test enabled

Fixes SIGABRT in Piglit tests EXT_framebuffer_object/fbo-stencil-* on
gen7.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Refactor intel_map_renderbuffer()
Chad Versace [Wed, 9 Nov 2011 02:17:33 +0000 (18:17 -0800)]
intel: Refactor intel_map_renderbuffer()

The function already implements 3 cases (map through GTT, blit to
a temporary, and detile stencil buffer to temporary), and a 4th will be
added soon: scatter/gather for depthstencil buffers using separate
stencil.  For sanity's sake, this factors each case out into its own
function.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agoir_to_mesa: don't init unfirom if link failed
Yuanhan Liu [Wed, 9 Nov 2011 06:55:53 +0000 (14:55 +0800)]
ir_to_mesa: don't init unfirom if link failed

Don't call set_unfiform_initializers if link failed, or it would trigger
a GL_INVALID_OPERATION error. That's not an expected behavior of
glLinkProgram function.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
13 years agoglsl: Always search for an exact function signature match.
Kenneth Graunke [Fri, 11 Nov 2011 08:43:06 +0000 (00:43 -0800)]
glsl: Always search for an exact function signature match.

Previously, we would fail to compile the following shader due to a bug
in lazy built-in importing:

    #version 130
    void main() {
        float f = abs(5.0);
        int i = abs(5);
    }

The first call, abs(5.0), would fail to find a local signature, look
through the built-ins, and import "float abs(float)".

The second call, abs(5), would find the newly imported float signature
in the local shader, and settle for that.  Unfortunately, it failed to
search the built-ins for the correct/exact signature, "int abs(int)".

Thus, abs(5) ended up being a float, causing a bizarre type error when
we tried to assign it to an int.

Fixes piglit test builtin-overload-matching.frag.

This is /not/ a candidate for stable branches, as it should only be
possible to trigger this bug using GLSL 1.30's built-in functions that
take integer arguments.  Plus, the changes are fairly invasive.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoglsl: Split code to generate an ir_call out from match_function_by_name.
Kenneth Graunke [Wed, 9 Nov 2011 11:01:54 +0000 (03:01 -0800)]
glsl: Split code to generate an ir_call out from match_function_by_name.

match_function_by_name performs two fairly separate tasks:
1. Hunt down the appropriate ir_function_signature for the callee.
2. Generate the actual ir_call (assuming we found the callee).

Both of these are complicated.  The first has to handle exact/inexact
matches, lazy importing of built-in prototypes, different scoping rules
for 1.10, 1.20+, and ES.  Not to mention printing a user-friendly error
message with pretty-printed "maybe you meant this" candidate signatures.

The second has to deal with void/non-void functions, pre-call implicit
conversions for "in" parmeters, and post-call "out" call conversions.

Trying to do both in one function is just too unwieldy.  Time to split.

This patch purely moves the code to generate an ir_call into a separate
function and reindents it.  Otherwise, the code is identical.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
13 years agoglsl: Add a new matching_signature() variant that returns exact/inexact.
Kenneth Graunke [Fri, 11 Nov 2011 08:48:14 +0000 (00:48 -0800)]
glsl: Add a new matching_signature() variant that returns exact/inexact.

When matching function signatures across multiple linked shaders, we
often want to see if the current shader has _any_ match, but also know
whether or not it was exact.  (If not, we may want to keep looking.)

This could be done via the existing mechanisms:

   sig = f->exact_matching_signature(params);
   if (sig != NULL) {
      exact = true;
   } else {
      sig = f->matching_signature(params);
      exact = false;
   }

However, this requires walking the list of function signatures twice,
which also means walking each signature's formal parameter lists twice.
This could be rather expensive.

Since matching_signature already internally knows whether a match was
exact or not, we can just return it to get that information for free.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
13 years agor600g: fix the representation of control-flow instructions
Marek Olšák [Mon, 14 Nov 2011 15:53:54 +0000 (16:53 +0100)]
r600g: fix the representation of control-flow instructions

We need something that looks like a compiler and not like some hacker
put some functions together. /rant

This is a band-aid for these two problems:
- The R600 and EG control-flow instructions appear in switch statements
  next to each other, causing conflicts when adding new instructions.
- The ALU control-flow instructions are bitshifted by 3 (from CF_INST 26:29
  to CF_INST 23:29, as is defined by r600 ISA) even for EG, where CF_INST
  is 22:29.

To fix this mess, the 'inst' field is bitshifted to the left either by 22, 23,
or 26 (directly in the definitions), such that it can be just or'd when making
bytecode without any shifting. All switch statements have been divided into
two, one for R600 and the other for EG.

Of course, there is a better way to do this, but that is left for future
work.

Tested on RV730 and REDWOOD with no regressions.

v2: minor cleanup as per Alex's comment.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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.

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

13 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

13 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

13 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>
13 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>
13 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>
13 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>
13 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.

13 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 `;'

13 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.

13 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().

13 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>
13 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>
13 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>
13 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>
13 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

13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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.

13 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>
13 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>
13 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>
13 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>