mesa.git
13 years agou_vbuf_mgr: remove a useless variable
Marek Olšák [Tue, 22 Nov 2011 19:04:40 +0000 (20:04 +0100)]
u_vbuf_mgr: remove a useless variable

13 years agou_vbuf_mgr: remove redundant memset
Marek Olšák [Sun, 20 Nov 2011 19:36:35 +0000 (20:36 +0100)]
u_vbuf_mgr: remove redundant memset

13 years agou_vbuf_mgr: don't reference non-native vertex buffers as native
Marek Olšák [Sun, 20 Nov 2011 19:34:12 +0000 (20:34 +0100)]
u_vbuf_mgr: don't reference non-native vertex buffers as native

also don't mark them as 'user', because they will be uploaded through
the translate fallback anyway.

13 years agou_vbuf_mgr: rename translate_vb_slot -> fallback_vb_slot
Marek Olšák [Sun, 20 Nov 2011 19:33:31 +0000 (20:33 +0100)]
u_vbuf_mgr: rename translate_vb_slot -> fallback_vb_slot

13 years agogallium: separate out floating-point CAPs into its own enum
Marek Olšák [Sat, 19 Nov 2011 21:38:22 +0000 (22:38 +0100)]
gallium: separate out floating-point CAPs into its own enum

The motivation behind this is to add some self-documentation in the code
about how each CAP can be used.

The idea is:
- enum pipe_cap is only valid in get_param
- enum pipe_capf is only valid in get_paramf

Which CAPs are floating-point have been determined based on how everybody
except svga implemented the functions. svga have been modified to match all
the other drivers.

Besides that, the floating-point CAPs are now prefixed with PIPE_CAPF_.

13 years agogallium: remove PIPE_CAP_GLSL and enable GLSL unconditionally
Marek Olšák [Fri, 18 Nov 2011 14:51:47 +0000 (15:51 +0100)]
gallium: remove PIPE_CAP_GLSL and enable GLSL unconditionally

Only i965g does not enable GLSL, but that driver has been unmaintained and
bitrotting for quite a while anyway.

13 years agoglsl: convervative_depth is not allowed in the vertex shader
Marek Olšák [Sat, 19 Nov 2011 15:45:46 +0000 (16:45 +0100)]
glsl: convervative_depth is not allowed in the vertex shader

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoglsl: finish up ARB_conservative_depth (v2)
Marek Olšák [Sat, 19 Nov 2011 15:41:08 +0000 (16:41 +0100)]
glsl: finish up ARB_conservative_depth (v2)

v2: updated an error message

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agomesa: rename the AMD_conservative_depth extension flag to ARB
Marek Olšák [Sat, 19 Nov 2011 15:27:50 +0000 (16:27 +0100)]
mesa: rename the AMD_conservative_depth extension flag to ARB

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agost/mesa: quick fix of CopyPixels with GL_DEPTH_STENCIL
Marek Olšák [Sun, 20 Nov 2011 14:08:56 +0000 (15:08 +0100)]
st/mesa: quick fix of CopyPixels with GL_DEPTH_STENCIL

This fixes:
- depthstencil-default_fb-copypixels
- fbo-depthstencil-GL_DEPTH24_STENCIL8-copypixels

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agolinker: Remove erroneous multiply by 4 in uniform usage calculation
Ian Romanick [Mon, 21 Nov 2011 19:42:37 +0000 (11:42 -0800)]
linker: Remove erroneous multiply by 4 in uniform usage calculation

The old count_uniform_size::num_shader_uniforms was actually
calculating the number of components used.  Multiplying by 4 when
setting gl_shader::num_uniform_components caused us to count 4x as
many uniform components as were actually used.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42930
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42966
Acked-by: Marek Olšák <maraeo@gmail.com>
Tested-by: Vinson Lee <vlee@vmware.com>
Tested-by: Pavel Ondračka <pavel.ondracka@email.cz>
Reviewed-and-tested-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoMerge branch 'hiz' of ssh://people.freedesktop.org/~chadversary/mesa
Chad Versace [Tue, 22 Nov 2011 18:52:29 +0000 (10:52 -0800)]
Merge branch 'hiz' of ssh://people.freedesktop.org/~chadversary/mesa

13 years agoi965/gen6: Enable HiZ by default
Chad Versace [Thu, 17 Nov 2011 16:53:39 +0000 (08:53 -0800)]
i965/gen6: Enable HiZ by default

Regresses one Piglit test: bugs/fdo10370.

I'm not enabling HiZ for gen7 yet because it causes a mysterious
performance regression.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Use separate stencil whenever possible
Chad Versace [Thu, 17 Nov 2011 16:50:05 +0000 (08:50 -0800)]
intel: Use separate stencil whenever possible

For depthstencil renderbuffers, we were using separate stencil only if the
hardware required it. Since the performance gains from HiZ is so high, we
should always use separate stencil if the hardware supports it.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agoi965: Implement the actual tables for texture alignment units [v2]
Kenneth Graunke [Mon, 7 Nov 2011 23:58:43 +0000 (15:58 -0800)]
i965: Implement the actual tables for texture alignment units [v2]

I implemented functions for horizontal/vertical alignment units separately
because I find it easier to read that way...especially with all the
corner-cases.

[chad] Corrected the vertical alignment calculation by checking for
depthstencil formats.

v2:
   - Fix typos in intel_horizontal_texture_alignment_unit():
     s/height/width/ and s/VALIGN/HALIGN.
   - Remove special case for compressed formats in
     intel_get_texture_alignment unit(). Compressed formats are already
     handled in the halign and valign functions.
   - Replace check ``_mesa_is_depth_format(...) ||
     _mesa_is_depthstencil_format(...)`` with explcitit checks against
     GL_DEPTH_COMPONENT and GL_DEPTH_STENCIL.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agoi965/gen6: Set vertical alignment in SURFACE_STATE batch
Chad Versace [Thu, 17 Nov 2011 17:09:56 +0000 (09:09 -0800)]
i965/gen6: Set vertical alignment in SURFACE_STATE batch

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Store miptree alignment units in the miptree
Chad Versace [Thu, 17 Nov 2011 16:30:30 +0000 (08:30 -0800)]
intel: Store miptree alignment units in the miptree

This allows us to replace all the calls to
intel_get_texture_alignment_unit() with a single call at miptree creation.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Enable HiZ for texture renderbuffers
Chad Versace [Wed, 16 Nov 2011 06:51:35 +0000 (22:51 -0800)]
intel: Enable HiZ for texture renderbuffers

When a depth texture is first attached to framebuffer, allocate a HiZ
miptree for it.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Resolve buffers in intel_map_renderbuffer()
Chad Versace [Wed, 16 Nov 2011 02:25:39 +0000 (18:25 -0800)]
intel: Resolve buffers in intel_map_renderbuffer()

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Resolve buffers in intel_map_texture_image()
Chad Versace [Wed, 16 Nov 2011 02:21:12 +0000 (18:21 -0800)]
intel: Resolve buffers in intel_map_texture_image()

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Mark needed resolves when first enabling HiZ on a miptree
Chad Versace [Wed, 16 Nov 2011 02:21:09 +0000 (18:21 -0800)]
intel: Mark needed resolves when first enabling HiZ on a miptree

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agoi965: Mark that depth buffer needs depth resolve after drawing
Chad Versace [Wed, 16 Nov 2011 02:20:43 +0000 (18:20 -0800)]
i965: Mark that depth buffer needs depth resolve after drawing

After brw_try_draw_prims() emits a batch, mark that the depth buffer needs
a depth resolve if the buffer was written to and if it has an accompanying
HiZ buffer.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Resolve buffers in intelSpanRenderStart
Chad Versace [Wed, 16 Nov 2011 02:21:05 +0000 (18:21 -0800)]
intel: Resolve buffers in intelSpanRenderStart

Resolve all buffers that will be mapped by intelSpanRenderStart. This
comprises resolving the depth buffer of each enabled texture and of the
read and draw buffers.

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

Factor the mapping loops from intelSpanRenderStart() into
intel_span_map_buffers(). This in preparation for the next commit,
which resolves the buffers before mapping.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agoi965: Resolve buffers before drawing [v2]
Chad Versace [Wed, 16 Nov 2011 02:20:39 +0000 (18:20 -0800)]
i965: Resolve buffers before drawing [v2]

Before emitting primitives in brw_try_draw_prims(), resolve the depth
buffer's HiZ buffer and resolve the depth buffer of each enabled depth
texture.

v2: [anholt] The driver no longer validates drm bo's, so update a comment
    to reflect that.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agoi965: Prevent recursive calls to FLUSH_VERTICES [v2]
Chad Versace [Wed, 16 Nov 2011 02:20:34 +0000 (18:20 -0800)]
i965: Prevent recursive calls to FLUSH_VERTICES [v2]

To do so, we must resolve all buffers on entering a glBegin/glEnd block.
For the detailed explanation, see the Doxygen comments in this patch.

v2:
   - Fix typo: s/enusure/ensure/.
   - In brwPrepareExecBegin(), do the same resolves as done by
     brw_predraw_resolve_buffers().

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agoi965/gen6: Manipulate state batches for HiZ meta-ops [v4]
Chad Versace [Wed, 16 Nov 2011 02:20:31 +0000 (18:20 -0800)]
i965/gen6: Manipulate state batches for HiZ meta-ops [v4]

A lot of the state manipulation is handled by the meta-op state setup.
However, some batches need manual intervention.

v2:
   Do not special-case the 3DSTATE_DEPTH_STENCIL.Depth_Test_Enable bit
   for HiZ in gen6_upload_depth_stencil(). The HiZ meta-op sets
   ctx->Depth.Test, just read the value from that.

v3:
   Add a new dirty flag, BRW_STATE_HIZ, for brw_tracked_state. Flag it
   immediately before and after executing the HiZ operation in
   gen6_resolve_slice(). Add the flag to the the dirty bits for the
   following state packets:
      gen6_clip_state
      gen6_depth_stencil_state
      gen6_sf_state
      gen6_wm_state

v4:
   - Add BRW_NEW_STATE_HIZ to the dirty bit table in brw_state_upload.c.
     This is needed for INTEL_DEBUG=state.
   - Align brw dirty bit for gen6_depth_stencil_state.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agoi965/gen6: Complete stubs for HiZ buffer resolves
Chad Versace [Thu, 17 Nov 2011 16:10:57 +0000 (08:10 -0800)]
i965/gen6: Complete stubs for HiZ buffer resolves

Some state batches also need to be manipulated. That's done in the next
commit.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agoi965: Add HiZ operation state to brw_context
Chad Versace [Wed, 16 Nov 2011 02:20:20 +0000 (18:20 -0800)]
i965: Add HiZ operation state to brw_context

brw_context::hiz contains state needed to perform HiZ meta-ops and
indicates if a HiZ operation is currently in progress.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Add resolve functions for renderbuffers
Chad Versace [Thu, 17 Nov 2011 16:03:48 +0000 (08:03 -0800)]
intel: Add resolve functions for renderbuffers

Add the following functions:
   intel_renderbuffer_resolve_hiz
   intel_renderbuffer_resolve_depth

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Add resolve functions for miptrees
Chad Versace [Wed, 16 Nov 2011 02:20:02 +0000 (18:20 -0800)]
intel: Add resolve functions for miptrees

Add functions that
   - set a miptree slice as needing a resolve
   - resolve a single slice of a miptree
   - resolve all slices of a miptree

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Add field intel_mipmap_tree::hiz_map
Chad Versace [Thu, 17 Nov 2011 15:42:21 +0000 (07:42 -0800)]
intel: Add field intel_mipmap_tree::hiz_map

This is a map of miptree slices to needed resolves.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Define struct intel_resolve_map [v2]
Chad Versace [Thu, 17 Nov 2011 07:43:56 +0000 (23:43 -0800)]
intel: Define struct intel_resolve_map [v2]

This is a map of miptree slices to needed resolves, implemented as
a linked list. A future commit will embed such a list in
intel_mipmap_tree.

If you think I'm crazy to put a list in a miptree, read the Doxygen in
this patch for intel_resolve_map.

v2: [anholt] Move Doxygen from functin prototypes to definitions.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Change signature of HiZ resolve functions
Chad Versace [Thu, 17 Nov 2011 07:23:30 +0000 (23:23 -0800)]
intel: Change signature of HiZ resolve functions

Now that intel_renderbuffer::region has been replaced with a miptree, the
HiZ functions region parameter must be replaced with a miptree parameter.

Change the return type from bool to void.

Rename the 'depth' parameter to 'layer', because it will correspond to
irb->mt_layer.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Remove unused HiZ functions
Chad Versace [Thu, 17 Nov 2011 07:10:48 +0000 (23:10 -0800)]
intel: Remove unused HiZ functions

Remove the following functions:
   i830_hiz_resolve_noop
   i915_hiz_resolve_noop
   brw_hiz_resolve_noop

My original strategy for how intel->vtbl.resolve_*buffer was used has
substantially changed. The above functions are no longer called in the
current strategy.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Replace intel_mipmap_tree::hiz_region with a miptree [v2]
Chad Versace [Thu, 17 Nov 2011 07:14:39 +0000 (23:14 -0800)]
intel: Replace intel_mipmap_tree::hiz_region with a miptree [v2]

This is required to correctly implement HiZ for mipmapped and
multi-layered textures.

v2: Accomodate refcount fixes in intel_process_dri2_buffer_*() that were
    introduced in v2 of commit
        intel: Replace intel_renderbuffer::region with a miptree [v2]

Reviewed-by: Eric Anholt <eric@anholt>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Replace intel_texture_image::stencil_irb with intel_mipmap_tree::stencil_mt...
Chad Versace [Wed, 16 Nov 2011 06:17:34 +0000 (22:17 -0800)]
intel: Replace intel_texture_image::stencil_irb with intel_mipmap_tree::stencil_mt [v3]

For depthstencil textures using separate stencil, we embedded a stencil
buffer in intel_texture_image. The intention was that the embedded stencil
buffer would be the golden copy of the texture's stencil bits. When
necessary, we scattered/gathered the stencil bits between the texture
miptree and the embedded stencil buffer.

This approach had a serious deficiency for mipmapped or multi-layer
textures. Any given moment the embedded stencil buffer was consistent with
exactly one miptree slice, the most recent one to be scattered. This
permitted tests of type A to pass, but broke tests of type B.

Test A:
    1. Create a depthstencil texture.
    2. Upload data into (level=x1,layer=y1).
    3. Read and test stencil data at (level=x1, layer=y1).
    4. Upload data into (level=x2,layer=y2).
    5. Read and test stencil data at (level=x2, layer=y2).

Test B:
    1. Create a depthstencil texture.
    2. Upload data into (level=x1,layer=y1).
    3. Upload data into (level=x2,layer=y2).
    4. Read and test stencil data at (level=x1, layer=y1).
    5. Read and test stencil data at (level=x2, layer=y2).

v2:
   Only allocate stencil miptree if intel->must_use_separate_stencil,
   because we don't make the conversion from must_use_separate_stencil to
   has_separate_stencil until commit
        intel: Use separate stencil whenever possible

v3:
   Don't call ChooseNewTexture in intel_renderbuffer_wrap_miptree() in
   order to determine the renderbuffer format. Instead, pass the format as
   a param to that function.

CC: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Refactor intel_render_texture() [v2]
Chad Versace [Wed, 16 Nov 2011 06:11:33 +0000 (22:11 -0800)]
intel: Refactor intel_render_texture() [v2]

This is in preparation for properly implementing glFramebufferTexture*()
for mipmapped depthstencil textures. The FIXME comments deleted by this
patch give a rough explanation of what was broken.

This refactor does the following:
   - In intel_update_wrapper() and intel_wrap_texture(), change the
     parameters to prepare to remove functions' dependency on
     gl_texture_image.
   - Move the call to intel_renderbuffer_set_draw_offsets() from
     intel_render_texture() into intel_udpate_wrapper().

Each time I encounter those functions, I dislike their vague names.
(Update which wrapper? What is wrapped? What is the wrapper?). So, while
I was mucking around, I also renamed the functions.

v2:
   In addition to the ``GLenum internal_format`` parameter to
   intel_wrap_miptree(), add a ``gl_format format`` parameter. This
   removes the need to recalculate for the true format from
   internal_format with ChooseNewTextureFormat, which was just weird.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Define intel_miptree_check_level_layer()
Chad Versace [Thu, 17 Nov 2011 06:42:44 +0000 (22:42 -0800)]
intel: Define intel_miptree_check_level_layer()

This is a small helper function that asserts that a given level and layer
are valid for a miptree. I will be extensively using it in the future
miptree HiZ functions.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Remove unneeded params from intel_renderbuffer_set_draw_offset()
Chad Versace [Tue, 15 Nov 2011 18:22:14 +0000 (10:22 -0800)]
intel: Remove unneeded params from intel_renderbuffer_set_draw_offset()

Since the renderbuffer tracks the miptree level and layer that it wraps,
the 'tex_image' and 'zoffset' params are no longer needed to calculate the draw
offsets.

Not only are they no longer needed, but their presence would prevent
calculating the renderbuffer draw offsets in situations where there were
no texture image. Such situations will occur during the HiZ meta-op and
during scatter/gather of separate stencil textures.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Track the miptree layer wrapped by a renderbuffer [v2]
Chad Versace [Tue, 15 Nov 2011 18:05:21 +0000 (10:05 -0800)]
intel: Track the miptree layer wrapped by a renderbuffer [v2]

TODO: Make v2 for kwg.

Add two fields to intel_renderbuffer:
    mt_level
    mt_layer

Multiple renderbuffers may simultaneously wrap a single texture and each
provide a different view into that texture. [Consider
glFramebufferTextureLayer()].  The new fields indicate which slice of the
miptree is wrapped by the renderbuffer.

The buffer resolve operations, to be introduced in the future, require
these fields in order to resolve the correct slice in the miptree.

To add the fields, it was necessary to replace the type of some function
parameters from gl_texture_image to gl_renderbuffer_attachment.

v2: [kwg] Replace confusing condition `CubeMapFace > 0` with the more
    sensible `Target == GL_TEXTURE_CUBE_MAP`.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Kill intel_mipmap_level::nr_images [v4]
Chad Versace [Tue, 15 Nov 2011 17:55:40 +0000 (09:55 -0800)]
intel: Kill intel_mipmap_level::nr_images [v4]

For all texture targets except GL_TEXTURE_CUBE_MAP, the 'nr_images' and
'depth' fields of intel_mipmap_level were identical.  In the exceptional
case, nr_images == 6 and depth == 1.

It is simple to determine if a texture is a cube or not, so the presence
of two fields here was not helpful. Worse, it was confusing. When we
eventually implement GL_ARB_texture_cube_map_array, this mess would have
become even more confusing.

This patch removes 'nr_images' and assigns to 'depth' a consistent
meaning: depth is the number of 2D slices at each miplevel.  The exact
semantics of depth varies according to the texture target:
   - For GL_TEXTURE_CUBE_MAP, depth is 6.
   - For GL_TEXTURE_2D_ARRAY, depth is the number of array slices. It is
     identical for all miplevels in the texture.
   - For GL_TEXTURE_3D, it is the texture's depth at each miplevel. Its
     value, like width and height, varies with miplevel.
   - For other texture types, depth is 1.

As a consequence, parameters were removed from the following function
signatures:
    intel_miptree_set_level_info
        Remove 'nr_images'.

    i945_miptree_layout
    brw_miptree_layout_texture
    brw_miptree_layout_texture_array
        Remove 'slices'.

v2:
   - Replace "It's" with "Its".
   - Remove all hunks in intel_fbo.c. The hunks were spurious and sneaked
     in during a rebase.
   - Remove unneeded hunk in intel_tex_map_image_for_swrast(). It was
     a little refactor of the for-loop's upper bound.

v4:
   In intel_miptree_get_image_offset(), document the conditions under
   which different if-branches are taken.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agoi915g: implement RGBX and BGRX render targets
Vasily Khoruzhick [Tue, 22 Nov 2011 16:04:04 +0000 (19:04 +0300)]
i915g: implement RGBX and BGRX render targets

They're not supported by hw directly, but it's easy to emulate
them with a shader swizzling fixup.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
[danvet: The important thing is to write a 1 to the unused alpha
channel, the ddx is relying on this for render accel.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
13 years agost/mesa: fix accum buffer allocation in st_renderbuffer_alloc_storage()
Brian Paul [Mon, 21 Nov 2011 20:59:35 +0000 (13:59 -0700)]
st/mesa: fix accum buffer allocation in st_renderbuffer_alloc_storage()

If the gallium driver doesn't support PIPE_FORMAT_R16G16B16A16_SNORM
the call to st_choose_renderbuffer_format() would fail and we'd generate
an GL_OUT_OF_MEMORY error.  We'd never get to the subsequent code that
handles software/malloc-based renderbuffers.

Add a special-case check for PIPE_FORMAT_R16G16B16A16_SNORM which is used
for software-based accum buffers.  This could be fixed in other ways but
it would be a much larger patch.  st_renderbuffer_alloc_storage() could
be reorganized in the future.

This fixes accum buffer allocation for the svga driver.

Note: This is a candidate for the 7.11 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
13 years agointel: Refactor intel_miptree_copy_teximage()
Chad Versace [Thu, 17 Nov 2011 06:26:38 +0000 (22:26 -0800)]
intel: Refactor intel_miptree_copy_teximage()

Extract the body of the inner loop into a new function,
intel_miptree_copy_slice().

This is in preparation for adding support for separate stencil and HiZ to
intel_miptree_copy_teximage(). When copying a slice of a depthstencil
miptree that uses separate stencil, we will also need to copy the
corresponding slice of the stencil miptree. The easiest way to do this
will be to call intel_miptree_copy_slice() recursively. Analogous
reasoning applies to copying a slice of a depth miptree with HiZ.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Refactor intel_mipmap_level offsets
Chad Versace [Mon, 14 Nov 2011 16:56:26 +0000 (08:56 -0800)]
intel: Refactor intel_mipmap_level offsets

Add a new field, intel_mipmap_level::slice, and move the offset fields
into it. Also add some much needed documentation for these fields.

Before this patch, a separate array was allocated for the
intel_mipmap_level::{x,y}_offsets.  This was just silly; it incurred an
extra call to malloc and diminished memory locality.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Replace intel_renderbuffer::region with a miptree [v3]
Chad Versace [Wed, 16 Nov 2011 22:04:25 +0000 (14:04 -0800)]
intel: Replace intel_renderbuffer::region with a miptree [v3]

Essentially, this patch just globally substitutes `irb->region` with
`irb->mt->region` and then does some minor cleanups to avoid segfaults
and other problems.

This is in preparation for
  1. Fixing scatter/gather for mipmapped separate stencil textures.
  2. Supporting HiZ for mipmapped depth textures.

As a nice benefit, this lays down some preliminary groundwork for easily
texturing from any renderbuffer, even those of the window system.

A future commit will replace intel_mipmap_tree::hiz_region with a miptree.

v2:
   - Return early in intel_process_dri2_buffer_*() if region allocation
     fails.
   - Fix double semicolon.
   - Fix miptree reference leaks in the following functions:
       intel_process_dri2_buffer_with_separate_stencil()
       intel_image_target_renderbuffer_storage()

v3:
   - [anholt] Fix check for hiz allocation failure. Replace
     ``if (!irb->mt)` with ``if(!irb->mt->hiz_region)``.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Define intel_miptree_create_for_renderbuffer()
Chad Versace [Mon, 14 Nov 2011 07:04:24 +0000 (23:04 -0800)]
intel: Define intel_miptree_create_for_renderbuffer()

This function creates a miptree that is suitable as storage for
a non-texture renderbuffer.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Move inline functions from intel_fbo.h to .c
Chad Versace [Mon, 14 Nov 2011 07:06:17 +0000 (23:06 -0800)]
intel: Move inline functions from intel_fbo.h to .c

Move the following inline functions:
    intel_get_rb_region
    intel_framebuffer_has_hiz

A future commit will replace the renderbuffer's region with a miptree.
This small refactor will eliminate the need for intel_fbo.h to include
intel_mipmap_tree.h on that commit. I'd like to avoid the situation where
each header transitively includes every other header.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Kill intel_framebuffer_get_hiz_region()
Chad Versace [Mon, 14 Nov 2011 07:05:47 +0000 (23:05 -0800)]
intel: Kill intel_framebuffer_get_hiz_region()

The only user of intel_framebuffer_get_hiz_region() was
intel_framebuffer_has_hiz(). So I folded the body of the former into the
latter.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Temporarily disable HiZ for textures
Chad Versace [Mon, 14 Nov 2011 07:02:04 +0000 (23:02 -0800)]
intel: Temporarily disable HiZ for textures

A great refactor thrashing begins after this commit for HiZ and separate
stencil.  Removing code for texture HiZ will make that refactoring easier,
because then we don't have to maintain that code during the refactor.

To disable HiZ for textures, I've removed the hook in
intel_update_wrapper() that allocates a HiZ buffer when attaching a depth
texture to a framebuffer.

HiZ was broken for textures anyway, so there's no regression here.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Always gather stencil buffer in intel_map_renderbuffer_separate_s8z24()
Chad Versace [Thu, 17 Nov 2011 00:02:39 +0000 (16:02 -0800)]
intel: Always gather stencil buffer in intel_map_renderbuffer_separate_s8z24()

The function gathered the stencil buffer into the depth buffer only when
the map mode contained the read bit. But we must do the gather even if the
map mode is write-only. If we do not, then, when the depth buffer's stencil
bits are scattered into the stencil buffer by intel_unmap_renderbuffer(),
some of the scattered stencil bits would be invalid.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Fix swrast_render_start() for depthstencil buffers with separate stencil
Chad Versace [Mon, 14 Nov 2011 01:45:51 +0000 (17:45 -0800)]
intel: Fix swrast_render_start() for depthstencil buffers with separate stencil

1. Don't map the depthstencil buffer twice

   Place a guard in intel_renderbuffer_map() to prevent a renderbuffer
   from being mapped twice. This happened if a single buffer was attached to
   the framebuffer's depth and stencil attachment points.  (Interestingly,
   because intel_map_renderbuffer_gtt() is idempotent, the double mapping did
   not cause bugs for depthstencil buffers *without* separate stencil).

2. Stop overriding gl_framebuffer::_DepthBuffer,_StencilBuffer

   Normally, if a depthstencil buffer is attached to the framebuffer's
   depth attachment point, then _mesa_update_framebuffer() installs
   a wrapper depth renderbuffer at gl_framebuffer::_DepthBuffer. Ditto for
   the stencil attachment point and gl_framebuffer::_StencilBuffer

   A depthstencil intel_renderbuffer with separate stencil contains hidden
   depth and stencil renderbuffers, which are the *real* renderbuffers. In
   order to force swrast to work, we were installing, in
   brw_update_draw_buffer(), the hidden renderbuffers at
   gl_framebuffer::_DepthBuffer and _StencilBuffer, thus overriding the
   behavior of _mesa_update_framebuffer().  However, now that
   intel_renderbuffer_map() is implemented with MapRenderbuffer(),
   overriding _mesa_update_framebuffer's introduces bugs.  This patch
   removes the override code.

Fixes several Piglit tests on gen7.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agointel: Don't use special stencil span accessors
Chad Versace [Thu, 17 Nov 2011 06:10:11 +0000 (22:10 -0800)]
intel: Don't use special stencil span accessors

The special stencil span accessors, as set by intel_span_init_funcs.
perform software W detiling. Since intel_renderbuffer_map() now uses
MapRenderbuffer, rb->Data points to an *untiled* stencil buffer.

Fixes several Piglit tests on gen7.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
13 years agor600g: handle PIPE_SHADER_CAP_OUTPUT_READ
Vadim Girlin [Tue, 15 Nov 2011 15:57:22 +0000 (19:57 +0400)]
r600g: handle PIPE_SHADER_CAP_OUTPUT_READ

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
13 years agost/mesa: use PIPE_SHADER_CAP_OUTPUT_READ
Vadim Girlin [Tue, 15 Nov 2011 15:57:21 +0000 (19:57 +0400)]
st/mesa: use PIPE_SHADER_CAP_OUTPUT_READ

Don't replace outputs with temps when the driver supports reading outputs.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
13 years agogallium: add PIPE_SHADER_CAP_OUTPUT_READ
Vadim Girlin [Tue, 15 Nov 2011 15:57:20 +0000 (19:57 +0400)]
gallium: add PIPE_SHADER_CAP_OUTPUT_READ

It's intended to indicate whether the driver/hardware supports reading
of the values written into shader outputs.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
13 years agoswrast: fix unmatched span->array->ChanType
Yuanhan Liu [Mon, 21 Nov 2011 08:31:58 +0000 (16:31 +0800)]
swrast: fix unmatched span->array->ChanType

texture_combine converts the result rgba to CHAN_TYPE from FLOAT. At the
same time, make sure the span->array->ChanType is changed, too.

v2: pick a nicer comment from Brian

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoswrast: simplify the prototype of function texture_combine
Yuanhan Liu [Fri, 18 Nov 2011 01:49:51 +0000 (09:49 +0800)]
swrast: simplify the prototype of function texture_combine

Parameter n and rgbaChan are both from structure span, thus using span
as paramter to simplify the prototype. Function texture_combine is only
used by _swrast_texture_span, so I guess it's safe to do so.

This patch is mainly for the next patch.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agor300g: set max_index to 0xffffff if there are no per-vertex attribs
Marek Olšák [Sun, 20 Nov 2011 18:22:47 +0000 (19:22 +0100)]
r300g: set max_index to 0xffffff if there are no per-vertex attribs

13 years agou_vbuf_mgr: correctly compute max vertex count from hw buffers
Marek Olšák [Sun, 20 Nov 2011 02:58:34 +0000 (03:58 +0100)]
u_vbuf_mgr: correctly compute max vertex count from hw buffers

And update r300g.

This is different from util_draw_max_index in how it obtains vertex elements
and that it doesn't have to call util_format_description due to additional
precomputed data in vertex elements.

13 years agou_vbuf_mgr: correctly obtain min/max_index for uploads and translate
Marek Olšák [Sun, 20 Nov 2011 02:50:36 +0000 (03:50 +0100)]
u_vbuf_mgr: correctly obtain min/max_index for uploads and translate

This forks vbo_get_minmax_index. We need to know the index range when
translating non-native vertices into native ones. There is no other way
around it.

13 years agor600g: use u_vbuf_mgr to set/get the index buffer
Marek Olšák [Sun, 20 Nov 2011 02:47:29 +0000 (03:47 +0100)]
r600g: use u_vbuf_mgr to set/get the index buffer

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