Compare commits

..

296 Commits

Author SHA1 Message Date
Ian Romanick
c1f4867c89 docs: Add 8.0.4 release notes
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2012-07-10 08:45:16 -07:00
Ian Romanick
7c2225b026 mesa: Bump version number to 8.0.4
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2012-07-10 08:28:32 -07:00
Marek Olšák
827c99e1a0 st/mesa: don't do srgb->linear conversion in decompress_with_blit
This fixes piglit/getteximage-formats on r600g.

NOTE: This is a candidate for stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 5e7e7d96b3)
2012-07-06 10:09:00 -07:00
Thomas Gstädtner
0d38468098 gallium/targets: pass ldflags parameter to MKLIB
Without passing the -ldflags parameter before $(LDFLAGS) in some cases
flags will be passed to MKLIB which it does not understand.
This might be -m64, -m32 or similar.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Thomas Gstädtner <thomas@gstaedtner.net>
Signed-off-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 93594f38be)
2012-07-06 10:09:00 -07:00
Vinson Lee
fc3d2c4623 st/mesa: Fix uninitialized members in glsl_to_tgsi_visitor constructor.
Fixes uninitialized member defects reported by Coverity.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 70d038e46e)
2012-07-06 10:09:00 -07:00
Vadim Girlin
fe5541f64c r600g: check gpr count limit
This should help to prevent gpu lockups.
See https://bugs.freedesktop.org/show_bug.cgi?id=48472

NOTE: This is a candidate for the stable branches.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 783e4da72a)
2012-07-06 10:09:00 -07:00
Brian Paul
1ce1a4526f st/mesa: fix max_offset computation for base vertex
Add the maximum base vertex offset to max_index for computing the
buffer size.  Fixes a failed assertion in the u_upload_mgr.c code with
the VMware svga driver.

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

v2: incorporate Marek's suggestions.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
(cherry picked from commit 299c9052e8)
2012-07-06 10:09:00 -07:00
Kenneth Graunke
e0e1ca353b glsl: Don't trust loop analysis in the presence of function calls.
Function calls may have side effects that alter variables used inside
the loop.  In the fragment shader, they may even terminate the shader.
This means our analysis about loop-constant or induction variables may
be completely wrong.

In general it's impossible to determine whether they actually do or not
(due to the halting problem), so we'd need to perform conservative
static analysis.  For now, it's not worth the complexity: most functions
will be inlined, at which point we can unroll them successfully.

Fixes Piglit tests:
- shaders/glsl-fs-unroll-out-param
- shaders/glsl-fs-unroll-side-effect

NOTE: This is a candidate for release branches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 0405bd08ca)
2012-07-06 10:09:00 -07:00
Brian Paul
04f7c32f78 draw: fix missing immediates bug in polygon stipple code
The function that counts the number of TGSI immediates also needs to
emit the immediates.  This fixes assorted failures when using polygon
stipple with fragment shaders that have their own immediates.

NOTE: This is a candidate for the 8.0 branch.
(cherry picked from commit 7f16246ace)
2012-07-06 10:09:00 -07:00
Brian Paul
da8d65fde4 st/mesa: fix mipmap image size computation w.r.t. texture arrays
The image height or depth is the array_size for array textures.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=47742

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
(cherry picked from commit 318669f196)
2012-07-06 10:08:59 -07:00
Brian Paul
57a273d89b st/mesa: add null pointer check in st_texture_image_map()
If we failed to allocate a memory resource for the texture we'd crash
when we tried to map it.  Now we propogate the NULL back up to the
texstore code and generate GL_OUT_OF_MEMORY.

Fixes a crash with the upcoming piglit max-texture-size test.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit 03f8a97d71)
2012-07-06 10:08:59 -07:00
Brian Paul
099bc3aaea st/mesa: use private pipe_sampler_view in decompress_with_blit()
Similar to the previous commit.  Also fix incorrect setting of the
sampler view's state after it's created.  We need to specify the
first/last_level fields in the template instead.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
(cherry picked from commit 0315cb9f8f)
2012-07-06 10:08:59 -07:00
Brian Paul
3539914e49 st/mesa: don't set PIPE_BIND_DISPLAY_TARGET for user-created renderbuffers
The st_renderbuffer_alloc_storage() function is used to allocate both
window-system buffers and user-created renderbuffers.  The later kind
are never directly displayed so don't set PIPE_BIND_DISPLAY_TARGET for
those surfaces.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
(cherry picked from commit 5a70e12fc0)
2012-07-06 10:08:59 -07:00
José Fonseca
de8bb6a59b draw: Ensure that prepare is always run after LLVM garbagge collection.
Should avoid dangling pointer derreference with

  glean --run results --overwrite --quick --tests texSwizzle

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 07635a4799)
2012-07-06 10:08:59 -07:00
Brian Paul
646ac02462 svga: reset vertex buffer offset in svga_release_user_upl_buffers()
This function releases the buffer that contains user-space vertex data.
The buffer_offset field points into that buffer.  So reset the
buffer_offset to zero when we release the buffer so that subsequent
draws don't inadvertantly get a bad offset.

Fixes error messages / failed assertions (in the draw module's bounds/size
checking code) when running piglit's polygon-mode test.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit 04341e51ce)
2012-07-06 10:08:59 -07:00
Brian Paul
dad7547b98 svga: move svga_texture() casts/calls in svga_surface_copy()
To fix failed assertions when calling glCopyBufferSubData().

svga_texture() asserts that the resource is a texture.  Simply move the
calls to svga_texture() after the code that handles non-texture copies
so that we don't call it with non-texture resources.

Fixes glean bufferObject failure.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit 7f2e12812a)
2012-07-06 10:08:58 -07:00
Brian Paul
2bf8f39cc8 st/mesa: copy num_immediates field when copying the immediates array
Two assignments to num_immediates were missing in
get_pixel_transfer_visitor() and get_bitmap_visitor().
The uninitialized value led to valgrind errors and crashes in some
cases.

Added new assertions to catch future problems in this area.  Also
changed num_immediates to unsigned to avoid signed/unsigned
comparison warnings.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit fdae0eaf22)
2012-07-06 10:08:58 -07:00
Brian Paul
5c65bcd259 st/mesa: add fallback pipe formats for (compressed) R, RG formats
If we don't find an exact PIPE_FORMAT_x for a GL_(COMPRESSED)_RED/RG format,
try uncompressed formats.  We were already doing this for the RGB(A) formats.

Fixes piglit arb_texture_compression-internal-format-query test.

NOTE: This is a candidate for the stable branches.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit 75f37ddba7)
2012-07-06 10:08:57 -07:00
Stéphane Marchesin
c60a83adc2 i915g: Don't avoid flushing when we have a pending fence.
Otherwise the fence will never arrive.
Also check for a NULL i915->batch.

NOTE: This is a candidate for the 8.0 branch.
(cherry picked from commit 32b07bb149)
2012-07-06 10:08:56 -07:00
Stéphane Marchesin
db555c5d59 i915g: Don't invert signalled/unsignalled fences
NOTE: This is a candidate for the 8.0 branch.
(cherry picked from commit 2b4afdba05)
2012-07-06 10:08:56 -07:00
Brian Paul
f1423b1c20 svga: change PIPE_CAPF_MAX_TEXTURE_LOD_BIAS from 16.0 to 15.0
The legal range for the device is apparently [-16.0, +15.0].
Limiting the range to [-15, +15] fixes piglit's lodbias test.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit a9eda41539)
2012-07-06 10:08:56 -07:00
Brian Paul
21d77c51c1 svga: fix min/max lod clamping
The interaction between the mipmap lod min/max limits and the texture
base/max level limits is kind of tricky.  Changing the base level
didn't work as expected before.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit fd890873b2)
2012-07-06 10:08:56 -07:00
Brian Paul
fc7d43ee9a svga: add 0.5 in float->int conversion of sample min/max lod
This makes lod clamping more consistent with other drivers.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit 5abcd198b8)
2012-07-06 10:08:56 -07:00
Brian Paul
ed8fcc0c82 st/mesa: pass GL_MAP_INVALIDATE_RANGE_BIT to gallium drivers
when mapping renderbuffers or texture images.

NOTE: This is a candidate for the 8.0 branch.
(cherry picked from commit 84c7c14697)
2012-07-06 10:08:56 -07:00
Ian Romanick
ed1da7e503 glsl: Fix pi/2 constant in acos built-in function
In single precision, 1.5707963 becomes 1.5707962513 which is too
small.  However, 1.5707964 becomes 1.5707963705 which is just right.
The value 1.5707964 is already used in asin.ir.

NOTE: This is a candidate for stable release branches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Olivier Galibert <galibert@pobox.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
(cherry picked from commit 4bfdc83135)

Conflicts:

	src/glsl/builtins/ir/acos.ir
2012-07-06 10:03:54 -07:00
Antoine Labour
74f21adbb7 mesa: Free uniforms correclty.
This is an array of uniforms, not a single one.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>

NOTE: This is a candidate for the 8.0 branch.
(cherry picked from commit e2e9b4b10f)
2012-07-06 10:01:50 -07:00
Antoine Labour
09c746f2dc meta: Cleanup the resources we allocate.
When we have multiple shared contexts, and one of them is
long-running, this will lead to never freeing those resources
since they are shared. Instead, free them right away on context
destruction since we know the other context isn't using them.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>

NOTE: This is a candidate for the 8.0 branch.
(cherry picked from commit 53feb8ecdc)
2012-07-06 10:01:33 -07:00
Stéphane Marchesin
ab33bc8c7b glx: Handle a null reply in QueryVersion.
Works around crashes when X connections break.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>

NOTE: This is a candidate for the 8.0 branch.
(cherry picked from commit 0256edd709)
2012-07-06 10:00:46 -07:00
Kenneth Graunke
1edeb2cec1 glsl: Hook up loop_variable_state destructor to plug a memory leak.
While ~loop_state() is already freeing the loop_variable_state objects
via ralloc_free(this->mem_ctx), the ~loop_variable_state() destructor
was never getting called, so the hash table inside loop_variable_state
was never getting destroyed.

Fixes a memory leak in any shader with loops.

NOTE: This is a candidate for stable release branches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 3603fdcebf)
2012-07-06 10:00:30 -07:00
Kenneth Graunke
afaf5b59e4 i965/fs: Fix user-defined FS outputs with less than four components.
OpenGL allows you to declare user-defined fragment shader outputs with
less than four components:

    out ivec2 color;

This makes sense if you're rendering to an RG format render target.

Previously, we assumed that all color outputs had four components (like
the built-in gl_FragColor/gl_FragData variables).  This caused us to
call emit_color_write for invalid indices, incrementing the output
virtual GRF's reg_offset beyond the size of the register.

This caused cascading failures: split_virtual_grfs would allocate new
size-1 registers based on the virtual GRF size, but then proceed to
rewrite the out-of-bounds accesses assuming that it had allocated enough
new (contiguously numbered) registers.  This resulted in instructions
that accessed size-1 GRFs which register numbers beyond
virtual_grf_next (i.e. registers that were never allocated).

Finally, this manifested as live variable analysis and instruction
scheduling accessing their temporary array with an out of bounds index
(as they're all sized based on virtual_grf_next), and the program would
segfault.

It looks like the hardware's Render Target Write message requires you to
send four components, even for RT formats such as RG or RGB.  This patch
continues to use all four MRFs, but doesn't bother to fill any data for
the last few, which should be unused.

+2 oglconforms.

NOTE: This is a candidate for stable release branches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 2f18698220)

Conflicts:

	src/mesa/drivers/dri/i965/brw_fs.h

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2012-07-06 09:59:36 -07:00
Kenneth Graunke
1fc9b5a213 i965/vs: Fix texelFetchOffset() on pre-Gen7.
Commit 4650aea7a5 fixed texelFetchOffset()
on Ivybridge, but didn't update the Ironlake/Sandybridge code.

+18 piglits on Sandybridge.

NOTE: This and 4650aea7a5 are both candidates for stable branches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit cb18472eca)
2012-07-06 09:57:14 -07:00
Eric Anholt
9b38691927 i965/vs: Fix texelFetchOffset()
It appears that when using 'ld' with the offset bits, address bounds
checking happens before the offset is applied, so parts of the drawing
in piglit texelFetchOffset() with a negative texcoord go black.
(cherry picked from commit 4650aea7a5)
2012-07-06 09:57:07 -07:00
Kenneth Graunke
6f1218385a i965/fs: Fix texelFetchOffset() on pre-Gen7.
Commit f41ecade7b fixed texelFetchOffset()
on Ivybridge, but didn't update the Ironlake/Sandybridge code.

+15 piglits on Sandybridge.

NOTE: This and f41ecade7b are both candidates for stable branches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 217b62bf00)
2012-07-06 09:54:09 -07:00
Kenneth Graunke
5c2f9828e0 meta: Fix GL_RENDERBUFFER binding in decompress_texture_image().
This isn't saved/restored by _mesa_meta_begin, so we need to do it
manually (like we do for the read/draw framebuffers).  Additionally,
we neglected to re-bind before the glRenderbufferStorage call.

+13 oglconforms.

NOTE: This is a candidate for stable release branches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 7fde071f04)
2012-07-06 09:53:48 -07:00
Kenneth Graunke
a03d5e6a88 mesa: Unbind ARB_transform_feedback2 binding points on Delete too.
DeleteBuffer needs to unbind from these binding points as well, based on
the same rationale as the previous patch.

+51 oglconforms (together with the last patch).

NOTE: This is a candidate for stable release branches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 3edd2ba22b)
2012-07-06 09:53:15 -07:00
Kenneth Graunke
5fde348eb8 mesa: Support BindBuffer{Base,Offset,Range} with a buffer of 0.
_mesa_lookup_bufferobj returns NULL for 0, which caused us to say
"there's no such buffer object" and raise an error, rather than
correctly binding the shared NullBufferObj.

Now you can unbind your buffers.

NOTE: This is a candidate for stable release branches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 05b086ce93)
2012-07-06 09:52:30 -07:00
Kenneth Graunke
a8fed44e9e mesa: Unbind ARB_copy_buffer and transform feedback buffers on delete.
According to the GL 3.1 spec, section 2.9 ("Buffer Objects"):
"If a buffer object is deleted while it is bound, all bindings to that
 object in the current context (i.e. in the thread that called
 DeleteBuffers) are reset to zero."

The code already checked for a number of cases, but neglected these
newer binding points.

+21 oglconforms.

NOTE: This is a candidate for stable release branches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit cb8ed93dd0)
2012-07-06 09:51:26 -07:00
Kenneth Graunke
0f7dffae69 glsl/builtins: Fix textureGrad() for Array samplers.
We were incorrectly assuming that the coordinate's dimensionality is
equal to the gradient's dimensionality.  For array types, the coordinate
has one more component.

Fixes 12 subcases of oglconform's glsl-bif-tex-grad test.

NOTE: This is a candidate for stable release branches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 25edfbfccf)
2012-07-06 09:50:54 -07:00
Kenneth Graunke
7a34e98b61 mesa: Restore depth texture state on glPopAttrib(GL_TEXTURE_BIT).
According to Table 6.17 in the GL 2.1 specification, DEPTH_TEXTURE_MODE,
TEXTURE_COMPARE_MODE, and TEXTURE_COMPARE_FUNC need to be restored on
glPopAttrib(GL_TEXTURE_BIT).

Makes a number of oglconform tests happier.

v2: Make restoration conditional on the ARB_shadow and ARB_depth_texture
    extensions, as suggested by Brian.  I'm not sure that any
    implementations still remain that don't support those, but why not?

NOTE: This is a candidate for stable release branches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 608c3d2083)
2012-07-06 09:50:05 -07:00
Ian Romanick
39a0b79c6f glsl: Remove spurious printf messages
These look like debug messages from the switch-statement development.

NOTE: This is a candidate for the 8.0 release branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit adfe531841)
2012-07-06 09:49:24 -07:00
Kenneth Graunke
5c8f5e9af0 ralloc: Fix ralloc_parent() of memory allocated out of the NULL context.
If an object is allocated out of the NULL context, info->parent will be
NULL.  Using the PTR_FROM_HEADER macro would be incorrect: it would say
that ralloc_parent(ralloc_context(NULL)) == sizeof(ralloc_header).

Fixes the new "null_parent" unit test.

NOTE: This is a candidate for the 7.9, 7.10, 7.11, and 8.0 branches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 1559b2e2d7)
2012-07-06 09:49:05 -07:00
Kurt Roeckx
a72fdfed7b i830: Fix crash for GL_STENCIL_TEST in i830Enable()
commit 87f12bb2d9 tried to fix rb->mt
being NULL, but change this case wrong.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit f92b2e5e90)
2012-07-06 09:48:11 -07:00
Lukas Rössler
ba45b6deea glu: fix two Clang warnings
This patch removes two Clang warnings in GLU:

The first one seems to be an actual bug in mapdesc.cc: Clang complains
that sizeof(dest) will return the size of REAL*[MAXCOORDS], instead of
the intended REAL[MAXCOORDS][MAXCOORDS]. The second one is just
cosmetic because Clang doesn't like extra parentheses.

NOTE: This is a candidate for the 8.0 branch

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 6178b653c7)
2012-07-06 09:47:42 -07:00
Dylan Noblesmith
04c35a5dff mesa: require GL_MAX_SAMPLES >= 4 for GL 3.0
As noted in commit be4e46b21a,
this was missing before.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 8e90913e9f)
2012-07-06 09:46:03 -07:00
Kenneth Graunke
3bcddd5e89 glsl: Remove unused ir_loop_jump::loop pointer.
Commit 0c005bd7 intended to make ir_loop_jump::mode public, but also
accidentally added a new pointer to the enclosing loop.  Furthermore, it
tried to initialize the new field by adding "this->loop = loop;" to the
constructor, but since there is no loop parameter, this only initialized
the field to itself---so it will likely be a garbage pointer.

A lot of code, such as lower_jumps, allocates new loop jumps without
setting this field appropriately, so any uses would probably just crash.

Thankfully, there were none, so we can just delete the field.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51574
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit b1802a2115)
2012-07-03 15:32:16 -07:00
Ian Romanick
313d48a110 glx/tests: Fix off-by-one error in allocating extension string buffer
NOTE: This is a candidate for the 8.0 release branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50621
Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=418161
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: Markus Oehme <oehme.markus@gmx.de>
(cherry picked from commit 5fb178ee43)
2012-07-03 12:39:22 -07:00
Brian Paul
076805c9c2 mesa: fix missing return value in getteximage_error_check() 2012-07-03 10:48:33 -06:00
Brian Paul
d715d3f4a8 mesa: add missing GL_UNSIGNED_INT_10F_11F_11F_REV case
in _mesa_error_check_format_and_type().

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=45967
(cherry picked from commit df1cd55ebf)
2012-06-20 12:51:28 -07:00
Brian Paul
af47c324aa mesa: new _mesa_error_check_format_and_type() function
This replaces the _mesa_is_legal_format_and_type() function.

According to the spec, some invalid format/type combinations to
glDrawPixels, ReadPixels and glTexImage should generate
GL_INVALID_ENUM but others should generate GL_INVALID_OPERATION.

With the old function we didn't make that distinction and generated
GL_INVALID_ENUM errors instead of GL_INVALID_OPERATION.  The new
function returns one of those errors or GL_NO_ERROR.

This will also let us remove some redundant format/type checks in
follow-on commit.

v2: add more checks for ARB_texture_rgb10_a2ui at the top of
_mesa_error_check_format_and_type() per Ian.

Signed-off-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 627b435dfe)
2012-06-20 12:51:28 -07:00
Marek Olšák
1af70e475f mesa: allow exposing GL3 without EXT_texture_integer
Strictly speaking, it's not legal to expose EXT_texture_integer without
EXT_gpu_shader4. It might be even dangerous (apps can assume EXT_gpu_shader4
is available without checking for it).

The check in compute_version is removed as well, because that's already
covered by GLSLVersion >= 130.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 3363e87d7d)
2012-06-20 12:51:28 -07:00
Kenneth Graunke
1f4f86e951 i965: Fix brw_swap_cmod() for LE/GE comparisons.
The idea here is to rewrite comparisons like 2 >= x with x <= 2; we want
to simply exchange arguments, not negate the condition.  If equality was
part of the original comparison, it should remain part of the swapped
version.

This is the true cause of bug #50298.  It didn't manifest itself on
Sandybridge because we embed the conditional modifier in the IF
instruction rather than emitting a CMP.  All other platforms use CMP.

It also didn't manifest itself on the master branch because commit
be5f27a84d ("glsl: Refine the loop instruction counting.") papered over
the problem.

NOTE: This is a candidate for stable release branches.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50298
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 5b83bdc154)
2012-06-18 15:51:40 -07:00
Brian Paul
6dd1270008 svga: fix synchronization bug between sampler views and surfaces
This fixes a bug where a sampler view was using stale texture/resource
data when the texture was modified through a surface (render to texture).
Bumping the texture and layer ages triggers sampler view revalidation.

Fixes piglit fbo-blit failure.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit 8ae93c68ea)
2012-06-18 13:26:07 -06:00
Brian Paul
29c67f9203 st/mesa: fix glDrawPixels(GL_DEPTH_COMPONENT) color output
When drawing a depth image the fragment shader also needs to emit the
current raster color.

The new piglit drawpix-z test exercises this.

NOTE: This is a candiate for the 8.0 branch.
(cherry picked from commit f677954e07)
2012-06-18 13:24:23 -06:00
Brian Paul
29c4e92b2c draw: fix primitive restart bug by using the index buffer offset
The code which scans the index buffer for restart indexes wasn't adding
the index buffer offset so we were always starting at offset=0.  The
offset is usually zero so it wasn't noticed before.

Fixes a failure in the piglit primitive-restart test when testing
vertex data + index data in a single VBO.

NOTE: This is a candidate for the 8.0 branch.
(cherry picked from commit 1609efb418)
2012-06-18 10:33:38 -06:00
Vadim Girlin
26f7f8076d st/mesa: set stObj->lastLevel in guess_and_alloc_texture
Fixes lockups/asserts with depthstencil-render-miplevels tests and r600g.
Should also fix https://bugs.freedesktop.org/show_bug.cgi?id=50033

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit c91b4edff9)
2012-06-18 10:33:37 -06:00
Brian Paul
dc8134fe98 mesa: fix Z32_FLOAT -> uint conversion functions
The IROUND converted all arguments to 0 or 1.  That's not what we wanted.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit 31d59c78f0)
2012-06-18 10:33:37 -06:00
Andreas Betz
a211a140a6 vega: fix 565 color unpacking bug
NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 9d6e908f14)
2012-06-18 10:33:37 -06:00
José Fonseca
7fd94900e0 mesa: Avoid void * arithmetic.
Should fix MSVC build.
(cherry picked from commit 3409118371)
2012-06-18 10:33:37 -06:00
Christoph Bumiller
e902faa18a nv50: handle NEG,ABS modifiers for short RCP encoding 2012-06-14 23:12:20 +02:00
Kenneth Graunke
cb70af5c94 mesa: Check for a negative "size" parameter in glCopyBufferSubData().
From the GL_ARB_copy_buffer spec:
"An INVALID_VALUE error is generated if any of readoffset, writeoffset,
 or size are negative [...]"

Fixes oglconform's copybuffer/negative.CNNegativeValues test.

NOTE: This is a candidate for stable release branches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit a75e704326)
2012-06-11 13:38:19 -07:00
Brian Paul
3d657b14b4 docs: add link to 8.0.3 release notes 2012-05-21 09:26:39 -06:00
Paul Seidler
84e74ca275 tests: include mesa headers
else they will fail for fresh installs

Signed-off-by: Brian Paul <brianp@vmware.com>
2012-05-21 08:42:52 -06:00
Ian Romanick
44f550ef90 docs: Add 8.0.3 release md5sums
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2012-05-18 16:17:01 -07:00
Ian Romanick
1659d87afe docs: Add 8.0.3 release notes
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2012-05-18 16:11:34 -07:00
Ian Romanick
60dffb92de mesa: Bump version number to 8.0.3
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2012-05-18 16:08:35 -07:00
Eric Anholt
b5b65af5fa mesa: Check for framebuffer completeness before looking at the rb.
Otherwise, an incomplete framebuffer could have a NULL
_ColorReadBuffer and we'd deref that.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 5a827d9a2b)
2012-05-18 16:08:34 -07:00
Eric Anholt
e0e8f1efad glsl: Fix assertion failure on handling switch on uint expressions.
Fixes piglit glsl-1.30/execution/switch/fs-uint.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 9c4e9ce051)
2012-05-18 16:08:34 -07:00
Eric Anholt
91874c3252 glsl: Reject non-scalar switch expressions.
The comment quotes spec saying that only scalar integers are allowed,
but we only checked for integer.

Fixes piglit switch-expression-const-ivec2.vert

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit bbbc7c7d56)
2012-05-18 16:08:34 -07:00
Eric Anholt
2d105870c9 glsl: Let the constructor figure out the types of switch-related expressions.
I noticed this while unindenting the code.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 5d6ea16dfe)
2012-05-18 16:08:34 -07:00
Eric Anholt
912acd045c glsl: Fix indentation of switch code.
I managed to completely trash it in 22d81f15.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 5462f3679a)
2012-05-18 16:08:34 -07:00
Eric Anholt
1f90817e3c i965/vs: Fix up swizzle for dereference_array of matrices.
Fixes assertion failure in piglit:
vs-mat2-struct-assignment.shader_test
vs-mat2-array-assignment.shader_test

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit aa02884c4f)
2012-05-18 16:08:34 -07:00
Eric Anholt
1974502223 mesa: Throw error on glGetActiveUniform inside Begin/End.
Fixes piglit GL_ARB_shader_objeccts/getactiveuniform-beginend.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit ef691885c9)
2012-05-18 16:08:34 -07:00
Brian Paul
0bf439e5da mesa: fix glMaterial / dlist bug
When glColorMaterial() is used to latch glColor commands to a material
attribute, glMaterial calls to change that material should become no-ops.
This failed to work properly when the glMaterial call was inside a
display list.

This removes the Material function from the vbo_attrib_tmp.h template
file.  We have separate/different implementations for the "save" and
"exec" cases now.

NOTE: This is a candidate for the 8.0 branch.
(cherry picked from commit 1bc16bf98a)
2012-05-18 16:08:34 -07:00
Brian Paul
d28e968edb mesa: fix/add error check in _mesa_ColorMaterial()
_mesa_material_bitmask() will record a GL error and return 0 if
face or mode are illegal.  Return early in that case.

NOTE: This is a candidate for the 8.0 branch.
(cherry picked from commit f272490546)
2012-05-18 16:08:34 -07:00
Kenneth Graunke
9f67d73830 glsl: Fix broken constant expression handling for <, <=, >, and >=.
We were looping over all the vector components, but only dealing with
the first one.  This was masked by the fact that constant expression
handling on built-ins went through custom code for the lessThan()
/function/ rather than the ir_binop_less expression operator.

NOTE: This is a candidate for all release branches.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Olivier Galibert <galibert@pobox.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit f72e9b2041)
2012-05-18 16:08:34 -07:00
Chad Versace
84f537e72b intel: Disable ARB_framebuffer_object in ES contexts
This patch removes ARB_framebuffer_object from the GLES1 and GLES2
extension lists in intel_extensions_es.c.

Fixes a crash in the Android browser on Ice Cream Sandwich.

The Android browser crashed because it did the following, which is legal
in GLES2 but not in ARB_framebuffer_object.
    glGenFramebuffers(1, &fb);
    glBindFramebuffer(GL_FRAMEBUFFER, fb);
    // render render render...
    glDeleteFramebuffers(1, &fb);
    // go do other stuff...
    glBindFramebuffer(GL_FRAMEBUFFER, fb);
    // This bind unexpectedly failed, and the app panics.

The semantics of glBindFramebuffer specified by ARB_framebuffer_object (a
desktop GL extension) and GLES2 specs are incompatible. The ideal solution
to fix this is to create separate API entry points for glBindFramebuffer,
one for GL and the other for GLES2. But, until that work is complete,
disabling ARB_framebuffer_object in GLES2 contexts safely fixes the problem.

Likewise, the semantics of glBindFramebuffer in ARB_framebuffer_object and
of glBindFramebufferOES in OES_framebuffer_object (a GLES1 extension) are
incompatible. Even though the functions have different names, the semantic
difference still results in a bug because both API calls are implemented
by a single function, _mesa_BindFramebufferEXT, which handles the semantic
difference incorrectly. Again, disabling ARB_framebuffer_object in GLES1
contexts safely fixes this problem.

According to the ARB_framebuffer_object spec, the extension is an
amalgamation of
    EXT_framebuffer_object
    EXT_framebuffer_blit
    EXT_packed_depth_stencil
    EXT_framebuffer_multisample
By disabling this extension, however, no functionality is removed from
GLES1 and GLES2 contexts because 1) the first three extensions are
explicitly enabled in Intel's ES extension lists and 2) no functionality
of the last extension is exposed in an ES context.

Note: This is a candidate for the 8.0 branch.
See-also: http://www.mail-archive.com/mesa-dev@lists.freedesktop.org/msg21006.html
CC: Charles Johnson <charles.f.johnson@intel.com>
CC: Sean Kelley <sean.v.kelley@intel.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit 1c0f5d8324)
2012-05-18 16:08:34 -07:00
Jordan Justen
3eaa27789d mesa: Add primitive restart support to glArrayElement
When primitive restart is enabled, and glArrayElement is called
with the restart index value, then call glPrimitiveRestartNV.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Brian Paul<brianp@vmware.com>
(cherry picked from commit 5795d3b5ae)
2012-05-18 16:08:34 -07:00
Vinson Lee
6e8c30304e mesa: Fix memory leak in generate_mipmap_compressed.
Fixes Coverity resource leak defect.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit b688700edc)
2012-05-18 16:08:34 -07:00
Han Shen(沈涵)
3e5f17b5f9 bin/mklib: remove '-m32' for arm linux
-m32 is not a valid option for ARM.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit b352d676e4)
2012-05-18 16:08:34 -07:00
Kenneth Graunke
6b9363a316 intel: Remove pointless software fallback for glBitmap on Gen6.
We already have a meta path below that works just fine; no apparent
regressions in oglconform.

NOTE: This is a candidate for the 8.0 branch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=46834
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit 3cd7bee48f)
2012-05-18 16:08:34 -07:00
Eric Anholt
4d9ff6af59 intel: Return success when asked to allocate a 0-width/height renderbuffer.
It seems silly that GL lets you allocate these given that they're
framebuffer attachment incomplete, but the webgl conformance tests
actually go looking to see if the getters on 0-width/height
depth/stencil renderbuffers return good values.  By failing out here,
they all got smashed to 0, which turned out to be correct for all the
getters they tested except for GL_RENDERBUFFER_INTERNAL_FORMAT.  Now,
by succeeding but not making a miptree, that one also returns the
expected value.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit b7406404ab)
2012-05-18 16:08:34 -07:00
Brian Paul
110111bc5b mesa: do more teximage error checking for generic compressed formats
When glTexImage or glCopyTexImage is called with internalFormat being a
generic compressed format (like GL_COMPRESSED_RGB) we need to do the same
error checks as for specific compressed formats.  In particular, check if
the texture target is compatible with the format.  None of the texture
compression formats we support so far work with GL_TEXTURE_1D, for example.

See also https://bugs.freedesktop.org/show_bug.cgi?id=49124

NOTE: This is a candidate for the 8.0 branch.
(cherry picked from commit a36581ccc0)
2012-05-18 16:08:34 -07:00
Brian Paul
2aaaa18853 st/mesa: no-op glCopyPixels if source region is out of bounds
If the source region for a glCopyPixels is completely outside the
source buffer bounds, no-op the copy.  Fixes a failed assertion.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
(cherry picked from commit 99ed0b2f9b)
2012-05-18 16:08:34 -07:00
Vinson Lee
7e824b728b ir_to_mesa: Fix uninitialized member in add_uniform_to_shader.
Fix uninitialized scalar field defect reported by Coverity.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 10ec14865a)
2012-05-18 16:08:34 -07:00
Chad Versace
fc65fc5035 main: Fix memory leak in _mesa_make_extension_string()
I forgot to free the string returned by strdup().

Note: This is a candidate for the stable branches.
CC: Johannes Obermayr <johannesobermayr@gmx.de>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit 36fef005b1)
2012-05-18 16:08:33 -07:00
Vinson Lee
c9088b5251 swrast: Fix memory leaks in blit_linear.
Fixes Coverity resource leak defects.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 431b458f24)
2012-05-18 16:08:33 -07:00
Vinson Lee
8537544be9 linker: Fix memory leak in count_uniform_size::visit_field.
Fixes a Coverity resource leak defect.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 4123d0b321)
2012-05-18 16:08:33 -07:00
Kenneth Graunke
b4693383bf i965: Avoid explicit accumulator operands in SIMD16 mode on Gen7.
According to the BSpec ISA volume's "Accumulator Register" section:

"[DevIVB] SIMD16 execution on dwords is not allowed when accumulator is
 explicit source or destination operand."

Fixes piglit tests:
- fs-multiply-const-ivec4
- fs-multiply-const-uvec4
- fs-multiply-ivec4-const
- fs-multiply-uvec4-const

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 01044fce6b)
2012-05-18 16:08:33 -07:00
Dave Airlie
5eb2e5bdc7 intel: fix TFP at 16-bpp
don't ask why I had to debug this.

tested to fix g-s and kwin at 16-bpp on Ironlake.

Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 7b6424143d)
2012-05-18 16:08:33 -07:00
Dave Airlie
ca8be6fe2b drisw: fix image stride calculation for 16-bit.
If you ran g-s in 16-bpp we'd do a bunch of memory corruption.

now it just misrenders for some other reasons.

applies to stable.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit d6c5ad52b2)
2012-05-18 16:08:33 -07:00
Dave Airlie
aa17a8b81e glx/drisw: avoid segfaults when we fail to get visual
piglit glx-tfp segfaults on llvmpipe when run vs a 16-bit radeon screen,

it now fails instead of segfaulting, much prettier.

Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 2c778375a1)
2012-05-18 16:08:33 -07:00
Vinson Lee
b304eca8df mesa: Fix memory leak in _mesa_get_uniform_location.
Fixes Coverity resource leak defect.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 0f3aa9f4bd)
2012-05-18 16:08:33 -07:00
Brian Paul
97bff96352 st/mesa: set MaxUnrollIterations = 255
The default was 32 for the EmitNoLoops=0 case.  This allows the oZone3D
soft shadows test to work properly with the vmware driver.  Jose reported
that SM3 supports up to 255 loop iterations.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit 20836c8185)
2012-05-18 16:08:33 -07:00
Brian Paul
9405567c28 glsl: propagate MaxUnrollIterations to the optimizer's loop unroller
Instead of the hard-coded value of 32.  Note that MaxUnrollIterations
defaults to 32 so there's no net change.  But the gallium state tracker
can override this.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 7feabfe23d)
2012-05-18 16:08:33 -07:00
Jeremy Huddleston
e69758260b darwin: Address a build failure on Leopard and earlier OS versions
<https://trac.macports.org/ticket/34499>

Regression-from: 51691f0767
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 27b821bc95)
2012-05-18 11:33:05 -07:00
Anuj Phogat
869c34527a intel: Fix a case when mapping large texture fails
This is a squash of:

    intel: Fix a case when mapping large texture fails

    This patch handles a case when mapping a large texture fails
    in drm_intel_gem_bo_map_gtt(). These changes avoid assertion
    failure later in the driver as reported in following bugs:

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

    Testing: No regressions in piglit quick.tests

    Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
    (cherry picked from commit cdcfd5d1d6)

and:

    intel: fix un-blanced map_refcount issue

    This is a regression introduced by commit cdcfd5, which forget to
    increase the map_refcount for successfully-mapped region. Thus caused a
    wrong non-blanced map_refcount.

    This would fix the regression found in the two following webglc testcase
    on Pineview platform:
       texture-npot.html
       gl-max-texture-dimensions.html

    Cc: Anuj Phogat <anuj.phogat@gmail.com>
    Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
    Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
    (cherry picked from commit 9cb777eb71)
2012-05-17 23:38:07 -07:00
Anuj Phogat
7e7f099108 mesa: Fix the cause of piglit test fbo-array failure
Handle the special case of glFramebufferTextureLayer() for which we pass
teximage = 0 internally in framebuffer_texture(). This patch makes failing
piglit test fbo-array, fbo-depth-array to pass.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=47126

V4: Removed the duplicated code.
Note: This is a candidate for the stable branches.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit cc5b0ffae0)
2012-05-17 22:13:49 -07:00
Kenneth Graunke
cc2413c889 drirc: Add force_glsl_extensions_warn workaround for Unigine Heaven.
Unfortunately, Unigine Heaven 3.0 still needs this.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 60218b604a)
2012-05-17 22:13:49 -07:00
Anuj Phogat
1ebdf22224 mesa: Fix valid texture target test in _mesa_GetTexLevelParameteriv()
_mesa_max_texture_levels() is also used to test valid texture target
in _mesa_GetTexLevelParameteriv(). GL_TEXTURE_CUBE_MAP is not allowed
as texture target in glGetTexLevelParameter(). So, this should throw
GL_INVALID_ENUM error.

Few other functions which use _mesa_max_texture_levels() like
getcompressedteximage_error_check() and getteximage_error_check()
also don't accept GL_TEXTURE_CUBE_MAP.

Above fix makes piglit fbo-cubemap test to fail. This is because of
incorrect texture target passed to _mesa_max_texture_levels() in
framebuffer_texture(). Fixing that as well

Note: This is a candidate for the stable branches

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit a9523af0e8)
2012-05-17 22:13:49 -07:00
Kurt Roeckx
a3f6e8f431 i915: Fix i830 polygon stipple from PBOs.
This is a direct port of the i915 patch in
a856da6324.

Fixes glean's pbo test.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41372
Reviewed-by: Eric Anholt <eric@anholt.net>
NOTE: This is a candidate for release branches.
(cherry picked from commit 489ac8e73a)
2012-05-17 22:13:49 -07:00
Kurt Roeckx
5696077656 i915: Compute maximum number of verts using the actual batchbuffer size.
We were looking at the size of batch.map for how big the batchbuffer
was, but on 865 we just use a single-page batchbuffer due to hardware
limits.

v2: Removed check for sizeof map < bo->size, since that's always false.
    [change by anholt]
NOTE: This is a candidate for release branches.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41495
(cherry picked from commit 024ece7523)
2012-05-17 22:13:49 -07:00
Chris Wilson
815d6e3f2f i830: Compute initial number of vertices from remaining batch space
In order to prevent an overflow of the batch buffer when emitting
triangles, we need to limit the initial primitive to fit within the
current batch. To do we need to measure the remaining space and thence
compute the maximum number of vertices that fit into that space.

Reported-by: Kurt Roeckx <kurt@roeckx.be>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41495
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Eric Anholt <eric@anholt.net>
NOTE: This is a candidate for release branches.
(cherry picked from commit 33b07893e9)
2012-05-17 22:13:49 -07:00
Alban Browaeys
c9aa4607c5 dri/i915: Fix off-by-one in i830 clip region size.
The hardware, like i915, uses an inclusive bounds on min and max for
the drawing rectangle, but we were providing a number for exclusive.
The number of bits used by the hardware only covers this value going
up to the maximum size, so when we programmed 2048 as the maximum
inclusive X, it saw a maximum X of 0 and clipped all rendering.  This
caused rendering failures in gnome-shell.

Fixes piglit fbo-maxsize.

v2: dropped changes to the blitter, which does use an exclusive x2, y2.
    [change by anholt]

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45558
Reviewed-by: Eric Anholt <eric@anholt.net>
NOTE: This is a candidate for release branches.
(cherry picked from commit 7d13a6e64b)
2012-05-17 22:13:49 -07:00
Eric Anholt
a164f23d09 i915: Fix piglit fbo-nodepth-test on i830.
This is a direct port of fc4fba52cf from
i915, and fixes GPU hangs when running piglit.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41372
Reviewed-by: Eric Anholt <eric@anholt.net>
NOTE: This is a candidate for release branches.
(cherry picked from commit 4d4f2daefa)
2012-05-17 21:53:27 -07:00
Eric Anholt
31aaf56f28 mesa: Add missing error check for first < 0 in glDrawArraysInstanced().
Fixes piglit GL_ARB_draw_instanced/negative-arrays-first-negative.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 767ba60831)
2012-05-17 21:53:12 -07:00
Eric Anholt
9bbd435900 mesa: Fix display lists for draw_elements_base_vertex with draw_instanced.
Fixes piglit GL_ARB_draw_elements_base_vertex/dlist-arb_draw_instanced

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 871518dbf8)
2012-05-17 21:53:06 -07:00
Eric Anholt
fe64ad0cba mesa: Fix display list handling for GL_ARB_draw_instanced.
When you called them in a display list compile before, you would just
end up calling through NULL.

Fixes piglit GL_ARB_draw_instanced/dlist.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 3c69a18b6a)
2012-05-17 21:52:55 -07:00
Paul Berry
ae02489a6d i915: Initialize swrast_texture_image structure fields.
Commit 980f6f1 (mesa: move gl_texture_image::Width/Height/DepthScale
fields to swrast) moved the initialization of the Width, Height, and
DepthScale fields to _swrast_alloc_texture_image_buffer().  However,
i915 doesn't call this function because it performs its own buffer
allocation.  As a result, the Width, Height, and DepthScale fields
weren't getting initialized properly, and some operations requiring
swrast would fail.

This patch ensures that Width, Height, and DepthScale are properly
initialized by separating the code that sets them into a new function,
_swrast_init_texture_image(), which is called by
intel_alloc_texture_image_buffer() as well as
_swrast_alloc_texture_image_buffer().  It also moves the
initialization of _IsPowerOfTwo into this function.

Fixes piglit test fbo/fbo-cubemap on i915.

Partially fixes https://bugs.freedesktop.org/show_bug.cgi?id=41216

This is a candidate for the 8.0 branch.

Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 80513ec8b4)
2012-05-17 21:52:48 -07:00
Anuj Phogat
00a182d66e mesa: fix issues with texture border and array textures
For a 1D texture array, the border only applies to the width.  For a 2D
texture array the border applies to the width and height but not the depth.
Sucha cases were  not handled correctly in _mesa_init_teximage_fields().

Note: This is a candidate for stable branches

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit b5c409363c)
2012-05-17 21:29:41 -07:00
Brian Paul
88cbc43d1f mesa: add missing return after _mesa_error() in update_array()
NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit e14b357367)
2012-05-17 21:29:35 -07:00
Kenneth Graunke
d342246e2b i965: Make the dummy fragment shader work in SIMD16 mode.
If you're resorting to the dummy shader, you've probably already turned
off SIMD16 mode.  But if you didn't, it would die in a fire.

We could either fail to compile in SIMD16 mode...or just fix it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit df5963c256)
2012-05-17 21:29:27 -07:00
Kenneth Graunke
51e1111bd6 i965: Fix GPU hangs in the dummy fragment shader.
The dummy FB write failed to specify EOT and a message length, causing
the GPU to hang.  Now we can enjoy "everyone's favorite color" again.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 393b42240f)
2012-05-17 21:29:17 -07:00
Kenneth Graunke
b85c5d9344 vbo: Eliminate short-circuiting in invalid-start case.
Now that we have a index_range_invalid flag, we can just use that rather
than calling vbo_validated_drawrangeelements directly and returning.

NOTE: This is a candidate for release branches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 6e738d35c5)
2012-05-17 21:29:05 -07:00
Kenneth Graunke
eb2eb97baf vbo: Rework checking of 'end' against _MaxElement.
This failed to take basevertex into account:

If basevertex < 0:
   (end + basevertex) might actually be in-bounds while 'end' is not.
   We would have clamped in this case when we probably shouldn't.
   This could break application drawing.

If basevertex > 0:
   'end' might be in-bounds while (end + basevertex) might not.
   We would have failed to clamp in this place.  There's a comment
   indicating the TNL module depends on max_index being in-bounds;
   if so, it would likely break horribly.

Rather than trying to clamp correctly in the face of basevertex, simply
delete the clamping code and indicate that we don't have a valid range.
This causes _tnl_vbo_draw_prims to use vbo_get_minmax_indices() to
compute the actual bounds, which is much safer.

NOTE: This is a candidate for release branches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
(cherry picked from commit 112b02c324)
2012-05-17 21:28:57 -07:00
Kenneth Graunke
7032a56c85 vbo: Ignore invalid element ranges which are outside VBO bounds.
Some applications, such as Regnum Online, appear to pass invalid
start/end values to glDrawRangeElements.  In particular, the 'start'
index sometimes exceeds the maximum array element.  This is clearly
invalid behavior, and although the spec isn't clear, seems to result
in undefined, implementation-specific behavior.

This patch takes the conservative approach and simply ignores the range,
while issuing a warning indicating that the application is broken and
should be fixed.

NOTE: This is a candidate for release branches.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45214
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44701
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41152
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40361
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=28138
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com> [v1]
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
(cherry picked from commit f00c97b23f)
2012-05-17 21:28:48 -07:00
Kenneth Graunke
3aaf3c85e4 vbo: Remove pedantic warning about 'end' beind out of bounds.
The application supplied [start, end] range is merely a conservative
hint of the ranges of index values inside the index buffer.  There is no
requirement that all vertices in the range [start, end] be referenced.

Passing an 'end' value larger than the maximum legal index is perfectly
acceptible; applications can legally pass 0xffffffff when they don't
have a tighter bound readily available.

Thus, the warning doesn't indicate a correctness issue; it could only
indicate a performance issue.  However, it does not even do that.

glDrawRangeElements is designed to optimize non-VBO vertex data uploads
by providing an upper bound on the size of buffers a driver would need
to allocate.  With VBOs, the data is already in an uploaded buffer, so
the range doesn't help.

The clincher is: we only know _MaxElement for VBOs.  For user-space
arrays, we just set it to 2,000,000,000 (see mesa/main/varray.h:63.)
So we can only check this in the case where it is not useful.

Many applications, including the Unigine demos, currently trigger this
warning, which suggests the applications are buggy when they're actually
fine.  Eliminating the warning should confuse users less while not
actually losing any benefit to application developers.

NOTE: This is a candidate for release branches.

Suggested-by: Jose Fonseca <jfonseca@vmware.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
(cherry picked from commit f9be8543aa)
2012-05-17 21:28:38 -07:00
Brian Paul
0a24f0868f mesa: add missing texture integer test in glTexSubImage()
If the texture format is integer, the incoming user data must also be
integer (and similarly for non-integer textures).

NOTE: This is a candidate for the stable branches.

Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 6f3d918409)
2012-05-17 21:28:29 -07:00
Eric Anholt
a325146f11 mesa: Include the multisample enables under GL_MULTISAMPLE_BIT attrib as well.
Fixes (with the previous commit) piglit GL_ARB_multisample/pushpop.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit b631b471d8)
2012-05-17 21:28:20 -07:00
Eric Anholt
64c69a5b86 mesa: Fix push/pop of multisample coverage invert.
In the table of of push/pop attributes, this one doesn't fall under
the enable group.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 4b6e45c7d6)
2012-05-17 21:28:13 -07:00
Mathias Fröhlich
8a7cb5d21c glsl: Avoid excessive loop unrolling.
Avoid unrollong loops that are either nested loops or
where the loop body times the unroll count is huge.

The change is far from being perfect but it extends the
loop unrolling decision heuristic by some additional
safeguard. In particular this cuts down compilation of
a shader precomputing atmospheric scattering integral
tables containing two nesting levels in a loop from
something way beyond some minutes (I never waited for
it to finish) to some fractions of a second.

This fixes piglit tests glsl-fs-unroll-explosion and
glsl-vs-unroll-explosion on r600g.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
(cherry picked from commit 67007080b7)
2012-05-17 21:27:59 -07:00
Eric Anholt
865ad64e06 i965/fs: Implement GL_CLAMP behavior on texture rectangles on gen6+.
We were doing saturate-based clamping on the [0,width] or [0,height]
coordinate, which meant only the first pixel was addressable.

Fixes piglit ARB_texture_rectangle/texwrap-RECT-bordercolor

NOTE: This is a candidate for the 8.0 release branch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 7c857a6b15)
2012-05-17 21:27:48 -07:00
Eric Anholt
0b2ffc647d i965/fs: Move GL_CLAMP handling to coordinate setup.
We should be able to merge self-move instruction into the MRF move
anyway, and this simplifies things for the next commit.

NOTE: This is a candidate for the 8.0 release branch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 07e621c523)
2012-05-17 21:27:41 -07:00
Jon TURNEY
0d1049ff26 Have __glImageSize handle format GL_DEPTH_STENCIL_NV the same way as the server does
There is a mismatch between the way the X server and GLX library
calculates the image size for format GL_DEPTH_STENCIL(|_NV|_EXT)

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

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
(cherry picked from commit 8937c166ef)
2012-05-17 17:23:57 -07:00
Roland Scheidegger
78b66adc1a mesa: check_index_bounds off-by-one fix
in check_index_bounds the comparison needs to be "greater equal" since
contrary to the name _MaxElement is the count of the array (this matches
similar code in vbo_exec_DrawRangeElementsBaseVertex).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 1f4a853b1e)
2012-05-17 17:23:37 -07:00
Brian Paul
d7b1a7bfb1 vbo: fix node_attrsz[] usage in vbo_bind_vertex_list()
The node_attrsz[] array is initially copied from the node->attrsz[]
array but some values get rewritten.  Thereafter, we need to use the
node_attrsz[] values.

Fixes a bug when replaying a display list that uses generic vertex
array[16] (at least).

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit e53557996e)
2012-05-17 17:23:18 -07:00
Dave Airlie
4d5b40a5a2 mesa/format_unpack: add LUMINANCE 8/16 UINT/INT
This just copies what the LUMINANCE_ALPHA bits do.

Fixes piglit tests on softpipe complaining about missing unpack.

Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit fef395c0c3)
2012-05-17 17:23:07 -07:00
Brian Paul
1e987b6e7a mesa: add BGR888 code in _mesa_format_matches_format_and_type()
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 966720f507)
2012-05-17 17:22:41 -07:00
Brian Paul
3158636f4c mesa: fix error in _mesa_format_matches_format_and_type() for RGB888
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit b019228d6b)
2012-05-17 17:22:35 -07:00
Brian Paul
a341475398 mesa: remove LSB-first pixel packing check in glReadPixels
GL_UNPACK_LSB_FIRST only applies to bitmap data, not glReadPixels.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 343100d1fc)
2012-05-17 17:22:30 -07:00
Eric Anholt
d953370670 mesa: Fix handling of glCopyBufferSubData() for src == dst.
Fixes piglit ARB_copy_buffer-overlap, on swrast, which previously
assertion failed.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 531e44415b)
2012-05-17 17:22:15 -07:00
Alexander von Gluck
8e8c974fff glsl: Don't use newlocale on Haiku
NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 873f3ae92e)
2012-05-17 17:21:55 -07:00
Alexander von Gluck
a0f010db1c mesa: Don't use newlocale on Haiku
NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 02a1f9f14d)
2012-05-17 17:21:44 -07:00
Alexander von Gluck
9de17f5f4d svga: fix typedef conflicts on Haiku
NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 32876a452f)
2012-05-17 17:21:29 -07:00
Alexander von Gluck
abd1431707 llvmpipe: fix symbol conflict on Haiku
NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 1550b0668e)
2012-05-17 17:21:15 -07:00
Matt Turner
c2fdcc1e12 Remove -ffast-math from default CFLAGS
Fixes glsl-const-folding-01. inversesqrt(1.0) != 1.0 was evaluating as
true.

Signed-off-by: Matt Turner <mattst88@gmail.com>
(cherry picked from commit 2fdbbeca43)
2012-05-17 17:20:32 -07:00
Alex Deucher
f1b6c69137 radeon: fix fog coordinate emit
Noticed by dungeon on phoronix:
http://phoronix.com/forums/showthread.php?65408-Radeon-R100-R200-Mesa-Driver-Sees-Attention&p=247018#post247018

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

Note: this is a candidate for the stable branches.
(cherry picked from commit e77c495d09)
2012-05-17 17:19:52 -07:00
Alex Deucher
e72cbdf395 r200: fix fog coordinate emit
Noticed by dungeon on phoronix:
http://phoronix.com/forums/showthread.php?65408-Radeon-R100-R200-Mesa-Driver-Sees-Attention&p=247018#post247018

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

Note: this is a candidate for the stable branches.
(cherry picked from commit afdd6f8c34)
2012-05-17 17:19:36 -07:00
Eugeni Dodonov
bf7407f631 intel: add PCI IDs for Ivy Bridge GT2 server variant
Those IDs are used by Bromolow.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>

(cherry picked from commit a45247fb1b)

Conflicts:
	include/pci_ids/i965_pci_ids.h
2012-05-17 08:16:09 -07:00
Jeremy Huddleston
9724c8d13c darwin: Eliminate a possible race condition while destroying a surface
Introduced by: c60ffd2840
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit d65bd195ec)
2012-05-16 18:59:02 -07:00
Jeremy Huddleston
7e624edba4 darwin: Unlock our mutex before destroying it
http://xquartz.macosforge.org/trac/ticket/575

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit a73a800b32)
2012-05-16 18:59:00 -07:00
Dylan Noblesmith
03354a3c4a i965: fix typo
Noticed by clang:

brw_wm_surface_state.c:330:30: warning: initializer overrides prior
initialization of this subobject [-Winitializer-overrides]
      [MESA_FORMAT_Z24_S8] = 0,
                             ^
brw_wm_surface_state.c:326:30: note: previous initialization is here
      [MESA_FORMAT_Z24_S8] = 0,
                             ^

No functionality change, since the array is declared static so
it was zero-initialized by default.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit dd32df3829)
2012-05-16 10:58:49 -07:00
Brian Paul
0a25c4c384 swrast: include s_fragprog.h to silence warnings 2012-05-14 09:59:41 -06:00
Yuanhan Liu
fa68a8bae3 i965: fix wrong cube/3D texture layout
Fix wrong cube/3D texture layout for the tailing levels whose width or
height is smaller than the align unit.

From 965 B-spec http://intellinuxgraphics.org/VOL_1_graphics_core.pdf at
page 135:
   All of the LOD=0 q-planes are stacked vertically, then below that,
   the LOD=1 qplanes are stacked two-wide, then the LOD=2 qplanes are
   stacked four-wide below that, and so on.

Thus we should always inrease pack_x_nr, which results to the pitch of LODn
may greater than the pitch of LOD0. So we should refactor mt->total_width
when needed.

This would fix the following webgl test case on all gen4 platforms:
  conformance/textures/texture-size-cube-maps.html

NOTE: This is a candidate for stable release branches.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
(cherry picked from commit f939776cb2)
2012-05-09 15:18:42 +08:00
Brian Paul
064c324d8d mesa: bump version to 8.0.2 in configs/default 2012-05-07 08:59:05 -06:00
Brian Paul
8700db8c87 mesa/gdi: remove clear_color() function
Setup the clearing color in the clear() function.

Reviewed-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 9c53fc593e)
2012-05-07 08:59:04 -06:00
Brian Paul
53f88f8606 mesa/gdi: remove wmesa_set_renderbuffer_funcs() function
The code is no longer relevant.
Note: this driver is probably broken now.  There's no implementation
of ctx->Driver.Map/UnmapRenderbuffer().
(cherry picked from commit 4a1c660599)
2012-05-07 08:59:04 -06:00
Tom Stellard
0558ac1fd7 r300/compiler: Copy all instruction attributes during local transfoms
Instruction attributes like WriteALUResult and ALUResultCompare
were being discarded during the some of the local transformations.

This fixes the following piglit tests:

glsl1-inequality (vec2, pass)
loopfunc
fs-any-bvec2-using-if
fs-op-ne-bvec2-bvec2-using-if
fs-op-ne-ivec2-ivec2-using-if
fs-op-ne-mat2-mat2-using-if
fs-op-ne-vec2-vec2-using-if
fs-op-ne-mat2x3-mat2x3-using-if
fs-op-ne-mat2x4-mat2x4-using-if

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

(cherry-picked from commit 73249239cf)
2012-05-06 19:05:47 -04:00
Tom Stellard
649a8952df r300/compiler: Clear loop registers in vertex shaders w/o loops
The loop registers weren't being cleared, so any shader that was
executed after a shader containing loops was at risk of having a loop
randomly inserted into it.

This fixes over one hundred piglit tests, although these test
only failed during full piglit runs and would pass if
run individually.  The exact number of piglit tests that this patch
fixes will vary depending on the version of piglit and the order the
tests are run.

(cherry-picked from commit 4a269a8dc0)
2012-05-06 19:05:17 -04:00
Jeremy Huddleston
f36e638c76 darwin: Use ASL for logging
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 51691f0767)
2012-05-03 11:00:57 -07:00
Jeremy Huddleston
f818673acb darwin: Make reported errors more user-friendly
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit cf5db0a418)
2012-05-03 11:00:53 -07:00
Jeremy Huddleston
8010ff17ae darwin: Fix an error message
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 244dc05214)
2012-05-03 11:00:48 -07:00
Eric Anholt
93e94cbb48 intel: Fix rendering from textures after RenderTexture().
There's a serious trap for drivers: RenderTexture() does not indicate
that the texture is currently bound to the draw buffer, despite
FinishRenderTexture() signaling that the texture is just now being
unbound from the draw buffer.

We were acting as if RenderTexture() *was* the start of rendering and
that we could make texturing incoherent with the current contents of
the renderbuffer.  This caused intel oglconform sRGB
Mipmap.1D_textures to fail, because we got a call to TexImage() and
thus RenderTexture() on a texture bound to a framebuffer that wasn't
the draw buffer, so we skipped validating the new image into the
texture object used for rendering.

We can't (easily) make RenderTexture() indicate the start of drawing,
because both our driver and gallium are using it as the moment to set
up the renderbuffer wrapper used for things like MapRenderbuffer().
Instead, postpone the setup of the workaround render target miptree
until update_renderbuffer time, so that we no longer need to skip
validation of miptrees used as render targets.  As a bonus, this
should make GL_NV_texture_barrier possible.

(This also fixes a regression in the gen4 small-mipmap rendering since
3b38b33c16, which switched
set_draw_offset from image->mt to irb->mt but didn't move the irb->mt
replacement up before set_draw_offset).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44961
NOTE: This is a candidate for the 8.0 branch.
2012-04-30 11:46:42 -07:00
Eric Anholt
4e172532d1 i965/fs: Jump from discard statements to the end of the program when done.
From the GLSL 1.30 spec:

     The discard keyword is only allowed within fragment shaders. It
     can be used within a fragment shader to abandon the operation on
     the current fragment. This keyword causes the fragment to be
     discarded and no updates to any buffers will occur. Control flow
     exits the shader, and subsequent implicit or explicit derivatives
     are undefined when this control flow is non-uniform (meaning
     different fragments within the primitive take different control
     paths).

v2: Don't emit the final HALT if no other HALTs were emitted.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
2012-04-30 11:28:01 -07:00
Dylan Noblesmith
e995b41a16 egl-static: fix printf warning
Noticed by clang:

egl_st.c:57:50: warning: field precision should have type 'int',
but argument has type 'size_t' (aka 'unsigned long') [-Wformat]
      ret = util_snprintf(path, sizeof(path), "%.*s/%s" UTIL_DL_EXT,
                                               ~~^~

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 2bb91274e2)
2012-04-29 11:22:57 +00:00
Dylan Noblesmith
fca35d2e5e st/vega: fix uninitialized values
C still treats array arguments exactly like pointer arguments.
By sheer coincidence, this still worked fine on 64-bit
machines where 2 * sizeof(float) == sizeof(void*), but not
on 32-bit.

Noticed by clang:

text.c:76:51: warning: sizeof on array function parameter will
return size of 'const VGfloat *' (aka 'const float *') instead of
'const VGfloat [2]' [-Wsizeof-array-argument]
   memcpy(glyph->glyph_origin, glyphOrigin, sizeof(glyphOrigin));

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 6a491b5728)
2012-04-29 11:22:47 +00:00
Dylan Noblesmith
4dd228a0a9 egl: fix uninitialized values
Noticed by clang:

eglimage.c:48:28: warning: argument to 'sizeof' in 'memset' call is
the same expression as the destination; did you mean to dereference
it? [-Wsizeof-pointer-memaccess]
   memset(attrs, 0, sizeof(attrs));
          ~~~~~            ^~~~~

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 071501a681)
2012-04-29 11:22:34 +00:00
Dylan Noblesmith
108d544cae util: fix uninitialized table
Most of the 256 values in the 'generic_to_slot' table were supposed to
be initialized with the default value 0xff, but were left at zero
(from CALLOC_STRUCT()) instead.

Noticed by clang:

u_linkage.h:60:31: warning: argument to 'sizeof' in 'memset' call is the same expression as the destination;
      did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
   memset(table, 0xff, sizeof(table));
          ~~~~~               ^~~~~

Also fix a signed/unsigned comparison and a comment typo here.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 520521e380)
2012-04-29 11:22:23 +00:00
Dylan Noblesmith
546abd2503 util: fix undefined behavior
container_of() can legally return anything, even invalid addresses
that cause segfaults, when 'sample' is an uninitialized pointer.

Bug exposed by clang.

NOTE: This is a candidate for the 8.0 branch.
(cherry picked from commit ccff749712)
2012-04-29 11:22:15 +00:00
Kenneth Graunke
bcc5caf642 i965/fs: Fix FB writes that tried to use the non-existent m16 register.
A little analysis shows that the worst-case value for "nr" is 17:
- base_mrf = 2                       ... 2
- header present (say gen == 5)      ... 4
- aa_dest_stencil_reg (stencil test) ... 5
- SIMD16 mode: += 4 * reg_width      ... 13
- source_depth_to_render_target      ... 15
- dest_depth_reg                     ... 17

This resulted in us setting base_mrf to 2 and mlen to 15.  In other
words, we'd try to use m2..m16.  But m16 doesn't exist pre-Gen6.  Also,
the instruction scheduler data structures use arrays of size 16, so this
would cause us to access them out of bounds.

While the debugger system routine may need m0 and m1, we don't use it
today, so the simplest solution is just to move base_mrf back to 1.
That way, our worst case message fits in m1..m15, which is legal.

An alternative would be to fail on SIMD16 in this case, but that seems
a bit unfortunate if there's no real need to reserve m0 and m1.

Fixes new piglit test shaders/depth-test-and-write on Ironlake,
as well as gzdoom.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=48218
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit aa429ea73c0931d5cfa2c263fe005ead8dc32ddf)
2012-04-27 16:53:08 -07:00
Jeremy Huddleston
69d8a25d42 darwin: Eliminate a pthread mutex leak
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Tested-by: Charles Davis <cdavis@mines.edu>
(cherry picked from commit 1a33c1b2b8)
2012-04-24 00:27:07 -07:00
Jonas Maebe
6095a17534 apple: Fix a use after free
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit c60ffd2840)
2012-04-23 16:18:19 -07:00
Jonas Maebe
bb30e76328 glapi: Correct size of allocated _glapi_table struct
The __glapi_gentable_set_remaining_noop() routine treats the _glapi_struct
as an array of _glapi_get_dispatch_table_size() pointers, so we have to
allocate _glapi_get_dispatch_table_size()*sizeof(void*) bytes rather
than sizeof(struct _glapi_struct) bytes.

Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 8d09f4d0cc)
2012-04-22 20:41:04 -07:00
Brian Paul
49ed43b6de mesa: add a couple fast-paths to fast_read_rgba_pixels_memcpy()
Accelerates a few glReadPixels cases for WebGL.
See https://bugs.freedesktop.org/show_bug.cgi?id=48545

v2: Per Jose, use bit twiddling for the swizzle case instead of ubyte
arrays (it's about 44% faster).

Note: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>

(cherry picked from commit a5e95a419e)
2012-04-17 17:41:09 -06:00
Yuanhan Liu
9f150ffe8e i915: set SPRITE_POINT_ENABLE bit correctly
When SPRITE_POINT_ENABLE bit is set, the texture coord would be
replaced, and this is only needed when we called something like
glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE).

And more,  we currently handle varying inputs as texture coord,
we would be careful when setting this bit and set it just when
needed, or you will find the value of varying input is not right
and changed.

Thus we do set SPRITE_POINT_ENABLE bit only when all enabled tex
coord units need do CoordReplace. Or fallback is needed to make
sure the rendering is right.

With handling the bit setup at i915_update_sprite_point_enable(),
we don't need the relative code at i915Enable then.

This patch would _really_ fix the webglc point-size.html test case and
of course, not regress piglit point-sprite and glean-pointSprite
testcase.

NOTE: This is a candidate for stable release branches.

v2: fallback just when all enabled tex coord units need do
    CoordReplace (Eric)
v3: move the sprite point validate code at I915InvalidateState (Eric)
v4: sprite point enable bit update based on _NEW_PROGRAM, too
    add relative _NEW-state comments to show what state is being used(Eric)

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
(cherry picked from commit c653287549)
2012-04-09 10:07:56 +08:00
Kenneth Graunke
edeb3976d4 i965: Actually upload sampler state pointers for the VS unit on Gen6.
We already program all the sampler state correctly, we just didn't give
the GPU a pointer to it for the VS stage.  Thus, any texturing other
than texelFetch() wouldn't work.

Fixes piglit test vs-textureLod-miplevels and 99 of oglconform's
glsl-bif-tex subtests.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 2a80a1e2a7)
2012-04-05 18:38:31 -07:00
Marek Olšák
a30790a9a3 r300g/swtcl: fix crash when back color is present in vertex shader
The shader transformation code sometimes produced invalid TGSI.
(cherry picked from commit 75f8990547)
2012-04-04 05:04:00 +02:00
Marek Olšák
3d436f6c37 r300g/swtcl: fix polygon offset
(cherry picked from commit c3481f3410)
2012-04-04 05:03:51 +02:00
Marek Olšák
8d40c2f5e2 r300g/swtcl: don't expose shader subroutine support
RET in the main function doesn't work. This should be fixed in Draw, but meh.
(cherry picked from commit 3b8fe06eb6)
2012-04-04 05:03:46 +02:00
Marek Olšák
d146c50358 r300g/swtcl: don't enter u_vbuf_mgr
(cherry picked from commit da2123051c)
2012-04-04 05:03:39 +02:00
Marek Olšák
1709144338 r300g/swtcl: don't print an error when getting ClipVertex
Draw can do it just fine.
(cherry picked from commit 5ce0598a03)
2012-04-04 05:03:34 +02:00
Chad Versace
54f7391664 glsl: Fix Android build
The build was broken by the line below, added in commit 4f82fed4.
  s_expression.cpp:26: #include <limits>

Mesa's half of the fix is to add 'external/astl/include' to the include
path. The other half of the fix requires implementing
numeric_limits<float>::infinity() in astl, for which I have patches
submitted upstream for review.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit 5497cc428f)
2012-03-23 16:28:38 -07:00
Dylan Noblesmith
89e796aef5 intel: fix null dereference processing HiZ buffer
Or technically, a near-null dereference.

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

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit 8d9decb75f)
2012-03-23 19:01:58 +00:00
Jakob Bornecrantz
0bf0ba44de docs: Add 8.0.2 md5sums
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
2012-03-21 19:19:59 +00:00
Jakob Bornecrantz
5f7204c3bb docs: Add 8.0.2 release notes
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
2012-03-21 18:01:20 +00:00
Jakob Bornecrantz
dc20396a14 mesa: Bump version number to 8.0.2
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
2012-03-21 17:55:53 +00:00
Jakob Bornecrantz
770f785a6f mesa: Include mesa ES mapi generated files
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
2012-03-21 17:55:53 +00:00
Brian Paul
4b52be53a4 docs: add links to 8.0.1 release notes 2012-03-21 17:55:53 +00:00
Daniel Vetter
e26aa8c660 i965: fixup W-tile offset computation to take swizzling into account
There's even a comment in the code containing the right swizzling
computations!

Previously this has not been noticed because we need to manually
enabled swizzling on snb/ivb (kernel 3.4 will do that) and we
don't use the separate stencil on ilk (where the bios enables
swizzling). This fixes

piglit ./bin/fbo-stencil  readpixels GL_DEPTH32F_STENCIL8 -auto

on recent drm-intel-next kernels.

Also remove the comment about ivb, it's stale now.

Swizzling detection is done by allocating a temporary x-tiled
buffer object. Unfortunately kernels before v3.2 lie on snb/ivb
because they claim that swizzling is enable, but it isn't. The
kernel commit that fixes this for backport to pre-v3.2 is

commit acc83eb5a1e0ae7dbbf89ca2a1a943ade224bb84
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Mon Sep 12 20:49:16 2011 +0200

    drm/i915: fix swizzling on gen6+

But if the kernel doesn't lie, this now works on swizzling and
not swizzling machines.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit f172eae8b2)
2012-03-20 12:20:04 -07:00
Eugeni Dodonov
2f5182cfcf intel: check for LLC support when reading maps
This checks for advertised LLC support by the GPU instead of relying on
the GPU generation for detection.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
(cherry picked from commit 84e5f1c635)
2012-03-20 12:19:58 -07:00
Eugeni Dodonov
7fe667a18d intel: verify if hardware has LLC support
Rely on libdrm HAS_LLC parameter to verify if hardware supports it. In
case the libdrm version does not supports this check, fallback to older
way of detecting it which assumed that GPUs newer than GEN6 have it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
(cherry picked from commit 7def293204)
2012-03-20 12:19:38 -07:00
Kenneth Graunke
3d036f3f0a i965: Fix Gen6+ dynamic state upper bound on older kernels.
Kernels prior to 271d81b84171d84723357ae6d172ec16b0d8139c (March 2011)
don't support relocations outside of the target buffer object.  Rather
than guarding this with a I915_PARAM_HAS_RELAXED_DELTA check, just
smash the bound to 0xfffff001 like we do on Ironlake.

This effectively gives us no upper bound check, just like we did prior
to commit 271d81b84171d84723357ae6d172ec16b0d8139c.

Daniel Vetter would also like to mention that this relies on the guard
page at the end of the GTT.

Fixes a regression since 271d81b84171d84723357ae6d172ec16b0d8139c.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=46766
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit b2ace06cbb)
2012-03-20 12:16:19 -07:00
Dylan Noblesmith
b056fc0741 mesa: add back glGetnUniform*v() overflow error reporting
The error was removed in:

commit 719909698c
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Tue Oct 18 16:01:49 2011 -0700

    mesa: Rewrite the way uniforms are tracked and handled

The GL_ARB_robustness spec doesn't say the implementation
should truncate the output, so just return after setting
the required error like it did before the above commit.

Also fixup an old comment and add an assert.

NOTE: This is a candidate for the 8.0 branch.
(cherry picked from commit b536ac6b2b)
2012-03-20 07:49:53 +00:00
Yuanhan Liu
adcb180671 i915: fallback for NPOT cubemap texture
Although some hardware support NPOT cubemap, but it seems we don't know
the right layout for NPOT cubemap. Thus seems we need do fallback for
other platforms as well.

See comments inline the code for more detailed info.

v2: give a more detailed info about why we need fallback for other
    platfroms as well.

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

NOTE: This is a candidate for stable release branches.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
(cherry picked from commit 40c995c1fd)
2012-03-19 10:15:48 +08:00
Jeremy Huddleston
d982036c3a darwin: Link against libxcb
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 90a51753c4)
2012-03-16 17:14:31 -07:00
Jeremy Huddleston
63c8f7142c darwin: Build create_context.c
Fixes a build regression from: 588042a8ec

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit f9e1295cff)
2012-03-16 17:14:26 -07:00
Jeremy Huddleston
485d1c491a darwin: config file cleanups
Set our default compiler based on what our installed XCode prefers

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 61f6aff5d9)
2012-03-16 17:14:21 -07:00
Yuanhan Liu
7b1fbc6889 i965: handle gl_PointCoord for Gen4 and Gen5 platforms
This patch add the support of gl_PointCoord gl builtin variable for
platform gen4 and gen5(ILK).

Unlike gen6+, we don't have a hardware support of gl_PointCoord, means
hardware will not calculate the interpolation coefficient for you.
Instead, you should handle it yourself in sf shader stage.

But badly, gl_PointCoord is a FS instead of VS builtin variable, thus
it's not included in c.vue_map generated in VS stage. Thus the current
code doesn't aware of this attribute. And to handle it correctly, we
need add it to c.vue_map manually to let SF shader generate the needed
interpolation coefficient for FS shader. SF stage has it's own copy of
vue_map, thus I think it's safe to do it manually.

Since handling gl_PointCoord for gen4 and gen5 platforms is somehow a
little special, I added a lot of comments and hope I didn't overdo it ;)

v2: add a /* _NEW_BUFFERS */ comment to note the state flag dependency
    and also add the _NEW_BUFFERS dirty mask (Eric).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45975
Piglit: glsl-fs-pointcoord and fbo-gl_pointcoord

NOTE: This is a candidate for stable release branches.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 43af02ac73)
2012-03-16 10:44:01 +08:00
Yuanhan Liu
7f8ac0e70f i915: move the FALLBACK_DRAW_OFFSET check outside the drawing rect check
We have to do fallback when the 'Clipped Drawing Rectangle X/Y Max'
exceed the hardware's limit no matter the drawing rectangle offset
changed or not.

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

NOTE: This is a candidate for stable release branches.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit cf2f9ef015)
2012-03-16 10:37:43 +08:00
Yuanhan Liu
5cfc7d1167 i915: fix wrong rendering of gl_PointSize on Pineview
The current code would ignore the point size specified by gl_PointSize
builtin variable in vertex shader on Pineview. This patch servers as
fixing that.

This patch fixes the following issues on Pineview:
webglc: https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/tests/conformance/rendering/point-size.html
piglit: glsl-vs-point-size

NOTE: This is a candidate for stable release branches.

v2: pick Eric's nice tip for fixing this issue in hardware rendering.
v3: the last arg of EMIT_ATTR specify the size in _byte_. (Eric)

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 058fc6521e)
2012-03-16 10:36:57 +08:00
Yuanhan Liu
fae3a31bbb tnl: let _TNL_ATTRIB_POINTSIZE do not depend on ctx->VertexProgram._Enabled
We may specify the point size in a glsl vertex shader.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=46311
piglit: glsl-vs-point-size

NOTE: This is a candidate for stable release branches.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 9962280c33)
2012-03-16 10:35:42 +08:00
Brian Paul
b9f8cb9e0b mesa: fix GL_LUMINANCE handling in glGetTexImage
There are several cases in which we need to explicity "rebase" colors
(ex: set G=B=0) when getting GL_LUMINANCE textures:
1. If the luminance texture is actually stored as rgba
2. If getting a luminance texture, but returning rgba
3. If getting an rgba texture, but returning luminance

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

Also fixes the new piglit getteximage-luminance test.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit f5d0ced242)
2012-03-14 17:32:17 -06:00
Brian Paul
aabbf5adac mesa: use _mesa_rebase_rgba_float/uint() in glGetTexImage code
NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2012-03-14 17:26:06 -06:00
Brian Paul
83728cf4ce mesa: use _mesa_rebase_rgba_float/uint() in glReadPixels code
See the comments for _mesa_rebase_rgba_float() for details.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=46679

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit ad897fff77)
2012-03-14 17:23:59 -06:00
Brian Paul
8836517250 mesa: add _mesa_rebase_rgba_float/uint() functions
These will be used by glReadPixels() and glGetTexImage() to fix issues
with reading GL_LUMINANCE and other formats.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit 774c402765)
2012-03-14 17:23:47 -06:00
Brian Paul
bc9d4ae6c7 util: add mutex lock in u_debug_memory.c code
The linked list of memory allocations was not protected by a mutex.
This lead to sporadic failures with multi-threaded apps.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2012-03-14 12:27:57 +00:00
Brian Paul
437ed1faaf svga: add null vs pointer check in update_need_pipeline()
Based on a patch submitted by Vic Lee.  The other part of his patch
which checked the fs pointer wasn't needed.

This fixes a crash when clear() is called before any VS or FS is set.
But this can only happen when the driver is used without the Mesa
state tracker.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit 9917988223)
2012-03-09 08:44:06 -07:00
Zack Rusin
fa9efdbab8 svga: fix the rasterizer state resets
draw module calls back into the driver and sets certain parts
of the state to whatever it needs, unfortunately unless you
get the ordering of calls to draw just right you'll end up
reseting your own driver state. That's what was happening to us
draw module would under certain conditions reset our own driver
state.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 831de96db8)
2012-03-09 08:43:58 -07:00
Zack Rusin
151d32dd45 svga: Fix stencil op mapping
We were inverting the meaning of the stencil op flags: in svga/d3d
the normal incr/decr wraps and the SAT ops clamp.
This fixes piglit failures (at least stencil-twoside and stencil-wrap).
We should backport this everywhere we can.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 5d9bfc4d3f)
2012-03-09 08:43:41 -07:00
Zack Rusin
1fae49b0f5 svga: fix a crash happening before setting fragment shaders.
In certain situations API's will call pipe->clear which doesn't
require fragment shader, but then we'd try to verify the pipeline
and assume fragment shader was always set. This was leading to
crash when API would just call simple clear's before anything else.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit cff0eac702)
2012-03-09 08:43:22 -07:00
Neil Roberts
9664fb70dc mesa: Don't disable fast path for normalized types
Mesa has a fast path for the generic fallback when using glReadPixels
for RGBA data which uses memcpy.  However it was really difficult to
hit this case because it would not be used if any transferOps are
enabled.  Any type apart from floating point or non-normalized integer
types (so any of the common types) would force enabling clamping so
the fast path could not be used.  This patch makes it ignore clamping
when determining whether to use the fast path if the data type of the
buffer is an unsigned normalized type because in that case clamping
will not have any effect anyway.

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

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit d9c4209777)
2012-03-05 12:53:37 -07:00
José Fonseca
a30809878f svga: Clamp advertised PIPE_SHADER_CAP_MAX_TEMPS to SVGA3D_TEMPREG_MAX.
Some backends may advertise more temps than SVGA3D_TEMPREG_MAX, but the
driver is hardwired to only support up to the value defined by
SVGA3D_TEMPREG_MAX, so clamp to it.

Reviewed-by: Brian Paul <brianp@vmware.com>
2012-03-01 08:15:53 +00:00
Yuanhan Liu
9f44387e48 mesa: let GL3 buf obj queries not depend on opengl major version
While the ARB_map_buffer_range extension spec says nothing about these
queries -- they were added in GL 3.0 --, it seems like this could be an
error in the extension spec.  This is one of the extensions, like
ARB_framebuffer_object, that "back ports" OpenGL 3.0 functionality to
previous versions.  These extensions are supposed to provide identical
functionality to OpenGL 3.0.  The other cases of mismatches have been
determined to be bugs in the extension specs.

And tools like apitrace rely on such queries to function properly.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Signed-off-by: José Fonseca <jfonseca@vmware.com>
Acked-by: Brian Paul <brianp@vmware.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
2012-03-01 08:15:36 +00:00
Kenneth Graunke
16cc79f975 i965: Only set Last Render Target Select on the last FB write.
Fixes GPU hangs in OilRush, Trine, and Amnesia: The Dark Descent,
which all use MRT (multiple render targets).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38720
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40059
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45216
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 172bb92db1)
2012-02-28 11:26:05 -08:00
Tom Stellard
82043eb72d r300/compiler: Fix bug when lowering KILP on r300 cards
KILP instruction inside IF blocks were being lowered to an unconditional
KIL.  Since r300 doesn't support branching, when the IF's were lowered
to conditional moves, the KIL would always be executed.  This is not a
problem with the mesa state tracker, because the GLSL compiler handles
lowering IF's, but this bug was appearing in the VDPAU state tracker,
which does not use the GLSL compiler.

(cherry picked from commit 342cac7166)
2012-02-26 20:51:21 -05:00
Marek Olšák
2845a0be81 gallium/rtasm: properly detect SSE and SSE2
This should fix crashes on ancient processors.
(cherry picked from commit 74d303521e)
2012-02-27 02:06:59 +01:00
Ian Romanick
d38a295289 docs: Add 8.0.1 release md5sums
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2012-02-16 23:25:14 -08:00
Ian Romanick
fe77fd3983 docs: Add 8.0.1 release notes
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2012-02-16 18:55:18 -08:00
Ian Romanick
b695078937 mesa: Bump version number to 8.0.1
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2012-02-16 18:54:28 -08:00
Simon Farnsworth
106ea10d1b r600g: Use a fake reloc to sleep for fences
r300g is able to sleep until a fence completes rather than busywait because
it creates a special buffer object and relocation that stays busy until the
CS containing the fence is finished.

Copy the idea into r600g, and use it to sleep if the user asked for an
infinite wait, falling back to busywaiting if the user provided a timeout.

Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 8cd03b933c)

Conflicts:

	src/gallium/drivers/r600/r600_pipe.c
2012-02-16 17:49:23 +01:00
Alex Deucher
fca1a33c96 r600g: 128 bit formats require tile_type = 1 on cayman
Noticed by taiu on IRC.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

(cherry picked from commit 5e1495b2d9)

Conflicts:

	src/gallium/drivers/r600/evergreen_state.c
2012-02-16 17:48:13 +01:00
Alex Deucher
036d999265 r600g: fix tex tile_type offset for cayman
Noticed by taiu on IRC.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

(cherry picked from commit acca690c25)

Conflicts:

	src/gallium/drivers/r600/evergreen_state.c
2012-02-16 17:45:41 +01:00
Kenneth Graunke
e3943cf1cc i965: Emit Ivybridge VS workaround flushes.
I recently discovered this text in the BSpec.  It seems wise to comply,
though I haven't observed it to fix anything yet.

Fixes a regression in glean/fbo since 28cfa1fa21.

NOTE: This is a candidate for stable release branches.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45221
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 709f50928e)
2012-02-16 00:09:31 -08:00
Kenneth Graunke
0aadb240e1 i965/fs: Take # of components into account in try_rewrite_rhs_to_dst.
Commit dc7f449d1a introduced a new method
for avoiding MOVs: try to rewrite the destination of the instruction
that produced the RHS so it writes into the LHS.

Unfortunately, this is not safe for swizzled texturing operations, as
they return a set of four contiguous registers.  Consider the following:

(assign (x)
        (var_ref vec_ctor_x)
        (swiz x (tex vec4 (var_ref m_sampY) (var_ref m_cordY) 0 1 ())))

In this case, the source and destination registers are equal, since
reg_offset is 0 for both.  Yet, this is only a partial move: the texture
operation generates four registers, and the LHS only covers one.

Fixes color distortion in XBMC when using GLSL shaders.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44333
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 4b27406820)
2012-02-15 17:17:35 -08:00
Kenneth Graunke
740123fff7 i965/fs: Add a new fs_inst::regs_written function.
Certain instructions write more than one register.  Texturing, for
example, returns 4 registers.  (We set rlen to 4 even for TXS and float
shadow sampling.)  Some math functions return 2.  Most return 1.

The next commit introduces a use of this function.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 8ab02b5118)
2012-02-15 17:17:16 -08:00
Ian Romanick
ff1d945032 swrast: Only avoid empty _TexEnvPrograms
If the generated shader for _TexEnvProgram is empty, force the use of
the fixed-function code.  Otherwise, go ahead and use the shader.
This works around a mysterious issue on i915 where fixed-function
software fallbacks are not working correctly.

This isn't really the fix we want, but it works around the issue.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45872
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45876
(cherry picked from commit 3e22d4e5fc)
2012-02-15 14:51:37 -08:00
Ian Romanick
efca49fd51 glapi: Include GLES2 headers for ES2 extension functions
This fixes build errors like

In file included from glapi_dispatch.c:91:
../../../src/mapi/glapi/glapitemp.h:4641: error: no previous prototype for
'glDrawBuffersNV'

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Lucas Stach <dev@lynxeye.de>
(cherry picked from commit 8f3be33985)
2012-02-15 14:51:26 -08:00
Anuj Phogat
d45a5fde45 meta: Avoid FBO resizing/reallocating in decompress_texture_image
Reallocate/resize decompress FBO only if texture image width/height is
greater than existing decompress FBO width/height.

This is a candidate for stable branches.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 66bf25f1a2)
2012-02-15 14:48:59 -08:00
Paul Berry
e55f2d97f6 i915: Fix type of "specoffset" variable.
Commit 2e5a1a2 (intel: Convert from GLboolean to 'bool' from
stdbool.h.) converted the "specoffset" local variable (in
intel_tris.c) from a GLboolean to a bool.  However, GLboolean was the
wrong type for specoffset--it should have been a GLuint (to match the
declaration of specoffset in struct intel_context).

This patch changes specoffset to the proper type.

Fixes piglit test general/two-sided-lighting-separate-specular.

This is a candidate for stable branches.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45917
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 6b0a07f9ce)
2012-02-15 14:48:20 -08:00
Mathias Fröhlich
6e09d3cff2 state_stracker: Fix access to uninitialized memory.
Fix an access to uninitialized memory pointed out by valgrind in
glsl_to_tgsi_visitor::simplify_cmp(void).

Note: This is a candidate for the 8.0 branch.
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
(cherry picked from commit 1d01429c6a)
2012-02-15 14:45:06 -08:00
Eric Anholt
99f9c9789a i965/fs: Enable register spilling on gen7 too.
It turns out the same messages work on gen7, we were just being paranoid.

Fixes the penumbra shadows mode of Lightsmark since the register
allocation fix.

NOTE: This is a candidate for release branches.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 93831a54c7)
2012-02-14 17:53:14 -08:00
Eric Anholt
a63d79dd40 i965: Report the failure message when failing to compile the fragment shader.
We just abort later, but at least this should result in more
informative bug reports.

NOTE: This is a candidate for release branches.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit a7f46eadea)
2012-02-14 17:53:07 -08:00
Anuj Phogat
ff7ccb1cf1 meta: Add pixel store/pack operations in decompress_texture_image
This patch adds the pixel store operations in decompress_texture_image().
decompress_texture_image() is used in glGetTexImage() for compressed
textures with unsigned, normalized values.

It also fixes the failures in intel oglconform pxstore-gettex due to
following sub test cases:

 - Test all mipmaps with byte swapping enabled
 - Test all small mipmaps with all allowable alignment values
 - Test subimage packing for all mipmap levels

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

Note: This is a candidate for stable branches

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 4042702591)
2012-02-14 17:52:50 -08:00
Dave Airlie
9e98d38e58 st/mesa: only resolve if number of samples is > 1
Marek: this fixes a firefox crash and maybe even:
https://bugs.freedesktop.org/show_bug.cgi?id=45943

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Marek Olšák <maraeo@gmail.com>
(cherry picked from commit 094eeff199)
2012-02-14 17:52:32 -08:00
Brian Paul
a2186a2ea6 swrast: fix span color type selection
Fixes a regression from commit 660ed923de.
The basic idea is to look at the format of the dest renderbuffer and
choose either GLubyte or GLfloat for colors.  The previous code used
_mesa_format_to_type_and_comps() which could return a bunch types other
than ubyte/float.

Determine the datatype at renderbuffer mapping time to avoid frequent
calls to the format query functions.

NOTE: This is a candidate for the 8.0 branch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45578
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45577
(cherry picked from commit bd1ae51b13)
2012-02-14 17:51:39 -08:00
Kenneth Graunke
be1377c33c i965: Fix border color on Ironlake.
Ironlake appears to check our pointer against the General State Base
Address upper bound, rather than ignoring the zero bound as it ought.

Unfortunately, since we leave GSBA set to zero, there is no logical
upper bound.  Set it to the maximum possible value, which should work
since our virtual addresses only go up to 2GB.

+94 piglits.

NOTE: This is a candidate for stable release branches.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=28924
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 3340b47c22)
2012-02-14 17:51:22 -08:00
Brian Paul
9489ce6e06 mesa: fix proxy texture target initialization
The mapping from TEXTURE_x_INDEX to GL_TEXTURE_x was broken in
alloc_proxy_textures() because the elements in the targets[] array
were in the wrong order.

This didn't actually cause any failures since we never really use the
proxy texture's Target field.  But let's get it right.

NOTE: This is a candidate for the 8.0 branch.
(cherry picked from commit d925b0d4a7)
2012-02-14 17:50:11 -08:00
Chad Versace
c1dd6ddfd0 i965: Remove file i965/junk, accidentally added in 7b36c68
(cherry picked from commit b44c459cc3)
2012-02-14 11:07:24 -08:00
Eric Anholt
3d3bd0e917 i965: Fix HiZ change compiler warning.
(cherry picked from commit 94866ffbb8)
2012-02-14 11:07:19 -08:00
Chad Versace
e1f9820b47 i965: Rewrite the HiZ op
This is a combination of 4 commits. The first commit rewrites the HiZ op,
and remaining three fix bugs introduced by the rewrite.

======== commit 1 ========

i965: Rewrite the HiZ op

The HiZ op was implemented as a meta-op. This patch reimplements it by
emitting a special HiZ batch. This fixes several known bugs, and likely
a lot of undiscovered ones too.

==== Why the HiZ meta-op needed to die ====

The HiZ op was implemented as a meta-op, which caused lots of trouble. All
other meta-ops occur as a result of some GL call (for example, glClear and
glGenerateMipmap), but the HiZ meta-op was special. It was called in
places that Mesa (in particular, the vbo and swrast modules) did not
expect---and were not prepared for---state changes to occur (for example:
glDraw; glCallList; within glBegin/End blocks; and within
swrast_prepare_render as a result of intel_miptree_map).

In an attempt to work around these unexpected state changes, I added two
hooks in i965:
  - A hook for glDraw, located in brw_predraw_resolve_buffers (which is
    called in the glDraw path). This hook detected if a predraw resolve
    meta-op had occurred, and would hackishly repropagate some GL state
    if necessary. This ensured that the meta-op state changes would not
    intefere with the vbo module's subsequent execution of glDraw.
  - A hook for glBegin, implemented by brwPrepareExecBegin. This hook
    resolved all buffers before entering
    a glBegin/End block, thus preventing an infinitely recurring call to
    vbo_exec_FlushVertices. The vbo module calls vbo_exec_FlushVertices to
    flush its vertex queue in response to GL state changes.

Unfortunately, these hooks were not sufficient. The meta-op state changes
still interacted badly with glPopAttrib (as discovered in bug 44927) and
with swrast rendering (as discovered by debugging gen6's swrast fallback
for glBitmap). I expect there are more undiscovered bugs. Rather than play
whack-a-mole in a minefield, the sane approach is to replace the HiZ
meta-op with something safer.

==== How it was killed ====

This patch consists of several logical components:
  1. Rewrite the HiZ op by replacing function gen6_resolve_slice with
     gen6_hiz_exec and gen7_hiz_exec. The new functions do not call
     a meta-op, but instead manually construct and emit a batch to "draw"
     the HiZ op's rectangle primitive. The new functions alter no GL
     state.
  2. Add fields to brw_context::hiz for the new HiZ op.
  3. Emit a workaround flush when toggling 3DSTATE_VS.VsFunctionEnable.
  4. Kill all dead HiZ code:
     - the function gen6_resolve_slice
     - the dirty flag BRW_NEW_HIZ
     - the dead fields in brw_context::hiz
     - the state packet manipulation triggered by the now removed
       brw_context::hiz::op
     - the meta-op workaround in brw_predraw_resolve_buffers (discussed
       above)
     - the meta-op workaround brwPrepareExecBegin (discussed above)

Note: This is a candidate for the 8.0 branch.
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43327
Reported-by: xunx.fang@intel.com
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44927
Reported-by: chao.a.chen@intel.com
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit 7b36c68ba6)

======== commit 2 ========

i965/gen7: Fix GPU hangs from the HiZ op.

The wm max threads is in the same dword as the dispatch enable.  The
hardware gets super angry if you set max threads to 0, even if you
aren't dispatching threads.
(cherry picked from commit e5b225afbd)

======== commit 3 ========

i965/gen7: Fix the length of the DS state packet in the HiZ op.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit cdcfaa64e3)

======== commit 4 ========

i965/gen7: Fix the length of the MULTISAMPLE state packet in the HiZ op.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit a7750c9fb5)
2012-02-14 10:50:42 -08:00
Brian Paul
65526d54aa docs: remove link to the GLSL compiler page
The page is terribly out of date.
2012-02-09 18:08:02 -07:00
Brian Paul
6aa9ce2687 docs: add VMware link 2012-02-09 18:07:47 -07:00
Brian Paul
14cf3dd826 docs: update info about supported systems, GPUs, APIs
Add link to Intel's Linux graphics page, etc.
2012-02-09 18:07:22 -07:00
Brian Paul
7aef839760 docs: add news item for 8.0 release 2012-02-09 15:52:13 -07:00
Ian Romanick
fb56b0972d docs: Add 8.0 MD5 checksums
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2012-02-09 14:28:58 -08:00
Ian Romanick
f9c9933f9c mesa: Bump version number to 8.0 (final)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2012-02-09 14:26:15 -08:00
Anuj Phogat
b2b5d6b8fb mesa: fix maximum allowed proxy texture size condition
width, height parameter in glTexImage2D() includes: texture image
width + 2 * border (if any). So when doing the texture size check
in _mesa_test_proxy_teximage() width and height should not exceed
maximum supported size for target texture type + 2 * border.
i.e. 1 << (ctx->Const.MaxTextureLevels - 1) + 2 * border

Texture border is anyway stripped out before it is given to intel
or gallium drivers.

This patch fixes Intel oglconform test case:
max_values negative.textureSize.textureCube
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44970

Note: This is a candidate for mesa 8.0 branch.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit ea228d97f8)
2012-02-09 13:16:07 -08:00
Eric Anholt
e86d90eb20 dri: Add Unigine Tropics as an app that requires the GLSL warn workaround.
I wasn't seeing it be needed because of the previous bug.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
(cherry picked from commit b8c9252570)
2012-02-07 16:18:32 -08:00
Eric Anholt
1531b94471 dri: Fix typo in xml file that made all applications use the workaround.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
(cherry picked from commit 4dd2743d45)
2012-02-07 16:18:32 -08:00
Eric Anholt
b5efe0881e dri: Add a default drirc to be installed to provide application workarounds.
Specifially, this being present works around a bug in Unigine
Sanctuary on i965 which previously resulted in bad rendering.

NOTE: This is a candidate for the 8.0 branch.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit ff2497dca3)

NOTE: Compared to ff2497d this does not install the default drirc.
The pre-automake build system is sufficiently braindamaged to make
this exceptionally difficult.
2012-02-07 16:17:33 -08:00
Chih-Wei Huang
73e15679ce vbo: fix a building error
Signed-off-by: Marek Olšák <maraeo@gmail.com>

NOTE: This is a candidate for the 8.0 branch.
(cherry picked from commit f8be4f33d3)
2012-02-07 10:26:17 -08:00
Eric Anholt
974a67b41e glsl: Add error case for switch() with two default cases.
Fixes piglit switch-case-duplicated.vert.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 57e44371a5)
2012-02-07 10:26:17 -08:00
Eric Anholt
83075bd0fe glsl: Throw an error when faced with a duplicated switch() case label.
The error message I chose matches gcc's error.  Fixes piglit
switch-case-duplicated.vert.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 140632190c)
2012-02-07 10:26:17 -08:00
Eric Anholt
d799a7b585 glsl: Add other missing error location information for switch statements.
NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 01a5a2c9d7)
2012-02-07 10:26:17 -08:00
Eric Anholt
2b4df494b1 glsl: Add missing location info to case labels.
Otherwise, the upcoming error messages said the location was 0:0(0).

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 663dcbbffe)
2012-02-07 10:26:17 -08:00
Eric Anholt
728bda08d8 glsl: Throw the required error when a case label is a non-constant.
It's not quite spelled out in the spec text, but the grammar indicates
that only constant values are allowed as switch() case labels (and
only constant values make sense, anyway).

Fixes piglit glsl-1.30/compiler/switch-statement/switch-case-uniform-int.vert.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 2c3e10e719)
2012-02-07 10:26:16 -08:00
Eric Anholt
f775d9aa84 glsl: Save and restore the whole switch state for nesting.
This stuffs them all in a struct for sanity.  Fixes piglit
glsl-1.30/execution/switch/fs-uniform-nested.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 22d81f154f)
2012-02-07 10:26:16 -08:00
Eric Anholt
6887ec766b mesa: Fix the error message function names for glFlushMappedBufferRange().
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 27af00eac8)
2012-02-07 10:26:16 -08:00
Eric Anholt
6d82dc18f1 mesa: Fix bad-enum/no-buffer error handling for buffer object functions.
For all the extension entrypoints using the get_buffer() helper, they
wanted the same error handling.  In some cases, the error was doing
the same error return whether target was a bad enum, or a user buffer
wasn't bound.

(Actually, GL_ARB_map_buffer_range doesn't specify the error for a zero
buffer being bound for MapBufferRange, though it does for
FlushMappedBufferRange.  This appears to be an oversight).

Fixes piglit GL_ARB_copy_buffer/negative-bound-zero.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit f20fb80a91)
2012-02-07 10:26:16 -08:00
Carl Worth
02962ea086 glsl: Avoid ralloc_stealing a long-lived object to a short-lived parent
In commit 6ecee54a9a a call to
talloc_reference was replaced with a call to talloc_steal. This was in
preparation for moving to ralloc which doesn't support reference
counting.

The justification for talloc_steal within token_list_append in that
commit is that the tokens are being copied already. But the copies are
shallow, so this does not work.

Fortunately, the lifetime of these tokens is easy to understand. A
token list for "replacements" is created and stored in a hash table
when a function-like macro is defined. This list will live until the
macro is #undefed (if ever).

Meanwhile, a shallow copy of the list is created when the macro is
used and the list expanded. This copy is short-lived, so is unsuitable
as a new parent.

So we can just let the original, longer-lived owner continue to own
the underlying objects and things will work.

This fixes bug #45082:

	"ralloc.c:78: get_header: Assertion `info->canary == 0x5A1106'
	failed." when using a macro in GLSL
	https://bugs.freedesktop.org/show_bug.cgi?id=45082

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>

NOTE: This is a candidate for stable release branches.
(cherry picked from commit cd2e2187cb)
2012-02-07 10:26:16 -08:00
Brian Paul
358389fe59 mesa: reference shared state in glPushAttrib(GL_TEXTURE_BIT)
This fixes a dangling texture object pointer bug hit via wglShareLists().
When we push the GL_TEXTURE_BIT state we may push references to the default
texture objects which are owned by the gl_shared_state object.  We don't
want to accidentally delete that shared state while the attribute stack
references shared objects.  So keep a reference to it.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit a1471e4877)
2012-02-07 10:23:43 -08:00
Brian Paul
2ed8367d72 mesa: use new _mesa_reference_shared_state() function
This cleans up the reference counting of shared context state.
The next patch will use this to fix an actual bug.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit 361cd53a77)
2012-02-07 10:23:43 -08:00
Eric Anholt
f723df005c i965: Add a driconf option to force GLSL extension behavior to "warn".
This can be used to work around broken application behavior, like in
Unigine where it attempts to use texture arrays without declaring
either "#extension GL_EXT_texture_array : enable" or "#version 130".

NOTE: This is a candidate for the 8.0 branch.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 642247883f)
2012-02-07 10:20:07 -08:00
Eric Anholt
92d842c073 mesa: Add a flag for forcing all GLSL extensions to "warn".
NOTE: This is a candidate for the 8.0 branch.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit b9e27cc142)
2012-02-07 10:20:07 -08:00
Eric Anholt
1b5e151ffa i965/vs: Avoid allocating registers in to the gen7 MRF hack region.
This is the corresponding fix to the previous one for the FS, but I
don't have a particular test for it.

NOTE: This is a candidate for the 8.0 branch.
(cherry picked from commit 9195191e50)
2012-02-07 10:20:07 -08:00
Chad Versace
20da01fecd swrast: Fix fixed-function fragment processing
On i965, _mesa_ir_link_shader is never called. As a consequence, the
current fragment program (ctx->FragmentProgram->_Current) exists but is
invalid because it has no instructions. Yet swrast continued to attempt to
use the empty program.

To avoid using the empty program, this patch 1) defines a new function,
_swrast_use_fragment_program, which checks if the current fragment program
exists and differs from the fixed function fragment program, and, when
appropriate, 2) replaces checks of the form
    if (ctx->FragmentProgram->_Current == NULL)
with
    if (_swrast_use_fragment_program(ctx))

Fixes the following oglconform regressions on i965/gen6:
    api-fogcoord(basic.allCases.log)
    api-mtexcoord(basic.allCases.log)
    api-seccolor(basic.allCases.log)
    api-texcoord(basic.allCases.log)
    blend-separate(basic.allCases)
    colorsum(basic.allCases.log)

The tests were ran with the GLXFBConfig:
    visual  x   bf lv rg d st  colorbuffer  sr ax dp st accumbuffer ms  cav
  id dep cl sp  sz l  ci b ro  r  g  b  a F gb bf th cl  r  g  b  a ns b eat
----------------------------------------------------------------------------
0x021 24 tc  0  32  0 r  y .   8  8  8  8 .  .  0 24 8  0  0  0  0  0 0 None

(Note: I originally believed that the hunk in
_swrast_update_fragment_program was unnecessary. But it is required to fix
blend-separate.)

Note: This is a candidate for the 8.0 branch.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43327
Reveiwed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit 1c0f1dd42a)
2012-02-07 10:20:07 -08:00
Eric Anholt
203ef2a12b mesa: Don't round-trip integer texture data through a floating point temp.
This was losing bits of precision.  Fixes (with the previous commits):
piglit EXT_texture_integer/getteximage-clamping
piglit EXT_texture_integer/getteximage-clamping GL_ARB_texture_rg
oglc advanced.mipmap.upload

Regresses oglc negative.typeFormatMismatch.teximage from fail to
abort, because it's been hitting texstore for a format/type combo that
shouldn't happen.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 5f65598cc7)
2012-02-07 10:20:07 -08:00
Eric Anholt
05ff4d209d mesa: When unpacking signed integer pixel data, don't clamp to 0.
In the core, we always treat spans of int/uint data as uint, so this
extract function was truncating storage of integer pixel data to a n
int texture to (0, max_int) instead of (min_int, max_int).  There is
probably missing code for handling truncation on conversion between
pixel formats, still, but this does improve things.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit dadbec1e90)
2012-02-07 10:20:07 -08:00
Eric Anholt
c1ccb52c72 mesa: Add clamping for packing of integer data.
Mostly fixes piglit EXT_texture_integer/getteximage-clamping.  The
remaining failure involves precision loss on storing of int32 texture
data (something I knew was an issue, but wasn't trying to test).

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 8b97bb02fb)
2012-02-07 10:20:07 -08:00
Eric Anholt
35af090907 mesa: Add missing format unpack for some integer texture formats.
This cut and paste is pretty awful.  I'm tempted to do a lot of this
using preprocessor tricks for customizing the parameter type from a
template function, but that's just a different sort of hideous.

Fixes 8 Intel oglconform int-textures cases.

NOTE: This is a candidate for the 8.0 branch.
v2: Add alpha formats, too.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit de24ccabd6)
2012-02-07 10:20:06 -08:00
Eric Anholt
80cd02f517 i965: Don't allow rendering to non-GL_RED/RG/RGBA integer textures.
Fixes piglit EXT_texture_integer/fbo-blending.
(cherry picked from commit 3a8cf3357a)
2012-02-07 10:20:06 -08:00
Eric Anholt
0749290d69 intel: Pass the gl_renderbuffer to render_target_supported() vtable method.
I'm going to want to go looking at it for an integer texture fix.

NOTE: This is a candidate for the 8.0 branch.
(cherry picked from commit 796f44d779)
2012-02-07 10:20:06 -08:00
Eric Anholt
f62c8648d3 intel: Make a renderbuffer wrapping a texture have the same _BaseFormat.
Otherwise, when you asked for the _BaseFormat of an rb wrapping a
GL_RGB texture, you got GL_RGBA because that's what we were storing
the texture data as.

NOTE: This is a candidate for the 8.0 branch.
(cherry picked from commit 7cac88679b)
2012-02-07 10:20:06 -08:00
Eric Anholt
869728bd99 intel: Simplify intel_renderbuffer_update_wrapper() by passing in the image.
NOTE: This is a candidate for the 8.0 branch.
(cherry picked from commit b73f5df648)
2012-02-07 10:20:05 -08:00
Eric Anholt
1100a19da8 intel: Drop intel_wrap_miptree().
Most of this function was just calling
intel_renderbuffer_update_wrapper(), which was called immediately
afterwards in the only caller.

NOTE: This is a candidate for the 8.0 branch.
(cherry picked from commit 74484c5d41)
2012-02-07 10:20:05 -08:00
Yuanhan Liu
f811d501b6 i965: fix inverted point sprite origin when rendering to FBO
When rendering to FBO, rendering is inverted. At the same time, we would
also make sure the point sprite origin is inverted. Or, we will get an
inverted result correspoinding to rendering to the default winsys FBO.

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

NOTE: This is a candidate for stable release branches.

v2: add the simliar logic to ivb, too (comments from Ian)
    simplify the logic operation (comments from Brian)

v3: pick a better comment from Eric
    use != for the logic instead of ^ (comments from Ian)

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit eaf360e5bf)
2012-02-07 10:09:02 -08:00
Eric Anholt
ecd0d46070 i965/fs: Fix rendering corruption in unigine tropics.
We were allocating registers into the MRF hack region, resulting in
sparkly renering in a few of the scenes.  We could do better
allocation by making an MRF class, having MRFs conflict with the
corresponding GRFs, and tracking the live intervals of the "MRF"s and
setting up the conflicts.  But this is way easier for the moment.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit e910241e97)
2012-02-07 10:07:41 -08:00
Ian Romanick
cf4a7c41f6 intel: Avoid divide by zero for very small linear blits
If size is small (such as 1),

   pitch = ROUND_DOWN_TO(MIN2(size, (1 << 15) - 1), 4);

makes pitch = 0.  Then

   height = size / pitch;

causes a division-by-zero exception.  If pitch is zero, set height to
1 and avoid the division.

This fixes piglit's bin/getteximage-formats test and glean's
bufferObject test.

NOTE: This is a candidate for the 8.0 release branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44971
(cherry picked from commit d59466279e)
2012-02-07 10:02:23 -08:00
Ian Romanick
74a5f03066 intel: Remove num_mapped_regions assertion from _intel_batchbuffer_flush
There are cases where a buffer can be mapped while another buffer is
flushed.  This can happen in the CopyPixels meta-op path for piglit's
fbo-mipmap-copypix.  After some discussion with Eric, it seems this
assertion is no longer necessary, and it has always been too strict.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43328
Cc: Eric Anholt <eric@anholt.net>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit 65b096aedd)
2012-02-07 10:02:18 -08:00
Ian Romanick
65b500857e intel: FBOs with texture border are unsupported
FBOs differ from textures in a significant way.  With textures, we can
strip the border and get correct rendering except when the application
fetches texels outside [0,1].

With an FBO, the pixel at (0,0) is in the border.  The
ARB_framebuffer_object spec says:

    "If the attached image is a texture image, then the window
    coordinates (x[w], y[w]) correspond to the texel (i, j, k), from
    figure 3.10 as follows:

                           i = (x[w] - b)

                           j = (y[w] - b)

                           k = (layer - b)

    where <b> is the texture image's border width..."

Since the border doesn't exist, we can never render any pixels in the
correct location.  Just mark these FBOs FRAMEBUFFER_UNSUPPORTED.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42336
(cherry picked from commit 87b4c9b322)
2012-02-03 11:08:40 -07:00
Carl Worth
c231482725 glcpp: Fix so that trailing punctuation does not prevent macro expansion
The trick here is that flex always chooses the rule that matches the most
text. So with a input text of "two:" which we want to be lexed as an
IDENTIFIER token "two" followed by an OTHER token ":" the previous OTHER
rule would match longer as a single token of "two:" which we don't want.

We prevent this by forcing the OTHER pattern to never match any
characters that appear in other constructs, (no letters, numbers, #,
_, whitespace, nor any punctuation that appear in CPP operators).

Fixes bug #44764:

	GLSL preprocessor doesn't replace defines ending with ":"
	https://bugs.freedesktop.org/show_bug.cgi?id=44764

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>

NOTE: This is a candidate for stable release branches.
(cherry picked from commit 7ab1c7f792)
2012-02-03 11:08:26 -07:00
Ville Syrjala
50a8b9971e gallium/dri: Handle xserver that doesn't send needless DRI2 invalidate events
Ever since xserver commit 531869448d07e00ae241120b59f3aaaa5709d59c,
the server no longer sends invalidate events to clients, unless they
have performed a GetBuffers request since the drawable was last
invalidated.

If the drawable gets invalidated immediately after the GetBuffers
request was processed by the X server, it's possible that Xlib
will process the invalidate event while waiting for the GetBuffers
reply. So the server, thinking the client knows that the buffers
are invalid, is waiting for another GetBuffers request before
sending any more invalidate events. The client, on the other hand,
believes the buffers to be valid, and thus is expecting to receive
another invalidate event before it has to send another GetBuffers
request. The end result is that the client never again sends
a GetBuffers request.

To avoid this problem, take a snapshot of the lastStamp before
doing GetBuffers, and retry if the snapshot and the current
lastStamp no longer match after the GetBuffers reply has been
processed.

Signed-off-by: Ville Syrjälä <syrjala@sci.fi>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 0fcc518964)
2012-02-03 12:05:36 +00:00
Brian Paul
a4cb2fdb64 gallium/postprocess: move declarations before code
To fix MSVC build.
(cherry picked from commit 8cbe699c0d)
2012-02-02 15:22:17 -07:00
Lauri Kasanen
1c403f4999 gallium/postprocess: Just to be safe, reference all buffers from outside
Even though it should be safe to use them for one frame, better be sure.
Suggested by Michael Dänzer.

NOTE: This is a candidate for the 8.0 stable branch.

Signed-off-by: Lauri Kasanen <cand@gmx.com>
(cherry picked from commit 81938d2137)
2012-02-02 17:09:29 -05:00
Lauri Kasanen
ad83ddc868 gallium/postprocess: Fix depth logic
This prevents a possible lapse of the depth buffer - the situation where
the app and pp have different depth buffers.

NOTE: This is a candidate for the 8.0 stable branch.

Signed-off-by: Lauri Kasanen <cand@gmx.com>
(cherry picked from commit c5976017e3)
2012-02-02 17:09:16 -05:00
Michel Dänzer
ac089040d7 gallium/postprocess: Proper reference counting of pp_jimenezmlaa depth buffer.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=40776

NOTE: This is a candidate for the stable branches.
(cherry picked from commit 7219af5ec1)
2012-02-02 17:08:06 -05:00
Paul Berry
0e08205421 i965/gen6: Fix segfault in transform feedback to DYNAMIC_DRAW buffers.
When storing data in a buffer of type DYNAMIC_DRAW, we don't create a
drm_intel_bo for it; instead we store the data in system memory and
defer allocation of the GPU buffer until it is needed.  Therefore, in
brw_update_sol_surface(), we can't just consult the "buffer" field of
the intel_buffer_object structure; we need to call
intel_bufferobj_buffer() to ensure that the deferred allocation
occurs.

This parallels a similar fix for gen7 (see commit ba6f4c9).

Fixes piglit test EXT_transform_feedback/buffer-usage on gen6.

This is a candidate for the 8.0 release branch.

Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 6bc08ee569)
2012-02-02 11:39:28 -07:00
Paul Berry
cc27a42b6f i965/vs: Fix bogus assertion in emit_block_move()
i965 processes assignments of whole structures using
vec4_visitor::emit_block_move, a recursive function which visits each
element of a structure or array (to arbitrary nesting depth) and
copies it from the source to the destination.  Then it increments the
source and destination register numbers so that further recursive
invocations will copy the rest of the structure.  In addition, it sets
the swizzle field for the source register to an appropriate value of
swizzle_for_size(...) for the size of each element being copied, so
that later optimization passes won't be fooled into thinking that
unused vector elements are live.

This all works fine.  However, emit_block_move also contains an
assertion to verify, before setting the swizzle field for the source
register, that the source register doesn't already contain a
nontrivial swizzle.  The intention is to make sure that the caller of
emit_block_move hasn't already done some swizzling of the data before
the call, which emit_block_move would then counteract when it
overwrites the swizzle field.  But the assertion is at the lowest
level of nesting of emit_block_move, which means that after the first
element is copied, instead of checking the swizzle field set by the
caller, it checks the swizzle field used when moving the previous
element.  That means that if the structure contains elements of
different vector sizes (which therefore require different swizzles),
the assertion will erroneously fire.

This patch moves the assertion from emit_block_move to the calling
function, vec4_visitor::visit(ir_assignment *).  Since the caller is
non-recursive, the assertion will only happen once, and won't be
fooled by emit_block_move's modification of the swizzle field.

This patch also reverts commit fe006a7 (i965/vs: Fix swizzle related
assertion), which attempted to fix the bug by making the assertion
more lenient, but only worked properly for structures, arrays, and
matrices in which each constituent vector is the same size.

This fixes the problem described in comment 9 of
https://bugs.freedesktop.org/show_bug.cgi?id=40865.  Unfortunately, it
doesn't fix the whole bug, since the test in question is also failing
due to lack of register spilling support in the VS.

Fixes piglit test vs-assign-varied-struct.  No piglit regressions on
Sandy Bridge.

This is a candidate for the 8.0 release branch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40865#c9
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit e2274aa739)
2012-02-02 11:37:21 -07:00
Eric Anholt
67937502f5 mesa: Fix display list handling for GL_EXT_framebuffer_multisample.
From the extension spec:

    Added to section 5.4, as part of the discussion of which commands
    are not compiled into display lists:

    "Certain commands, when called while compiling a display list, are
    not compiled into the display list but are executed immediately.
    These are: ..., RenderbufferStorageMultisampleEXT..."

Fixes piglit EXT_framebuffer_multisample/dlist.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 3d8c27f882)
2012-02-02 11:28:25 -07:00
Eric Anholt
1a77654e6a mesa: Fix display list handling for EXT_framebuffer_object.
Noticed when handling a similar problem in EXT_framebuffer_multisample.

From the EXT_framebuffer_object spec:

    Added to section 5.4, as part of the discussion of which commands
    are not compiled into display lists:

    "Certain commands, when called while compiling a display list, are
    not compiled into the display list but are executed immediately.
    These are: ..., GenFramebuffersEXT, BindFramebufferEXT,
    DeleteFramebuffersEXT, CheckFramebufferStatusEXT,
    GenRenderbuffersEXT, BindRenderbufferEXT, DeleteRenderbuffersEXT,
    RenderbufferStorageEXT, FramebufferTexture1DEXT,
    FramebufferTexture2DEXT, FramebufferTexture3DEXT,
    FramebufferRenderbufferEXT, GenerateMipmapEXT..."

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 25dd80555d)
2012-02-02 11:28:17 -07:00
Anuj Phogat
b38640082c mesa: fix maximum allowed proxy texture size condition
width, height parameter in glTexImage2D() includes: texture image
width + 2 * border (if any). So when doing the texture size check
in _mesa_test_proxy_teximage() width and height should not exceed
maximum supported size for target texture type.
i.e. 1 << (ctx->Const.MaxTextureLevels - 1)

Texture border is anyway stripped out before it is given to intel
or gallium drivers.

This patch fixes Intel oglconform test case: max_values
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44970

Note: This is a candidate for mesa 8.0 branch.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
(cherry picked from commit 15986d21eb)
2012-02-02 11:21:20 -07:00
Anuj Phogat
736f1e53e4 mesa: set clamp bit in glGetTexImage for GL_UNSIGNED_NORMALIZED
Color clamping should be enabled in glGetTexImage if texture dataType is
GL_UNSIGNED_NORMALIZED and format is GL_LUMINANCE or GL_LUMINANCE_ALPHA

Fixes 2 Intel oglconform test cases: pxconv-gettex and pxtrans-gettex
https://bugs.freedesktop.org/show_bug.cgi?id=40864

NOTE: This is a candidate for the 8.0 branch

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 5665b5cc31)
2012-02-02 11:21:07 -07:00
Ian Romanick
d45d250ad1 mesa: Fix copy-and-paste error in _mesa_pack_rgba_span_float
GL_RG_INTEGER only has two components, not three.  I'll be surprised
if anyone ever tries to glReadPixels(..., GL_SHORT, GL_RG_INTEGER,
...).  This was found by inspection.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 2e8f8cb383)
2012-02-02 10:17:49 -07:00
Ian Romanick
4635e26db2 mesa: Fix copy-and-paste bug in do_row_3D
Several of the half-float cases used 4 as the texel size when it
should have been some smaller value.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43324
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43325
(cherry picked from commit 5c341b7df3)
2012-02-02 10:17:49 -07:00
Ian Romanick
65b9c1dee6 mesa: Convert colors if span ChanType and renderbuffer data type don't match
This is a partial revert of f9874fe.  It turns out that the types
don't always match.  Specifically, this can happen when doing
glCopyPixels from a float FBO to a RGBA8 FBO.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45429
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 660ed923de)
2012-02-02 10:17:49 -07:00
Ian Romanick
c34947dbb1 mesa: Set the gl_array_object::ARBsemantics flag at the right time
With 0963990 the flag was only set when Bind created the object.  In
all cases where ::ARBsemantics could be true, this path never
happened.  Instead, add a _Used flag to track whether a VAO has ever
been bound.  On the first Bind, set the _Used flag, and set the
ARBsemantics flag to the correct value.

NOTE: This is a candidate for release branches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45423
(cherry picked from commit e06b1c65bc)
2012-02-02 10:17:49 -07:00
Ian Romanick
9da7b58b39 mesa: Add unpack_uint_z_row support for floating-point depth buffers
This is a hack, and it will result in incorrect rendering.  However,
it does eliminate spurious warnings in several piglit CopyPixels tests
that involve floating-point depth buffers.

The real solution is to add a zf field to SWspan to store float Z
values.  When a float depth buffer is involved, swrast should also
populate the zf field.  I'll consider this post-8.0 work.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit af1477b088)
2012-02-02 10:17:48 -07:00
José Fonseca
5ac4c8cf53 mapi/glapi: Never use a generic no-op entry-point on Windows.
When GLAPIENTRY is __stdcall (ie Windows), the stack is popped by the
callee making the number/type of arguments significant, therefore
using a generic no-op causes stack corruption for many entry-points.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
2012-02-02 15:43:10 +00:00
Ian Romanick
7f5d3f7ed2 meta: Fallback for glBlitFramebuffer from a multisample surface
NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44818
(cherry picked from commit b48d4b64e9)
2012-02-01 09:23:32 -07:00
Eric Anholt
442dc31fa7 intel: Fix accum buffer mapping since the swrast rework.
A pure swrast-allocated buffer gets an irb of NULL, so we segfaulted
in the clear-accum test.  Just look at the swrast renderbuffer pointer
for handling swrast rbs.
(cherry picked from commit 42e9936ce6)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45428
2012-01-31 09:39:10 -07:00
Brian Paul
3ad7f44926 osmesa: set RefCount = 1 in new_osmesa_renderbuffer()
This was lost during the renderbuffer overhaul work.  Fixes a failed
refcount assertion.
(cherry picked from commit 3fc6e4e025)
2012-01-31 07:51:04 -07:00
Vinson Lee
9f0088e906 osmesa: Fix osmesa_context.DataType type.
Fixes these GCC warnings.
osmesa.c: In function ‘osmesa_renderbuffer_storage’:
osmesa.c:417: warning: comparison is always false due to limited range of data type
osmesa.c:423: warning: comparison is always false due to limited range of data type
osmesa.c:431: warning: comparison is always false due to limited range of data type
osmesa.c:437: warning: comparison is always false due to limited range of data type
osmesa.c:447: warning: comparison is always false due to limited range of data type
osmesa.c:453: warning: comparison is always false due to limited range of data type
osmesa.c:463: warning: comparison is always false due to limited range of data type
osmesa.c:466: warning: comparison is always false due to limited range of data type
osmesa.c:476: warning: comparison is always false due to limited range of data type
osmesa.c:479: warning: comparison is always false due to limited range of data type

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Signed-off-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 136791ebc1)
2012-01-31 07:50:51 -07:00
Brian Paul
f893fde63b vega: memset data array to zero to silence uninitialized var warnings
(cherry picked from commit 6386f80dbd)
2012-01-31 07:04:25 -07:00
Brian Paul
6bb4823f7d softpipe: move var initialization to silence warning
(cherry picked from commit 3e01c3f3ba)
2012-01-31 06:55:25 -07:00
Vinson Lee
ddd2503750 softpipe: Silence unused variable warning on non-LLVM builds.
Fix this GCC warning with non-LLVM builds.
sp_screen.c: In function ‘softpipe_get_shader_param’:
sp_screen.c:141:28: warning: unused variable ‘sp_screen’ [-Wunused-variable]

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 8e543cc098)
2012-01-31 06:55:07 -07:00
Benjamin Franzke
5f60d134e6 st/dri: Support 24bit formats in dri2_allocate_buffer
Prior commit 576161289d,
the parameter format was bpp, thus both 24bit and 32bit formats were
requested with format set to 32. Handle 24bit seperately now.

Fixes RGBX formats in wayland platform for egl_dri2 (EGL_ALPHA_SIZE=0).

Note: This is a candidate for the 8.0 branch.
(cherry picked from commit c72d7df168)
2012-01-30 17:22:44 +01:00
Christian König
caebd7929d st/xvmc: remove xorg-server dependency
Fixing a circular build dependency.

NOTE: This is a candidate for the 8.0 branch.

Signed-off-by: Christian König <deathsimple@vodafone.de>
(cherry picked from commit c2e2b58a58)
2012-01-29 00:06:59 +01:00
253 changed files with 5763 additions and 2077 deletions

View File

@@ -184,7 +184,7 @@ ultrix-gcc:
# Rules for making release tarballs
PACKAGE_VERSION=8.0-rc2
PACKAGE_VERSION=8.0.4
PACKAGE_DIR = Mesa-$(PACKAGE_VERSION)
PACKAGE_NAME = MesaLib-$(PACKAGE_VERSION)
@@ -199,6 +199,12 @@ EXTRA_FILES = \
src/glsl/glcpp/glcpp-lex.c \
src/glsl/glcpp/glcpp-parse.c \
src/glsl/glcpp/glcpp-parse.h \
src/mesa/main/api_exec_es1.c \
src/mesa/main/api_exec_es1_dispatch.h \
src/mesa/main/api_exec_es1_remap_helper.h \
src/mesa/main/api_exec_es2.c \
src/mesa/main/api_exec_es2_dispatch.h \
src/mesa/main/api_exec_es2_remap_helper.h \
src/mesa/program/lex.yy.c \
src/mesa/program/program_parse.tab.c \
src/mesa/program/program_parse.tab.h

View File

@@ -334,7 +334,9 @@ case $ARCH in
# environment. If so, pass -m32 flag to linker.
set ${OBJECTS}
ABI32=`file $1 | grep 32-bit`
if [ "${ABI32}" -a `uname -m` = "x86_64" ] ; then
ARM=`file $1 | grep ARM`
# Do not add "-m32" option for arm.
if [ -z "$ARM" -a "${ABI32}" -a `uname -m` = "x86_64" ] ; then
OPTS="-m32 ${OPTS}"
fi
@@ -391,7 +393,9 @@ case $ARCH in
# environment. If so, pass -m32 flag to linker.
set ${OBJECTS}
ABI32=`file $1 | grep 32-bit`
if [ "${ABI32}" -a `uname -m` = "x86_64" ] ; then
ARM=`file $1 | grep ARM`
# Do not add "-m32" option for arm.
if [ -z "$ARM" -a "${ABI32}" -a `uname -m` = "x86_64" ] ; then
OPTS="-m32 ${OPTS}"
fi
if [ "${ALTOPTS}" ] ; then

View File

@@ -9,8 +9,8 @@ INSTALL_DIR = /usr/X11
X11_DIR = $(INSTALL_DIR)
# Compiler and flags
CC = gcc
CXX = g++
CC = $(shell xcrun -find cc)
CXX = $(shell xcrun -find c++)
PIC_FLAGS = -fPIC
DEFINES = -D_DARWIN_C_SOURCE -DPTHREADS -D_GNU_SOURCE \
-DGLX_ALIAS_UNSUPPORTED \
@@ -24,11 +24,14 @@ DEFINES = -D_DARWIN_C_SOURCE -DPTHREADS -D_GNU_SOURCE \
# -DIN_DRI_DRIVER
ARCH_FLAGS += $(RC_CFLAGS)
INCLUDE_FLAGS = -I$(INSTALL_DIR)/include -I$(X11_DIR)/include
OPT_FLAGS = -g3 -gdwarf-2 -Os -ffast-math -fno-strict-aliasing
WARN_FLAGS = -Wall -Wmissing-prototypes
CFLAGS = -ggdb3 -Os -Wall -Wmissing-prototypes -std=c99 -ffast-math -fno-strict-aliasing -fvisibility=hidden \
-I$(INSTALL_DIR)/include -I$(X11_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
CXXFLAGS = -ggdb3 -Os -Wall -fno-strict-aliasing -fvisibility=hidden \
-I$(INSTALL_DIR)/include -I$(X11_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
CFLAGS = -std=c99 -fvisibility=hidden \
$(OPT_FLAGS) $(WARN_FLAGS) $(INCLUDE_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES) $(EXTRA_CFLAGS)
CXXFLAGS = -fvisibility=hidden \
$(OPT_FLAGS) $(WARN_FLAGS) $(INCLUDE_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES) $(EXTRA_CFLAGS)
# Library names (actual file names)
GL_LIB_NAME = lib$(GL_LIB).dylib
@@ -44,10 +47,10 @@ GLW_LIB_GLOB = lib$(GLW_LIB).*dylib
OSMESA_LIB_GLOB = lib$(OSMESA_LIB).*dylib
VG_LIB_GLOB = lib$(VG_LIB).*dylib
GL_LIB_DEPS = -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXext -lm -lpthread
OSMESA_LIB_DEPS =
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXt
GL_LIB_DEPS = -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11-xcb -lxcb -lX11 -lXext $(EXTRA_LDFLAGS)
OSMESA_LIB_DEPS = $(EXTRA_LDFLAGS)
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(EXTRA_LDFLAGS)
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXt $(EXTRA_LDFLAGS)
SRC_DIRS = glsl mapi/glapi mapi/vgapi glx/apple mesa gallium glu
GLU_DIRS = sgi

7
configs/darwin-fat-intel Normal file
View File

@@ -0,0 +1,7 @@
# Configuration for Darwin / MacOS X, making 32bit and 64bit fat dynamic libs for intel
RC_CFLAGS=-arch i386 -arch x86_64
include $(TOP)/configs/darwin
CONFIG_NAME = darwin-fat-intel

View File

@@ -10,7 +10,7 @@ CONFIG_NAME = default
# Version info
MESA_MAJOR=8
MESA_MINOR=0
MESA_TINY=0
MESA_TINY=4
MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)
# external projects. This should be useless now that we use libdrm.

View File

@@ -168,9 +168,6 @@ esac
dnl Add flags for gcc and g++
if test "x$GCC" = xyes; then
CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99"
if test "x$CLANG" = "xno"; then
CFLAGS="$CFLAGS -ffast-math"
fi
# Enable -fvisibility=hidden if using a gcc that supports it
save_CFLAGS="$CFLAGS"
@@ -1566,7 +1563,7 @@ if test "x$enable_gallium_g3dvl" = xyes; then
fi
if test "x$enable_xvmc" = xyes; then
PKG_CHECK_MODULES([XVMC], [xvmc >= 1.0.6 xorg-server])
PKG_CHECK_MODULES([XVMC], [xvmc >= 1.0.6])
GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg/xvmc"
HAVE_ST_XVMC="yes"
fi

View File

@@ -52,7 +52,6 @@ a:visited {
<b>User Topics</b>
<ul>
<li><a href="shading.html" target="MainFrame">Shading Language</a>
<li><a href="egl.html" target="MainFrame">EGL</a>
<li><a href="opengles.html" target="MainFrame">OpenGL ES</a>
<li><a href="openvg.html" target="MainFrame">OpenVG / Vega</a>

View File

@@ -11,6 +11,32 @@
<H1>News</H1>
<h2>March 21, 2012</h2>
<p>
<a href="relnotes-8.0.2.html">Mesa 8.0.2</a> is released.
This is a bug fix release.
</p>
<h2>February 16, 2012</h2>
<p>
<a href="relnotes-8.0.1.html">Mesa 8.0.1</a> is released.
This is a bug fix release.
</p>
<h2>February 9, 2012</h2>
<p>
<a href="relnotes-8.0.html">Mesa 8.0</a> is released.
This is the first version of Mesa to support OpenGL 3.0 and GLSL 1.30
(with the i965 driver).
See the release notes for more information about the release.
</p>
<h2>November 27, 2011</h2>
<p>

153
docs/relnotes-8.0.1.html Normal file
View File

@@ -0,0 +1,153 @@
<HTML>
<head>
<TITLE>Mesa Release Notes</TITLE>
<link rel="stylesheet" type="text/css" href="mesa.css">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 8.0.1 Release Notes / February 16, 2012</H1>
<p>
Mesa 8.0.1 is a bug fix release which fixes bugs found since the 8.0 release.
</p>
<p>
Mesa 8.0 implements the OpenGL 3.0 API, but the version reported by
glGetString(GL_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 3.0.
</p>
<p>
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
for DRI hardware acceleration.
</p>
<h2>MD5 checksums</h2>
<pre>
4855c2d93bd2ebd43f384bdcc92c9a27 MesaLib-8.0.1.tar.gz
24eeebf66971809d8f40775a379b36c9 MesaLib-8.0.1.tar.bz2
54e745d14dac5717f7f65b4e2d5c1df2 MesaLib-8.0.1.zip
</pre>
<h2>New features</h2>
<p>None.</p>
<h2>Bug fixes</h2>
<p>This list is likely incomplete.</p>
<ul>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28924">Bug 28924</a> - [ILK] piglit tex-border-1 fail</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=40864">Bug 40864</a> - [bisected pineview] oglc pxconv-gettex(basic.allCases) fails on pineview</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=43327">Bug 43327</a> - [bisected SNB] HiZ make many oglc cases regressed</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=44333">Bug 44333</a> - [bisected] Color distortion with xbmc mediaplayer</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=44927">Bug 44927</a> - [SNB IVB regression] gl-117 abort when click</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=45221">Bug 45221</a> - [bisected IVB] glean/fbo regression in stencil-only case</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=45877">Bug 45877</a> - main/image.c:1597: _mesa_convert_colors: Assertion `dstType == 0x1406' failed.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=45578">Bug 45578</a> - main/image.c:1659: _mesa_convert_colors: Assertion `dstType == 0x1403' failed.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=45872">Bug 45872</a> - [bisected PNV] oglc mustpass(basic.stipple) regressed on pineview</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=45876">Bug 45876</a> - [PNV]oglc texenv(basic.allCases) regressed on pineview</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=45917">Bug 45917</a> - [PNV] Regression in Piglit test general/two-sided-lighting-separate-specular</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=45943">Bug 45943</a> - [r300g] r300_emit.c:365:r300_emit_aa_state: Assertion `(aa-d&gt;dest)-&gt;cs_buf' failed.</li>
<!-- <li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=">Bug </a> - </li> -->
</ul>
<h2>Changes</h2>
<p>The full set of changes can be viewed by using the following GIT command:</p>
<pre>
git log mesa-8.0..mesa-8.0.1
</pre>
<p>Alex Deucher (2):
<ul>
<li>r600g: fix tex tile_type offset for cayman</li>
<li>r600g: 128 bit formats require tile_type = 1 on cayman</li>
</ul></p>
<p>Anuj Phogat (2):
<ul>
<li>meta: Add pixel store/pack operations in decompress_texture_image</li>
<li>meta: Avoid FBO resizing/reallocating in decompress_texture_image</li>
</ul></p>
<p>Brian Paul (6):
<ul>
<li>docs: add news item for 8.0 release</li>
<li>docs: update info about supported systems, GPUs, APIs</li>
<li>docs: add VMware link</li>
<li>docs: remove link to the GLSL compiler page</li>
<li>mesa: fix proxy texture target initialization</li>
<li>swrast: fix span color type selection</li>
</ul></p>
<p>Chad Versace (2):
<ul>
<li>i965: Rewrite the HiZ op</li>
<li>i965: Remove file i965/junk, accidentally added in 7b36c68</li>
</ul></p>
<p>Dave Airlie (1):
<ul>
<li>st/mesa: only resolve if number of samples is &gt; 1</li>
</ul></p>
<p>Eric Anholt (3):
<ul>
<li>i965: Fix HiZ change compiler warning.</li>
<li>i965: Report the failure message when failing to compile the fragment shader.</li>
<li>i965/fs: Enable register spilling on gen7 too.</li>
</ul></p>
<p>Ian Romanick (4):
<ul>
<li>docs: Add 8.0 MD5 checksums</li>
<li>glapi: Include GLES2 headers for ES2 extension functions</li>
<li>swrast: Only avoid empty _TexEnvPrograms</li>
<li>mesa: Bump version number to 8.0.1</li>
</ul></p>
<p>Kenneth Graunke (4):
<ul>
<li>i965: Fix border color on Ironlake.</li>
<li>i965/fs: Add a new fs_inst::regs_written function.</li>
<li>i965/fs: Take # of components into account in try_rewrite_rhs_to_dst.</li>
<li>i965: Emit Ivybridge VS workaround flushes.</li>
</ul></p>
<p>Mathias Fröhlich (1):
<ul>
<li>state_stracker: Fix access to uninitialized memory.</li>
</ul></p>
<p>Paul Berry (1):
<ul>
<li>i915: Fix type of "specoffset" variable.</li>
</ul></p>
<p>Simon Farnsworth (1):
<ul>
<li>r600g: Use a fake reloc to sleep for fences</li>
</ul></p>
</body>
</html>

160
docs/relnotes-8.0.2.html Normal file
View File

@@ -0,0 +1,160 @@
<HTML>
<head>
<TITLE>Mesa Release Notes</TITLE>
<link rel="stylesheet" type="text/css" href="mesa.css">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 8.0.2 Release Notes / March 21, 2012</H1>
<p>
Mesa 8.0.2 is a bug fix release which fixes bugs found since the 8.0.1 release.
</p>
<p>
Mesa 8.0.2 implements the OpenGL 3.0 API, but the version reported by
glGetString(GL_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 3.0.
</p>
<p>
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
for DRI hardware acceleration.
</p>
<h2>MD5 checksums</h2>
<pre>
70eb3dc74fbfcd72f6776268ee1db52e MesaLib-8.0.2.tar.gz
a368104e5700707048dc3e8691a9a7a1 MesaLib-8.0.2.tar.bz2
d5e5cdb85d2afdbcd1c0623d3ed1c54d MesaLib-8.0.2.zip
</pre>
<h2>New features</h2>
<p>None.</p>
<h2>Bug fixes</h2>
<p>This list is likely incomplete.</p>
<ul>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=38720">Bug 38720</a> - [SNB] Trine triggers a GPU hang</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=40059">Bug 40059</a> - [SNB] hang in "Amnesia: The Dark Descent" demo</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=45216">Bug 45216</a> - [SNB] GPU hang in OilRush</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=46631">Bug 46631</a> - It's really hard to hit the fast path for the fallback glReadPixels code</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=46679">Bug 46679</a> - glReadPixels on a luminance texture returns the wrong values</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=46311">Bug 46311</a> - Missing support of point size in Mesa core</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=46665">Bug 46665</a> - [PNV] webgl conformance case max texture fails</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=45975">Bug 45975</a> - [Gen4 + ILK] render with pointcoord will fail to render</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=46666">Bug 46666</a> - [PNV] webgl conformance case NPOT case fails with TEXTURE_MIN_FILTER set to LINEAR</li>
<!-- <li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=">Bug </a> - </li> -->
</ul>
<h2>Changes</h2>
<p>The full set of changes can be viewed by using the following GIT command:</p>
<pre>
git log mesa-8.0.1..mesa-8.0.2
</pre>
<p>Brian Paul (7):
<ul>
<li>svga: add null vs pointer check in update_need_pipeline()</li>
<li>util: add mutex lock in u_debug_memory.c code</li>
<li>mesa: add _mesa_rebase_rgba_float/uint() functions</li>
<li>mesa: use _mesa_rebase_rgba_float/uint() in glReadPixels code</li>
<li>mesa: use _mesa_rebase_rgba_float/uint() in glGetTexImage code</li>
<li>mesa: fix GL_LUMINANCE handling in glGetTexImage</li>
<li>docs: add links to 8.0.1 release notes</li>
</ul></p>
<p>Daniel Vetter (1):
<ul>
<li>i965: fixup W-tile offset computation to take swizzling into account</li>
<ul></p>
<p>Dylan Noblesmith (1):
<ul>
<li>mesa: add back glGetnUniform*v() overflow error reporting</li>
</ul></p>
<p>Ian Romanick (1):
<ul>
<li>docs: Add 8.0.1 release md5sums</li>
</ul></p>
<p>Jakob Bornecrantz (3):
<ul>
<li>mesa: Include mesa ES mapi generated files</li>
<li>mesa: Bump version number to 8.0.2</li>
<li>docs: Add 8.0.2 release notes</li>
</ul></p>
<p>Jeremy Huddleston (3):
<ul>
<li>darwin: config file cleanups</li>
<li>darwin: Build create_context.c</li>
<li>darwin: Link against libxcb</li>
</ul></p>
<p>José Fonseca (1):
<ul>
<li>svga: Clamp advertised PIPE_SHADER_CAP_MAX_TEMPS to SVGA3D_TEMPREG_MAX.</li>
</ul></p>
<p>Kenneth Graunke (2):
<ul>
<li>i965: Only set Last Render Target Select on the last FB write.</li>
<li>i965: Fix Gen6+ dynamic state upper bound on older kernels.</li>
</ul></p>
<p>Marek Olšák (1):
<ul>
<li>gallium/rtasm: properly detect SSE and SSE2</li>
</ul></p>
<p>Neil Roberts (1):
<ul>
<li>mesa: Don't disable fast path for normalized types</li>
</ul></p>
<p>Tom Stellard (1):
<ul>
<li>r300/compiler: Fix bug when lowering KILP on r300 cards</li>
</ul></p>
<p>Yuanhan Liu (6):
<ul>
<li>mesa: let GL3 buf obj queries not depend on opengl major version</li>
<li>tnl: let _TNL_ATTRIB_POINTSIZE do not depend on ctx-&gt;VertexProgram._Enabled</li>
<li>i915: fix wrong rendering of gl_PointSize on Pineview</li>
<li>i915: move the FALLBACK_DRAW_OFFSET check outside the drawing rect check</li>
<li>i965: handle gl_PointCoord for Gen4 and Gen5 platforms</li>
<li>i915: fallback for NPOT cubemap texture</li>
</ul></p>
<p>Zack Rusin (3):
<ul>
<li>svga: fix a crash happening before setting fragment shaders.</li>
<li>svga: Fix stencil op mapping</li>
<li>svga: fix the rasterizer state resets</li>
</ul></p>
</body>
</html>

319
docs/relnotes-8.0.3.html Normal file
View File

@@ -0,0 +1,319 @@
<HTML>
<head>
<TITLE>Mesa Release Notes</TITLE>
<link rel="stylesheet" type="text/css" href="mesa.css">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 8.0.3 Release Notes / May 18, 2012</H1>
<p>
Mesa 8.0.3 is a bug fix release which fixes bugs found since the 8.0.2 release.
</p>
<p>
Mesa 8.0.3 implements the OpenGL 3.0 API, but the version reported by
glGetString(GL_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 3.0.
</p>
<p>
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
for DRI hardware acceleration.
</p>
<h2>MD5 checksums</h2>
<pre>
b7210a6d6e4584bd852ab29294ce717e MesaLib-8.0.3.tar.gz
cc5ee15e306b8c15da6a478923797171 MesaLib-8.0.3.tar.bz2
32773634a0f7e70a680505a81426eccf MesaLib-8.0.3.zip
</pre>
<h2>New features</h2>
<p>None.</p>
<h2>Bug fixes</h2>
<p>This list is likely incomplete.</p>
<ul>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28138">Bug 28138</a> - [G45] Regnum Online, sparkling in in-game rendering</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=30102">Bug 30102</a> - glean depthStencil test fails BadLength with indirect non-swrast rendering</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=40361">Bug 40361</a> - Glitches on X3100 after upgrade to 7.11</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=41152">Bug 41152</a> - [glsl] Shader backend in Regnum Online does not work</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=41216">Bug 41216</a> - [bisected pineview]oglc filtercubemin(basic.sizedRGBA) fails</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=41372">Bug 41372</a> - i830_state.c PBO crash</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=41495">Bug 41495</a> - i830: intel_get_vb_max / intel_batchbuffer_space mismatch.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=44701">Bug 44701</a> - Regnum online textures flickering</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=44961">Bug 44961</a> - [bisected i965] oglc sRGB(Mipmap.1D_textures) regressed</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=44970">Bug 44970</a> - [i965]oglc max_values(negative.textureSize.textureCube) segfaults</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=45214">Bug 45214</a> - Textures disappearing or missing in RegnumOnline OpenGL game</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=45558">Bug 45558</a> - cannot render on a drawable of size equal the max framebuffer size</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=45921">Bug 45921</a> - [r300g, bisected] Multiple piglit regressions after glsl_to_tgsi changes</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=46303">Bug 46303</a> - [SNB] segfault in intel_miptree_release()</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=46739">Bug 46739</a> - [snb-m-gt2+] compiz crashed with SIGSEGV in intel_miptree_release()</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=46834">Bug 46834</a> - small performance when playing flightgear (swrast fallback through GTT mapping)</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=47126">Bug 47126</a> - tests/fbo/fbo-array.c:109: create_array_fbo: Assertion `glGetError() == 0' failed.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=48218">Bug 48218</a> - brw_fs_schedule_instructions.cpp segfault due to accessing not allocated last_mrf_write[16]</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=48545">Bug 48545</a> - LLVMpipe glReadPixels Firefox hits the slow path (WebGL rendering)</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=49124">Bug 49124</a> - swrast/s_texfetch.c:1156: set_fetch_functions: Assertion `texImage-&gt;FetchTexel' failed.</li>
<!-- <li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=">Bug </a> - </li> -->
</ul>
<h2>Changes</h2>
<p>The full set of changes can be viewed by using the following GIT command:</p>
<pre>
git log mesa-8.0.2..mesa-8.0.3
</pre>
<p>Alban Browaeys (1):
<ul>
<li>dri/i915: Fix off-by-one in i830 clip region size.</li>
</ul></p>
<p>Alex Deucher (2):
<ul>
<li>r200: fix fog coordinate emit</li>
<li>radeon: fix fog coordinate emit</li>
</ul></p>
<p>Alexander von Gluck (4):
<ul>
<li>llvmpipe: fix symbol conflict on Haiku</li>
<li>svga: fix typedef conflicts on Haiku</li>
<li>mesa: Don't use newlocale on Haiku</li>
<li>glsl: Don't use newlocale on Haiku</li>
</ul></p>
<p>Anuj Phogat (4):
<ul>
<li>mesa: fix issues with texture border and array textures</li>
<li>mesa: Fix valid texture target test in _mesa_GetTexLevelParameteriv()</li>
<li>mesa: Fix the cause of piglit test fbo-array failure</li>
<li>intel: Fix a case when mapping large texture fails</li>
</ul></p>
<p>Brian Paul (17):
<ul>
<li>mesa: add a couple fast-paths to fast_read_rgba_pixels_memcpy()</li>
<li>mesa/gdi: remove wmesa_set_renderbuffer_funcs() function</li>
<li>mesa/gdi: remove clear_color() function</li>
<li>mesa: bump version to 8.0.2 in configs/default</li>
<li>swrast: include s_fragprog.h to silence warnings</li>
<li>mesa: remove LSB-first pixel packing check in glReadPixels</li>
<li>mesa: fix error in _mesa_format_matches_format_and_type() for RGB888</li>
<li>mesa: add BGR888 code in _mesa_format_matches_format_and_type()</li>
<li>vbo: fix node_attrsz[] usage in vbo_bind_vertex_list()</li>
<li>mesa: add missing texture integer test in glTexSubImage()</li>
<li>mesa: add missing return after _mesa_error() in update_array()</li>
<li>glsl: propagate MaxUnrollIterations to the optimizer's loop unroller</li>
<li>st/mesa: set MaxUnrollIterations = 255</li>
<li>st/mesa: no-op glCopyPixels if source region is out of bounds</li>
<li>mesa: do more teximage error checking for generic compressed formats</li>
<li>mesa: fix/add error check in _mesa_ColorMaterial()</li>
<li>mesa: fix glMaterial / dlist bug</li>
</ul></p>
<p>Chad Versace (3):
<ul>
<li>glsl: Fix Android build</li>
<li>main: Fix memory leak in _mesa_make_extension_string()</li>
<li>intel: Disable ARB_framebuffer_object in ES contexts</li>
</ul></p>
<p>Chris Wilson (1):
<ul>
<li>i830: Compute initial number of vertices from remaining batch space</li>
</ul></p>
<p>Dave Airlie (4):
<ul>
<li>mesa/format_unpack: add LUMINANCE 8/16 UINT/INT</li>
<li>glx/drisw: avoid segfaults when we fail to get visual</li>
<li>drisw: fix image stride calculation for 16-bit.</li>
<li>intel: fix TFP at 16-bpp</li>
</ul></p>
<p>Dylan Noblesmith (7):
<ul>
<li>intel: fix null dereference processing HiZ buffer</li>
<li>util: fix undefined behavior</li>
<li>util: fix uninitialized table</li>
<li>egl: fix uninitialized values</li>
<li>st/vega: fix uninitialized values</li>
<li>egl-static: fix printf warning</li>
<li>i965: fix typo</li>
</ul></p>
<p>Eric Anholt (19):
<ul>
<li>i965/fs: Jump from discard statements to the end of the program when done.</li>
<li>intel: Fix rendering from textures after RenderTexture().</li>
<li>mesa: Fix handling of glCopyBufferSubData() for src == dst.</li>
<li>i965/fs: Move GL_CLAMP handling to coordinate setup.</li>
<li>i965/fs: Implement GL_CLAMP behavior on texture rectangles on gen6+.</li>
<li>mesa: Fix push/pop of multisample coverage invert.</li>
<li>mesa: Include the multisample enables under GL_MULTISAMPLE_BIT attrib as well.</li>
<li>mesa: Fix display list handling for GL_ARB_draw_instanced.</li>
<li>mesa: Fix display lists for draw_elements_base_vertex with draw_instanced.</li>
<li>mesa: Add missing error check for first &lt 0 in glDrawArraysInstanced().</li>
<li>i915: Fix piglit fbo-nodepth-test on i830.</li>
<li>intel: Return success when asked to allocate a 0-width/height renderbuffer.</li>
<li>mesa: Throw error on glGetActiveUniform inside Begin/End.</li>
<li>i965/vs: Fix up swizzle for dereference_array of matrices.</li>
<li>glsl: Fix indentation of switch code.</li>
<li>glsl: Let the constructor figure out the types of switch-related expressions.</li>
<li>glsl: Reject non-scalar switch expressions.</li>
<li>glsl: Fix assertion failure on handling switch on uint expressions.</li>
<li>mesa: Check for framebuffer completeness before looking at the rb.</li>
</ul></p>
<p>Eugeni Dodonov (1):
<ul>
<li>intel: add PCI IDs for Ivy Bridge GT2 server variant</li>
</ul></p>
<p>Han Shen(沈涵) (1):
<ul>
<li>bin/mklib: remove '-m32' for arm linux</li>
</ul></p>
<p>Ian Romanick (1):
<ul>
<li>mesa: Bump version number to 8.0.3</li>
</ul></p>
<p>Jakob Bornecrantz (1):
<ul>
<li>docs: Add 8.0.2 md5sums</li>
</ul></p>
<p>Jeremy Huddleston (7):
<ul>
<li>darwin: Eliminate a pthread mutex leak</li>
<li>darwin: Fix an error message</li>
<li>darwin: Make reported errors more user-friendly</li>
<li>darwin: Use ASL for logging</li>
<li>darwin: Unlock our mutex before destroying it</li>
<li>darwin: Eliminate a possible race condition while destroying a surface</li>
<li>darwin: Address a build failure on Leopard and earlier OS versions</li>
</ul></p>
<p>Jon TURNEY (1):
<ul>
<li>Have __glImageSize handle format GL_DEPTH_STENCIL_NV the same way as the server does</li>
</ul></p>
<p>Jonas Maebe (2):
<ul>
<li>glapi: Correct size of allocated _glapi_table struct</li>
<li>apple: Fix a use after free</li>
</ul></p>
<p>Jordan Justen (1):
<ul>
<li>mesa: Add primitive restart support to glArrayElement</li>
</ul></p>
<p>Kenneth Graunke (12):
<ul>
<li>i965: Actually upload sampler state pointers for the VS unit on Gen6.</li>
<li>i965/fs: Fix FB writes that tried to use the non-existent m16 register.</li>
<li>vbo: Remove pedantic warning about 'end' beind out of bounds.</li>
<li>vbo: Ignore invalid element ranges which are outside VBO bounds.</li>
<li>vbo: Rework checking of 'end' against _MaxElement.</li>
<li>vbo: Eliminate short-circuiting in invalid-start case.</li>
<li>i965: Fix GPU hangs in the dummy fragment shader.</li>
<li>i965: Make the dummy fragment shader work in SIMD16 mode.</li>
<li>drirc: Add force_glsl_extensions_warn workaround for Unigine Heaven.</li>
<li>i965: Avoid explicit accumulator operands in SIMD16 mode on Gen7.</li>
<li>intel: Remove pointless software fallback for glBitmap on Gen6.</li>
<li>glsl: Fix broken constant expression handling for &lt, &lt=, &gt;, and &gt;=.</li>
</ul></p>
<p>Kurt Roeckx (2):
<ul>
<li>i915: Compute maximum number of verts using the actual batchbuffer size.</li>
<li>i915: Fix i830 polygon stipple from PBOs.</li>
</ul></p>
<p>Marek Olšák (5):
<ul>
<li>r300g/swtcl: don't print an error when getting ClipVertex</li>
<li>r300g/swtcl: don't enter u_vbuf_mgr</li>
<li>r300g/swtcl: don't expose shader subroutine support</li>
<li>r300g/swtcl: fix polygon offset</li>
<li>r300g/swtcl: fix crash when back color is present in vertex shader</li>
</ul></p>
<p>Mathias Fröhlich (1):
<ul>
<li>glsl: Avoid excessive loop unrolling.</li>
</ul></p>
<p>Matt Turner (1):
<ul>
<li>Remove -ffast-math from default CFLAGS</li>
</ul></p>
<p>Paul Berry (1):
<ul>
<li>i915: Initialize swrast_texture_image structure fields.</li>
</ul></p>
<p>Roland Scheidegger (1):
<ul>
<li>mesa: check_index_bounds off-by-one fix</li>
</ul></p>
<p>Tom Stellard (2):
<ul>
<li>r300/compiler: Clear loop registers in vertex shaders w/o loops</li>
<li>r300/compiler: Copy all instruction attributes during local transfoms</li>
</ul></p>
<p>Vinson Lee (5):
<ul>
<li>mesa: Fix memory leak in _mesa_get_uniform_location.</li>
<li>linker: Fix memory leak in count_uniform_size::visit_field.</li>
<li>swrast: Fix memory leaks in blit_linear.</li>
<li>ir_to_mesa: Fix uninitialized member in add_uniform_to_shader.</li>
<li>mesa: Fix memory leak in generate_mipmap_compressed.</li>
</ul></p>
<p>Yuanhan Liu (2):
<ul>
<li>i915: set SPRITE_POINT_ENABLE bit correctly</li>
<li>i965: fix wrong cube/3D texture layout</li>
</ul></p>
</body>
</html>

202
docs/relnotes-8.0.4.html Normal file
View File

@@ -0,0 +1,202 @@
<HTML>
<head>
<TITLE>Mesa Release Notes</TITLE>
<link rel="stylesheet" type="text/css" href="mesa.css">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 8.0.4 Release Notes / July 10, 2012</H1>
<p>
Mesa 8.0.4 is a bug fix release which fixes bugs found since the 8.0.2 release.
</p>
<p>
Mesa 8.0.4 implements the OpenGL 3.0 API, but the version reported by
glGetString(GL_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 3.0.
</p>
<p>
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
for DRI hardware acceleration.
</p>
<h2>MD5 checksums</h2>
<pre>
TBD
</pre>
<h2>New features</h2>
<p>None.</p>
<h2>Bug fixes</h2>
<p>This list is likely incomplete.</p>
<ul>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=45967">Bug 45967</a> - piglit getteximage-invalid-format-for-packed-type regression</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=47742">Bug 47742</a> - [softpipe] piglit fbo-generatemipmap-array regression</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=48141">Bug 48141</a> - [vmwgfx] src/gallium/auxiliary/util/u_inlines.h:256:pipe_buffer_map_range: Assertion `offset + length &lt;= buffer-&gt;width0' failed.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=48472">Bug 48472</a> - GPU Lockup while running demo (rzr - the scene is dead) in wine</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=50033">Bug 50033</a> - src/mesa/state_tracker/st_cb_fbo.c:379:st_render_texture: Assertion `strb-&gt;rtt_level &lt;= strb-&gt;texture-&gt;last_level' failed.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=50621">Bug 50621</a> - Mesa fails its test suite with a buffer overflow.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=50298">Bug 50298</a> - [ILK IVB bisected]Ogles2conform GL/sin/sin_float_vert_xvary.test regressed</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=51574">Bug 51574</a> - ir_loop_jump constructor assigns member variable to itself</li>
<!-- <li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=">Bug </a> - </li> -->
</ul>
<h2>Changes</h2>
<p>The full set of changes can be viewed by using the following GIT command:</p>
<pre>
git log mesa-8.0.3..mesa-8.0.4
</pre>
<p>Andreas Betz (1):
<ul>
<li>vega: fix 565 color unpacking bug</li>
</ul></p>
<p>Antoine Labour (2):
<ul>
<li>meta: Cleanup the resources we allocate.</li>
<li>mesa: Free uniforms correclty.</li>
</ul></p>
<p>Brian Paul (22):
<ul>
<li>docs: add link to 8.0.3 release notes</li>
<li>mesa: fix Z32_FLOAT -&gt; uint conversion functions</li>
<li>draw: fix primitive restart bug by using the index buffer offset</li>
<li>st/mesa: fix glDrawPixels(GL_DEPTH_COMPONENT) color output</li>
<li>svga: fix synchronization bug between sampler views and surfaces</li>
<li>mesa: new _mesa_error_check_format_and_type() function</li>
<li>mesa: add missing GL_UNSIGNED_INT_10F_11F_11F_REV case</li>
<li>mesa: fix missing return value in getteximage_error_check()</li>
<li>st/mesa: pass GL_MAP_INVALIDATE_RANGE_BIT to gallium drivers</li>
<li>svga: add 0.5 in float-&gt;int conversion of sample min/max lod</li>
<li>svga: fix min/max lod clamping</li>
<li>svga: change PIPE_CAPF_MAX_TEXTURE_LOD_BIAS from 16.0 to 15.0</li>
<li>st/mesa: add fallback pipe formats for (compressed) R, RG formats</li>
<li>st/mesa: copy num_immediates field when copying the immediates array</li>
<li>svga: move svga_texture() casts/calls in svga_surface_copy()</li>
<li>svga: reset vertex buffer offset in svga_release_user_upl_buffers()</li>
<li>st/mesa: don't set PIPE_BIND_DISPLAY_TARGET for user-created renderbuffers</li>
<li>st/mesa: use private pipe_sampler_view in decompress_with_blit()</li>
<li>st/mesa: add null pointer check in st_texture_image_map()</li>
<li>st/mesa: fix mipmap image size computation w.r.t. texture arrays</li>
<li>draw: fix missing immediates bug in polygon stipple code</li>
<li>st/mesa: fix max_offset computation for base vertex</li>
</ul></p>
<p>Christoph Bumiller (1):
<ul>
<li>nv50: handle NEG,ABS modifiers for short RCP encoding</li>
</ul></p>
<p>Dylan Noblesmith (1):
<ul>
<li>mesa: require GL_MAX_SAMPLES &gt;= 4 for GL 3.0</li>
</ul></p>
<p>Eric Anholt (1):
<ul>
<li>i965/vs: Fix texelFetchOffset()</li>
</ul></p>
<p>Ian Romanick (5):
<ul>
<li>docs: Add 8.0.3 release md5sums</li>
<li>glx/tests: Fix off-by-one error in allocating extension string buffer</li>
<li>glsl: Remove spurious printf messages</li>
<li>glsl: Fix pi/2 constant in acos built-in function</li>
<li>mesa: Bump version number to 8.0.4</li>
</ul></p>
<p>José Fonseca (2):
<ul>
<li>mesa: Avoid void acinclude.m4 Android.common.mk Android.mk autogen.sh bin common.py configs configure.ac docs doxygen include Makefile scons SConstruct src tests arithmetic.</li>
<li>draw: Ensure that prepare is always run after LLVM garbagge collection.</li>
</ul></p>
<p>Kenneth Graunke (15):
<ul>
<li>mesa: Check for a negative "size" parameter in glCopyBufferSubData().</li>
<li>i965: Fix brw_swap_cmod() for LE/GE comparisons.</li>
<li>glsl: Remove unused ir_loop_jump::loop pointer.</li>
<li>ralloc: Fix ralloc_parent() of memory allocated out of the NULL context.</li>
<li>mesa: Restore depth texture state on glPopAttrib(GL_TEXTURE_BIT).</li>
<li>glsl/builtins: Fix textureGrad() for Array samplers.</li>
<li>mesa: Unbind ARB_copy_buffer and transform feedback buffers on delete.</li>
<li>mesa: Support BindBuffer{Base,Offset,Range} with a buffer of 0.</li>
<li>mesa: Unbind ARB_transform_feedback2 binding points on Delete too.</li>
<li>meta: Fix GL_RENDERBUFFER binding in decompress_texture_image().</li>
<li>i965/fs: Fix texelFetchOffset() on pre-Gen7.</li>
<li>i965/vs: Fix texelFetchOffset() on pre-Gen7.</li>
<li>i965/fs: Fix user-defined FS outputs with less than four components.</li>
<li>glsl: Hook up loop_variable_state destructor to plug a memory leak.</li>
<li>glsl: Don't trust loop analysis in the presence of function calls.</li>
</ul></p>
<p>Kurt Roeckx (1):
<ul>
<li>i830: Fix crash for GL_STENCIL_TEST in i830Enable()</li>
</ul></p>
<p>Lukas Rössler (1):
<ul>
<li>glu: fix two Clang warnings</li>
</ul></p>
<p>Marek Olšák (2):
<ul>
<li>mesa: allow exposing GL3 without EXT_texture_integer</li>
<li>st/mesa: don't do srgb-&gt;linear conversion in decompress_with_blit</li>
</ul></p>
<p>Paul Seidler (1):
<ul>
<li>tests: include mesa headers</li>
</ul></p>
<p>Stéphane Marchesin (3):
<ul>
<li>glx: Handle a null reply in QueryVersion.</li>
<li>i915g: Don't invert signalled/unsignalled fences</li>
<li>i915g: Don't avoid flushing when we have a pending fence.</li>
</ul></p>
<p>Thomas Gstädtner (1):
<ul>
<li>gallium/targets: pass ldflags parameter to MKLIB</li>
</ul></p>
<p>Vadim Girlin (2):
<ul>
<li>st/mesa: set stObj-&gt;lastLevel in guess_and_alloc_texture</li>
<li>r600g: check gpr count limit</li>
</ul></p>
<p>Vinson Lee (1):
<ul>
<li>st/mesa: Fix uninitialized members in glsl_to_tgsi_visitor constructor.</li>
</ul></p>
</body>
</html>

View File

@@ -10,7 +10,7 @@
<body bgcolor="#eeeeee">
<H1>Mesa 8.0 Release Notes / (release date TBD)</H1>
<H1>Mesa 8.0 Release Notes / February 9, 2012</H1>
<p>
Mesa 8.0 is a new development release.
@@ -30,7 +30,9 @@ for DRI hardware acceleration.
<h2>MD5 checksums</h2>
<pre>
tbd
3516fea6c28ce4a0fa9759e4894729a1 MesaLib-8.0.tar.gz
1a5668fe72651a670611164cefc703b2 MesaLib-8.0.tar.bz2
66f5a01a85530a91472a3acceb556db8 MesaLib-8.0.zip
</pre>

View File

@@ -13,6 +13,10 @@ The release notes summarize what's new or changed in each Mesa release.
</p>
<UL>
<LI><A HREF="relnotes-8.0.4.html">8.0.4 release notes</A>
<LI><A HREF="relnotes-8.0.3.html">8.0.3 release notes</A>
<LI><A HREF="relnotes-8.0.2.html">8.0.2 release notes</A>
<LI><A HREF="relnotes-8.0.1.html">8.0.1 release notes</A>
<LI><A HREF="relnotes-8.0.html">8.0 release notes</A>
<LI><A HREF="relnotes-7.11.html">7.11 release notes</A>
<LI><A HREF="relnotes-7.10.3.html">7.10.3 release notes</A>

View File

@@ -9,34 +9,78 @@
<H1>Supported Systems and Drivers</H1>
<p>
Mesa was originally designed for Unix/X11 systems and is still best
supported on those systems. All you need is an ANSI C compiler and the
X development environment to use Mesa.
Mesa is primarily developed and used on Linux systems.
But there's also support for Windows, other flavors of Unix and other
systems such as Haiku.
We're actively developing and maintaining several hardware and
software drivers.
</p>
<p>
The DRI hardware drivers for the X.org server and XFree86 provide
hardware accelerated rendering for chips from ATI, Intel, and NVIDIA
on Linux and FreeBSD.
The primary API is OpenGL but there's also support for OpenGL ES 1
and ES 2, OpenVG and the EGL interface.
</p>
<p>
Drivers for other assorted platforms include:
the Apple Macintosh and Windows.
Hardware drivers include:
</p>
<ul>
<li>Intel i965, i945, i915.
See <a href="http://intellinuxgraphics.org/index.html" target="_parent">
Intel's website</a>
<li>AMD Radeon series
<li>Some NVIDIA GPus.
<li>VMware virtual GPU
</ul>
<p>
Details about particular drivers follows:
Software drivers include:
</p>
<ul>
<li><a href="llvmpipe.html">llvmpipe</a> - uses LLVM for x86 JIT code
generation and is multi-threaded
<li>softpipe - a reference Gallium driver
<li>swrast - the legacy/original Mesa software rasterizer
</ul>
<p>
Additional driver information:
</p>
<UL>
<li><a href="http://dri.freedesktop.org/" target="_parent"> DRI hardware
drivers</a> for the X Window System
<LI><a href="xlibdriver.html">Xlib software driver</a> for the X Window System
<li><a href="xlibdriver.html">Xlib / swrast driver</a> for the X Window System
and Unix-like operating systems
<LI>Microsoft Windows <A HREF="README.WIN32">(README.WIN32)</A>
<LI>DEC VMS <A HREF="README.VMS">(README.VMS)</A>
<li><a href="README.WIN32">Microsoft Windows</a>
<li><a href="vmware-guest.html">VMware</a> guest OS driver
</UL>
<h1>
Deprecated Systems and Drivers
</h1>
<p>
In the past there were other drivers for older GPUs and operating
systems.
These have been removed from the Mesa source tree and distribution.
If anyone's interested though, the code can be found in the git repo.
The list includes:
</p>
<ul>
<li>3dfx/glide
<li>Matrox
<li>ATI R128
<li>Savage
<li>VIA Unichrome
<li>SIS
<li>3Dlabs gamma
<li>DOS
<li>fbdev
<li>DEC/VMS
<ul>
</body>
</html>

View File

@@ -10,7 +10,8 @@
<h1>VMware guest GL driver</h1>
<p>
This page describes how to build, install and use the VMware guest GL driver
This page describes how to build, install and use the
<a href="http://www.vmware.com/" target="_parent">VMware</a> guest GL driver
(aka the SVGA or SVGA3D driver) for Linux using the latest source code.
This driver gives a Linux virtual machine access to the host's GPU for
hardware-accelerated 3D.

View File

@@ -25,3 +25,4 @@ CHIPSET(0x0162, IVYBRIDGE_GT2, ivb_gt2)
CHIPSET(0x0156, IVYBRIDGE_M_GT1, ivb_gt1)
CHIPSET(0x0166, IVYBRIDGE_M_GT2, ivb_gt2)
CHIPSET(0x015a, IVYBRIDGE_S_GT1, ivb_gt1)
CHIPSET(0x016a, IVYBRIDGE_S_GT2, ivb_gt2)

View File

@@ -45,7 +45,7 @@ _eglParseImageAttribList(_EGLImageAttribs *attrs, _EGLDisplay *dpy,
(void) dpy;
memset(attrs, 0, sizeof(attrs));
memset(attrs, 0, sizeof(*attrs));
attrs->ImagePreserved = EGL_FALSE;
attrs->GLTextureLevel = 0;
attrs->GLTextureZOffset = 0;

View File

@@ -80,6 +80,21 @@ void draw_set_viewport_state( struct draw_context *draw,
void draw_set_clip_state( struct draw_context *pipe,
const struct pipe_clip_state *clip );
/**
* Sets the rasterization state used by the draw module.
* The rast_handle is used to pass the driver specific representation
* of the rasterization state. It's going to be used when the
* draw module sets the state back on the driver itself using the
* pipe::bind_rasterizer_state method.
*
* NOTE: if you're calling this function from within the pipe's
* bind_rasterizer_state you should always call it before binding
* the actual state - that's because the draw module can try to
* bind its own rasterizer state which would reset your newly
* set state. i.e. always do
* draw_set_rasterizer_state(driver->draw, state->pipe_state, state);
* driver->state.raster = state;
*/
void draw_set_rasterizer_state( struct draw_context *draw,
const struct pipe_rasterizer_state *raster,
void *rast_handle );

View File

@@ -65,8 +65,13 @@ static void
draw_llvm_garbage_collect_callback(void *cb_data)
{
struct draw_llvm *llvm = (struct draw_llvm *) cb_data;
struct draw_context *draw = llvm->draw;
struct draw_llvm_variant_list_item *li;
/* Ensure prepare will be run and shaders recompiled */
assert(!draw->suspend_flushing);
draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE);
/* free all shader variants */
li = first_elem(&llvm->vs_variants_list);
while (!at_end(&llvm->vs_variants_list, li)) {

View File

@@ -165,11 +165,16 @@ pstip_transform_decl(struct tgsi_transform_context *ctx,
}
/**
* TGSI immediate declaration transform callback.
* We're just counting the number of immediates here.
*/
static void
pstip_transform_immed(struct tgsi_transform_context *ctx,
struct tgsi_full_immediate *immed)
{
struct pstip_transform_context *pctx = (struct pstip_transform_context *) ctx;
ctx->emit_immediate(ctx, immed); /* emit to output shader */
pctx->numImmed++;
}

View File

@@ -329,25 +329,28 @@ draw_pt_arrays_restart(struct draw_context *draw,
if (draw->pt.user.elts) {
/* indexed prims (draw_elements) */
const char *elts =
(const char *) draw->pt.user.elts + draw->pt.index_buffer.offset;
cur_start = start;
cur_count = 0;
switch (draw->pt.user.eltSize) {
case 1:
{
const ubyte *elt_ub = (const ubyte *) draw->pt.user.elts;
const ubyte *elt_ub = (const ubyte *) elts;
PRIM_RESTART_LOOP(elt_ub);
}
break;
case 2:
{
const ushort *elt_us = (const ushort *) draw->pt.user.elts;
const ushort *elt_us = (const ushort *) elts;
PRIM_RESTART_LOOP(elt_us);
}
break;
case 4:
{
const uint *elt_ui = (const uint *) draw->pt.user.elts;
const uint *elt_ui = (const uint *) elts;
PRIM_RESTART_LOOP(elt_ui);
}
break;

View File

@@ -72,8 +72,7 @@ void pp_free(struct pp_queue_t *);
void pp_free_fbos(struct pp_queue_t *);
void pp_debug(const char *, ...);
struct program *pp_init_prog(struct pp_queue_t *, struct pipe_screen *);
void pp_init_fbos(struct pp_queue_t *, unsigned int, unsigned int,
struct pipe_resource *);
void pp_init_fbos(struct pp_queue_t *, unsigned int, unsigned int);
/* The filters */

View File

@@ -195,7 +195,7 @@ pp_debug(const char *fmt, ...)
/** Allocate the temp FBOs. Called on makecurrent and resize. */
void
pp_init_fbos(struct pp_queue_t *ppq, unsigned int w,
unsigned int h, struct pipe_resource *indepth)
unsigned int h)
{
struct program *p = ppq->p; /* The lazy will inherit the earth */
@@ -242,11 +242,7 @@ pp_init_fbos(struct pp_queue_t *ppq, unsigned int w,
goto error;
}
tmp_res.format = p->surf.format = indepth->format;
tmp_res.bind = p->surf.usage = PIPE_BIND_DEPTH_STENCIL;
ppq->depth = indepth;
if (!ppq->depth)
goto error;
tmp_res.format = p->surf.format = PIPE_FORMAT_S8_UINT_Z24_UNORM;

View File

@@ -42,14 +42,14 @@ void
pp_run(struct pp_queue_t *ppq, struct pipe_resource *in,
struct pipe_resource *out, struct pipe_resource *indepth)
{
struct pipe_resource *refin = NULL, *refout = NULL;
unsigned int i;
if (in->width0 != ppq->p->framebuffer.width ||
in->height0 != ppq->p->framebuffer.height) {
pp_debug("Resizing the temp pp buffers\n");
pp_free_fbos(ppq);
pp_init_fbos(ppq, in->width0, in->height0, indepth);
pp_init_fbos(ppq, in->width0, in->height0);
}
if (in == out && ppq->n_filters == 1) {
@@ -64,6 +64,11 @@ pp_run(struct pp_queue_t *ppq, struct pipe_resource *in,
in = ppq->tmp[0];
}
// Kept only for this frame.
pipe_resource_reference(&ppq->depth, indepth);
pipe_resource_reference(&refin, in);
pipe_resource_reference(&refout, out);
switch (ppq->n_filters) {
case 1: /* No temp buf */
ppq->pp_queue[0] (ppq, in, out, 0);
@@ -93,6 +98,10 @@ pp_run(struct pp_queue_t *ppq, struct pipe_resource *in,
break;
}
pipe_resource_reference(&ppq->depth, NULL);
pipe_resource_reference(&refin, NULL);
pipe_resource_reference(&refout, NULL);
}

View File

@@ -25,43 +25,43 @@
*
**************************************************************************/
#include "util/u_debug.h"
#include "pipe/p_config.h"
#include "rtasm_cpu.h"
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
static boolean rtasm_sse_enabled(void)
#include "util/u_debug.h"
#include "util/u_cpu_detect.h"
DEBUG_GET_ONCE_BOOL_OPTION(nosse, "GALLIUM_NOSSE", FALSE);
static struct util_cpu_caps *get_cpu_caps(void)
{
static boolean firsttime = 1;
static boolean enabled;
/* This gets called quite often at the moment:
*/
if (firsttime) {
enabled = !debug_get_bool_option("GALLIUM_NOSSE", FALSE);
firsttime = FALSE;
}
return enabled;
util_cpu_detect();
return &util_cpu_caps;
}
#endif
int rtasm_cpu_has_sse(void)
{
/* FIXME: actually detect this at run-time */
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
return rtasm_sse_enabled();
#else
return 0;
#endif
return !debug_get_option_nosse() && get_cpu_caps()->has_sse;
}
int rtasm_cpu_has_sse2(void)
{
/* FIXME: actually detect this at run-time */
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
return rtasm_sse_enabled();
#else
return 0;
#endif
return !debug_get_option_nosse() && get_cpu_caps()->has_sse2;
}
#else
int rtasm_cpu_has_sse(void)
{
return 0;
}
int rtasm_cpu_has_sse2(void)
{
return 0;
}
#endif

View File

@@ -38,6 +38,7 @@
#include "os/os_memory.h"
#include "os/os_memory_debug.h"
#include "os/os_thread.h"
#include "util/u_debug.h"
#include "util/u_debug_stack.h"
@@ -72,6 +73,8 @@ struct debug_memory_footer
static struct list_head list = { &list, &list };
pipe_static_mutex(list_mutex);
static unsigned long last_no = 0;
@@ -132,7 +135,9 @@ debug_malloc(const char *file, unsigned line, const char *function,
ftr = footer_from_header(hdr);
ftr->magic = DEBUG_MEMORY_MAGIC;
pipe_mutex_lock(list_mutex);
LIST_ADDTAIL(&hdr->head, &list);
pipe_mutex_unlock(list_mutex);
return data_from_header(hdr);
}
@@ -164,7 +169,9 @@ debug_free(const char *file, unsigned line, const char *function,
debug_assert(0);
}
pipe_mutex_lock(list_mutex);
LIST_DEL(&hdr->head);
pipe_mutex_unlock(list_mutex);
hdr->magic = 0;
ftr->magic = 0;
@@ -232,7 +239,9 @@ debug_realloc(const char *file, unsigned line, const char *function,
new_ftr = footer_from_header(new_hdr);
new_ftr->magic = DEBUG_MEMORY_MAGIC;
pipe_mutex_lock(list_mutex);
LIST_REPLACE(&old_hdr->head, &new_hdr->head);
pipe_mutex_unlock(list_mutex);
/* copy data */
new_ptr = data_from_header(new_hdr);

View File

@@ -105,6 +105,11 @@ static INLINE void list_delinit(struct list_head *item)
#define LIST_IS_EMPTY(__list) \
((__list)->next == (__list))
/**
* Cast from a pointer to a member of a struct back to the containing struct.
*
* 'sample' MUST be initialized, or else the result is undefined!
*/
#ifndef container_of
#define container_of(ptr, sample, member) \
(void *)((char *)(ptr) \
@@ -112,29 +117,29 @@ static INLINE void list_delinit(struct list_head *item)
#endif
#define LIST_FOR_EACH_ENTRY(pos, head, member) \
for (pos = container_of((head)->next, pos, member); \
for (pos = NULL, pos = container_of((head)->next, pos, member); \
&pos->member != (head); \
pos = container_of(pos->member.next, pos, member))
#define LIST_FOR_EACH_ENTRY_SAFE(pos, storage, head, member) \
for (pos = container_of((head)->next, pos, member), \
for (pos = NULL, pos = container_of((head)->next, pos, member), \
storage = container_of(pos->member.next, pos, member); \
&pos->member != (head); \
pos = storage, storage = container_of(storage->member.next, storage, member))
#define LIST_FOR_EACH_ENTRY_SAFE_REV(pos, storage, head, member) \
for (pos = container_of((head)->prev, pos, member), \
for (pos = NULL, pos = container_of((head)->prev, pos, member), \
storage = container_of(pos->member.prev, pos, member); \
&pos->member != (head); \
pos = storage, storage = container_of(storage->member.prev, storage, member))
#define LIST_FOR_EACH_ENTRY_FROM(pos, start, head, member) \
for (pos = container_of((start), pos, member); \
for (pos = NULL, pos = container_of((start), pos, member); \
&pos->member != (head); \
pos = container_of(pos->member.next, pos, member))
#define LIST_FOR_EACH_ENTRY_FROM_REV(pos, start, head, member) \
for (pos = container_of((start), pos, member); \
for (pos = NULL, pos = container_of((start), pos, member); \
&pos->member != (head); \
pos = container_of(pos->member.prev, pos, member))

View File

@@ -49,15 +49,16 @@ unsigned util_semantic_set_from_program_file(struct util_semantic_set *set, cons
*
* num_slots is the size of the layout array and hardware limit instead.
*
* efficient_slots == 0 or efficient_solts == num_slots are typical settings.
* efficient_slots == 0 or efficient_slots == num_slots are typical settings.
*/
void util_semantic_layout_from_set(unsigned char *layout, const struct util_semantic_set *set, unsigned efficient_slots, unsigned num_slots);
static INLINE void
util_semantic_table_from_layout(unsigned char *table, unsigned char *layout, unsigned char first_slot_value, unsigned char num_slots)
util_semantic_table_from_layout(unsigned char *table, size_t table_size, unsigned char *layout,
unsigned char first_slot_value, unsigned char num_slots)
{
int i;
memset(table, 0xff, sizeof(table));
unsigned char i;
memset(table, 0xff, table_size);
for(i = 0; i < num_slots; ++i)
table[layout[i]] = first_slot_value + i;

View File

@@ -45,7 +45,10 @@ static void i915_flush_pipe( struct pipe_context *pipe,
draw_flush(i915->draw);
if (i915->batch->map == i915->batch->ptr) {
/* Only shortcut this if we have no fence, otherwise we must flush the
* empty batchbuffer to get our fence back.
*/
if (!fence && i915->batch && (i915->batch->map == i915->batch->ptr)) {
return;
}

View File

@@ -368,7 +368,7 @@ i915_fence_signalled(struct pipe_screen *screen,
{
struct i915_screen *is = i915_screen(screen);
return is->iws->fence_signalled(is->iws, fence) == 0;
return is->iws->fence_signalled(is->iws, fence) == 1;
}
static boolean
@@ -378,7 +378,7 @@ i915_fence_finish(struct pipe_screen *screen,
{
struct i915_screen *is = i915_screen(screen);
return is->iws->fence_finish(is->iws, fence) == 0;
return is->iws->fence_finish(is->iws, fence) == 1;
}

View File

@@ -792,7 +792,7 @@ lp_rast_finish( struct lp_rasterizer *rast )
* 2. do work
* 3. signal that we're done
*/
static PIPE_THREAD_ROUTINE( thread_func, init_data )
static PIPE_THREAD_ROUTINE( thread_function, init_data )
{
struct lp_rasterizer_task *task = (struct lp_rasterizer_task *) init_data;
struct lp_rasterizer *rast = task->rast;
@@ -860,7 +860,7 @@ create_rast_threads(struct lp_rasterizer *rast)
for (i = 0; i < rast->num_threads; i++) {
pipe_semaphore_init(&rast->tasks[i].work_ready, 0);
pipe_semaphore_init(&rast->tasks[i].work_done, 0);
rast->threads[i] = pipe_thread_create(thread_func,
rast->threads[i] = pipe_thread_create(thread_function,
(void *) &rast->tasks[i]);
}
}

View File

@@ -865,8 +865,10 @@ emit_flop(struct nv_pc *pc, struct nv_instruction *i)
assert(SFILE(i, 0) == NV_FILE_GPR);
if (!i->is_long) {
assert(i->opcode == NV_OP_RCP);
emit_form_MUL(pc, i);
assert(i->opcode == NV_OP_RCP && !src0->mod);
if (src0->mod & NV_MOD_NEG) pc->emit[0] |= 0x00400000;
if (src0->mod & NV_MOD_ABS) pc->emit[0] |= 0x00008000;
return;
}

View File

@@ -977,7 +977,8 @@ nvfx_fragprog_prepare(struct nvfx_context* nvfx, struct nvfx_fpc *fpc)
if(fpc->fp->num_slots > num_texcoords)
return FALSE;
util_semantic_layout_from_set(fpc->fp->slot_to_generic, &set, 0, num_texcoords);
util_semantic_table_from_layout(fpc->generic_to_slot, fpc->fp->slot_to_generic, 0, num_texcoords);
util_semantic_table_from_layout(fpc->generic_to_slot, sizeof fpc->generic_to_slot,
fpc->fp->slot_to_generic, 0, num_texcoords);
memset(fpc->fp->slot_to_fp_input, 0xff, sizeof(fpc->fp->slot_to_fp_input));

View File

@@ -41,13 +41,16 @@
static struct rc_instruction *emit1(
struct radeon_compiler * c, struct rc_instruction * after,
rc_opcode Opcode, rc_saturate_mode Saturate, struct rc_dst_register DstReg,
struct rc_src_register SrcReg)
rc_opcode Opcode, struct rc_sub_instruction * base,
struct rc_dst_register DstReg, struct rc_src_register SrcReg)
{
struct rc_instruction *fpi = rc_insert_new_instruction(c, after);
if (base) {
memcpy(&fpi->U.I, base, sizeof(struct rc_sub_instruction));
}
fpi->U.I.Opcode = Opcode;
fpi->U.I.SaturateMode = Saturate;
fpi->U.I.DstReg = DstReg;
fpi->U.I.SrcReg[0] = SrcReg;
return fpi;
@@ -55,13 +58,17 @@ static struct rc_instruction *emit1(
static struct rc_instruction *emit2(
struct radeon_compiler * c, struct rc_instruction * after,
rc_opcode Opcode, rc_saturate_mode Saturate, struct rc_dst_register DstReg,
rc_opcode Opcode, struct rc_sub_instruction * base,
struct rc_dst_register DstReg,
struct rc_src_register SrcReg0, struct rc_src_register SrcReg1)
{
struct rc_instruction *fpi = rc_insert_new_instruction(c, after);
if (base) {
memcpy(&fpi->U.I, base, sizeof(struct rc_sub_instruction));
}
fpi->U.I.Opcode = Opcode;
fpi->U.I.SaturateMode = Saturate;
fpi->U.I.DstReg = DstReg;
fpi->U.I.SrcReg[0] = SrcReg0;
fpi->U.I.SrcReg[1] = SrcReg1;
@@ -70,14 +77,18 @@ static struct rc_instruction *emit2(
static struct rc_instruction *emit3(
struct radeon_compiler * c, struct rc_instruction * after,
rc_opcode Opcode, rc_saturate_mode Saturate, struct rc_dst_register DstReg,
rc_opcode Opcode, struct rc_sub_instruction * base,
struct rc_dst_register DstReg,
struct rc_src_register SrcReg0, struct rc_src_register SrcReg1,
struct rc_src_register SrcReg2)
{
struct rc_instruction *fpi = rc_insert_new_instruction(c, after);
if (base) {
memcpy(&fpi->U.I, base, sizeof(struct rc_sub_instruction));
}
fpi->U.I.Opcode = Opcode;
fpi->U.I.SaturateMode = Saturate;
fpi->U.I.DstReg = DstReg;
fpi->U.I.SrcReg[0] = SrcReg0;
fpi->U.I.SrcReg[1] = SrcReg1;
@@ -221,7 +232,7 @@ static void transform_ABS(struct radeon_compiler* c,
struct rc_src_register src = inst->U.I.SrcReg[0];
src.Abs = 1;
src.Negate = RC_MASK_NONE;
emit1(c, inst->Prev, RC_OPCODE_MOV, inst->U.I.SaturateMode, inst->U.I.DstReg, src);
emit1(c, inst->Prev, RC_OPCODE_MOV, &inst->U.I, inst->U.I.DstReg, src);
rc_remove_instruction(inst);
}
@@ -240,7 +251,7 @@ static void transform_CEIL(struct radeon_compiler* c,
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dst, negate(inst->U.I.SrcReg[0]));
emit2(c, inst->Prev, RC_OPCODE_ADD, inst->U.I.SaturateMode, inst->U.I.DstReg,
emit2(c, inst->Prev, RC_OPCODE_ADD, &inst->U.I, inst->U.I.DstReg,
inst->U.I.SrcReg[0], srcreg(RC_FILE_TEMPORARY, dst.Index));
rc_remove_instruction(inst);
}
@@ -256,7 +267,7 @@ static void transform_CLAMP(struct radeon_compiler *c,
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
emit2(c, inst->Prev, RC_OPCODE_MIN, 0, dst,
inst->U.I.SrcReg[0], inst->U.I.SrcReg[2]);
emit2(c, inst->Prev, RC_OPCODE_MAX, inst->U.I.SaturateMode, inst->U.I.DstReg,
emit2(c, inst->Prev, RC_OPCODE_MAX, &inst->U.I, inst->U.I.DstReg,
srcreg(RC_FILE_TEMPORARY, dst.Index), inst->U.I.SrcReg[1]);
rc_remove_instruction(inst);
}
@@ -272,7 +283,7 @@ static void transform_DP2(struct radeon_compiler* c,
src1.Negate &= ~(RC_MASK_Z | RC_MASK_W);
src1.Swizzle &= ~(63 << (3 * 2));
src1.Swizzle |= (RC_SWIZZLE_ZERO << (3 * 2)) | (RC_SWIZZLE_ZERO << (3 * 3));
emit2(c, inst->Prev, RC_OPCODE_DP3, inst->U.I.SaturateMode, inst->U.I.DstReg, src0, src1);
emit2(c, inst->Prev, RC_OPCODE_DP3, &inst->U.I, inst->U.I.DstReg, src0, src1);
rc_remove_instruction(inst);
}
@@ -283,7 +294,7 @@ static void transform_DPH(struct radeon_compiler* c,
src0.Negate &= ~RC_MASK_W;
src0.Swizzle &= ~(7 << (3 * 3));
src0.Swizzle |= RC_SWIZZLE_ONE << (3 * 3);
emit2(c, inst->Prev, RC_OPCODE_DP4, inst->U.I.SaturateMode, inst->U.I.DstReg, src0, inst->U.I.SrcReg[1]);
emit2(c, inst->Prev, RC_OPCODE_DP4, &inst->U.I, inst->U.I.DstReg, src0, inst->U.I.SrcReg[1]);
rc_remove_instruction(inst);
}
@@ -294,7 +305,7 @@ static void transform_DPH(struct radeon_compiler* c,
static void transform_DST(struct radeon_compiler* c,
struct rc_instruction* inst)
{
emit2(c, inst->Prev, RC_OPCODE_MUL, inst->U.I.SaturateMode, inst->U.I.DstReg,
emit2(c, inst->Prev, RC_OPCODE_MUL, &inst->U.I, inst->U.I.DstReg,
swizzle(inst->U.I.SrcReg[0], RC_SWIZZLE_ONE, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_ONE),
swizzle(inst->U.I.SrcReg[1], RC_SWIZZLE_ONE, RC_SWIZZLE_Y, RC_SWIZZLE_ONE, RC_SWIZZLE_W));
rc_remove_instruction(inst);
@@ -305,7 +316,7 @@ static void transform_FLR(struct radeon_compiler* c,
{
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dst, inst->U.I.SrcReg[0]);
emit2(c, inst->Prev, RC_OPCODE_ADD, inst->U.I.SaturateMode, inst->U.I.DstReg,
emit2(c, inst->Prev, RC_OPCODE_ADD, &inst->U.I, inst->U.I.DstReg,
inst->U.I.SrcReg[0], negate(srcreg(RC_FILE_TEMPORARY, dst.Index)));
rc_remove_instruction(inst);
}
@@ -379,14 +390,14 @@ static void transform_LIT(struct radeon_compiler* c,
swizzle_wwww(srctemp));
/* tmp.z = (tmp.x > 0) ? tmp.w : 0.0 */
emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode,
emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I,
dstregtmpmask(temp, RC_MASK_Z),
negate(swizzle_xxxx(srctemp)),
swizzle_wwww(srctemp),
builtin_zero);
/* tmp.x, tmp.y, tmp.w = 1.0, tmp.x, 1.0 */
emit1(c, inst->Prev, RC_OPCODE_MOV, inst->U.I.SaturateMode,
emit1(c, inst->Prev, RC_OPCODE_MOV, &inst->U.I,
dstregtmpmask(temp, RC_MASK_XYW),
swizzle(srctemp, RC_SWIZZLE_ONE, RC_SWIZZLE_X, RC_SWIZZLE_ONE, RC_SWIZZLE_ONE));
@@ -401,7 +412,7 @@ static void transform_LRP(struct radeon_compiler* c,
emit2(c, inst->Prev, RC_OPCODE_ADD, 0,
dst,
inst->U.I.SrcReg[1], negate(inst->U.I.SrcReg[2]));
emit3(c, inst->Prev, RC_OPCODE_MAD, inst->U.I.SaturateMode,
emit3(c, inst->Prev, RC_OPCODE_MAD, &inst->U.I,
inst->U.I.DstReg,
inst->U.I.SrcReg[0], srcreg(RC_FILE_TEMPORARY, dst.Index), inst->U.I.SrcReg[2]);
@@ -418,7 +429,7 @@ static void transform_POW(struct radeon_compiler* c,
emit1(c, inst->Prev, RC_OPCODE_LG2, 0, tempdst, swizzle_xxxx(inst->U.I.SrcReg[0]));
emit2(c, inst->Prev, RC_OPCODE_MUL, 0, tempdst, tempsrc, swizzle_xxxx(inst->U.I.SrcReg[1]));
emit1(c, inst->Prev, RC_OPCODE_EX2, inst->U.I.SaturateMode, inst->U.I.DstReg, tempsrc);
emit1(c, inst->Prev, RC_OPCODE_EX2, &inst->U.I, inst->U.I.DstReg, tempsrc);
rc_remove_instruction(inst);
}
@@ -472,7 +483,7 @@ static void transform_SEQ(struct radeon_compiler* c,
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode, inst->U.I.DstReg,
emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg,
negate(absolute(srcreg(RC_FILE_TEMPORARY, dst.Index))), builtin_zero, builtin_one);
rc_remove_instruction(inst);
@@ -481,7 +492,7 @@ static void transform_SEQ(struct radeon_compiler* c,
static void transform_SFL(struct radeon_compiler* c,
struct rc_instruction* inst)
{
emit1(c, inst->Prev, RC_OPCODE_MOV, inst->U.I.SaturateMode, inst->U.I.DstReg, builtin_zero);
emit1(c, inst->Prev, RC_OPCODE_MOV, &inst->U.I, inst->U.I.DstReg, builtin_zero);
rc_remove_instruction(inst);
}
@@ -491,7 +502,7 @@ static void transform_SGE(struct radeon_compiler* c,
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode, inst->U.I.DstReg,
emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg,
srcreg(RC_FILE_TEMPORARY, dst.Index), builtin_zero, builtin_one);
rc_remove_instruction(inst);
@@ -503,7 +514,7 @@ static void transform_SGT(struct radeon_compiler* c,
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, negate(inst->U.I.SrcReg[0]), inst->U.I.SrcReg[1]);
emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode, inst->U.I.DstReg,
emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg,
srcreg(RC_FILE_TEMPORARY, dst.Index), builtin_one, builtin_zero);
rc_remove_instruction(inst);
@@ -515,7 +526,7 @@ static void transform_SLE(struct radeon_compiler* c,
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, negate(inst->U.I.SrcReg[0]), inst->U.I.SrcReg[1]);
emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode, inst->U.I.DstReg,
emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg,
srcreg(RC_FILE_TEMPORARY, dst.Index), builtin_zero, builtin_one);
rc_remove_instruction(inst);
@@ -527,7 +538,7 @@ static void transform_SLT(struct radeon_compiler* c,
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode, inst->U.I.DstReg,
emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg,
srcreg(RC_FILE_TEMPORARY, dst.Index), builtin_one, builtin_zero);
rc_remove_instruction(inst);
@@ -539,7 +550,7 @@ static void transform_SNE(struct radeon_compiler* c,
struct rc_dst_register dst = try_to_reuse_dst(c, inst);
emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode, inst->U.I.DstReg,
emit3(c, inst->Prev, RC_OPCODE_CMP, &inst->U.I, inst->U.I.DstReg,
negate(absolute(srcreg(RC_FILE_TEMPORARY, dst.Index))), builtin_one, builtin_zero);
rc_remove_instruction(inst);
@@ -604,7 +615,7 @@ static void transform_XPD(struct radeon_compiler* c,
emit2(c, inst->Prev, RC_OPCODE_MUL, 0, dst,
swizzle(inst->U.I.SrcReg[0], RC_SWIZZLE_Z, RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_W),
swizzle(inst->U.I.SrcReg[1], RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_X, RC_SWIZZLE_W));
emit3(c, inst->Prev, RC_OPCODE_MAD, inst->U.I.SaturateMode, inst->U.I.DstReg,
emit3(c, inst->Prev, RC_OPCODE_MAD, &inst->U.I, inst->U.I.DstReg,
swizzle(inst->U.I.SrcReg[0], RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_X, RC_SWIZZLE_W),
swizzle(inst->U.I.SrcReg[1], RC_SWIZZLE_Z, RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_W),
negate(srcreg(RC_FILE_TEMPORARY, dst.Index)));
@@ -719,7 +730,7 @@ static void transform_r300_vertex_DP3(struct radeon_compiler* c,
src1.Negate &= ~RC_MASK_W;
src1.Swizzle &= ~(7 << (3 * 3));
src1.Swizzle |= RC_SWIZZLE_ZERO << (3 * 3);
emit2(c, inst->Prev, RC_OPCODE_DP4, inst->U.I.SaturateMode, inst->U.I.DstReg, src0, src1);
emit2(c, inst->Prev, RC_OPCODE_DP4, &inst->U.I, inst->U.I.DstReg, src0, src1);
rc_remove_instruction(inst);
}
@@ -1043,22 +1054,22 @@ static void r300_transform_SIN_COS_SCS(struct radeon_compiler *c,
unsigned srctmp)
{
if (inst->U.I.Opcode == RC_OPCODE_COS) {
emit1(c, inst->Prev, RC_OPCODE_COS, inst->U.I.SaturateMode, inst->U.I.DstReg,
emit1(c, inst->Prev, RC_OPCODE_COS, &inst->U.I, inst->U.I.DstReg,
srcregswz(RC_FILE_TEMPORARY, srctmp, RC_SWIZZLE_WWWW));
} else if (inst->U.I.Opcode == RC_OPCODE_SIN) {
emit1(c, inst->Prev, RC_OPCODE_SIN, inst->U.I.SaturateMode,
emit1(c, inst->Prev, RC_OPCODE_SIN, &inst->U.I,
inst->U.I.DstReg, srcregswz(RC_FILE_TEMPORARY, srctmp, RC_SWIZZLE_WWWW));
} else if (inst->U.I.Opcode == RC_OPCODE_SCS) {
struct rc_dst_register moddst = inst->U.I.DstReg;
if (inst->U.I.DstReg.WriteMask & RC_MASK_X) {
moddst.WriteMask = RC_MASK_X;
emit1(c, inst->Prev, RC_OPCODE_COS, inst->U.I.SaturateMode, moddst,
emit1(c, inst->Prev, RC_OPCODE_COS, &inst->U.I, moddst,
srcregswz(RC_FILE_TEMPORARY, srctmp, RC_SWIZZLE_WWWW));
}
if (inst->U.I.DstReg.WriteMask & RC_MASK_Y) {
moddst.WriteMask = RC_MASK_Y;
emit1(c, inst->Prev, RC_OPCODE_SIN, inst->U.I.SaturateMode, moddst,
emit1(c, inst->Prev, RC_OPCODE_SIN, &inst->U.I, moddst,
srcregswz(RC_FILE_TEMPORARY, srctmp, RC_SWIZZLE_WWWW));
}
}
@@ -1165,35 +1176,79 @@ int radeonTransformDeriv(struct radeon_compiler* c,
}
/**
* IF Temp[0].x -> IF Temp[0].x
* ... -> ...
* KILP -> KIL -abs(Temp[0].x)
* ... -> ...
* ENDIF -> ENDIF
*
* === OR ===
*
* IF Temp[0].x -\
* KILP - > KIL -abs(Temp[0].x)
* ENDIF -/
*
* This needs to be done in its own pass, because it modifies the instructions
* before and after KILP.
* === OR ===
*
* IF Temp[0].x -> IF Temp[0].x
* ... -> ...
* ELSE -> ELSE
* ... -> ...
* KILP -> KIL -abs(Temp[0].x)
* ... -> ...
* ENDIF -> ENDIF
*
* === OR ===
*
* KILP -> KIL -none.1111
*
* This needs to be done in its own pass, because it might modify the
* instructions before and after KILP.
*/
void rc_transform_KILP(struct radeon_compiler * c, void *user)
{
struct rc_instruction * inst;
for (inst = c->Program.Instructions.Next;
inst != &c->Program.Instructions; inst = inst->Next) {
struct rc_instruction * if_inst;
unsigned in_if = 0;
if (inst->U.I.Opcode != RC_OPCODE_KILP)
continue;
for (if_inst = inst->Prev; if_inst != &c->Program.Instructions;
if_inst = if_inst->Prev) {
if (if_inst->U.I.Opcode == RC_OPCODE_IF) {
in_if = 1;
break;
}
}
inst->U.I.Opcode = RC_OPCODE_KIL;
if (inst->Prev->U.I.Opcode != RC_OPCODE_IF
|| inst->Next->U.I.Opcode != RC_OPCODE_ENDIF) {
if (!in_if) {
inst->U.I.SrcReg[0] = negate(builtin_one);
} else {
/* This should work even if the KILP is inside the ELSE
* block, because -0.0 is considered negative. */
inst->U.I.SrcReg[0] =
negate(absolute(inst->Prev->U.I.SrcReg[0]));
/* Remove IF */
rc_remove_instruction(inst->Prev);
/* Remove ENDIF */
rc_remove_instruction(inst->Next);
negate(absolute(if_inst->U.I.SrcReg[0]));
if (inst->Prev->U.I.Opcode != RC_OPCODE_IF
&& inst->Next->U.I.Opcode != RC_OPCODE_ENDIF) {
/* Optimize the special case:
* IF Temp[0].x
* KILP
* ENDIF
*/
/* Remove IF */
rc_remove_instruction(inst->Prev);
/* Remove ENDIF */
rc_remove_instruction(inst->Next);
}
}
}
}

View File

@@ -63,8 +63,13 @@ static void r300_blitter_begin(struct r300_context* r300, enum r300_blitter_op o
util_blitter_save_vertex_shader(r300->blitter, r300->vs_state.state);
util_blitter_save_viewport(r300->blitter, &r300->viewport);
util_blitter_save_vertex_elements(r300->blitter, r300->velems);
util_blitter_save_vertex_buffers(r300->blitter, r300->vbuf_mgr->nr_vertex_buffers,
r300->vbuf_mgr->vertex_buffer);
if (r300->vbuf_mgr) {
util_blitter_save_vertex_buffers(r300->blitter, r300->vbuf_mgr->nr_vertex_buffers,
r300->vbuf_mgr->vertex_buffer);
} else {
util_blitter_save_vertex_buffers(r300->blitter, r300->swtcl_nr_vertex_buffers,
r300->swtcl_vertex_buffer);
}
if (op & R300_SAVE_FRAMEBUFFER) {
util_blitter_save_framebuffer(r300->blitter, r300->fb_state.state);

View File

@@ -419,17 +419,19 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
r300_init_query_functions(r300);
r300_init_state_functions(r300);
r300_init_resource_functions(r300);
r300->context.create_video_decoder = vl_create_decoder;
r300->context.create_video_buffer = vl_video_buffer_create;
r300->vbuf_mgr = u_vbuf_create(&r300->context, 1024 * 1024, 16,
if (r300->screen->caps.has_tcl) {
r300->vbuf_mgr = u_vbuf_create(&r300->context, 1024 * 1024, 16,
PIPE_BIND_VERTEX_BUFFER |
PIPE_BIND_INDEX_BUFFER,
U_VERTEX_FETCH_DWORD_ALIGNED);
if (!r300->vbuf_mgr)
goto fail;
r300->vbuf_mgr->caps.format_fixed32 = 0;
if (!r300->vbuf_mgr)
goto fail;
r300->vbuf_mgr->caps.format_fixed32 = 0;
}
r300->blitter = util_blitter_create(&r300->context);
if (r300->blitter == NULL)

View File

@@ -581,6 +581,9 @@ struct r300_context {
void *dsa_decompress_zmask;
struct u_vbuf *vbuf_mgr;
struct pipe_index_buffer swtcl_index_buffer;
struct pipe_vertex_buffer swtcl_vertex_buffer[PIPE_MAX_ATTRIBS];
unsigned swtcl_nr_vertex_buffers;
struct util_slab_mempool pool_transfers;

View File

@@ -1030,20 +1030,18 @@ void r300_emit_vs_state(struct r300_context* r300, unsigned size, void* state)
R300_PVS_VF_MAX_VTX_NUM(12) |
(r300screen->caps.is_r500 ? R500_TCL_STATE_OPTIMIZATION : 0));
/* Emit flow control instructions. */
if (code->num_fc_ops) {
OUT_CS_REG(R300_VAP_PVS_FLOW_CNTL_OPC, code->fc_ops);
if (r300screen->caps.is_r500) {
OUT_CS_REG_SEQ(R500_VAP_PVS_FLOW_CNTL_ADDRS_LW_0, code->num_fc_ops * 2);
OUT_CS_TABLE(code->fc_op_addrs.r500, code->num_fc_ops * 2);
} else {
OUT_CS_REG_SEQ(R300_VAP_PVS_FLOW_CNTL_ADDRS_0, code->num_fc_ops);
OUT_CS_TABLE(code->fc_op_addrs.r300, code->num_fc_ops);
}
OUT_CS_REG_SEQ(R300_VAP_PVS_FLOW_CNTL_LOOP_INDEX_0, code->num_fc_ops);
OUT_CS_TABLE(code->fc_loop_index, code->num_fc_ops);
/* Emit flow control instructions. Even if there are no fc instructions,
* we still need to write the registers to make sure they are cleared. */
OUT_CS_REG(R300_VAP_PVS_FLOW_CNTL_OPC, code->fc_ops);
if (r300screen->caps.is_r500) {
OUT_CS_REG_SEQ(R500_VAP_PVS_FLOW_CNTL_ADDRS_LW_0, R300_VS_MAX_FC_OPS * 2);
OUT_CS_TABLE(code->fc_op_addrs.r500, R300_VS_MAX_FC_OPS * 2);
} else {
OUT_CS_REG_SEQ(R300_VAP_PVS_FLOW_CNTL_ADDRS_0, R300_VS_MAX_FC_OPS);
OUT_CS_TABLE(code->fc_op_addrs.r300, R300_VS_MAX_FC_OPS);
}
OUT_CS_REG_SEQ(R300_VAP_PVS_FLOW_CNTL_LOOP_INDEX_0, R300_VS_MAX_FC_OPS);
OUT_CS_TABLE(code->fc_loop_index, R300_VS_MAX_FC_OPS);
END_CS;
}

View File

@@ -818,7 +818,7 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
struct pipe_transfer *ib_transfer = NULL;
int i;
void *indices = NULL;
boolean indexed = info->indexed && r300->vbuf_mgr->index_buffer.buffer;
boolean indexed = info->indexed && r300->swtcl_index_buffer.buffer;
if (r300->skip_rendering) {
return;
@@ -831,10 +831,10 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
(indexed ? PREP_INDEXED : 0),
indexed ? 256 : 6);
for (i = 0; i < r300->vbuf_mgr->nr_vertex_buffers; i++) {
if (r300->vbuf_mgr->vertex_buffer[i].buffer) {
for (i = 0; i < r300->swtcl_nr_vertex_buffers; i++) {
if (r300->swtcl_vertex_buffer[i].buffer) {
void *buf = pipe_buffer_map(pipe,
r300->vbuf_mgr->vertex_buffer[i].buffer,
r300->swtcl_vertex_buffer[i].buffer,
PIPE_TRANSFER_READ |
PIPE_TRANSFER_UNSYNCHRONIZED,
&vb_transfer[i]);
@@ -843,7 +843,7 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
}
if (indexed) {
indices = pipe_buffer_map(pipe, r300->vbuf_mgr->index_buffer.buffer,
indices = pipe_buffer_map(pipe, r300->swtcl_index_buffer.buffer,
PIPE_TRANSFER_READ |
PIPE_TRANSFER_UNSYNCHRONIZED, &ib_transfer);
}
@@ -856,8 +856,8 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
draw_flush(r300->draw);
r300->draw_vbo_locked = FALSE;
for (i = 0; i < r300->vbuf_mgr->nr_vertex_buffers; i++) {
if (r300->vbuf_mgr->vertex_buffer[i].buffer) {
for (i = 0; i < r300->swtcl_nr_vertex_buffers; i++) {
if (r300->swtcl_vertex_buffer[i].buffer) {
pipe_buffer_unmap(pipe, vb_transfer[i]);
draw_set_mapped_vertex_buffer(r300->draw, i, NULL);
}

View File

@@ -212,6 +212,7 @@ static int r300_get_shader_param(struct pipe_screen *pscreen, unsigned shader, e
switch (param)
{
case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
case PIPE_SHADER_CAP_SUBROUTINES:
return 0;
default:;
}

View File

@@ -1048,6 +1048,10 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
/* Override some states for Draw. */
rs->rs_draw.sprite_coord_enable = 0; /* We can do this in HW. */
rs->rs_draw.offset_point = 0;
rs->rs_draw.offset_line = 0;
rs->rs_draw.offset_tri = 0;
rs->rs_draw.offset_clamp = 0;
#ifdef PIPE_ARCH_LITTLE_ENDIAN
vap_control_status = R300_VC_NO_SWAP;
@@ -1595,7 +1599,6 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe,
const struct pipe_vertex_buffer* buffers)
{
struct r300_context* r300 = r300_context(pipe);
unsigned i;
struct pipe_vertex_buffer dummy_vb = {0};
/* There must be at least one vertex buffer set, otherwise it locks up. */
@@ -1605,18 +1608,13 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe,
count = 1;
}
u_vbuf_set_vertex_buffers(r300->vbuf_mgr, count, buffers);
if (r300->screen->caps.has_tcl) {
/* HW TCL. */
for (i = 0; i < count; i++) {
if (buffers[i].buffer &&
!r300_resource(buffers[i].buffer)->b.user_ptr) {
}
}
u_vbuf_set_vertex_buffers(r300->vbuf_mgr, count, buffers);
r300->vertex_arrays_dirty = TRUE;
} else {
/* SW TCL. */
util_copy_vertex_buffers(r300->swtcl_vertex_buffer,
&r300->swtcl_nr_vertex_buffers,
buffers, count);
draw_set_vertex_buffers(r300->draw, count, buffers);
}
}
@@ -1626,9 +1624,15 @@ static void r300_set_index_buffer(struct pipe_context* pipe,
{
struct r300_context* r300 = r300_context(pipe);
u_vbuf_set_index_buffer(r300->vbuf_mgr, ib);
if (!r300->screen->caps.has_tcl) {
if (r300->screen->caps.has_tcl) {
u_vbuf_set_index_buffer(r300->vbuf_mgr, ib);
} else {
if (ib) {
pipe_resource_reference(&r300->swtcl_index_buffer.buffer, ib->buffer);
memcpy(&r300->swtcl_index_buffer, ib, sizeof(*ib));
} else {
pipe_resource_reference(&r300->swtcl_index_buffer.buffer, NULL);
}
draw_set_index_buffer(r300->draw, ib);
}
}
@@ -1702,11 +1706,11 @@ static void* r300_create_vertex_elements_state(struct pipe_context* pipe,
return NULL;
velems->count = count;
velems->vmgr_elements =
u_vbuf_create_vertex_elements(r300->vbuf_mgr, count, attribs,
velems->velem);
if (r300_screen(pipe->screen)->caps.has_tcl) {
velems->vmgr_elements =
u_vbuf_create_vertex_elements(r300->vbuf_mgr, count, attribs,
velems->velem);
/* Setup PSC.
* The unused components will be replaced by (..., 0, 1). */
r300_vertex_psc(velems);
@@ -1716,6 +1720,8 @@ static void* r300_create_vertex_elements_state(struct pipe_context* pipe,
align(util_format_get_blocksize(velems->velem[i].src_format), 4);
velems->vertex_size_dwords += velems->format_size[i] / 4;
}
} else {
memcpy(velems->velem, attribs, count * sizeof(struct pipe_vertex_element));
}
return velems;
@@ -1733,9 +1739,9 @@ static void r300_bind_vertex_elements_state(struct pipe_context *pipe,
r300->velems = velems;
u_vbuf_bind_vertex_elements(r300->vbuf_mgr, state, velems->vmgr_elements);
if (r300->draw) {
if (r300->screen->caps.has_tcl) {
u_vbuf_bind_vertex_elements(r300->vbuf_mgr, state, velems->vmgr_elements);
} else {
draw_set_vertex_elements(r300->draw, velems->count, velems->velem);
return;
}
@@ -1750,7 +1756,9 @@ static void r300_delete_vertex_elements_state(struct pipe_context *pipe, void *s
struct r300_context *r300 = r300_context(pipe);
struct r300_vertex_element_state *velems = state;
u_vbuf_destroy_vertex_elements(r300->vbuf_mgr, velems->vmgr_elements);
if (r300->screen->caps.has_tcl) {
u_vbuf_destroy_vertex_elements(r300->vbuf_mgr, velems->vmgr_elements);
}
FREE(state);
}
@@ -1765,10 +1773,10 @@ static void* r300_create_vs_state(struct pipe_context* pipe,
vs->state.tokens = tgsi_dup_tokens(shader->tokens);
if (r300->screen->caps.has_tcl) {
r300_init_vs_outputs(vs);
r300_init_vs_outputs(r300, vs);
r300_translate_vertex_shader(r300, vs);
} else {
r300_draw_init_vertex_shader(r300->draw, vs);
r300_draw_init_vertex_shader(r300, vs);
}
return vs;
@@ -1794,9 +1802,8 @@ static void r300_bind_vs_state(struct pipe_context* pipe, void* shader)
if (r300->screen->caps.has_tcl) {
unsigned fc_op_dwords = r300->screen->caps.is_r500 ? 3 : 2;
r300_mark_atom_dirty(r300, &r300->vs_state);
r300->vs_state.size =
vs->code.length + 9 +
(vs->code.num_fc_ops ? vs->code.num_fc_ops * fc_op_dwords + 4 : 0);
r300->vs_state.size = vs->code.length + 9 +
(R300_VS_MAX_FC_OPS * fc_op_dwords + 4);
r300_mark_atom_dirty(r300, &r300->vs_constants);
r300->vs_constants.size =

View File

@@ -36,6 +36,7 @@
/* Convert info about VS output semantics into r300_shader_semantics. */
static void r300_shader_read_vs_outputs(
struct r300_context *r300,
struct tgsi_shader_info* info,
struct r300_shader_semantics* vs_outputs)
{
@@ -83,6 +84,14 @@ static void r300_shader_read_vs_outputs(
fprintf(stderr, "r300 VP: cannot handle edgeflag output.\n");
break;
case TGSI_SEMANTIC_CLIPVERTEX:
assert(index == 0);
/* Draw does clip vertex for us. */
if (r300->screen->caps.has_tcl) {
fprintf(stderr, "r300 VP: cannot handle clip vertex output.\n");
}
break;
default:
fprintf(stderr, "r300 VP: unknown vertex output semantic: %i.\n",
info->output_semantic_name[i]);
@@ -160,10 +169,11 @@ static void set_vertex_inputs_outputs(struct r300_vertex_program_compiler * c)
c->code->outputs[outputs->wpos] = reg++;
}
void r300_init_vs_outputs(struct r300_vertex_shader *vs)
void r300_init_vs_outputs(struct r300_context *r300,
struct r300_vertex_shader *vs)
{
tgsi_scan_shader(vs->state.tokens, &vs->info);
r300_shader_read_vs_outputs(&vs->info, &vs->outputs);
r300_shader_read_vs_outputs(r300, &vs->info, &vs->outputs);
}
static void r300_dummy_vertex_shader(
@@ -187,7 +197,7 @@ static void r300_dummy_vertex_shader(
ureg_destroy(ureg);
shader->dummy = TRUE;
r300_init_vs_outputs(shader);
r300_init_vs_outputs(r300, shader);
r300_translate_vertex_shader(r300, shader);
}

View File

@@ -56,12 +56,13 @@ struct r300_vertex_shader {
void *draw_vs;
};
void r300_init_vs_outputs(struct r300_vertex_shader *vs);
void r300_init_vs_outputs(struct r300_context *r300,
struct r300_vertex_shader *vs);
void r300_translate_vertex_shader(struct r300_context *r300,
struct r300_vertex_shader *vs);
void r300_draw_init_vertex_shader(struct draw_context *draw,
void r300_draw_init_vertex_shader(struct r300_context *r300,
struct r300_vertex_shader *vs);
#endif /* R300_VS_H */

View File

@@ -29,7 +29,7 @@
*
* Transformations:
* 1) If the secondary color output is present, the primary color must be
* inserted before it.
* present too.
* 2) If any back-face color output is present, there must be all 4 color
* outputs and missing ones must be inserted.
* 3) Insert a trailing texcoord output containing a copy of POS, for WPOS.
@@ -52,7 +52,6 @@ struct vs_transform_context {
boolean color_used[2];
boolean bcolor_used[2];
boolean temp_used[128];
/* Index of the pos output, typically 0. */
unsigned pos_output;
@@ -72,6 +71,8 @@ struct vs_transform_context {
boolean first_instruction;
/* End instruction processed? */
boolean end_instruction;
boolean temp_used[1024];
};
static void emit_temp(struct tgsi_transform_context *ctx, unsigned reg)
@@ -102,9 +103,9 @@ static void emit_output(struct tgsi_transform_context *ctx,
++vsctx->num_outputs;
}
static void insert_output(struct tgsi_transform_context *ctx,
struct tgsi_full_declaration *before,
unsigned name, unsigned index, unsigned interp)
static void insert_output_before(struct tgsi_transform_context *ctx,
struct tgsi_full_declaration *before,
unsigned name, unsigned index, unsigned interp)
{
struct vs_transform_context *vsctx = (struct vs_transform_context *)ctx;
unsigned i;
@@ -115,28 +116,29 @@ static void insert_output(struct tgsi_transform_context *ctx,
}
/* Insert the new output. */
emit_output(ctx, name, index, interp, before->Range.First);
emit_output(ctx, name, index, interp,
before->Range.First + vsctx->decl_shift);
++vsctx->decl_shift;
}
static void insert_trailing_bcolor(struct tgsi_transform_context *ctx,
struct tgsi_full_declaration *before)
static void insert_output_after(struct tgsi_transform_context *ctx,
struct tgsi_full_declaration *after,
unsigned name, unsigned index, unsigned interp)
{
struct vs_transform_context *vsctx = (struct vs_transform_context *)ctx;
unsigned i;
/* If BCOLOR0 is used, make sure BCOLOR1 is present too. Otherwise
* the rasterizer doesn't do the color selection correctly. */
if (vsctx->bcolor_used[0] && !vsctx->bcolor_used[1]) {
if (before) {
insert_output(ctx, before, TGSI_SEMANTIC_BCOLOR, 1,
TGSI_INTERPOLATE_LINEAR);
} else {
emit_output(ctx, TGSI_SEMANTIC_BCOLOR, 1,
TGSI_INTERPOLATE_LINEAR, vsctx->num_outputs);
}
vsctx->bcolor_used[1] = TRUE;
/* Make a place for the new output. */
for (i = after->Range.First+1; i < Elements(vsctx->out_remap); i++) {
++vsctx->out_remap[i];
}
/* Insert the new output. */
emit_output(ctx, name, index, interp,
after->Range.First + 1);
++vsctx->decl_shift;
}
static void transform_decl(struct tgsi_transform_context *ctx,
@@ -153,41 +155,38 @@ static void transform_decl(struct tgsi_transform_context *ctx,
case TGSI_SEMANTIC_COLOR:
assert(decl->Semantic.Index < 2);
vsctx->color_used[decl->Semantic.Index] = TRUE;
/* We must rasterize the first color if the second one is
* used, otherwise the rasterizer doesn't do the color
* selection correctly. Declare it, but don't write to it. */
if (decl->Semantic.Index == 1 && !vsctx->color_used[0]) {
insert_output(ctx, decl, TGSI_SEMANTIC_COLOR, 0,
TGSI_INTERPOLATE_LINEAR);
insert_output_before(ctx, decl, TGSI_SEMANTIC_COLOR, 0,
TGSI_INTERPOLATE_LINEAR);
vsctx->color_used[0] = TRUE;
}
break;
case TGSI_SEMANTIC_BCOLOR:
assert(decl->Semantic.Index < 2);
vsctx->bcolor_used[decl->Semantic.Index] = TRUE;
/* We must rasterize all 4 colors if back-face colors are
* used, otherwise the rasterizer doesn't do the color
* selection correctly. Declare it, but don't write to it. */
if (!vsctx->color_used[0]) {
insert_output(ctx, decl, TGSI_SEMANTIC_COLOR, 0,
TGSI_INTERPOLATE_LINEAR);
insert_output_before(ctx, decl, TGSI_SEMANTIC_COLOR, 0,
TGSI_INTERPOLATE_LINEAR);
vsctx->color_used[0] = TRUE;
}
if (!vsctx->color_used[1]) {
insert_output(ctx, decl, TGSI_SEMANTIC_COLOR, 1,
TGSI_INTERPOLATE_LINEAR);
insert_output_before(ctx, decl, TGSI_SEMANTIC_COLOR, 1,
TGSI_INTERPOLATE_LINEAR);
vsctx->color_used[1] = TRUE;
}
if (decl->Semantic.Index == 1 && !vsctx->bcolor_used[0]) {
insert_output(ctx, decl, TGSI_SEMANTIC_BCOLOR, 0,
TGSI_INTERPOLATE_LINEAR);
insert_output_before(ctx, decl, TGSI_SEMANTIC_BCOLOR, 0,
TGSI_INTERPOLATE_LINEAR);
vsctx->bcolor_used[0] = TRUE;
}
/* One more case is handled in insert_trailing_bcolor. */
break;
case TGSI_SEMANTIC_GENERIC:
@@ -195,11 +194,6 @@ static void transform_decl(struct tgsi_transform_context *ctx,
break;
}
if (decl->Semantic.Name != TGSI_SEMANTIC_BCOLOR) {
/* Insert it as soon as possible. */
insert_trailing_bcolor(ctx, decl);
}
/* Since we're inserting new outputs in between, the following outputs
* should be moved to the right so that they don't overlap with
* the newly added ones. */
@@ -214,6 +208,14 @@ static void transform_decl(struct tgsi_transform_context *ctx,
}
ctx->emit_declaration(ctx, decl);
/* Insert BCOLOR1 if needed. */
if (decl->Declaration.File == TGSI_FILE_OUTPUT &&
decl->Semantic.Name == TGSI_SEMANTIC_BCOLOR &&
!vsctx->bcolor_used[1]) {
insert_output_after(ctx, decl, TGSI_SEMANTIC_BCOLOR, 1,
TGSI_INTERPOLATE_LINEAR);
}
}
static void transform_inst(struct tgsi_transform_context *ctx,
@@ -226,10 +228,6 @@ static void transform_inst(struct tgsi_transform_context *ctx,
if (!vsctx->first_instruction) {
vsctx->first_instruction = TRUE;
/* The trailing BCOLOR should be inserted before the code
* if it hasn't already been done so. */
insert_trailing_bcolor(ctx, NULL);
/* Insert the generic output for WPOS. */
emit_output(ctx, TGSI_SEMANTIC_GENERIC, vsctx->last_generic + 1,
TGSI_INTERPOLATE_PERSPECTIVE, vsctx->num_outputs);
@@ -309,14 +307,18 @@ static void transform_inst(struct tgsi_transform_context *ctx,
ctx->emit_instruction(ctx, inst);
}
void r300_draw_init_vertex_shader(struct draw_context *draw,
void r300_draw_init_vertex_shader(struct r300_context *r300,
struct r300_vertex_shader *vs)
{
struct draw_context *draw = r300->draw;
struct pipe_shader_state new_vs;
struct tgsi_shader_info info;
struct vs_transform_context transform;
const uint newLen = tgsi_num_tokens(vs->state.tokens) + 100 /* XXX */;
unsigned i;
tgsi_scan_shader(vs->state.tokens, &info);
new_vs.tokens = tgsi_alloc_tokens(newLen);
if (new_vs.tokens == NULL)
return;
@@ -329,6 +331,22 @@ void r300_draw_init_vertex_shader(struct draw_context *draw,
transform.base.transform_instruction = transform_inst;
transform.base.transform_declaration = transform_decl;
for (i = 0; i < info.num_outputs; i++) {
unsigned index = info.output_semantic_index[i];
switch (info.output_semantic_name[i]) {
case TGSI_SEMANTIC_COLOR:
assert(index < 2);
transform.color_used[index] = TRUE;
break;
case TGSI_SEMANTIC_BCOLOR:
assert(index < 2);
transform.bcolor_used[index] = TRUE;
break;
}
}
tgsi_transform_shader(vs->state.tokens,
(struct tgsi_token*)new_vs.tokens,
newLen, &transform.base);
@@ -350,7 +368,7 @@ void r300_draw_init_vertex_shader(struct draw_context *draw,
vs->state.tokens = new_vs.tokens;
/* Init the VS output table for the rasterizer. */
r300_init_vs_outputs(vs);
r300_init_vs_outputs(r300, vs);
/* Make the last generic be WPOS. */
vs->outputs.wpos = vs->outputs.generic[transform.last_generic + 1];

View File

@@ -1046,6 +1046,7 @@ static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_conte
struct pipe_resource *texture,
const struct pipe_sampler_view *state)
{
struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
struct r600_pipe_sampler_view *view = CALLOC_STRUCT(r600_pipe_sampler_view);
struct r600_pipe_resource_state *rstate;
struct r600_resource_texture *tmp = (struct r600_resource_texture*)texture;
@@ -1092,6 +1093,11 @@ static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_conte
util_format_get_blockwidth(state->format), 8);
array_mode = tmp->array_mode[0];
tile_type = tmp->tile_type;
/* 128 bit formats require tile type = 1 */
if (rctx->chip_class == CAYMAN) {
if (util_format_get_blocksize(state->format) >= 16)
tile_type = 1;
}
if (texture->target == PIPE_TEXTURE_1D_ARRAY) {
height = 1;
@@ -1107,8 +1113,11 @@ static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_conte
rstate->val[0] = (S_030000_DIM(r600_tex_dim(texture->target)) |
S_030000_PITCH((pitch / 8) - 1) |
S_030000_NON_DISP_TILING_ORDER(tile_type) |
S_030000_TEX_WIDTH(texture->width0 - 1));
if (rctx->chip_class == CAYMAN)
rstate->val[0] |= CM_S_030000_NON_DISP_TILING_ORDER(tile_type);
else
rstate->val[0] |= S_030000_NON_DISP_TILING_ORDER(tile_type);
rstate->val[1] = (S_030004_TEX_HEIGHT(height - 1) |
S_030004_TEX_DEPTH(depth - 1) |
S_030004_ARRAY_MODE(array_mode));
@@ -1457,6 +1466,11 @@ static void evergreen_cb(struct r600_pipe_context *rctx, struct r600_pipe_state
tile_type = rtex->tile_type;
} else /* workaround for linear buffers */
tile_type = 1;
/* 128 bit formats require tile type = 1 */
if (rctx->chip_class == CAYMAN) {
if (util_format_get_blocksize(surf->base.format) >= 16)
tile_type = 1;
}
/* FIXME handle enabling of CB beyond BASE8 which has different offset */
r600_pipe_state_add_reg(rstate,

View File

@@ -970,6 +970,9 @@
#define S_030000_NON_DISP_TILING_ORDER(x) (((x) & 0x1) << 5)
#define G_030000_NON_DISP_TILING_ORDER(x) (((x) >> 5) & 0x1)
#define C_030000_NON_DISP_TILING_ORDER 0xFFFFFFDF
#define CM_S_030000_NON_DISP_TILING_ORDER(x) (((x) & 0x3) << 4)
#define CM_G_030000_NON_DISP_TILING_ORDER(x) (((x) >> 4) & 0x3)
#define CM_C_030000_NON_DISP_TILING_ORDER 0xFFFFFFCF
#define S_030000_PITCH(x) (((x) & 0xFFF) << 6)
#define G_030000_PITCH(x) (((x) >> 6) & 0xFFF)
#define C_030000_PITCH 0xFFFC003F

View File

@@ -47,6 +47,7 @@
#include "r600_resource.h"
#include "r600_shader.h"
#include "r600_pipe.h"
#include "r600_hw_context_priv.h"
/*
* pipe_context
@@ -116,6 +117,14 @@ static struct r600_fence *r600_create_fence(struct r600_pipe_context *ctx)
rscreen->fences.data[fence->index] = 0;
r600_context_emit_fence(&ctx->ctx, rscreen->fences.bo, fence->index, 1);
/* Create a dummy BO so that fence_finish without a timeout can sleep waiting for completion */
fence->sleep_bo = (struct r600_resource*)
pipe_buffer_create(&ctx->ctx.screen->screen, PIPE_BIND_CUSTOM,
PIPE_USAGE_STAGING, 1);
/* Add the fence as a dummy relocation. */
r600_context_bo_reloc(&ctx->ctx, fence->sleep_bo, RADEON_USAGE_READWRITE);
out:
pipe_mutex_unlock(rscreen->fences.mutex);
return fence;
@@ -568,6 +577,7 @@ static void r600_fence_reference(struct pipe_screen *pscreen,
if (pipe_reference(&(*oldf)->reference, &newf->reference)) {
struct r600_screen *rscreen = (struct r600_screen *)pscreen;
pipe_mutex_lock(rscreen->fences.mutex);
pipe_resource_reference((struct pipe_resource**)&(*oldf)->sleep_bo, NULL);
LIST_ADDTAIL(&(*oldf)->head, &rscreen->fences.pool);
pipe_mutex_unlock(rscreen->fences.mutex);
}
@@ -601,6 +611,17 @@ static boolean r600_fence_finish(struct pipe_screen *pscreen,
}
while (rscreen->fences.data[rfence->index] == 0) {
/* Special-case infinite timeout - wait for the dummy BO to become idle */
if (timeout == PIPE_TIMEOUT_INFINITE) {
rscreen->ws->buffer_wait(rfence->sleep_bo->buf, RADEON_USAGE_READWRITE);
break;
}
/* The dummy BO will be busy until the CS including the fence has completed, or
* the GPU is reset. Don't bother continuing to spin when the BO is idle. */
if (!rscreen->ws->buffer_is_busy(rfence->sleep_bo->buf, RADEON_USAGE_READWRITE))
break;
if (++spins % 256)
continue;
#ifdef PIPE_OS_UNIX
@@ -610,11 +631,11 @@ static boolean r600_fence_finish(struct pipe_screen *pscreen,
#endif
if (timeout != PIPE_TIMEOUT_INFINITE &&
os_time_get() - start_time >= timeout) {
return FALSE;
break;
}
}
return TRUE;
return rscreen->fences.data[rfence->index] != 0;
}
static int r600_interpret_tiling(struct r600_screen *rscreen, uint32_t tiling_config)

View File

@@ -172,6 +172,7 @@ struct r600_textures_info {
struct r600_fence {
struct pipe_reference reference;
unsigned index; /* in the shared bo */
struct r600_resource *sleep_bo;
struct list_head head;
};

View File

@@ -1277,6 +1277,14 @@ static int r600_shader_from_tgsi(struct r600_pipe_context * rctx, struct r600_pi
if (ctx.bc->chip_class == CAYMAN)
cm_bytecode_add_cf_end(ctx.bc);
/* check GPR limit - we have 124 = 128 - 4
* (4 are reserved as alu clause temporary registers) */
if (ctx.bc->ngpr > 124) {
R600_ERR("GPR limit exceeded - shader requires %d registers\n", ctx.bc->ngpr);
r = -ENOMEM;
goto out_err;
}
free(ctx.literals);
tgsi_parse_free(&ctx.parse);
return 0;

View File

@@ -138,7 +138,9 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
static int
softpipe_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_shader_cap param)
{
#ifdef HAVE_LLVM
struct softpipe_screen *sp_screen = softpipe_screen(screen);
#endif
switch(shader)
{
case PIPE_SHADER_FRAGMENT:

View File

@@ -88,7 +88,7 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe)
vinfo->num_attribs = 0;
for (i = 0; i < fsInfo->num_inputs; i++) {
int src;
enum interp_mode interp;
enum interp_mode interp = INTERP_LINEAR;
switch (fsInfo->input_interpolate[i]) {
case TGSI_INTERPOLATE_CONSTANT:
@@ -105,7 +105,6 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe)
break;
default:
assert(0);
interp = INTERP_LINEAR;
}
switch (fsInfo->input_semantic_name[i]) {

View File

@@ -28,6 +28,7 @@
#include "pipe/p_compiler.h"
#ifndef __HAIKU__
typedef int64_t int64;
typedef uint64_t uint64;
@@ -39,6 +40,9 @@ typedef uint16_t uint16;
typedef int8_t int8;
typedef uint8_t uint8;
#else
#include <OS.h>
#endif /* HAIKU */
typedef uint8_t Bool;

View File

@@ -44,8 +44,7 @@ static void svga_surface_copy(struct pipe_context *pipe,
const struct pipe_box *src_box)
{
struct svga_context *svga = svga_context(pipe);
struct svga_texture *stex = svga_texture(src_tex);
struct svga_texture *dtex = svga_texture(dst_tex);
struct svga_texture *stex, *dtex;
/* struct pipe_screen *screen = pipe->screen;
SVGA3dCopyBox *box;
enum pipe_error ret;
@@ -63,6 +62,9 @@ static void svga_surface_copy(struct pipe_context *pipe,
return;
}
stex = svga_texture(src_tex);
dtex = svga_texture(dst_tex);
#if 0
srcsurf = screen->get_tex_surface(screen, src_tex,
src_level, src_box->z, src_box->z,

View File

@@ -57,10 +57,10 @@ svga_translate_stencil_op(unsigned op)
case PIPE_STENCIL_OP_KEEP: return SVGA3D_STENCILOP_KEEP;
case PIPE_STENCIL_OP_ZERO: return SVGA3D_STENCILOP_ZERO;
case PIPE_STENCIL_OP_REPLACE: return SVGA3D_STENCILOP_REPLACE;
case PIPE_STENCIL_OP_INCR: return SVGA3D_STENCILOP_INCR;
case PIPE_STENCIL_OP_DECR: return SVGA3D_STENCILOP_DECR;
case PIPE_STENCIL_OP_INCR_WRAP: return SVGA3D_STENCILOP_INCRSAT; /* incorrect? */
case PIPE_STENCIL_OP_DECR_WRAP: return SVGA3D_STENCILOP_DECRSAT; /* incorrect? */
case PIPE_STENCIL_OP_INCR: return SVGA3D_STENCILOP_INCRSAT;
case PIPE_STENCIL_OP_DECR: return SVGA3D_STENCILOP_DECRSAT;
case PIPE_STENCIL_OP_INCR_WRAP: return SVGA3D_STENCILOP_INCR;
case PIPE_STENCIL_OP_DECR_WRAP: return SVGA3D_STENCILOP_DECR;
case PIPE_STENCIL_OP_INVERT: return SVGA3D_STENCILOP_INVERT;
default:
assert(0);

View File

@@ -201,6 +201,17 @@ svga_release_user_upl_buffers(struct svga_context *svga)
if (vb->buffer && svga_buffer_is_user_buffer(vb->buffer)) {
struct svga_buffer *buffer = svga_buffer(vb->buffer);
/* The buffer_offset is relative to the uploaded buffer.
* Since we're discarding that buffer we need to reset this offset
* so it's not inadvertantly applied to a subsequent draw.
*
* XXX a root problem here is that the svga->curr.vb[] information
* is getting set both by gallium API calls and by code in
* svga_upload_user_buffers(). We should instead have two copies
* of the vertex buffer information and choose between as needed.
*/
vb->buffer_offset = 0;
buffer->uploaded.start = ~0;
buffer->uploaded.end = 0;
if (buffer->uploaded.buffer)

View File

@@ -237,11 +237,11 @@ static void svga_bind_rasterizer_state( struct pipe_context *pipe,
struct svga_context *svga = svga_context(pipe);
struct svga_rasterizer_state *raster = (struct svga_rasterizer_state *)state;
svga->curr.rast = raster;
draw_set_rasterizer_state(svga->swtnl.draw, raster ? &raster->templ : NULL,
state);
svga->curr.rast = raster;
svga->dirty |= SVGA_NEW_RAST;
}

View File

@@ -125,8 +125,8 @@ svga_create_sampler_state(struct pipe_context *pipe,
* - min/max LOD clamping
*/
cso->min_lod = 0;
cso->view_min_lod = MAX2(sampler->min_lod, 0);
cso->view_max_lod = MAX2(sampler->max_lod, 0);
cso->view_min_lod = MAX2((int) (sampler->min_lod + 0.5), 0);
cso->view_max_lod = MAX2((int) (sampler->max_lod + 0.5), 0);
/* Use min_mipmap */
if (svga->debug.use_min_mipmap) {

View File

@@ -120,7 +120,7 @@ svga_get_paramf(struct pipe_screen *screen, enum pipe_capf param)
return result.u;
case PIPE_CAPF_MAX_TEXTURE_LOD_BIAS:
return 16.0;
return 15.0;
default:
return 0;
@@ -235,7 +235,7 @@ static int svga_get_shader_param(struct pipe_screen *screen, unsigned shader, en
case PIPE_SHADER_CAP_MAX_TEMPS:
if (!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_TEMPS, &result))
return 32;
return result.u;
return MIN2(result.u, SVGA3D_TEMPREG_MAX);
case PIPE_SHADER_CAP_MAX_ADDRS:
case PIPE_SHADER_CAP_INDIRECT_INPUT_ADDR:
/*
@@ -286,7 +286,7 @@ static int svga_get_shader_param(struct pipe_screen *screen, unsigned shader, en
case PIPE_SHADER_CAP_MAX_TEMPS:
if (!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEMPS, &result))
return 32;
return result.u;
return MIN2(result.u, SVGA3D_TEMPREG_MAX);
case PIPE_SHADER_CAP_MAX_ADDRS:
return 1;
case PIPE_SHADER_CAP_MAX_PREDS:

View File

@@ -136,7 +136,7 @@ update_need_pipeline( struct svga_context *svga,
/* EDGEFLAGS
*/
if (vs->base.info.writes_edgeflag) {
if (vs && vs->base.info.writes_edgeflag) {
SVGA_DBG(DEBUG_SWTNL, "%s: edgeflags\n", __FUNCTION__);
need_pipeline = TRUE;
}
@@ -145,7 +145,8 @@ update_need_pipeline( struct svga_context *svga,
*/
if (svga->curr.reduced_prim == PIPE_PRIM_POINTS) {
unsigned sprite_coord_gen = svga->curr.rast->templ.sprite_coord_enable;
unsigned generic_inputs = svga->curr.fs->generic_inputs;
unsigned generic_inputs =
svga->curr.fs ? svga->curr.fs->generic_inputs : 0;
if (sprite_coord_gen &&
(generic_inputs & ~sprite_coord_gen)) {

View File

@@ -82,12 +82,14 @@ update_tss_binding(struct svga_context *svga,
const struct svga_sampler_state *s = svga->curr.sampler[i];
struct svga_hw_view_state *view = &svga->state.hw_draw.views[i];
struct pipe_resource *texture = NULL;
struct pipe_sampler_view *sv = svga->curr.sampler_views[i];
/* get min max lod */
if (svga->curr.sampler_views[i]) {
min_lod = MAX2(s->view_min_lod, 0);
max_lod = MIN2(s->view_max_lod, svga->curr.sampler_views[i]->texture->last_level);
texture = svga->curr.sampler_views[i]->texture;
if (sv) {
min_lod = MAX2(0, (s->view_min_lod + sv->u.tex.first_level));
max_lod = MIN2(s->view_max_lod, sv->texture->last_level);
max_lod += sv->u.tex.first_level;
texture = sv->texture;
} else {
min_lod = 0;
max_lod = 0;

View File

@@ -320,6 +320,11 @@ svga_mark_surface_dirty(struct pipe_surface *surf)
else {
/* this will happen later in svga_propagate_surface */
}
/* Increment the view_age and texture age for this surface's slice
* so that any sampler views into the texture are re-validated too.
*/
tex->view_age[surf->u.tex.first_layer] = ++(tex->age);
}
}

View File

@@ -232,8 +232,7 @@ dri_make_current(__DRIcontext * cPriv,
if (draw->textures[ST_ATTACHMENT_BACK_LEFT] && draw->textures[ST_ATTACHMENT_DEPTH_STENCIL]
&& ctx->pp)
pp_init_fbos(ctx->pp, draw->textures[ST_ATTACHMENT_BACK_LEFT]->width0,
draw->textures[ST_ATTACHMENT_BACK_LEFT]->height0,
draw->textures[ST_ATTACHMENT_DEPTH_STENCIL]);
draw->textures[ST_ATTACHMENT_BACK_LEFT]->height0);
return GL_TRUE;
}

View File

@@ -53,6 +53,7 @@ dri_st_framebuffer_validate(struct st_framebuffer_iface *stfbi,
unsigned statt_mask, new_mask;
boolean new_stamp;
int i;
unsigned int lastStamp;
statt_mask = 0x0;
for (i = 0; i < count; i++)
@@ -66,23 +67,26 @@ dri_st_framebuffer_validate(struct st_framebuffer_iface *stfbi,
* client stamp. It has the value of the server stamp when last
* checked.
*/
new_stamp = (drawable->texture_stamp != drawable->dPriv->lastStamp);
do {
lastStamp = drawable->dPriv->lastStamp;
new_stamp = (drawable->texture_stamp != lastStamp);
if (new_stamp || new_mask || screen->broken_invalidate) {
if (new_stamp && drawable->update_drawable_info)
drawable->update_drawable_info(drawable);
if (new_stamp || new_mask || screen->broken_invalidate) {
if (new_stamp && drawable->update_drawable_info)
drawable->update_drawable_info(drawable);
drawable->allocate_textures(drawable, statts, count);
drawable->allocate_textures(drawable, statts, count);
/* add existing textures */
for (i = 0; i < ST_ATTACHMENT_COUNT; i++) {
if (drawable->textures[i])
statt_mask |= (1 << i);
/* add existing textures */
for (i = 0; i < ST_ATTACHMENT_COUNT; i++) {
if (drawable->textures[i])
statt_mask |= (1 << i);
}
drawable->texture_stamp = lastStamp;
drawable->texture_mask = statt_mask;
}
drawable->texture_stamp = drawable->dPriv->lastStamp;
drawable->texture_mask = statt_mask;
}
} while (lastStamp != drawable->dPriv->lastStamp);
if (!out)
return TRUE;

View File

@@ -316,6 +316,9 @@ dri2_allocate_buffer(__DRIscreen *sPriv,
switch (format) {
case 32:
pf = PIPE_FORMAT_B8G8R8A8_UNORM;
break;
case 24:
pf = PIPE_FORMAT_B8G8R8X8_UNORM;
break;
case 16:

View File

@@ -253,6 +253,7 @@ drisw_update_tex_buffer(struct dri_drawable *drawable,
char *map;
int x, y, w, h;
int ximage_stride, line;
int cpp = util_format_get_blocksize(res->format);
get_drawable_info(dPriv, &x, &y, &w, &h);
@@ -265,9 +266,8 @@ drisw_update_tex_buffer(struct dri_drawable *drawable,
/* Copy the Drawable content to the mapped texture buffer */
get_image(dPriv, x, y, w, h, map);
/* The pipe transfer has a pitch rounded up to the nearest 64 pixels.
We assume 32 bit pixels. */
ximage_stride = w * 4;
/* The pipe transfer has a pitch rounded up to the nearest 64 pixels. */
ximage_stride = w * cpp;
for (line = h-1; line; --line) {
memmove(&map[line * transfer->stride],
&map[line * ximage_stride],

View File

@@ -367,6 +367,8 @@ static struct polygon_array * path_get_fill_polygons(struct path *p, struct matr
void *coords = (VGfloat *)p->control_points->data;
struct array *array;
memset(data, 0, sizeof(data));
if (p->fill_polys.polygon_array.array)
{
if (memcmp( &p->fill_polys.matrix,

View File

@@ -73,8 +73,8 @@ static void add_glyph(struct vg_font *font,
glyph = CALLOC_STRUCT(vg_glyph);
glyph->object = obj;
glyph->is_hinted = isHinted;
memcpy(glyph->glyph_origin, glyphOrigin, sizeof(glyphOrigin));
memcpy(glyph->escapement, escapement, sizeof(escapement));
memcpy(glyph->glyph_origin, glyphOrigin, sizeof(glyph->glyph_origin));
memcpy(glyph->escapement, escapement, sizeof(glyph->glyph_origin));
cso_hash_insert(font->glyphs, (unsigned) glyphIndex, glyph);
}

View File

@@ -526,8 +526,8 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
src += offset;
for (i = 0; i < n; ++i) {
VGfloat clr[4];
clr[0] = ((*src >> 10) & 31)/31.;
clr[1] = ((*src >> 5) & 95)/95.;
clr[0] = ((*src >> 11) & 31)/31.;
clr[1] = ((*src >> 5) & 63)/63.;
clr[2] = ((*src >> 0) & 31)/31.;
clr[3] = 1.f;

View File

@@ -29,7 +29,6 @@
#include <X11/Xlibint.h>
#include <X11/extensions/XvMClib.h>
#include <xorg/fourcc.h>
#include "pipe/p_screen.h"
#include "pipe/p_video_decoder.h"
@@ -46,6 +45,8 @@
#include "xvmc_private.h"
#define FOURCC_RGB 0x0000003
#define FOURCC_AI44 0x34344941
#define FOURCC_IA44 0x34344149
static enum pipe_format XvIDToPipe(int xvimage_id)
{

View File

@@ -46,7 +46,7 @@ endif
default: depend $(TOP)/$(LIB_DIR)/gallium $(LIBNAME) $(LIBNAME_STAGING)
$(LIBNAME): $(OBJECTS) Makefile ../Makefile.xorg $(LIBS) $(DRIVER_PIPES) $(GALLIUM_AUXILIARIES)
$(MKLIB) -linker '$(LD)' -noprefix -o $@ $(LDFLAGS) $(OBJECTS) $(DRIVER_PIPES) $(GALLIUM_AUXILIARIES) $(DRIVER_LINKS)
$(MKLIB) -linker '$(LD)' -noprefix -o $@ -ldflags '$(LDFLAGS)' $(OBJECTS) $(DRIVER_PIPES) $(GALLIUM_AUXILIARIES) $(DRIVER_LINKS)
depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS) $(GENERATED_SOURCES)
rm -f depend

View File

@@ -54,8 +54,9 @@ dlopen_gl_lib_cb(const char *dir, size_t len, void *callback_data)
int ret;
if (len) {
assert(len <= INT_MAX && "path is insanely long!");
ret = util_snprintf(path, sizeof(path), "%.*s/%s" UTIL_DL_EXT,
len, dir, name);
(int)len, dir, name);
}
else {
ret = util_snprintf(path, sizeof(path), "%s" UTIL_DL_EXT, name);

View File

@@ -39,6 +39,7 @@ LOCAL_SRC_FILES := \
$(LIBGLSL_CXX_SOURCES)
LOCAL_C_INCLUDES := \
external/astl/include \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/mesa

View File

@@ -54,6 +54,7 @@
#include "glsl_parser_extras.h"
#include "ast.h"
#include "glsl_types.h"
#include "program/hash_table.h"
#include "ir.h"
void
@@ -3405,7 +3406,7 @@ ast_jump_statement::hir(exec_list *instructions,
"continue may only appear in a loop");
} else if (mode == ast_break &&
state->loop_nesting_ast == NULL &&
state->switch_nesting_ast == NULL) {
state->switch_state.switch_nesting_ast == NULL) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(& loc, state,
@@ -3423,11 +3424,11 @@ ast_jump_statement::hir(exec_list *instructions,
state);
}
if (state->is_switch_innermost &&
if (state->switch_state.is_switch_innermost &&
mode == ast_break) {
/* Force break out of switch by setting is_break switch state.
*/
ir_variable *const is_break_var = state->is_break_var;
ir_variable *const is_break_var = state->switch_state.is_break_var;
ir_dereference_variable *const deref_is_break_var =
new(ctx) ir_dereference_variable(is_break_var);
ir_constant *const true_val = new(ctx) ir_constant(true);
@@ -3515,11 +3516,9 @@ ast_switch_statement::hir(exec_list *instructions,
*
* "The type of init-expression in a switch statement must be a
* scalar integer."
*
* The checks are separated so that higher quality diagnostics can be
* generated for cases where the rule is violated.
*/
if (!test_expression->type->is_integer()) {
if (!test_expression->type->is_scalar() ||
!test_expression->type->is_integer()) {
YYLTYPE loc = this->test_expression->get_location();
_mesa_glsl_error(& loc,
@@ -3530,25 +3529,25 @@ ast_switch_statement::hir(exec_list *instructions,
/* Track the switch-statement nesting in a stack-like manner.
*/
ir_variable *saved_test_var = state->test_var;
ir_variable *saved_is_fallthru_var = state->is_fallthru_var;
bool save_is_switch_innermost = state->is_switch_innermost;
ast_switch_statement *saved_nesting_ast = state->switch_nesting_ast;
struct glsl_switch_state saved = state->switch_state;
state->is_switch_innermost = true;
state->switch_nesting_ast = this;
state->switch_state.is_switch_innermost = true;
state->switch_state.switch_nesting_ast = this;
state->switch_state.labels_ht = hash_table_ctor(0, hash_table_pointer_hash,
hash_table_pointer_compare);
state->switch_state.previous_default = NULL;
/* Initalize is_fallthru state to false.
*/
ir_rvalue *const is_fallthru_val = new (ctx) ir_constant(false);
state->is_fallthru_var = new(ctx) ir_variable(glsl_type::bool_type,
"switch_is_fallthru_tmp",
ir_var_temporary);
instructions->push_tail(state->is_fallthru_var);
state->switch_state.is_fallthru_var =
new(ctx) ir_variable(glsl_type::bool_type,
"switch_is_fallthru_tmp",
ir_var_temporary);
instructions->push_tail(state->switch_state.is_fallthru_var);
ir_dereference_variable *deref_is_fallthru_var =
new(ctx) ir_dereference_variable(state->is_fallthru_var);
new(ctx) ir_dereference_variable(state->switch_state.is_fallthru_var);
instructions->push_tail(new(ctx) ir_assignment(deref_is_fallthru_var,
is_fallthru_val,
NULL));
@@ -3556,13 +3555,13 @@ ast_switch_statement::hir(exec_list *instructions,
/* Initalize is_break state to false.
*/
ir_rvalue *const is_break_val = new (ctx) ir_constant(false);
state->is_break_var = new(ctx) ir_variable(glsl_type::bool_type,
"switch_is_break_tmp",
ir_var_temporary);
instructions->push_tail(state->is_break_var);
state->switch_state.is_break_var = new(ctx) ir_variable(glsl_type::bool_type,
"switch_is_break_tmp",
ir_var_temporary);
instructions->push_tail(state->switch_state.is_break_var);
ir_dereference_variable *deref_is_break_var =
new(ctx) ir_dereference_variable(state->is_break_var);
new(ctx) ir_dereference_variable(state->switch_state.is_break_var);
instructions->push_tail(new(ctx) ir_assignment(deref_is_break_var,
is_break_val,
NULL));
@@ -3570,21 +3569,16 @@ ast_switch_statement::hir(exec_list *instructions,
/* Cache test expression.
*/
test_to_hir(instructions, state);
/* Emit code for body of switch stmt.
*/
body->hir(instructions, state);
/* Restore previous nesting before returning.
*/
state->switch_nesting_ast = saved_nesting_ast;
state->is_switch_innermost = save_is_switch_innermost;
hash_table_dtor(state->switch_state.labels_ht);
state->test_var = saved_test_var;
state->is_fallthru_var = saved_is_fallthru_var;
state->switch_state = saved;
/* Switch statements do not have r-values.
*/
/* Switch statements do not have r-values. */
return NULL;
}
@@ -3595,21 +3589,19 @@ ast_switch_statement::test_to_hir(exec_list *instructions,
{
void *ctx = state;
/* Cache value of test expression.
*/
/* Cache value of test expression. */
ir_rvalue *const test_val =
test_expression->hir(instructions,
state);
state->test_var = new(ctx) ir_variable(glsl_type::int_type,
"switch_test_tmp",
ir_var_temporary);
state->switch_state.test_var = new(ctx) ir_variable(test_val->type,
"switch_test_tmp",
ir_var_temporary);
ir_dereference_variable *deref_test_var =
new(ctx) ir_dereference_variable(state->test_var);
new(ctx) ir_dereference_variable(state->switch_state.test_var);
instructions->push_tail(state->test_var);
instructions->push_tail(new(ctx) ir_assignment(deref_test_var,
test_val,
instructions->push_tail(state->switch_state.test_var);
instructions->push_tail(new(ctx) ir_assignment(deref_test_var, test_val,
NULL));
}
@@ -3620,58 +3612,51 @@ ast_switch_body::hir(exec_list *instructions,
{
if (stmts != NULL)
stmts->hir(instructions, state);
/* Switch bodies do not have r-values.
*/
/* Switch bodies do not have r-values. */
return NULL;
}
ir_rvalue *
ast_case_statement_list::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
foreach_list_typed (ast_case_statement, case_stmt, link, & this->cases)
case_stmt->hir(instructions, state);
/* Case statements do not have r-values.
*/
/* Case statements do not have r-values. */
return NULL;
}
ir_rvalue *
ast_case_statement::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
labels->hir(instructions, state);
/* Conditionally set fallthru state based on break state.
*/
/* Conditionally set fallthru state based on break state. */
ir_constant *const false_val = new(state) ir_constant(false);
ir_dereference_variable *const deref_is_fallthru_var =
new(state) ir_dereference_variable(state->is_fallthru_var);
new(state) ir_dereference_variable(state->switch_state.is_fallthru_var);
ir_dereference_variable *const deref_is_break_var =
new(state) ir_dereference_variable(state->is_break_var);
new(state) ir_dereference_variable(state->switch_state.is_break_var);
ir_assignment *const reset_fallthru_on_break =
new(state) ir_assignment(deref_is_fallthru_var,
false_val,
deref_is_break_var);
instructions->push_tail(reset_fallthru_on_break);
/* Guard case statements depending on fallthru state.
*/
/* Guard case statements depending on fallthru state. */
ir_dereference_variable *const deref_fallthru_guard =
new(state) ir_dereference_variable(state->is_fallthru_var);
new(state) ir_dereference_variable(state->switch_state.is_fallthru_var);
ir_if *const test_fallthru = new(state) ir_if(deref_fallthru_guard);
foreach_list_typed (ast_node, stmt, link, & this->stmts)
stmt->hir(& test_fallthru->then_instructions, state);
instructions->push_tail(test_fallthru);
/* Case statements do not have r-values.
*/
/* Case statements do not have r-values. */
return NULL;
}
@@ -3682,13 +3667,11 @@ ast_case_label_list::hir(exec_list *instructions,
{
foreach_list_typed (ast_case_label, label, link, & this->labels)
label->hir(instructions, state);
/* Case labels do not have r-values.
*/
/* Case labels do not have r-values. */
return NULL;
}
ir_rvalue *
ast_case_label::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
@@ -3696,49 +3679,83 @@ ast_case_label::hir(exec_list *instructions,
void *ctx = state;
ir_dereference_variable *deref_fallthru_var =
new(ctx) ir_dereference_variable(state->is_fallthru_var);
new(ctx) ir_dereference_variable(state->switch_state.is_fallthru_var);
ir_rvalue *const true_val = new(ctx) ir_constant(true);
/* If not default case, ...
*/
/* If not default case, ... */
if (this->test_value != NULL) {
/* Conditionally set fallthru state based on
* comparison of cached test expression value to case label.
*/
ir_rvalue *const test_val = this->test_value->hir(instructions, state);
ir_rvalue *const label_rval = this->test_value->hir(instructions, state);
ir_constant *label_const = label_rval->constant_expression_value();
if (!label_const) {
YYLTYPE loc = this->test_value->get_location();
_mesa_glsl_error(& loc, state,
"switch statement case label must be a "
"constant expression");
/* Stuff a dummy value in to allow processing to continue. */
label_const = new(ctx) ir_constant(0);
} else {
ast_expression *previous_label = (ast_expression *)
hash_table_find(state->switch_state.labels_ht,
(void *)(uintptr_t)label_const->value.u[0]);
if (previous_label) {
YYLTYPE loc = this->test_value->get_location();
_mesa_glsl_error(& loc, state,
"duplicate case value");
loc = previous_label->get_location();
_mesa_glsl_error(& loc, state,
"this is the previous case label");
} else {
hash_table_insert(state->switch_state.labels_ht,
this->test_value,
(void *)(uintptr_t)label_const->value.u[0]);
}
}
ir_dereference_variable *deref_test_var =
new(ctx) ir_dereference_variable(state->test_var);
new(ctx) ir_dereference_variable(state->switch_state.test_var);
ir_rvalue *const test_cond = new(ctx) ir_expression(ir_binop_all_equal,
glsl_type::bool_type,
test_val,
label_const,
deref_test_var);
ir_assignment *set_fallthru_on_test =
new(ctx) ir_assignment(deref_fallthru_var,
true_val,
test_cond);
instructions->push_tail(set_fallthru_on_test);
} else { /* default case */
/* Set falltrhu state.
*/
if (state->switch_state.previous_default) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(& loc, state,
"multiple default labels in one switch");
loc = state->switch_state.previous_default->get_location();
_mesa_glsl_error(& loc, state,
"this is the first default label");
}
state->switch_state.previous_default = this;
/* Set falltrhu state. */
ir_assignment *set_fallthru =
new(ctx) ir_assignment(deref_fallthru_var,
true_val,
NULL);
new(ctx) ir_assignment(deref_fallthru_var, true_val, NULL);
instructions->push_tail(set_fallthru);
}
/* Case statements do not have r-values.
*/
/* Case statements do not have r-values. */
return NULL;
}
void
ast_iteration_statement::condition_to_hir(ir_loop *stmt,
struct _mesa_glsl_parse_state *state)
@@ -3760,8 +3777,7 @@ ast_iteration_statement::condition_to_hir(ir_loop *stmt,
* like 'if (!condition) break;' as the loop termination condition.
*/
ir_rvalue *const not_cond =
new(ctx) ir_expression(ir_unop_logic_not, glsl_type::bool_type, cond,
NULL);
new(ctx) ir_expression(ir_unop_logic_not, cond);
ir_if *const if_stmt = new(ctx) ir_if(not_cond);
@@ -3792,8 +3808,7 @@ ast_iteration_statement::hir(exec_list *instructions,
ir_loop *const stmt = new(ctx) ir_loop();
instructions->push_tail(stmt);
/* Track the current loop nesting.
*/
/* Track the current loop nesting. */
ast_iteration_statement *nesting_ast = state->loop_nesting_ast;
state->loop_nesting_ast = this;
@@ -3801,8 +3816,8 @@ ast_iteration_statement::hir(exec_list *instructions,
/* Likewise, indicate that following code is closest to a loop,
* NOT closest to a switch.
*/
bool saved_is_switch_innermost = state->is_switch_innermost;
state->is_switch_innermost = false;
bool saved_is_switch_innermost = state->switch_state.is_switch_innermost;
state->switch_state.is_switch_innermost = false;
if (mode != ast_do_while)
condition_to_hir(stmt, state);
@@ -3819,10 +3834,9 @@ ast_iteration_statement::hir(exec_list *instructions,
if (mode != ast_do_while)
state->symbols->pop_scope();
/* Restore previous nesting before returning.
*/
/* Restore previous nesting before returning. */
state->loop_nesting_ast = nesting_ast;
state->is_switch_innermost = saved_is_switch_innermost;
state->switch_state.is_switch_innermost = saved_is_switch_innermost;
/* Loops do not have r-values.
*/

View File

@@ -2,21 +2,21 @@
(signature float
(parameters
(declare (in) float x))
((return (expression float - (constant float (1.5707963))
((return (expression float - (constant float (1.5707964))
(call asin ((var_ref x)))))))
(signature vec2
(parameters
(declare (in) vec2 x))
((return (expression vec2 - (constant float (1.5707963))
((return (expression vec2 - (constant float (1.5707964))
(call asin ((var_ref x)))))))
(signature vec3
(parameters
(declare (in) vec3 x))
((return (expression vec3 - (constant float (1.5707963))
((return (expression vec3 - (constant float (1.5707964))
(call asin ((var_ref x)))))))
(signature vec4
(parameters
(declare (in) vec4 x))
((return (expression vec4 - (constant float (1.5707963))
((return (expression vec4 - (constant float (1.5707964))
(call asin ((var_ref x)))))))
))

View File

@@ -54,7 +54,7 @@ def get_txs_dim(sampler_type):
def generate_sigs(g, tex_inst, sampler_type, variant = 0, unused_fields = 0):
coord_dim = get_coord_dim(sampler_type)
extra_dim = get_extra_dim(sampler_type, variant & Proj, unused_fields)
offset_dim = get_sampler_dim(sampler_type)
sampler_dim = get_sampler_dim(sampler_type)
if variant & Single:
return_type = "float"
@@ -74,12 +74,12 @@ def generate_sigs(g, tex_inst, sampler_type, variant = 0, unused_fields = 0):
elif tex_inst == "txf" or tex_inst == "txs":
print "\n (declare (in) int lod)",
elif tex_inst == "txd":
grad_type = vec_type("", coord_dim)
grad_type = vec_type("", sampler_dim)
print "\n (declare (in) " + grad_type + " dPdx)",
print "\n (declare (in) " + grad_type + " dPdy)",
if variant & Offset:
print "\n (declare (const_in) " + vec_type("i", offset_dim) + " offset)",
print "\n (declare (const_in) " + vec_type("i", sampler_dim) + " offset)",
if tex_inst == "txb":
print "\n (declare (in) float bias)",

View File

@@ -70,7 +70,15 @@ HSPACE [ \t]
HASH ^{HSPACE}*#{HSPACE}*
IDENTIFIER [_a-zA-Z][_a-zA-Z0-9]*
PUNCTUATION [][(){}.&*~!/%<>^|;,=+-]
OTHER [^][(){}.&*~!/%<>^|;,=#[:space:]+-]+
/* The OTHER class is simply a catch-all for things that the CPP
parser just doesn't care about. Since flex regular expressions that
match longer strings take priority over those matching shorter
strings, we have to be careful to avoid OTHER matching and hiding
something that CPP does care about. So we simply exclude all
characters that appear in any other expressions. */
OTHER [^][_#[:space:]#a-zA-Z0-9(){}.&*~!/%<>^|;,=+-]
DIGITS [0-9][0-9]*
DECIMAL_INTEGER [1-9][0-9]*[uU]?

View File

@@ -85,7 +85,6 @@ _token_create_ival (void *ctx, int type, int ival);
static token_list_t *
_token_list_create (void *ctx);
/* Note: This function calls ralloc_steal on token. */
static void
_token_list_append (token_list_t *list, token_t *token);
@@ -763,8 +762,6 @@ _token_list_append (token_list_t *list, token_t *token)
node->token = token;
node->next = NULL;
ralloc_steal (list, token);
if (list->head == NULL) {
list->head = node;
} else {

View File

@@ -1671,6 +1671,7 @@ switch_statement:
SWITCH '(' expression ')' switch_body
{
$$ = new(state) ast_switch_statement($3, $5);
$$->set_location(yylloc);
}
;
@@ -1691,10 +1692,12 @@ case_label:
CASE expression ':'
{
$$ = new(state) ast_case_label($2);
$$->set_location(yylloc);
}
| DEFAULT ':'
{
$$ = new(state) ast_case_label(NULL);
$$->set_location(yylloc);
}
;
@@ -1705,6 +1708,7 @@ case_label_list:
labels->labels.push_tail(& $1->link);
$$ = labels;
$$->set_location(yylloc);
}
| case_label_list case_label
{
@@ -1717,6 +1721,7 @@ case_statement:
case_label_list statement
{
ast_case_statement *stmts = new(state) ast_case_statement($1);
stmts->set_location(yylloc);
stmts->stmts.push_tail(& $2->link);
$$ = stmts;
@@ -1732,6 +1737,7 @@ case_statement_list:
case_statement
{
ast_case_statement_list *cases= new(state) ast_case_statement_list();
cases->set_location(yylloc);
cases->cases.push_tail(& $1->link);
$$ = cases;

View File

@@ -51,7 +51,7 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *ctx,
this->info_log = ralloc_strdup(mem_ctx, "");
this->error = false;
this->loop_nesting_ast = NULL;
this->switch_nesting_ast = NULL;
this->switch_state.switch_nesting_ast = NULL;
this->num_builtins_to_link = 0;
@@ -114,6 +114,9 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *ctx,
}
this->supported_version_string = supported;
if (ctx->Const.ForceGLSLExtensionsWarn)
_mesa_glsl_process_extension("all", NULL, "warn", NULL, this);
}
const char *

View File

@@ -42,6 +42,20 @@ enum _mesa_glsl_parser_targets {
struct gl_context;
struct glsl_switch_state {
/** Temporary variables needed for switch statement. */
ir_variable *test_var;
ir_variable *is_fallthru_var;
ir_variable *is_break_var;
class ast_switch_statement *switch_nesting_ast;
/** Table of constant values already used in case labels */
struct hash_table *labels_ht;
class ast_case_label *previous_default;
bool is_switch_innermost; // if switch stmt is closest to break, ...
};
struct _mesa_glsl_parse_state {
_mesa_glsl_parse_state(struct gl_context *ctx, GLenum target,
void *mem_ctx);
@@ -150,13 +164,8 @@ struct _mesa_glsl_parse_state {
/** Loop or switch statement containing the current instructions. */
class ast_iteration_statement *loop_nesting_ast;
class ast_switch_statement *switch_nesting_ast;
bool is_switch_innermost; // if switch stmt is closest to break, ...
/** Temporary variables needed for switch statement. */
ir_variable *test_var;
ir_variable *is_fallthru_var;
ir_variable *is_break_var;
struct glsl_switch_state switch_state;
/** List of structures defined in user code. */
const glsl_type **user_structures;

View File

@@ -1158,7 +1158,6 @@ public:
{
this->ir_type = ir_type_loop_jump;
this->mode = mode;
this->loop = loop;
}
virtual ir_loop_jump *clone(void *mem_ctx, struct hash_table *) const;
@@ -1182,9 +1181,6 @@ public:
/** Mode selector for the jump instruction. */
enum jump_mode mode;
private:
/** Loop containing this break instruction. */
ir_loop *loop;
};
/**

View File

@@ -633,13 +633,13 @@ ir_expression::constant_expression_value()
for (unsigned c = 0; c < op[0]->type->components(); c++) {
switch (op[0]->type->base_type) {
case GLSL_TYPE_UINT:
data.b[0] = op[0]->value.u[0] < op[1]->value.u[0];
data.b[c] = op[0]->value.u[c] < op[1]->value.u[c];
break;
case GLSL_TYPE_INT:
data.b[0] = op[0]->value.i[0] < op[1]->value.i[0];
data.b[c] = op[0]->value.i[c] < op[1]->value.i[c];
break;
case GLSL_TYPE_FLOAT:
data.b[0] = op[0]->value.f[0] < op[1]->value.f[0];
data.b[c] = op[0]->value.f[c] < op[1]->value.f[c];
break;
default:
assert(0);
@@ -669,13 +669,13 @@ ir_expression::constant_expression_value()
for (unsigned c = 0; c < op[0]->type->components(); c++) {
switch (op[0]->type->base_type) {
case GLSL_TYPE_UINT:
data.b[0] = op[0]->value.u[0] <= op[1]->value.u[0];
data.b[c] = op[0]->value.u[c] <= op[1]->value.u[c];
break;
case GLSL_TYPE_INT:
data.b[0] = op[0]->value.i[0] <= op[1]->value.i[0];
data.b[c] = op[0]->value.i[c] <= op[1]->value.i[c];
break;
case GLSL_TYPE_FLOAT:
data.b[0] = op[0]->value.f[0] <= op[1]->value.f[0];
data.b[c] = op[0]->value.f[c] <= op[1]->value.f[c];
break;
default:
assert(0);
@@ -687,13 +687,13 @@ ir_expression::constant_expression_value()
for (unsigned c = 0; c < op[0]->type->components(); c++) {
switch (op[0]->type->base_type) {
case GLSL_TYPE_UINT:
data.b[0] = op[0]->value.u[0] >= op[1]->value.u[0];
data.b[c] = op[0]->value.u[c] >= op[1]->value.u[c];
break;
case GLSL_TYPE_INT:
data.b[0] = op[0]->value.i[0] >= op[1]->value.i[0];
data.b[c] = op[0]->value.i[c] >= op[1]->value.i[c];
break;
case GLSL_TYPE_FLOAT:
data.b[0] = op[0]->value.f[0] >= op[1]->value.f[0];
data.b[c] = op[0]->value.f[c] >= op[1]->value.f[c];
break;
default:
assert(0);

View File

@@ -174,8 +174,7 @@ private:
if (this->map->get(id, name))
return;
char *key = strdup(name);
this->map->put(this->num_active_uniforms, key);
this->map->put(this->num_active_uniforms, name);
/* Each leaf uniform occupies one entry in the list of active
* uniforms.

View File

@@ -2263,7 +2263,9 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
if (ctx->ShaderCompilerOptions[i].LowerClipDistance)
lower_clip_distance(prog->_LinkedShaders[i]->ir);
while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, false, 32))
unsigned max_unroll = ctx->ShaderCompilerOptions[i].MaxUnrollIterations;
while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, false, max_unroll))
;
}

View File

@@ -110,6 +110,8 @@ public:
virtual ir_visitor_status visit(ir_loop_jump *);
virtual ir_visitor_status visit(ir_dereference_variable *);
virtual ir_visitor_status visit_enter(ir_call *);
virtual ir_visitor_status visit_enter(ir_loop *);
virtual ir_visitor_status visit_leave(ir_loop *);
virtual ir_visitor_status visit_enter(ir_assignment *);
@@ -152,6 +154,21 @@ loop_analysis::visit(ir_loop_jump *ir)
}
ir_visitor_status
loop_analysis::visit_enter(ir_call *ir)
{
/* If we're not somewhere inside a loop, there's nothing to do. */
if (this->state.is_empty())
return visit_continue;
loop_variable_state *const ls =
(loop_variable_state *) this->state.get_head();
ls->contains_calls = true;
return visit_continue_with_parent;
}
ir_visitor_status
loop_analysis::visit(ir_dereference_variable *ir)
{
@@ -209,6 +226,17 @@ loop_analysis::visit_leave(ir_loop *ir)
loop_variable_state *const ls =
(loop_variable_state *) this->state.pop_head();
/* Function calls may contain side effects. These could alter any of our
* variables in ways that cannot be known, and may even terminate shader
* execution (say, calling discard in the fragment shader). So we can't
* rely on any of our analysis about assignments to variables.
*
* We could perform some conservative analysis (prove there's no statically
* possible assignment, etc.) but it isn't worth it for now; function
* inlining will allow us to unroll loops anyway.
*/
if (ls->contains_calls)
return visit_continue;
foreach_list(node, &ir->body_instructions) {
/* Skip over declarations at the start of a loop.

View File

@@ -122,10 +122,16 @@ public:
*/
unsigned num_loop_jumps;
/**
* Whether this loop contains any function calls.
*/
bool contains_calls;
loop_variable_state()
{
this->max_iterations = -1;
this->num_loop_jumps = 0;
this->contains_calls = false;
this->var_hash = hash_table_ctor(0, hash_table_pointer_hash,
hash_table_pointer_compare);
}
@@ -134,6 +140,23 @@ public:
{
hash_table_dtor(this->var_hash);
}
static void* operator new(size_t size, void *ctx)
{
void *lvs = ralloc_size(ctx, size);
assert(lvs != NULL);
ralloc_set_destructor(lvs, (void (*)(void*)) destructor);
return lvs;
}
private:
static void
destructor(loop_variable_state *lvs)
{
lvs->~loop_variable_state();
}
};

View File

@@ -56,6 +56,7 @@ loop_unroll_visitor::visit_leave(ir_loop *ir)
{
loop_variable_state *const ls = this->state->get(ir);
int iterations;
unsigned ir_count;
/* If we've entered a loop that hasn't been analyzed, something really,
* really bad has happened.
@@ -78,6 +79,20 @@ loop_unroll_visitor::visit_leave(ir_loop *ir)
if (iterations > (int) max_iterations)
return visit_continue;
/* Don't try to unroll nested loops and loops with a huge body.
*/
ir_count = 0;
foreach_list(node, &ir->body_instructions) {
++ir_count;
/* If the loop body gets to huge, do not unroll. */
if (5*max_iterations < ir_count*iterations)
return visit_continue;
/* Do not unroll loops with child loop nodes. */
if (((ir_instruction *) node)->as_loop())
return visit_continue;
}
if (ls->num_loop_jumps > 1)
return visit_continue;
else if (ls->num_loop_jumps) {

View File

@@ -278,7 +278,7 @@ ralloc_parent(const void *ptr)
return NULL;
info = get_header(ptr);
return PTR_FROM_HEADER(info->parent);
return info->parent ? PTR_FROM_HEADER(info->parent) : NULL;
}
static void *autofree_context = NULL;

View File

@@ -44,7 +44,8 @@
double
glsl_strtod(const char *s, char **end)
{
#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__)
#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && \
!defined(__HAIKU__)
static locale_t loc = NULL;
if (!loc) {
loc = newlocale(LC_CTYPE_MASK, "C", NULL);

View File

@@ -90,7 +90,7 @@ Mapdesc::setBboxsize( INREAL *mat )
void
Mapdesc::identify( REAL dest[MAXCOORDS][MAXCOORDS] )
{
memset( dest, 0, sizeof( dest ) );
memset( dest, 0, sizeof( REAL ) * MAXCOORDS * MAXCOORDS );
for( int i=0; i != hcoords; i++ )
dest[i][i] = 1.0;
}

View File

@@ -505,7 +505,7 @@ NurbsTessellator::do_pwlcurve( O_pwlcurve *o_pwlcurve )
o_pwlcurve->owner = currentCurve;
}
if( (inCurve == 2) )
if( inCurve == 2 )
endcurve();
}

View File

@@ -26,6 +26,7 @@ SOURCES = \
apple_glx.c \
apple_glx_context.c \
apple_glx_drawable.c \
apple_glx_log.c \
apple_glx_pbuffer.c \
apple_glx_pixmap.c \
apple_glx_surface.c \
@@ -35,6 +36,7 @@ SOURCES = \
apple_xgl_api_stereo.c \
apple_xgl_api_viewport.c \
appledri.c \
../create_context.c \
../clientattrib.c \
../compsize.c \
../glxconfig.c \

View File

@@ -33,6 +33,8 @@
#include <assert.h>
#include <stdarg.h>
#include <dlfcn.h>
#include <pthread.h>
#include <inttypes.h>
#include "appledri.h"
#include "apple_glx.h"
#include "apple_glx_context.h"
@@ -43,22 +45,6 @@ static int dri_event_base = 0;
const GLuint __glXDefaultPixelStore[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
static bool diagnostic = false;
void
apple_glx_diagnostic(const char *fmt, ...)
{
va_list vl;
if (diagnostic) {
fprintf(stderr, "DIAG: ");
va_start(vl, fmt);
vfprintf(stderr, fmt, vl);
va_end(vl);
}
}
int
apple_get_dri_event_base(void)
{
@@ -125,10 +111,9 @@ apple_init_glx(Display * dpy)
if (initialized)
return false;
if (getenv("LIBGL_DIAGNOSTIC")) {
printf("initializing libGL in %s\n", __func__);
diagnostic = true;
}
apple_glx_log_init();
apple_glx_log(ASL_LEVEL_INFO, "Initializing libGL.");
apple_cgl_init();
(void) apple_glx_get_client_id();

View File

@@ -38,7 +38,8 @@
#define XP_NO_X_HEADERS
#include <Xplugin.h>
void apple_glx_diagnostic(const char *fmt, ...);
#include "apple_glx_log.h"
xp_client_id apple_glx_get_client_id(void);
bool apple_init_glx(Display * dpy);
void apple_glx_swap_buffers(void *ptr);

View File

@@ -421,7 +421,7 @@ apple_glx_make_current_context(Display * dpy, void *oldptr, void *ptr,
*/
if (same_drawable && ac->is_current) {
apple_glx_diagnostic("%s: same_drawable and ac->is_current\n");
apple_glx_diagnostic("same_drawable and ac->is_current\n");
return false;
}

View File

@@ -32,6 +32,7 @@
#include <stdlib.h>
#include <assert.h>
#include <pthread.h>
#include <string.h>
#include "apple_glx.h"
#include "apple_glx_context.h"
#include "apple_glx_drawable.h"
@@ -48,8 +49,8 @@ lock_drawables_list(void)
err = pthread_mutex_lock(&drawables_lock);
if (err) {
fprintf(stderr, "pthread_mutex_lock failure in %s: %d\n",
__func__, err);
fprintf(stderr, "pthread_mutex_lock failure in %s: %s\n",
__func__, strerror(err));
abort();
}
}
@@ -62,8 +63,8 @@ unlock_drawables_list(void)
err = pthread_mutex_unlock(&drawables_lock);
if (err) {
fprintf(stderr, "pthread_mutex_unlock failure in %s: %d\n",
__func__, err);
fprintf(stderr, "pthread_mutex_unlock failure in %s: %s\n",
__func__, strerror(err));
abort();
}
}
@@ -95,7 +96,7 @@ drawable_lock(struct apple_glx_drawable *agd)
err = pthread_mutex_lock(&agd->mutex);
if (err) {
fprintf(stderr, "pthread_mutex_lock error: %d\n", err);
fprintf(stderr, "pthread_mutex_lock error: %s\n", strerror(err));
abort();
}
}
@@ -108,7 +109,7 @@ drawable_unlock(struct apple_glx_drawable *d)
err = pthread_mutex_unlock(&d->mutex);
if (err) {
fprintf(stderr, "pthread_mutex_unlock error: %d\n", err);
fprintf(stderr, "pthread_mutex_unlock error: %s\n", strerror(err));
abort();
}
}
@@ -135,6 +136,7 @@ release_drawable(struct apple_glx_drawable *d)
static bool
destroy_drawable(struct apple_glx_drawable *d)
{
int err;
d->lock(d);
@@ -172,6 +174,15 @@ destroy_drawable(struct apple_glx_drawable *d)
apple_glx_diagnostic("%s: freeing %p\n", __func__, (void *) d);
/* Stupid recursive locks */
while (pthread_mutex_unlock(&d->mutex) == 0);
err = pthread_mutex_destroy(&d->mutex);
if (err) {
fprintf(stderr, "pthread_mutex_destroy error: %s\n", strerror(err));
abort();
}
free(d);
/* So that the locks are balanced and the caller correctly unlocks. */
@@ -238,7 +249,7 @@ common_init(Display * dpy, GLXDrawable drawable, struct apple_glx_drawable *d)
err = pthread_mutexattr_init(&attr);
if (err) {
fprintf(stderr, "pthread_mutexattr_init error: %d\n", err);
fprintf(stderr, "pthread_mutexattr_init error: %s\n", strerror(err));
abort();
}
@@ -250,14 +261,14 @@ common_init(Display * dpy, GLXDrawable drawable, struct apple_glx_drawable *d)
err = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
if (err) {
fprintf(stderr, "error: setting pthread mutex type: %d\n", err);
fprintf(stderr, "error: setting pthread mutex type: %s\n", strerror(err));
abort();
}
err = pthread_mutex_init(&d->mutex, &attr);
if (err) {
fprintf(stderr, "pthread_mutex_init error: %d\n", err);
fprintf(stderr, "pthread_mutex_init error: %s\n", strerror(err));
abort();
}

View File

@@ -0,0 +1,128 @@
/*
* Copyright (c) 2012 Apple Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
* HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name(s) of the above
* copyright holders shall not be used in advertising or otherwise to
* promote the sale, use or other dealings in this Software without
* prior written authorization.
*/
#include <sys/cdefs.h>
#include <asl.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <inttypes.h>
#include <pthread.h>
#include "apple_glx_log.h"
static bool diagnostic = false;
static aslclient aslc;
void apple_glx_log_init(void) {
if (getenv("LIBGL_DIAGNOSTIC")) {
diagnostic = true;
}
aslc = asl_open(NULL, NULL, 0);
}
void _apple_glx_log(int level, const char *file, const char *function,
int line, const char *fmt, ...) {
va_list v;
va_start(v, fmt);
_apple_glx_vlog(level, file, function, line, fmt, v);
va_end(v);
}
static const char *
_asl_level_string(int level)
{
if (level == ASL_LEVEL_EMERG) return ASL_STRING_EMERG;
if (level == ASL_LEVEL_ALERT) return ASL_STRING_ALERT;
if (level == ASL_LEVEL_CRIT) return ASL_STRING_CRIT;
if (level == ASL_LEVEL_ERR) return ASL_STRING_ERR;
if (level == ASL_LEVEL_WARNING) return ASL_STRING_WARNING;
if (level == ASL_LEVEL_NOTICE) return ASL_STRING_NOTICE;
if (level == ASL_LEVEL_INFO) return ASL_STRING_INFO;
if (level == ASL_LEVEL_DEBUG) return ASL_STRING_DEBUG;
return "unknown";
}
void _apple_glx_vlog(int level, const char *file, const char *function,
int line, const char *fmt, va_list args) {
aslmsg msg;
uint64_t thread = 0;
if (pthread_is_threaded_np()) {
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
thread = (uint64_t)(uintptr_t)pthread_self();
#elif MAC_OS_X_VERSION_MIN_REQUIRED < 1060
if (&pthread_threadid_np) {
pthread_threadid_np(NULL, &thread);
} else {
thread = (uint64_t)(uintptr_t)pthread_self();
}
#else
pthread_threadid_np(NULL, &thread);
#endif
}
if (diagnostic) {
va_list args2;
va_copy(args2, args);
fprintf(stderr, "%-9s %24s:%-4d %s(%"PRIu64"): ",
_asl_level_string(level), file, line, function, thread);
vfprintf(stderr, fmt, args2);
}
msg = asl_new(ASL_TYPE_MSG);
if (msg) {
if (file)
asl_set(msg, "File", file);
if (function)
asl_set(msg, "Function", function);
if (line) {
char *_line;
asprintf(&_line, "%d", line);
if (_line) {
asl_set(msg, "Line", _line);
free(_line);
}
}
if (pthread_is_threaded_np()) {
char *_thread;
asprintf(&_thread, "%"PRIu64, thread);
if (_thread) {
asl_set(msg, "Thread", _thread);
free(_thread);
}
}
}
asl_vlog(aslc, msg, level, fmt, args);
if (msg)
asl_free(msg);
}

View File

@@ -0,0 +1,57 @@
/*
* Copyright (c) 2012 Apple Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
* HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name(s) of the above
* copyright holders shall not be used in advertising or otherwise to
* promote the sale, use or other dealings in this Software without
* prior written authorization.
*/
#ifndef APPLE_GLX_LOG_H
#define APPLE_GLX_LOG_H
#include <sys/cdefs.h>
#include <asl.h>
void apple_glx_log_init(void);
__printflike(5, 6)
void _apple_glx_log(int level, const char *file, const char *function,
int line, const char *fmt, ...);
#define apple_glx_log(l, f, args ...) \
_apple_glx_log(l, __FILE__, __FUNCTION__, __LINE__, f, ## args)
__printflike(5, 0)
void _apple_glx_vlog(int level, const char *file, const char *function,
int line, const char *fmt, va_list v);
#define apple_glx_vlog(l, f, v) \
_apple_glx_vlog(l, __FILE__, __FUNCTION__, __LINE__, f, v)
/* This is just here to help the transition.
* TODO: Replace calls to apple_glx_diagnostic
*/
#define apple_glx_diagnostic(f, args ...) \
apple_glx_log(ASL_LEVEL_DEBUG, f, ## args)
#endif

View File

@@ -206,6 +206,7 @@ apple_glx_surface_destroy(unsigned int uid)
if (d) {
d->types.surface.pending_destroy = true;
d->release(d);
/*
* We release 2 references to the surface. One was acquired by
* the find, and the other was leftover from a context, or
@@ -216,8 +217,9 @@ apple_glx_surface_destroy(unsigned int uid)
* to actually destroy it when the pending_destroy is processed
* by a glViewport callback (see apple_glx_context_update()).
*/
d->destroy(d);
d->unlock(d);
if (!d->destroy(d)) {
/* apple_glx_drawable_find_by_uid returns a locked drawable */
d->unlock(d);
}
}
}

Some files were not shown because too many files have changed in this diff Show More