Compare commits

...

206 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
183 changed files with 3482 additions and 1249 deletions

View File

@@ -184,7 +184,7 @@ ultrix-gcc:
# Rules for making release tarballs
PACKAGE_VERSION=8.0.1
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"

View File

@@ -11,6 +11,22 @@
<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>

View File

@@ -28,7 +28,9 @@ for DRI hardware acceleration.
<h2>MD5 checksums</h2>
<pre>
tdb
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>

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

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

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

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

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

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

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

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

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

@@ -3516,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,
@@ -3571,7 +3569,7 @@ 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);
@@ -3580,290 +3578,265 @@ ast_switch_statement::hir(exec_list *instructions,
state->switch_state = saved;
/* Switch statements do not have r-values.
*/
return NULL;
}
/* Switch statements do not have r-values. */
return NULL;
}
void
ast_switch_statement::test_to_hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
void *ctx = state;
void
ast_switch_statement::test_to_hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
void *ctx = state;
/* Cache value of test expression.
*/
ir_rvalue *const test_val =
test_expression->hir(instructions,
state);
/* Cache value of test expression. */
ir_rvalue *const test_val =
test_expression->hir(instructions,
state);
state->switch_state.test_var = new(ctx) ir_variable(glsl_type::int_type,
"switch_test_tmp",
ir_var_temporary);
ir_dereference_variable *deref_test_var =
new(ctx) ir_dereference_variable(state->switch_state.test_var);
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->switch_state.test_var);
instructions->push_tail(state->switch_state.test_var);
instructions->push_tail(new(ctx) ir_assignment(deref_test_var,
test_val,
NULL));
}
instructions->push_tail(state->switch_state.test_var);
instructions->push_tail(new(ctx) ir_assignment(deref_test_var, test_val,
NULL));
}
ir_rvalue *
ast_switch_body::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
if (stmts != NULL)
stmts->hir(instructions, state);
ir_rvalue *
ast_switch_body::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
if (stmts != NULL)
stmts->hir(instructions, state);
/* Switch bodies do not have r-values.
*/
return NULL;
}
/* 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. */
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. */
ir_constant *const false_val = new(state) ir_constant(false);
ir_dereference_variable *const deref_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->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. */
ir_dereference_variable *const deref_fallthru_guard =
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. */
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);
ir_rvalue *
ast_case_label_list::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
foreach_list_typed (ast_case_label, label, link, & this->labels)
label->hir(instructions, state);
/* Case statements do not have r-values.
*/
return NULL;
}
/* Case labels do not have r-values. */
return NULL;
}
ir_rvalue *
ast_case_label::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
void *ctx = state;
ir_rvalue *
ast_case_statement::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
labels->hir(instructions, state);
ir_dereference_variable *deref_fallthru_var =
new(ctx) ir_dereference_variable(state->switch_state.is_fallthru_var);
/* 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->switch_state.is_fallthru_var);
ir_dereference_variable *const deref_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);
ir_rvalue *const true_val = new(ctx) ir_constant(true);
/* Guard case statements depending on fallthru state.
*/
ir_dereference_variable *const deref_fallthru_guard =
new(state) ir_dereference_variable(state->switch_state.is_fallthru_var);
ir_if *const test_fallthru = new(state) ir_if(deref_fallthru_guard);
/* 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 label_rval = this->test_value->hir(instructions, state);
ir_constant *label_const = label_rval->constant_expression_value();
foreach_list_typed (ast_node, stmt, link, & this->stmts)
stmt->hir(& test_fallthru->then_instructions, state);
if (!label_const) {
YYLTYPE loc = this->test_value->get_location();
instructions->push_tail(test_fallthru);
_mesa_glsl_error(& loc, state,
"switch statement case label must be a "
"constant expression");
/* Case statements do not have r-values.
*/
return NULL;
}
/* 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");
ir_rvalue *
ast_case_label_list::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
foreach_list_typed (ast_case_label, label, link, & this->labels)
label->hir(instructions, state);
/* Case labels do not have r-values.
*/
return NULL;
}
ir_rvalue *
ast_case_label::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
void *ctx = state;
ir_dereference_variable *deref_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 (this->test_value != NULL) {
/* Conditionally set fallthru state based on
* comparison of cached test expression value to case label.
*/
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,
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]);
}
}
if (previous_label) {
YYLTYPE loc = this->test_value->get_location();
_mesa_glsl_error(& loc, state,
"duplicate case value");
ir_dereference_variable *deref_test_var =
new(ctx) ir_dereference_variable(state->switch_state.test_var);
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_rvalue *const test_cond = new(ctx) ir_expression(ir_binop_all_equal,
label_const,
deref_test_var);
ir_dereference_variable *deref_test_var =
new(ctx) ir_dereference_variable(state->switch_state.test_var);
ir_assignment *set_fallthru_on_test =
new(ctx) ir_assignment(deref_fallthru_var,
true_val,
test_cond);
ir_rvalue *const test_cond = new(ctx) ir_expression(ir_binop_all_equal,
glsl_type::bool_type,
label_const,
deref_test_var);
instructions->push_tail(set_fallthru_on_test);
} else { /* default case */
if (state->switch_state.previous_default) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(& loc, state,
"multiple default labels in one switch");
ir_assignment *set_fallthru_on_test =
new(ctx) ir_assignment(deref_fallthru_var,
true_val,
test_cond);
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;
instructions->push_tail(set_fallthru_on_test);
} else { /* default case */
if (state->switch_state.previous_default) {
printf("a\n");
YYLTYPE loc = this->get_location();
_mesa_glsl_error(& loc, state,
"multiple default labels in one switch");
/* Set falltrhu state. */
ir_assignment *set_fallthru =
new(ctx) ir_assignment(deref_fallthru_var, true_val, NULL);
printf("b\n");
instructions->push_tail(set_fallthru);
}
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;
/* Case statements do not have r-values. */
return NULL;
}
/* Set falltrhu state.
*/
ir_assignment *set_fallthru =
new(ctx) ir_assignment(deref_fallthru_var,
true_val,
NULL);
void
ast_iteration_statement::condition_to_hir(ir_loop *stmt,
struct _mesa_glsl_parse_state *state)
{
void *ctx = state;
instructions->push_tail(set_fallthru);
}
if (condition != NULL) {
ir_rvalue *const cond =
condition->hir(& stmt->body_instructions, state);
/* Case statements do not have r-values.
*/
return NULL;
}
if ((cond == NULL)
|| !cond->type->is_boolean() || !cond->type->is_scalar()) {
YYLTYPE loc = condition->get_location();
_mesa_glsl_error(& loc, state,
"loop condition must be scalar boolean");
} else {
/* As the first code in the loop body, generate a block that looks
* like 'if (!condition) break;' as the loop termination condition.
*/
ir_rvalue *const not_cond =
new(ctx) ir_expression(ir_unop_logic_not, cond);
ir_if *const if_stmt = new(ctx) ir_if(not_cond);
ir_jump *const break_stmt =
new(ctx) ir_loop_jump(ir_loop_jump::jump_break);
if_stmt->then_instructions.push_tail(break_stmt);
stmt->body_instructions.push_tail(if_stmt);
}
}
}
void
ast_iteration_statement::condition_to_hir(ir_loop *stmt,
struct _mesa_glsl_parse_state *state)
{
void *ctx = state;
ir_rvalue *
ast_iteration_statement::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
void *ctx = state;
if (condition != NULL) {
ir_rvalue *const cond =
condition->hir(& stmt->body_instructions, state);
/* For-loops and while-loops start a new scope, but do-while loops do not.
*/
if (mode != ast_do_while)
state->symbols->push_scope();
if ((cond == NULL)
|| !cond->type->is_boolean() || !cond->type->is_scalar()) {
YYLTYPE loc = condition->get_location();
if (init_statement != NULL)
init_statement->hir(instructions, state);
_mesa_glsl_error(& loc, state,
"loop condition must be scalar boolean");
} else {
/* As the first code in the loop body, generate a block that looks
* 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);
ir_loop *const stmt = new(ctx) ir_loop();
instructions->push_tail(stmt);
ir_if *const if_stmt = new(ctx) ir_if(not_cond);
/* Track the current loop nesting. */
ast_iteration_statement *nesting_ast = state->loop_nesting_ast;
ir_jump *const break_stmt =
new(ctx) ir_loop_jump(ir_loop_jump::jump_break);
state->loop_nesting_ast = this;
if_stmt->then_instructions.push_tail(break_stmt);
stmt->body_instructions.push_tail(if_stmt);
}
}
}
/* Likewise, indicate that following code is closest to a loop,
* NOT closest to a switch.
*/
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);
ir_rvalue *
ast_iteration_statement::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
void *ctx = state;
if (body != NULL)
body->hir(& stmt->body_instructions, state);
/* For-loops and while-loops start a new scope, but do-while loops do not.
*/
if (mode != ast_do_while)
state->symbols->push_scope();
if (rest_expression != NULL)
rest_expression->hir(& stmt->body_instructions, state);
if (init_statement != NULL)
init_statement->hir(instructions, state);
if (mode == ast_do_while)
condition_to_hir(stmt, state);
ir_loop *const stmt = new(ctx) ir_loop();
instructions->push_tail(stmt);
if (mode != ast_do_while)
state->symbols->pop_scope();
/* Track the current loop nesting.
*/
ast_iteration_statement *nesting_ast = state->loop_nesting_ast;
state->loop_nesting_ast = this;
/* Likewise, indicate that following code is closest to a loop,
* NOT closest to a switch.
*/
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);
if (body != NULL)
body->hir(& stmt->body_instructions, state);
if (rest_expression != NULL)
rest_expression->hir(& stmt->body_instructions, state);
if (mode == ast_do_while)
condition_to_hir(stmt, state);
if (mode != ast_do_while)
state->symbols->pop_scope();
/* Restore previous nesting before returning.
*/
state->loop_nesting_ast = nesting_ast;
state->switch_state.is_switch_innermost = saved_is_switch_innermost;
/* Restore previous nesting before returning. */
state->loop_nesting_ast = nesting_ast;
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

@@ -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);
}
}
}

View File

@@ -71,6 +71,7 @@ __glElementsPerGroup(GLenum format, GLenum type)
case GL_422_REV_EXT:
case GL_422_AVERAGE_EXT:
case GL_422_REV_AVERAGE_EXT:
case GL_DEPTH_STENCIL_NV:
case GL_YCBCR_422_APPLE:
case GL_LUMINANCE_ALPHA:
return 2;

View File

@@ -80,8 +80,13 @@ glXCreateContextAttribsARB(Display *dpy, GLXFBConfig config,
&dummy_err);
}
if (gc == NULL)
if (gc == NULL) {
#ifdef GLX_USE_APPLEGL
gc = applegl_create_context(psc, cfg, share, 0);
#else
gc = indirect_create_context(psc, cfg, share, 0);
#endif
}
gc->xid = xcb_generate_id(c);
gc->share_xid = (share != NULL) ? share->xid : 0;

View File

@@ -91,6 +91,9 @@ XCreateDrawable(struct drisw_drawable * pdp,
visMask = VisualIDMask;
pdp->visinfo = XGetVisualInfo(dpy, visMask, &visTemp, &num_visuals);
if (!pdp->visinfo || num_visuals == 0)
return False;
/* create XImage */
pdp->ximage = XCreateImage(dpy,
pdp->visinfo->visual,
@@ -513,7 +516,7 @@ driswCreateDrawable(struct glx_screen *base, XID xDrawable,
struct drisw_drawable *pdp;
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes;
struct drisw_screen *psc = (struct drisw_screen *) base;
Bool ret;
const __DRIswrastExtension *swrast = psc->swrast;
pdp = Xmalloc(sizeof(*pdp));
@@ -525,7 +528,11 @@ driswCreateDrawable(struct glx_screen *base, XID xDrawable,
pdp->base.drawable = drawable;
pdp->base.psc = &psc->base;
XCreateDrawable(pdp, psc->base.dpy, xDrawable, modes->visualID);
ret = XCreateDrawable(pdp, psc->base.dpy, xDrawable, modes->visualID);
if (!ret) {
Xfree(pdp);
return NULL;
}
/* Create a new drawable */
pdp->driDrawable =

View File

@@ -293,6 +293,9 @@ QueryVersion(Display * dpy, int opcode, int *major, int *minor)
GLX_MINOR_VERSION),
NULL);
if (!reply)
return GL_FALSE;
if (reply->major_version != GLX_MAJOR_VERSION) {
free(reply);
return GL_FALSE;

View File

@@ -105,7 +105,7 @@ __glapi_gentable_set_remaining_noop(struct _glapi_table *disp) {
struct _glapi_table *
_glapi_create_table_from_handle(void *handle, const char *symbol_prefix) {
struct _glapi_table *disp = calloc(1, sizeof(struct _glapi_table));
struct _glapi_table *disp = calloc(_glapi_get_dispatch_table_size(), sizeof(void *));
char symboln[512];
if(!disp)

View File

@@ -315,6 +315,10 @@ struct gl_meta_state
struct drawtex_state DrawTex; /**< For _mesa_meta_DrawTex() */
};
static void meta_glsl_blit_cleanup(struct gl_context *ctx, struct blit_state *blit);
static void cleanup_temp_texture(struct gl_context *ctx, struct temp_texture *tex);
static void meta_glsl_clear_cleanup(struct gl_context *ctx, struct clear_state *clear);
static GLuint
compile_shader_with_debug(struct gl_context *ctx, GLenum target, const GLcharARB *source)
{
@@ -331,12 +335,16 @@ compile_shader_with_debug(struct gl_context *ctx, GLenum target, const GLcharARB
return shader;
_mesa_GetShaderiv(shader, GL_INFO_LOG_LENGTH, &size);
if (size == 0)
if (size == 0) {
_mesa_DeleteObjectARB(shader);
return 0;
}
info = malloc(size);
if (!info)
if (!info) {
_mesa_DeleteObjectARB(shader);
return 0;
}
_mesa_GetProgramInfoLog(shader, size, NULL, info);
_mesa_problem(ctx,
@@ -345,6 +353,7 @@ compile_shader_with_debug(struct gl_context *ctx, GLenum target, const GLcharARB
info, source);
free(info);
_mesa_DeleteObjectARB(shader);
return 0;
}
@@ -397,10 +406,15 @@ _mesa_meta_init(struct gl_context *ctx)
void
_mesa_meta_free(struct gl_context *ctx)
{
/* Note: Any textures, VBOs, etc, that we allocate should get
* freed by the normal context destruction code. But this would be
* the place to free other meta data someday.
*/
GET_CURRENT_CONTEXT(old_context);
_mesa_make_current(ctx, NULL, NULL);
meta_glsl_blit_cleanup(ctx, &ctx->Meta->Blit);
meta_glsl_clear_cleanup(ctx, &ctx->Meta->Clear);
cleanup_temp_texture(ctx, &ctx->Meta->TempTex);
if (old_context)
_mesa_make_current(old_context, old_context->WinSysDrawBuffer, old_context->WinSysReadBuffer);
else
_mesa_make_current(NULL, NULL, NULL);
free(ctx->Meta);
ctx->Meta = NULL;
}
@@ -1056,6 +1070,15 @@ init_temp_texture(struct gl_context *ctx, struct temp_texture *tex)
_mesa_GenTextures(1, &tex->TexObj);
}
static void
cleanup_temp_texture(struct gl_context *ctx, struct temp_texture *tex)
{
if (!tex->TexObj)
return;
_mesa_DeleteTextures(1, &tex->TexObj);
tex->TexObj = 0;
}
/**
* Return pointer to temp_texture info for non-bitmap ops.
@@ -1592,6 +1615,21 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
}
}
static void
meta_glsl_blit_cleanup(struct gl_context *ctx, struct blit_state *blit)
{
if (blit->ArrayObj) {
_mesa_DeleteVertexArraysAPPLE(1, &blit->ArrayObj);
blit->ArrayObj = 0;
_mesa_DeleteBuffersARB(1, &blit->VBO);
blit->VBO = 0;
}
if (blit->DepthFP) {
_mesa_DeletePrograms(1, &blit->DepthFP);
blit->DepthFP = 0;
}
}
/**
* Meta implementation of ctx->Driver.Clear() in terms of polygon rendering.
@@ -1774,7 +1812,9 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
clear->ShaderProg = _mesa_CreateProgramObjectARB();
_mesa_AttachShader(clear->ShaderProg, fs);
_mesa_DeleteObjectARB(fs);
_mesa_AttachShader(clear->ShaderProg, vs);
_mesa_DeleteObjectARB(vs);
_mesa_BindAttribLocationARB(clear->ShaderProg, 0, "position");
_mesa_LinkProgramARB(clear->ShaderProg);
@@ -1787,7 +1827,9 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
clear->IntegerShaderProg = _mesa_CreateProgramObjectARB();
_mesa_AttachShader(clear->IntegerShaderProg, fs);
_mesa_DeleteObjectARB(fs);
_mesa_AttachShader(clear->IntegerShaderProg, vs);
_mesa_DeleteObjectARB(vs);
_mesa_BindAttribLocationARB(clear->IntegerShaderProg, 0, "position");
/* Note that user-defined out attributes get automatically assigned
@@ -1802,6 +1844,24 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
}
}
static void
meta_glsl_clear_cleanup(struct gl_context *ctx, struct clear_state *clear)
{
if (clear->ArrayObj == 0)
return;
_mesa_DeleteVertexArraysAPPLE(1, &clear->ArrayObj);
clear->ArrayObj = 0;
_mesa_DeleteBuffersARB(1, &clear->VBO);
clear->VBO = 0;
_mesa_DeleteObjectARB(clear->ShaderProg);
clear->ShaderProg = 0;
if (clear->IntegerShaderProg) {
_mesa_DeleteObjectARB(clear->IntegerShaderProg);
clear->IntegerShaderProg = 0;
}
}
/**
* Meta implementation of ctx->Driver.Clear() in terms of polygon rendering.
*/
@@ -3256,6 +3316,7 @@ decompress_texture_image(struct gl_context *ctx,
};
struct vertex verts[4];
GLuint fboDrawSave, fboReadSave;
GLuint rbSave;
if (slice > 0) {
assert(target == GL_TEXTURE_3D ||
@@ -3272,6 +3333,7 @@ decompress_texture_image(struct gl_context *ctx,
/* save fbo bindings (not saved by _mesa_meta_begin()) */
fboDrawSave = ctx->DrawBuffer->Name;
fboReadSave = ctx->ReadBuffer->Name;
rbSave = ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0;
_mesa_meta_begin(ctx, MESA_META_ALL & ~MESA_META_PIXEL_STORE);
@@ -3292,6 +3354,7 @@ decompress_texture_image(struct gl_context *ctx,
/* alloc dest surface */
if (width > decompress->Width || height > decompress->Height) {
_mesa_BindRenderbufferEXT(GL_RENDERBUFFER_EXT, decompress->RBO);
_mesa_RenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA,
width, height);
decompress->Width = width;
@@ -3424,6 +3487,7 @@ decompress_texture_image(struct gl_context *ctx,
_mesa_BindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fboDrawSave);
_mesa_BindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, fboReadSave);
}
_mesa_BindRenderbufferEXT(GL_RENDERBUFFER_EXT, rbSave);
}

View File

@@ -6,5 +6,11 @@
<application executable="Tropics">
<option name="force_glsl_extensions_warn" value="true" />
</application>
<application executable="heaven_x86">
<option name="force_glsl_extensions_warn" value="true" />
</application>
<application executable="heaven_x64">
<option name="force_glsl_extensions_warn" value="true" />
</application>
</device>
</driconf>

View File

@@ -436,7 +436,10 @@ i830DepthMask(struct gl_context * ctx, GLboolean flag)
struct i830_context *i830 = i830_context(ctx);
DBG("%s flag (%d)\n", __FUNCTION__, flag);
if (!ctx->DrawBuffer || !ctx->DrawBuffer->Visual.depthBits)
flag = false;
I830_STATECHANGE(i830, I830_UPLOAD_CTX);
i830->state.Ctx[I830_CTXREG_ENABLES_2] &= ~ENABLE_DIS_DEPTH_WRITE_MASK;
@@ -473,7 +476,7 @@ static void
i830PolygonStipple(struct gl_context * ctx, const GLubyte * mask)
{
struct i830_context *i830 = i830_context(ctx);
const GLubyte *m = mask;
const GLubyte *m;
GLubyte p[4];
int i, j, k;
int active = (ctx->Polygon.StippleFlag &&
@@ -485,6 +488,12 @@ i830PolygonStipple(struct gl_context * ctx, const GLubyte * mask)
i830->state.Stipple[I830_STPREG_ST1] &= ~ST1_ENABLE;
}
/* Use the already unpacked stipple data from the context rather than the
* uninterpreted mask passed in.
*/
mask = (const GLubyte *)ctx->PolygonStipple;
m = mask;
p[0] = mask[12] & 0xf;
p[0] |= p[0] << 4;
p[1] = mask[8] & 0xf;
@@ -795,6 +804,9 @@ i830Enable(struct gl_context * ctx, GLenum cap, GLboolean state)
I830_STATECHANGE(i830, I830_UPLOAD_CTX);
i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~ENABLE_DIS_DEPTH_TEST_MASK;
if (!ctx->DrawBuffer || !ctx->DrawBuffer->Visual.depthBits)
state = false;
if (state)
i830->state.Ctx[I830_CTXREG_ENABLES_1] |= ENABLE_DEPTH_TEST;
else
@@ -849,7 +861,7 @@ i830Enable(struct gl_context * ctx, GLenum cap, GLboolean state)
if (ctx->DrawBuffer) {
struct intel_renderbuffer *irbStencil
= intel_get_renderbuffer(ctx->DrawBuffer, BUFFER_STENCIL);
hw_stencil = (irbStencil && irbStencil->mt->region);
hw_stencil = (irbStencil && irbStencil->mt);
}
if (hw_stencil) {
I830_STATECHANGE(i830, I830_UPLOAD_CTX);

View File

@@ -692,8 +692,8 @@ i830_set_draw_region(struct intel_context *intel,
state->Buffer[I830_DESTREG_DRAWRECT1] = 0;
state->Buffer[I830_DESTREG_DRAWRECT2] = (draw_y << 16) | draw_x;
state->Buffer[I830_DESTREG_DRAWRECT3] =
((ctx->DrawBuffer->Width + draw_x) & 0xffff) |
((ctx->DrawBuffer->Height + draw_y) << 16);
((ctx->DrawBuffer->Width + draw_x - 1) & 0xffff) |
((ctx->DrawBuffer->Height + draw_y - 1) << 16);
state->Buffer[I830_DESTREG_DRAWRECT4] = (draw_y << 16) | draw_x;
state->Buffer[I830_DESTREG_DRAWRECT5] = MI_NOOP;
@@ -826,8 +826,7 @@ i830_update_draw_buffer(struct intel_context *intel)
/*
* Update depth and stencil test state
*/
ctx->Driver.Enable(ctx, GL_DEPTH_TEST,
(ctx->Depth.Test && fb->Visual.depthBits > 0));
ctx->Driver.Enable(ctx, GL_DEPTH_TEST, ctx->Depth.Test);
ctx->Driver.Enable(ctx, GL_STENCIL_TEST,
(ctx->Stencil.Enabled && fb->Visual.stencilBits > 0));

View File

@@ -76,6 +76,8 @@ i915InvalidateState(struct gl_context * ctx, GLuint new_state)
i915_update_provoking_vertex(ctx);
if (new_state & (_NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS))
i915_update_program(ctx);
if (new_state & (_NEW_PROGRAM | _NEW_POINT))
i915_update_sprite_point_enable(ctx);
}

View File

@@ -40,6 +40,7 @@
#define I915_FALLBACK_POINT_SMOOTH 0x80000
#define I915_FALLBACK_POINT_SPRITE_COORD_ORIGIN 0x100000
#define I915_FALLBACK_DRAW_OFFSET 0x200000
#define I915_FALLBACK_COORD_REPLACE 0x400000
#define I915_UPLOAD_CTX 0x1
#define I915_UPLOAD_BUFFERS 0x2
@@ -338,6 +339,7 @@ extern void i915InitStateFunctions(struct dd_function_table *functions);
extern void i915InitState(struct i915_context *i915);
extern void i915_update_stencil(struct gl_context * ctx);
extern void i915_update_provoking_vertex(struct gl_context *ctx);
extern void i915_update_sprite_point_enable(struct gl_context *ctx);
/*======================================================================

View File

@@ -1361,6 +1361,10 @@ i915ValidateFragmentProgram(struct i915_context *i915)
EMIT_ATTR(_TNL_ATTRIB_POS, EMIT_3F_VIEWPORT, S4_VFMT_XYZ, 12);
}
/* Handle gl_PointSize builtin var here */
if (ctx->Point._Attenuated || ctx->VertexProgram.PointSizeEnabled)
EMIT_ATTR(_TNL_ATTRIB_POINTSIZE, EMIT_1F, S4_VFMT_POINT_WIDTH, 4);
if (inputsRead & FRAG_BIT_COL0) {
intel->coloroffset = offset / 4;
EMIT_ATTR(_TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA, S4_VFMT_COLOR, 4);

View File

@@ -652,6 +652,48 @@ i915PointParameterfv(struct gl_context * ctx, GLenum pname, const GLfloat *param
}
}
void
i915_update_sprite_point_enable(struct gl_context *ctx)
{
struct intel_context *intel = intel_context(ctx);
/* _NEW_PROGRAM */
struct i915_fragment_program *p =
(struct i915_fragment_program *) ctx->FragmentProgram._Current;
const GLbitfield64 inputsRead = p->FragProg.Base.InputsRead;
struct i915_context *i915 = i915_context(ctx);
GLuint s4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_VFMT_MASK;
int i;
GLuint coord_replace_bits = 0x0;
GLuint tex_coord_unit_bits = 0x0;
for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
/* _NEW_POINT */
if (ctx->Point.CoordReplace[i] && ctx->Point.PointSprite)
coord_replace_bits |= (1 << i);
if (inputsRead & FRAG_BIT_TEX(i))
tex_coord_unit_bits |= (1 << i);
}
/*
* Here we can't enable the SPRITE_POINT_ENABLE bit when the mis-match
* of tex_coord_unit_bits and coord_replace_bits, or this will make all
* the other non-point-sprite coords(like varying inputs, as we now use
* tex coord to implement varying inputs) be replaced to value (0, 0)-(1, 1).
*
* Thus, do fallback when needed.
*/
FALLBACK(intel, I915_FALLBACK_COORD_REPLACE,
coord_replace_bits && coord_replace_bits != tex_coord_unit_bits);
s4 &= ~S4_SPRITE_POINT_ENABLE;
s4 |= (coord_replace_bits && coord_replace_bits == tex_coord_unit_bits) ?
S4_SPRITE_POINT_ENABLE : 0;
if (s4 != i915->state.Ctx[I915_CTXREG_LIS4]) {
i915->state.Ctx[I915_CTXREG_LIS4] = s4;
I915_STATECHANGE(i915, I915_UPLOAD_CTX);
}
}
/* =============================================================
* Color masks
@@ -869,18 +911,7 @@ i915Enable(struct gl_context * ctx, GLenum cap, GLboolean state)
break;
case GL_POINT_SPRITE:
/* This state change is handled in i915_reduced_primitive_state because
* the hardware bit should only be set when rendering points.
*/
dw = i915->state.Ctx[I915_CTXREG_LIS4];
if (state)
dw |= S4_SPRITE_POINT_ENABLE;
else
dw &= ~S4_SPRITE_POINT_ENABLE;
if (dw != i915->state.Ctx[I915_CTXREG_LIS4]) {
i915->state.Ctx[I915_CTXREG_LIS4] = dw;
I915_STATECHANGE(i915, I915_UPLOAD_CTX);
}
/* Handle it at i915_update_sprite_point_enable () */
break;
case GL_POINT_SMOOTH:

View File

@@ -319,6 +319,28 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
((wt != GL_CLAMP) && (wt != GL_CLAMP_TO_EDGE))))
return false;
/*
* According to 3DSTATE_MAP_STATE at page of 104 in Bspec
* Vol3d 3D Instructions:
* [DevGDG and DevAlv]: Must be a power of 2 for cube maps.
* [DevLPT, DevCST and DevBLB]: If not a power of 2, cube maps
* must have all faces enabled.
*
* But, as I tested on pineview(DevBLB derived), the rendering is
* bad(you will find the color isn't samplered right in some
* fragments). After checking, it seems that the texture layout is
* wrong: making the width and height align of 4(although this
* doesn't make much sense) will fix this issue and also broke some
* others. Well, Bspec mentioned nothing about the layout alignment
* and layout for NPOT cube map. I guess the Bspec just assume it's
* a POT cube map.
*
* Thus, I guess we need do this for other platforms as well.
*/
if (tObj->Target == GL_TEXTURE_CUBE_MAP_ARB &&
!is_power_of_two(firstImage->Height))
return false;
state[I915_TEXREG_SS3] = ss3; /* SS3_NORMALIZED_COORDS */
state[I915_TEXREG_SS3] |=

View File

@@ -665,12 +665,11 @@ i915_set_draw_region(struct intel_context *intel,
draw_offset = (draw_y << 16) | draw_x;
FALLBACK(intel, I915_FALLBACK_DRAW_OFFSET,
(ctx->DrawBuffer->Width + draw_x > 2048) ||
(ctx->DrawBuffer->Height + draw_y > 2048));
/* When changing drawing rectangle offset, an MI_FLUSH is first required. */
if (draw_offset != i915->last_draw_offset) {
FALLBACK(intel, I915_FALLBACK_DRAW_OFFSET,
(ctx->DrawBuffer->Width + draw_x > 2048) ||
(ctx->DrawBuffer->Height + draw_y > 2048));
state->Buffer[I915_DESTREG_DRAWRECT0] = MI_FLUSH | INHIBIT_FLUSH_RENDER_CACHE;
i915->last_draw_offset = draw_offset;
} else

View File

@@ -119,13 +119,15 @@ intelDmaPrimitive(struct intel_context *intel, GLenum prim)
intel_set_prim(intel, hw_prim[prim]);
}
#define INTEL_NO_VBO_STATE_RESERVED 1500
static INLINE GLuint intel_get_vb_max(struct intel_context *intel)
{
GLuint ret;
if (intel->intelScreen->no_vbo)
ret = sizeof(intel->batch.map) - 1500;
else
if (intel->intelScreen->no_vbo) {
ret = intel->batch.bo->size - INTEL_NO_VBO_STATE_RESERVED;
} else
ret = INTEL_VB_SIZE;
ret /= (intel->vertex_size * 4);
return ret;
@@ -133,11 +135,15 @@ static INLINE GLuint intel_get_vb_max(struct intel_context *intel)
static INLINE GLuint intel_get_current_max(struct intel_context *intel)
{
GLuint ret;
if (intel->intelScreen->no_vbo)
return intel_get_vb_max(intel);
else
return (INTEL_VB_SIZE - intel->prim.current_offset) / (intel->vertex_size * 4);
if (intel->intelScreen->no_vbo) {
ret = intel_batchbuffer_space(intel);
ret = ret <= INTEL_NO_VBO_STATE_RESERVED ? 0 : ret - INTEL_NO_VBO_STATE_RESERVED;
} else
ret = (INTEL_VB_SIZE - intel->prim.current_offset);
return ret / (intel->vertex_size * 4);
}
#define LOCAL_VARS struct intel_context *intel = intel_context(ctx)

View File

@@ -1198,6 +1198,7 @@ static char *fallbackStrings[] = {
[19] = "Smooth point",
[20] = "point sprite coord origin",
[21] = "depth/color drawing offset",
[22] = "coord replace(SPRITE POINT ENABLE)",
};

View File

@@ -290,6 +290,12 @@ typedef enum
BRW_VERT_RESULT_NDC = VERT_RESULT_MAX,
BRW_VERT_RESULT_HPOS_DUPLICATE,
BRW_VERT_RESULT_PAD,
/*
* It's actually not a vert_result but just a _mark_ to let sf aware that
* he need do something special to handle gl_PointCoord builtin variable
* correctly. see compile_sf_prog() for more info.
*/
BRW_VERT_RESULT_PNTC,
BRW_VERT_RESULT_MAX
} brw_vert_result;

View File

@@ -47,13 +47,13 @@ brw_swap_cmod(uint32_t cmod)
case BRW_CONDITIONAL_NZ:
return cmod;
case BRW_CONDITIONAL_G:
return BRW_CONDITIONAL_LE;
case BRW_CONDITIONAL_GE:
return BRW_CONDITIONAL_L;
case BRW_CONDITIONAL_GE:
return BRW_CONDITIONAL_LE;
case BRW_CONDITIONAL_L:
return BRW_CONDITIONAL_GE;
case BRW_CONDITIONAL_LE:
return BRW_CONDITIONAL_G;
case BRW_CONDITIONAL_LE:
return BRW_CONDITIONAL_GE;
default:
return ~0;
}

View File

@@ -1048,6 +1048,7 @@ struct brw_instruction *brw_WHILE(struct brw_compile *p);
struct brw_instruction *brw_BREAK(struct brw_compile *p);
struct brw_instruction *brw_CONT(struct brw_compile *p);
struct brw_instruction *gen6_CONT(struct brw_compile *p);
struct brw_instruction *gen6_HALT(struct brw_compile *p);
/* Forward jumps:
*/
void brw_land_fwd_jump(struct brw_compile *p, int jmp_insn_idx);

View File

@@ -1339,6 +1339,20 @@ struct brw_instruction *brw_CONT(struct brw_compile *p)
return insn;
}
struct brw_instruction *gen6_HALT(struct brw_compile *p)
{
struct brw_instruction *insn;
insn = next_insn(p, BRW_OPCODE_HALT);
brw_set_dest(p, insn, retype(brw_null_reg(), BRW_REGISTER_TYPE_D));
brw_set_src0(p, insn, retype(brw_null_reg(), BRW_REGISTER_TYPE_D));
brw_set_src1(p, insn, brw_imm_d(0x0)); /* UIP and JIP, updated later. */
insn->header.compression_control = BRW_COMPRESSION_NONE;
insn->header.execution_size = BRW_EXECUTE_8;
return insn;
}
/* DO/WHILE loop:
*
* The DO/WHILE is just an unterminated loop -- break or continue are
@@ -2188,7 +2202,7 @@ void brw_fb_WRITE(struct brw_compile *p,
msg_type,
msg_length,
header_present,
1, /* last render target write */
eot, /* last render target write */
response_length,
eot,
0 /* send_commit_msg */);
@@ -2395,8 +2409,8 @@ brw_find_next_block_end(struct brw_compile *p, int start)
return ip;
}
}
assert(!"not reached");
return start + 1;
return 0;
}
/* There is no DO instruction on gen6, so to find the end of the loop
@@ -2425,7 +2439,7 @@ brw_find_loop_end(struct brw_compile *p, int start)
}
/* After program generation, go back and update the UIP and JIP of
* BREAK and CONT instructions to their correct locations.
* BREAK, CONT, and HALT instructions to their correct locations.
*/
void
brw_set_uip_jip(struct brw_compile *p)
@@ -2439,18 +2453,47 @@ brw_set_uip_jip(struct brw_compile *p)
for (ip = 0; ip < p->nr_insn; ip++) {
struct brw_instruction *insn = &p->store[ip];
int block_end_ip = 0;
if (insn->header.opcode == BRW_OPCODE_BREAK ||
insn->header.opcode == BRW_OPCODE_CONTINUE ||
insn->header.opcode == BRW_OPCODE_HALT) {
block_end_ip = brw_find_next_block_end(p, ip);
}
switch (insn->header.opcode) {
case BRW_OPCODE_BREAK:
insn->bits3.break_cont.jip = br * (brw_find_next_block_end(p, ip) - ip);
assert(block_end_ip != 0);
insn->bits3.break_cont.jip = br * (block_end_ip - ip);
/* Gen7 UIP points to WHILE; Gen6 points just after it */
insn->bits3.break_cont.uip =
br * (brw_find_loop_end(p, ip) - ip + (intel->gen == 6 ? 1 : 0));
break;
case BRW_OPCODE_CONTINUE:
insn->bits3.break_cont.jip = br * (brw_find_next_block_end(p, ip) - ip);
assert(block_end_ip != 0);
insn->bits3.break_cont.jip = br * (block_end_ip - ip);
insn->bits3.break_cont.uip = br * (brw_find_loop_end(p, ip) - ip);
assert(insn->bits3.break_cont.uip != 0);
assert(insn->bits3.break_cont.jip != 0);
break;
case BRW_OPCODE_HALT:
/* From the Sandy Bridge PRM (volume 4, part 2, section 8.3.19):
*
* "In case of the halt instruction not inside any conditional code
* block, the value of <JIP> and <UIP> should be the same. In case
* of the halt instruction inside conditional code block, the <UIP>
* should be the end of the program, and the <JIP> should be end of
* the most inner conditional code block."
*
* The uip will have already been set by whoever set up the
* instruction.
*/
if (block_end_ip == 0) {
insn->bits3.break_cont.jip = insn->bits3.break_cont.uip;
} else {
insn->bits3.break_cont.jip = br * (block_end_ip - ip);
}
assert(insn->bits3.break_cont.uip != 0);
assert(insn->bits3.break_cont.jip != 0);
break;

View File

@@ -710,6 +710,15 @@ fs_visitor::calculate_urb_setup()
urb_setup[fp_index] = urb_next++;
}
}
/*
* It's a FS only attribute, and we did interpolation for this attribute
* in SF thread. So, count it here, too.
*
* See compile_sf_prog() for more info.
*/
if (brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(FRAG_ATTRIB_PNTC))
urb_setup[FRAG_ATTRIB_PNTC] = urb_next++;
}
/* Each attribute is 4 setup channels, each of which is half a reg. */

View File

@@ -171,6 +171,26 @@ static const fs_reg reg_undef;
static const fs_reg reg_null_f(ARF, BRW_ARF_NULL, BRW_REGISTER_TYPE_F);
static const fs_reg reg_null_d(ARF, BRW_ARF_NULL, BRW_REGISTER_TYPE_D);
class ip_record : public exec_node {
public:
static void* operator new(size_t size, void *ctx)
{
void *node;
node = rzalloc_size(ctx, size);
assert(node != NULL);
return node;
}
ip_record(int ip)
{
this->ip = ip;
}
int ip;
};
class fs_inst : public exec_node {
public:
/* Callers of this ralloc-based new need not call delete. It's
@@ -489,6 +509,7 @@ public:
bool remove_duplicate_mrf_writes();
bool virtual_grf_interferes(int a, int b);
void schedule_instructions();
void patch_discard_jumps_to_fb_writes();
void fail(const char *msg, ...);
void push_force_uncompressed();
@@ -571,6 +592,7 @@ public:
struct gl_shader_program *prog;
void *mem_ctx;
exec_list instructions;
exec_list discard_halt_patches;
/* Delayed setup of c->prog_data.params[] due to realloc of
* ParamValues[] during compile.
@@ -595,6 +617,7 @@ public:
struct hash_table *variable_ht;
ir_variable *frag_depth;
fs_reg outputs[BRW_MAX_DRAW_BUFFERS];
unsigned output_components[BRW_MAX_DRAW_BUFFERS];
int first_non_payload_grf;
int max_grf;
int urb_setup[FRAG_ATTRIB_MAX];

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