Compare commits

..

91 Commits

Author SHA1 Message Date
Jeremy Huddleston Sequoia
1041bfe6dd Apple: glFlush() is not needed with CGLFlushDrawable()
<rdar://problem/14496373>

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit fa5ed99d8e)
2013-07-20 11:49:13 -07:00
Eric Anholt
ba73bea5d0 i965: Fix validation of ETC miptrees.
When comparing to the teximage's format, we have to look at the
format-the-mt-was-created-for not the format-actually-stored-in-the-mt.

Improves glbenchmark 2.1 offscreen test performance 159% +/- 17% (n=3).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54582
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
(cherry picked from commit 46386816a7)

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

The original patch needed some backporting for the old tree.
2013-07-03 13:17:25 -07:00
Maarten Lankhorst
4d07d52e27 nvc0: set rsvd_kick correctly
This prevents trampling beyond the end of the command stream during flushes.

NOTE: This is a candidate for the stable branches.

Reported-by: Christoph Bumiller <christoph.bumiller@speed.at>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
(cherry picked from commit e72cc26518)
2013-06-26 16:52:07 +02:00
Alan Coopersmith
18973c7f0f integer overflow in XF86DRIGetClientDriverName() [CVE-2013-1993 2/2]
clientDriverNameLength is a CARD32 and needs to be bounds checked before
adding one to it to come up with the total size to allocate, to avoid
integer overflow leading to underallocation and writing data from the
network past the end of the allocated buffer.

NOTE: This is a candidate for stable release branches.

Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 306f630e67)
2013-05-31 11:51:30 -07:00
Alan Coopersmith
ee30fd0ea0 integer overflow in XF86DRIOpenConnection() [CVE-2013-1993 1/2]
busIdStringLength is a CARD32 and needs to be bounds checked before adding
one to it to come up with the total size to allocate, to avoid integer
overflow leading to underallocation and writing data from the network past
the end of the allocated buffer.

NOTE: This is a candidate for stable release branches.

Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 2e5a268f18)
2013-05-31 11:51:24 -07:00
Eric Anholt
3d80d54bc9 i965: Add texrect scale parameters before pointers to ParameterValues.
If adding scale parameters during program compile caused a realloc of
ParameterValues, then the driver uniform storage set up by
_mesa_associate_uniform_storage() would point to potentially freed
memory.

Note that this uses TexturesUsed, which may change at runtime for GLSL
when sampler uniforms change.  This is a flaw in our handling of texrect
in general, and not one I'm fixing currently.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit ffdfafb06c)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=47169
2013-03-06 16:50:56 -08:00
Daniel van Vugt
205f537b5a gbm: Remember to init format on gbm_dri_bo_create.
https://bugs.freedesktop.org/show_bug.cgi?id=60143
(cherry picked from commit 6e226ab5ac)
2013-02-27 10:35:14 +01:00
Andreas Boll
c864835b3d docs: add news item for 9.0.3 release 2013-02-21 17:23:01 +01:00
Andreas Boll
fde69f8500 docs: Add 9.0.3 release md5sums 2013-02-21 17:22:37 +01:00
Andreas Boll
f75b27a53e docs: Add 9.0.3 release notes 2013-02-21 16:04:12 +01:00
Andreas Boll
183a28a34a mesa: Bump version to 9.0.3 2013-02-21 15:26:23 +01:00
Zack Rusin
f84fe6aa2e DRI2: Don't disable GLX_INTEL_swap_event unconditionally
GLX_INTEL_swap_event is broken on the server side, where it's
currently unconditionally enabled. This completely breaks
systems running on drivers which don't support that extension.
There's no way to test for its presence on this side, so instead
of disabling it uncondtionally, just disable it for drivers
which are known to not support it. It makes sense because
most drivers do support it right now.
We'll be able to remove this once Xserver properly advertises
GLX_INTEL_swap_event.

Note: This is a candidate for stable branch branches.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60052
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 076403c30d)
2013-02-21 09:27:39 +01:00
Eric Anholt
be7048477a i965/gen7: Set up all samplers even if samplers are sparsely used.
In GLSL, sampler indices are allocated contiguously from 0.  But in the
case of ARB_fragment_program (and possibly fixed function), an app that
uses texture 0 and 2 will use sampler indices 0 and 2, so we were only
allocating space for samplers 0 and 1 and setting up sampler 0.  We
would read garbage for sampler 2, resulting in flickering textures and
an angry simulator.

Fixes bad rendering in 0 A.D. and ETQW.  This was fixed for pre-gen7 by
28f4be9eb9

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=25201
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=58680
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
NOTE: This is a candidate for stable branches.
(cherry picked from commit 5bb05c6e6d)
2013-02-21 09:27:28 +01:00
Eric Anholt
4e35ffa762 i965/vs: Try again when we've successfully spilled a reg.
Before, we'd spill one reg, then continue on without actually register
allocating, then assertion fail when we tried to use a vgrf number as a
register number.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit d4bcc65918)

This should have been picked when 9237f0e was picked.

Bugzill: https://bugs.freedesktop.org/show_bug.cgi?id=59700
2013-02-19 16:06:56 -08:00
Brian Paul
15693b7925 nouveau: Fix build.
Fixes nouveau build failure introduced at
c73245882c.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57746
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
(cherry picked from commit a17750b688)
2013-02-14 09:48:31 +01:00
Kenneth Graunke
dddc5df519 i965: Fix the SF Vertex URB Read Length calculation for Gen7 platforms.
Ivybridge doesn't appear to have the same errata as Sandybridge; no
corruption was observed by setting it to more than the minimal correct
value.  It's possible that we were simply lucky, since the URB entries
are 1024-bit on Ivybridge vs. 512-bit Sandybridge.  Or perhaps the
underlying hardware issue is fixed.

Either way, we may as well program the minimum value since it's now
readily available, likely to be more efficient, and possibly more
correct.

v2: Use GEN7_SBE_* defines rather than GEN6_SF_*.  (A copy and paste
    mistake.)  They're the same, but using the right names is better.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 44aa2e15f6)
2013-02-13 21:48:37 +01:00
Kenneth Graunke
e11ef54a92 i965: Fix the SF Vertex URB Read Length calculation for Sandybridge.
(This commit message was primarily written by Paul Berry, who explained
 what's going on far better than I would have.)

Previous to this patch, we thought that the only restrictions on
3DSTATE_SF's URB read length were (a) it needs to be large enough to
read all the VUE data that the SF needs, and (b) it can't be so large
that it tries to read VUE data that doesn't exist.  Since the VUE map
already tells us how much VUE data exists, we didn't bother worrying
about restriction (a); we just did the easy thing and programmed the
read length to satisfy restriction (b).

However, we didn't notice this erratum in the hardware docs: "[errata]
Corruption/Hang possible if length programmed larger than recommended".
Judging by the context surrounding this erratum, it's pretty clear that
it means "URB read length must be exactly the size necessary to read all
the VUE data that the SF needs, and no larger".  Which means that we
can't program the read length based on restriction (b)--we have to
program it based on restriction (a).

The URB read size needs to precisely match the amount of data that the
SF consumes; it doesn't work to simply base it on the size of the VUE.

Thankfully, the PRM contains the precise formula the hardware expects.

Fixes random UI corruption in Steam's "Big Picture Mode", random terrain
corruption in PlaneShift, and Piglit's fbo-5-varyings test.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=56920
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60172
Tested-by: Jordan Justen <jordan.l.justen@intel.com> (v1/Piglit)
Tested-by: Martin Steigerwald <martin@lichtvoll.de> (PlaneShift)
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 09fbc29828)
2013-02-13 21:48:37 +01:00
Kenneth Graunke
2de8874ec3 i965: Compute the maximum SF source attribute.
The maximum SF source attribute is necessary to compute the Vertex URB
read length properly, which will be done in the next commit.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Tested-by: Martin Steigerwald <martin@lichtvoll.de>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 5e9bc7bd12)
2013-02-13 21:48:37 +01:00
Kenneth Graunke
d47020b6d4 i965: Refactor Gen6+ SF attribute override code.
The next patch will benefit from easy access to the source attribute
number and whether or not we're swizzling.  It doesn't want the final
attr_override DWord form, however.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Tested-by: Martin Steigerwald <martin@lichtvoll.de>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit b3efc5bea8)
2013-02-13 21:48:37 +01:00
Andreas Boll
52c711e5b2 cherry-ignore: Ignore candidates for the 9.1 branch. 2013-02-13 21:48:37 +01:00
Roland Scheidegger
71e3ee38ac softpipe: fix using optimized filter function
This optimized filter (when using repeat wrap modes,
linear min/mag/mip filters, pot textures) only applies to 2d textures,
but nothing prevented it from being used for other textures (likely
leading to very bogus sample results).

Note: This is a candidate for the 9.0 branch.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
(cherry picked from commit 66b6d51214)
2013-02-13 21:48:37 +01:00
Marek Olšák
fdfb299c22 r300g: fix blending with blend color and RGBA formats
NOTE: This is a candidate for the stable branches.
(cherry picked from commit f40a7fc34a)
2013-02-13 21:48:37 +01:00
Brian Paul
2389fcc802 svga: fix sRGB rendering
We weren't emitting the SVGA_RS_OUTPUTGAMMA state so sRGB rendering
didn't work properly.

Fixes piglit's framebuffer-srgb test.

Note: This is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
(cherry picked from commit ff60509157)
2013-02-13 21:48:37 +01:00
Brian Paul
cef854dba7 mesa: don't expose IBM_rasterpos_clip in a core context
glRasterPos doesn't exist in the core profile.

NOTE: This is a candidate for the stable branches (9.0 and 9.1).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit cc5fdaf2dc)

Conflicts:

	src/mesa/main/extensions.c
2013-02-13 21:48:37 +01:00
Brian Paul
adcf0a0cf4 st/mesa: only enable GL_EXT_framebuffer_multisample if GL_MAX_SAMPLES >= 2
We never really have multisampling with one sample per pixel.
See also http://bugs.freedesktop.org/show_bug.cgi?id=59873

Note: This is a candidate for the 9.0 branch.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
(cherry picked from commit c80bacba2e)
2013-02-13 21:48:37 +01:00
Brian Paul
663e41547a mesa: don't enable GL_EXT_framebuffer_multisample for software drivers
Note: This is a candidate for the 9.0 branch.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
(cherry picked from commit 8f3c81d018)

Conflicts:

	src/mesa/main/extensions.c
2013-02-13 21:48:37 +01:00
Marek Olšák
d40df80732 gallium/u_upload_mgr: fix a serious memory leak
It can eat all memory and crash in a matter of minutes with r600g.
(cherry picked from commit 87592cff57)
2013-02-13 21:48:36 +01:00
Brian Paul
914368538e util: add new error checking code in vbuf helper
Check the return value of calls to u_upload_alloc() and
u_upload_data() and return early if needed.

Since we don't have a way to propagate errors all the way up to
Mesa through pipe_context::draw_vbo(), call debug_warn_once() so
the user might have some clue about OOM errors.

Note: This is a candidate for the 9.0 branch.
(cherry picked from commit b13c534f14)

Conflicts:

	src/gallium/auxiliary/util/u_vbuf.c
2013-02-13 21:48:36 +01:00
Brian Paul
c760677c85 st/mesa: do proper error checking for u_upload_alloc() calls
We weren't properly checking the return value of these calls (and
calls to u_upload_data()) to detect OOM errors.

Note: This is a candidate for the 9.0 branch.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
(cherry picked from commit 8c3f9ea073)
2013-02-13 21:48:36 +01:00
Brian Paul
a1cb12c1fb util: add some defensive coding in u_upload_alloc()
Some callers of this function were checking the 'ptr' result to see if
the function failed.  But the correct way is to check the regular
return value for PIPE_ERROR_x.  Now we initialize all the returned
values at the top of the function in case we do hit an error (like OOM).

Callers are more likely to detect OOM conditions now.  But there
are some callers which don't do any error checking...

Note: This is a candidate for the 9.0 branch.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
(cherry picked from commit 68a097596e)

Conflicts:

	src/gallium/auxiliary/util/u_upload_mgr.c
2013-02-13 21:47:57 +01:00
Brian Paul
d32aff91c1 st/mesa: add null pointer check in st_renderbuffer_delete()
In my testing I haven't found any cases where we get a null context
pointer, but it might still be possible.  Check for null just to be safe.

Note: This is a candidate for the stable branches.
(cherry picked from commit a4311054c7)
2013-02-13 18:46:40 +01:00
Brian Paul
d4fc90c129 mesa: remove warning message in _mesa_reference_renderbuffer_()
We were warning when there was no current context and we're about
to delete a renderbuffer, but that happens fairly often and isn't
really a problem.

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

Note: This is a candidate for the stable branches.

Tested-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 006918c0db)
2013-02-13 18:46:40 +01:00
Brian Paul
5fdc42fb87 dri_glx: fix use after free report
the critical error would use driverName.

Found by internal RH coverity scan.

Note: This is a candidate for stable branches.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit a0ec9185eb)

Conflicts:

	src/glx/dri_glx.c
2013-02-13 18:46:40 +01:00
Brian Paul
527b3b8555 st/mesa: fix context use-after-free problem in st_renderbuffer_delete()
The use-after-free happened when the renderbuffer was shared by multiple
contexts and we tried to delete the renderbuffer using a context which
was previously deleted.

Note: this is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
(cherry picked from commit 4cedb65a43)
2013-02-13 18:46:40 +01:00
Brian Paul
9d4ab9a663 mesa: pass context parameter to gl_renderbuffer::Delete()
We sometimes need a rendering context when deleting renderbuffers.
Pass it explicitly instead of trying to grab a current context
(which might be NULL).  The next patch will make use of this.

Note: this is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
(cherry picked from commit c73245882c)

Conflicts:

	src/mesa/swrast/s_renderbuffer.c
2013-02-13 18:46:40 +01:00
Brian Paul
dca04373c2 mesa: fix-up and use _mesa_delete_renderbuffer()
_mesa_delete_renderbuffer() should free the mutex (though that may be a
no-op) and then free the renderbuffer object itself.  Subclasses of
gl_renderbuffer can use this function too.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit 8472bb4508)
2013-02-13 18:46:40 +01:00
Michel Dänzer
a8f8287154 configure.ac: GLX cannot work without OpenGL
GLX uses mapi/glapi/libglapi.la, which is only built for OpenGL.

If the user specified --enable-xlib-glx --disable-opengl, error out, as these
cannot be both observed at the same time. If the user just specified
--disable-opengl but not --disable-glx, print a warning and disable GLX as
well.

NOTE: This is a candidate for the stable branches.

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

Tested-by: Tom Stellard <thomas.stellard@amd.com>
(cherry picked from commit 3b888f534c)
2013-02-13 18:46:40 +01:00
Brian Paul
d2d3cd2be7 st/mesa: set ctx->Const.MaxSamples = 0, not 1
The gallium docs for pipe_screen::is_format_supported() says that
samples==0 or samples==1 both mean that multisampling is not supported.
Return GL_MAX_SAMPLES==0 instead of 1 for consistency with other drivers.

Note: This is a candidate for the 9.0 branch.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
(cherry picked from commit d60da27273)
2013-02-13 18:46:40 +01:00
Brian Paul
f4e33c551d xlib: use _mesa_generate_mipmap() for mipmap generation, not meta
The swrast fragment program interpreter has trouble computing the
right texture LOD because it doesn't have easy access to input
derivatives.  This causes the GLSL-based meta generate mipmap code
to fetch texels from the wrong mipmap level.

One possible fix would be to set the GL_TEXTURE_MIN/MAX_LOD parameters
to limit sampling from the right level.  But let's just use the
_mesa_generate_mipmap() fallback since it's a lot faster than using
the fragment shader interpreter.

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

Note: This is a candidate for the 9.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit 89551ae04f)
2013-02-13 18:46:40 +01:00
Brian Paul
8d38c72298 osmesa: use _mesa_generate_mipmap() for mipmap generation, not meta
See previous commit for more info.

Note: This is a candidate for the 9.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit 2180f32972)
2013-02-13 18:46:39 +01:00
Brian Paul
3fa0423c02 vbo: add a null pointer check to handle OOM instead of crashing
Note: This is a candidate for the 9.0 branch.
(cherry picked from commit 7a89f08a22)
2013-02-13 18:46:39 +01:00
Brian Paul
6b745a4e24 svga: add NULL pointer check in svga_create_sampler_state()
Note: This is a candidate for the 9.0 branch.
(cherry picked from commit 9227c53741)
2013-02-13 18:46:39 +01:00
Brian Paul
998f402af5 mesa: use GLbitfield64 when copying program inputs
Note: This is a candidate for the 9.0 branch.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit ccbb479f40)
2013-02-13 18:46:39 +01:00
Zack Rusin
63f8589430 glx: only advertise GLX_INTEL_swap_event if it's supported
Only drivers supporting DRI2 version >=4 support GLX_INTEL_swap_event.
So lets mark it as such otherwise applications which use this extension
(i.e. everything based on Clutter, e.g. gnome-shell) break horribly on
drivers supporting DRI2 versions only up to 3.

Note: This is a candidate for the 9.0 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit dbb2d192de)
2013-02-13 18:46:39 +01:00
Kenneth Graunke
1151cdfa9e build: Fix build on systems where /usr/bin/python isn't python 2.
configure.ac sets up a PYTHON2 variable, which is what we want
AX_PYTHON_MODULE to use (since we only use Python 2 for now).

NOTE: This is a candidate for the 9.0 branch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=31598
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
(cherry picked from commit 121d19de92)
2013-02-13 18:46:39 +01:00
Andreas Boll
ffaa1c92e9 build: require python module libxml2
configure should warn if libxml2 is not found.
libxml2 is needed by glapi/gen.

Fixes error during build in src/mapi/glapi/gen:
ImportError: No module named libxml2

NOTE: This is a candidate for the 9.0 branch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=31598
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 410b58c7bf)
2013-02-13 18:46:39 +01:00
Kenneth Graunke
765221c0d5 glsl: Track UBO block names in the symbol table.
The GLSL 1.40 spec says:

    "Uniform block names and variable names declared within uniform
    blocks are scoped at the program level."

Track the block name in the symbol table and emit errors when conflicts
exist.

Fixes es3conform's uniform_buffer_object_block_name_conflict test, and
fixes the piglit block-name-clashes-with-{variable,function,struct}.vert
tests.

NOTE: This is a candidate for the 9.0 branch.

v2: Fix bad constructor initialization.  Noticed by Topi Pohjolainen.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 4f29169913)
2013-02-13 18:46:39 +01:00
Adam Jackson
c10c3eab4c r200: Fix probable thinko in r200EmitArrays
Effectively this path would always assert.  Move the break statement to
the (probable) intended place.

Note: This is a candidate for the stable branches.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
(cherry picked from commit 06f3a1f792)
2013-02-13 18:46:39 +01:00
Jordan Justen
2cde1e592e unpack: support unpacking MESA_FORMAT_ARGB2101010
Note: This is a candidate for the stable branches.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 2ace406b1f)
2013-02-13 18:46:39 +01:00
Brian Paul
96c1678c3a util: add get/put_tile_z() support for PIPE_FORMAT_Z32_FLOAT_S8X24_UINT
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=58972

Note: This is a candidate for the stable branches.
(cherry picked from commit 073a53fe2f)
2013-02-13 18:46:39 +01:00
Brian Paul
af41a1d491 util: fix addressing bug in pipe_put_tile_z() for PIPE_FORMAT_Z32_FLOAT
The Z32 pixel is 4 bytes so multiply x by 4, not 2.

Note: This is a candidate for the stable branches.
(cherry picked from commit 69c2528b83)
2013-02-13 18:46:39 +01:00
Brian Paul
3a39c3cb67 st/glx: allow GLX_DONT_CARE for glXChooseFBConfig() attribute values
Fixes piglit glx-dont-care-mask test.

Note: This is a candidate for the stable branches.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit fe90762414)
2013-02-13 18:46:39 +01:00
Brian Paul
938b156d82 xlib: allow GLX_DONT_CARE for glXChooseFBConfig() attribute values
Fixes piglit glx-dont-care-mask test.

Note: This is a candidate for the stable branches.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit 46bad058eb)
2013-02-13 18:46:39 +01:00
Marek Olšák
cd95b67347 r600g: fix int->bool conversion in fence_signalled
NOTE: This is a candidate for the stable branches.
(cherry picked from commit 9f0ddbc9e4)
2013-02-13 18:46:38 +01:00
Brian Paul
439842e434 xlib: handle _mesa_initialize_visual()'s return value
If the call fails, we should return NULL from XMesaCreateVisual().
This was found when Waffle tried to create a visual with depth/stencil
bits = -1.  That's an illegal value for glXChooseFBConfig() and we should
return NULL in that situation.

Note: This is a candidate for the stable branches.
(cherry picked from commit 05cd6cfd5f)
2013-02-13 18:46:38 +01:00
Frank Henigman
3bdb758934 mesa: add bounds checking for uniform array access
No piglit regressions and now passes glsl-uniform-out-of-bounds-2.

validate_uniform_parameters now checks that the array index is
valid.  This means if an index is out of bounds, glGetUniform* now
fails with GL_INVALID_OPERATION, as it should.
_mesa_uniform and _mesa_uniform_matrix also call
validate_uniform_parameters so the bounds checks there became
redundant and were removed.

The test in glGetUniformLocation is modified to check array bounds
so it now returns GL_INVALID_INDEX (-1) if you ask for the location
of a non-existent array element, as it should.

Signed-off-by: Frank Henigman <fjhenigman@google.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
(cherry picked from commit 46e3aeb077)
2013-02-13 18:46:38 +01:00
Paul Berry
dcb6a7ccbb mesa: Allow glReadBuffer(GL_NONE) for winsys framebuffers.
Previously, Mesa code assumed that glReadBuffer(GL_NONE) was only
valid for user-created framebuffer objects.  However, the spec is
quite clear that is should also be valid for the default framebuffer.
From section 18.2.1 ("Obtaining Pixels from the Framebuffer") of the
GL 4.3 spec:

    "When READ_FRAMEBUFFER_BINDING is zero, i.e. the default
    framebuffer, src must be one of the values listed in table 17.4,
    including NONE."

Similar language exists in the GLES 3.0 spec, and in desktop GL all
the way back to ARB_framebuffer_object.

Partially fixes GLES3 conformance test "CoverageES30.test".

NOTE: This is a candidate for stable branches.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit cf5632094b)
2013-02-13 18:46:38 +01:00
Brian Paul
e8830f5a40 softpipe: fix unreliable FS variant binding bug
In exec_prepare() we were comparing pointers to see if the fragment
shader variant had changed before calling tgsi_exec_machine_bind_shader().
This didn't work reliably when there was a lot of shader token malloc/
freeing going on because the memory might get reused.
Instead, bind the shader variant during regular state validation.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=40404
(fixes a couple of piglit's glsl-max-varyings test)

Note: This is a candidate for the stable branches.
(cherry picked from commit 18ef8f83b2)
2013-02-13 18:46:38 +01:00
Brian Paul
e6e58cfa9d softpipe: fix up FS variant unbinding / deletion
The old call to tgsi_exec_machine_bind_shader() in
softpipe_delete_fs_state() was never called since the shader's original
tokens are never passed to the tgsi interpreter (only shader _variant_
tokens are).  Now, unbind the variant's tokens from the tgsi interpreter
when we free the variant.

This doesn't fix any known bugs but it's the right thing to do.

Note: This is a candidate for the stable branches.
(cherry picked from commit fddcc67f5c)
2013-02-13 18:46:38 +01:00
Matt Turner
5f8a8716b6 mesa/uniform_query: Don't write to *params if there is an error
The GL 3.1 and ES 3.0 specs say of glGetActiveUniformsiv:
   "If an error occurs, nothing will be written to params."

So, make a pass through the indices and check that they're valid before
the pass that actually writes to params. Checking pname happens on the
first iteration of the second loop.

Fixes es3conform's getactiveuniformsiv_for_nonexistent_uniform_indices
test.

NOTE: This is a candidate for the 9.0 branch.
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 11cea47246)
2013-02-13 18:46:38 +01:00
Stefan Dösinger
460096f5da r200: Initialize swrast before setting limits
Otherwise the driver announces 4096 vertex shader constants and other
way too high limits.

NOTE: This is a candidate for stable release branches.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 654a945f4d)

Conflicts:
	src/mesa/drivers/dri/r200/r200_context.c
2013-02-13 18:46:38 +01:00
Stefan Dösinger
25e34c3526 radeon: Initialize swrast before setting limits
NOTE: This is a candidate for stable release branches.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit f6a4e1bc1e)

Conflicts:
	src/mesa/drivers/dri/radeon/radeon_context.c
2013-02-13 18:46:38 +01:00
Stefan Dösinger
794c133dfb meta: Disable GL_FRAGMENT_SHADER_ATI in MESA_META_SHADER
Fixes clears in Wine on r200.

NOTE: This is a candidate for stable release branches.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit d8069b7603)

Port to 9.0: Andreas Boll <andreas.boll.dev@gmail.com>
    s/API_OPENGL_COMPAT/API_OPENGL/
2013-02-13 18:43:36 +01:00
Brian Paul
9ae069dbbd draw: set precalc_flat flag for AA lines too
Fixes flat shading for AA lines.  demos/src/trivial/line-smooth is a
test case which hits this.

Note: This is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
(cherry picked from commit d2c7fe5389)
2013-02-13 18:38:42 +01:00
José Fonseca
4a0423e1bd draw: Properly limit vertex buffer fetches on draw arrays.
We need to clamp vertex buffer fetch based on its size, not based on the
user specified max index hint.

This matches draw_pt_fetch_run() above.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 7da3a947c7)
2013-02-13 18:38:42 +01:00
Kenneth Graunke
e582e35227 mesa: Disable GL_NV_primitive_restart extension in core contexts.
The NV formulation of primitive restart is turned on/off with
glEnableClientState/glDisableClientState.  These two functions don't
exist in core contexts, which mean that GL_NV_primitive_restart is
essentially useless...even broken.

However, leaving it on causes oglconform's primitive-restart-nv tests to
run in OpenGL 3.1 contexts, which results in them all failing.  This
patch causes 29 subtests to go from "fail" to "not run".

NOTE: This is a candidate for stable branches.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 32c6db3978)
2013-02-13 18:38:42 +01:00
Brian Paul
37be707f57 st/glx: accept GLX_SAMPLE_BUFFERS/SAMPLES_ARB == 0
Only fail if GLX_SAMPLE_BUFFERS_ARB or GLX_SAMPLES_ARB are non-zero.
We were already doing this in the older swrast/glx code.

This fixes a piglit/waffle problem where we'd always fail to get a
visual/config and report the test as "skip".

Note: This is a candidate for the stable branches.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit c6d74bfaf6)
2013-02-13 18:38:42 +01:00
Anuj Phogat
b086d9ced7 mesa: Fix GL_LUMINANCE handling for textures in glGetTexImage
We need to rebase colors (ex: set G=B=0) when getting GL_LUMINANCE
textures in following cases:
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

A similar fix was pushed by Brian Paul for uncompressed textures
in commit: f5d0ced.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=47220

Observed no regressions in piglit and ogles2conform due to this fix.
This patch will cause failures in intel oglconform pxconv-gettex,
pxstore-gettex and pxtrans-gettex test cases. The cause of failures
is a bug in test cases. Expected luminance value is calculted
incorrectly in test cases: L = R+G+B.

V2: Set G = 0 when getting a RG texture but returning luminance.

Note: This is a candidate for stable branches.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
(cherry picked from commit 9ab896243c)
2013-02-13 18:38:42 +01:00
Matt Turner
ce22054074 mesa: Set transform feedback's default buffer mode to INTERLEAVED_ATTRIBS
Fixes part of es3conform's transform_feedback_init_defaults test.
NOTE: This is a candidate for the stable branch.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 13f9012ad3)
2013-02-13 18:38:42 +01:00
Matt Turner
b7af6550b1 mesa: Return 0 for XFB_VARYING_MAX_LENGTH if no varyings
v2: Perform this count the same way as elsewhere in this file, per
    Brian Paul's review.

Fixes part of es3conform's transform_feedback_init_defaults test.
NOTE: This is a candidate for the stable branches.
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 7c2060f0f0)
2013-02-13 18:38:41 +01:00
José Fonseca
738d1ae3b5 mesa/st: Don't use 4bits for GL_UNSIGNED_BYTE_3_3_2(_REV)
4bits and 3bits quantitization values differ significantly for
values other than 0 and 1.

Fixes piglit draw-pixels for softpipe/llvmpipe.

NOTE: Probably a candidate for stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
(cherry picked from commit 0cb0c38cce)
2013-02-13 18:38:41 +01:00
Andreas Boll
3479fdef2f configure.ac: Allow OpenGL ES1 and ES2 only with enabled OpenGL
Building OpenGL ES1 and/or ES2 without OpenGL is not supported on mesa
9.0.x

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2013-02-10 17:07:26 +01:00
Eric Anholt
ebd4883a0c i965: Actually add support for GL_ANY_SAMPLES_PASSED from GL_ARB_oq2.
v2: Fix mangled sentence in the comment, and make the loop exit early.

Fixes assertion failures in Piglit's spec/ARB_occlusion_query2/render
test as well as the game PlaneShift.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v1)
(cherry picked from commit e755c1a36b)
2013-02-01 16:22:42 -08:00
Jerome Glisse
78222e6363 r600g: add cs memory usage accounting and limit it v3 (backport for mesa 9.0)
We are now seing cs that can go over the vram+gtt size to avoid
failing flush early cs that goes over 70% (gtt+vram) usage. 70%
is use to allow some fragmentation.

The idea is to compute a gross estimate of memory requirement of
each draw call. After each draw call, memory will be precisely
accounted. So the uncertainty is only on the current draw call.
In practice this gave very good estimate (+/- 10% of the target
memory limit).

v2: Remove left over from testing version, remove useless NULL
    checking. Improve commit message.
v3: Add comment to code on memory accounting precision

This version is a backport for mesa 9.0

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
2013-01-31 14:36:28 -05:00
Kenneth Graunke
1e8de8437a cherry-ignore: Ignore candidates for the 9.1 branch. 2013-01-30 12:15:39 -08:00
Chad Versace
d9c7fcff8f i965/disasm: Fix horizontal stride of dest registers
The bug: The printed horizontal stride was the numerical value of the
  BRW_HORIZONTAL_$N enum.
The fix: Translate the enum before printing.

Note: This is a candidate for the stable releases.
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit ca7d332253)
2013-01-30 12:15:39 -08:00
Kenneth Graunke
bc7112746d i965/vs: Store texturing results into a vec4 temporary.
The sampler appears to ignore writemasks (even when correcting the
WRITEMASK_XYZW in brw_vec4_emit.cpp to the proper writemask) and just
always writes all four values.

To cope with this, just texture into a temporary, then MOV out into a
register that has the proper number of components.

NOTE: This is a candidate for stable branches.

Fixes es3conform's shadow_execution_vert.test.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
(cherry picked from commit f0dbd9255b)
2013-01-30 12:15:38 -08:00
Kenneth Graunke
29bc8e7d8f i965/vs: Set LOD to 0 for ordinary texture() calls.
Previously it was left undefined, causing us to select a random LOD.

NOTE: This is a candidate for stable branches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
(cherry picked from commit aeff9a0d98)
2013-01-30 12:15:38 -08:00
Kenneth Graunke
de150e2478 i965/vs: Create a 'lod_type' temporary for ir->lod_info.lod->type.
This is purely a refactor.  However, in a moment, we'll want to set
lod_type to float for ir_tex, where ir->lod_info.lod is NULL.

NOTE: This is a candidate for stable branches (for the next patch).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
(cherry picked from commit 56ce55d198)
2013-01-30 12:15:38 -08:00
Kenneth Graunke
a3d2e3e061 i965: Add missing _NEW_BUFFERS dirty bit in Gen7 SBE state.
This is needed to compute render_to_fbo.  It even has the comment.

NOTE: This is a candidate for stable branches.

Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit bd87441ac0)
2013-01-30 12:15:38 -08:00
Eric Anholt
0ba14013f6 i965/fs: Don't generate saturates over existing variable values.
Fixes a crash in http://workshop.chromeexperiments.com/stars/ on i965,
and the new piglit test glsl-fs-clamp-5.
We were trying to emit a saturating move into a uniform, which the code
generator appropriately choked on.  This was broken in the change in
32ae8d3b32.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57166
NOTE: This is a candidate for the 9.0 branch.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit b9b033d8e4)

Conflicts: 9.0 doesn't have the MOV() helper.  Convert to old style.
2013-01-30 12:15:38 -08:00
Kenneth Graunke
a474b455ac cherry-ignore: Ignore i965 guardband bug fixes.
Guardband clipping is disabled in 9.0, so these aren't actually needed
(and don't apply cleanly either).
2013-01-30 12:15:38 -08:00
Eric Anholt
457eab5a9b i965/fs: Fix the gen6-specific if handling for 80ecb8f15b
Fixes oglconform shad-compiler advanced.TestLessThani.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=48629
NOTE: This is a candidate for the 9.0 branch.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 0482998ccc)

Conflicts: fs_inst doesn't have a "predicate" field on the 9.0 branch,
so convert it to "predicated = true".  See 54679fcbca.
2013-01-30 12:14:31 -08:00
Kenneth Graunke
871da78263 i965: Add chipset limits for Haswell GT1/GT2.
The maximum number of URB entries come from the 3DSTATE_URB_VS and
3DSTATE_URB_GS state packet documentation; the thread count information
comes from the 3DSTATE_VS and 3DSTATE_PS state packet documentation.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
(cherry picked from commit 9add4e8038)
2013-01-30 09:46:00 -08:00
Kenneth Graunke
d02343e501 i965: Use Haswell's sample_d_c for textureGrad with shadow samplers.
The new hardware actually just supports this now.

Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 899017fc54)
2013-01-30 09:46:00 -08:00
Kenneth Graunke
e479370164 i965: Lower textureGrad() with samplerCubeShadow.
We weren't lowering textureGrad() with samplerCubeShadow because I
couldn't figure out the LOD calculations.  It turns out they're easy:
you just have to use 1 for the depth.  This causes it to pass
oglconform's four tests.

(cherry picked from commit 613e64060c)

When cherry-picking this to stable, I've reordered this before the
Haswell commit that would have introduced a regression.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Anuj Phogat <anuj.phogat@gmail.com> (original)
Tested-by: Ian Romanick <idr@freedesktop.org> (original)
2013-01-30 09:46:00 -08:00
Kenneth Graunke
42df904f88 i965: Do texture swizzling in hardware on Haswell.
Haswell supports EXT_texture_swizzle and legacy DEPTH_TEXTURE_MODE
swizzling by setting SURFACE_STATE entries.  This means we don't have to
bake the swizzle settings into the shader code by emitting MOV
instructions, and thus don't have to recompile shaders whenever the
swizzles change.

Unfortunately, we can't handle GL_ALPHA this way: unlike all the others,
which store the comparison result in the .r channel (and possibly others
as well), GL_ALPHA puts it in the .a channel.  The GLSL 1.30+ style
functions which return a float always simply return the .r channel,
which would be zero if we handled this as a surface override.  In this
case, fall back to doing it the old way.  DEPTH_TEXTURE_MODE = GL_ALPHA
isn't an interesting performance path anyway.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 6d6aef7974)
2013-01-30 09:45:46 -08:00
Kenneth Graunke
3ebfd3f774 i965: Refactor texture swizzle generation into a helper.
It's going to be reused in a second place soon.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit b5a042a657)
2013-01-30 09:45:18 -08:00
Kenneth Graunke
b922999a40 i965: Fix primitive restart on Haswell.
Haswell moved the "Cut Index Enable" bit from the INDEX_BUFFER packet to
a new 3DSTATE_VF packet, so we need to emit that.  Also, it requires us
to specify the cut index rather than assuming it's 0xffffffff.

This adds a new Haswell-specific tracked state atom to gen7_atoms.
Normally, we would create a new generation-specific atom list, but since
there's only one difference over Ivybridge so far, I chose to simply
make it return without doing any work on non-Haswell systems.

Fixes five piglit tests:
- general/primitive-restart-DISABLE_VBO
- general/primitive-restart-VBO_COMBINED_VERTEX_AND_INDEX
- general/primitive-restart-VBO_INDEX_ONLY
- general/primitive-restart-VBO_SEPARATE_VERTEX_AND_INDEX
- general/primitive-restart-VBO_VERTEX_ONLY

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
(cherry picked from commit 815d9d405c)
2013-01-30 09:45:04 -08:00
Andreas Boll
0f687f8455 docs: add news item for 9.0.2 release 2013-01-22 21:26:05 +01:00
Andreas Boll
f3374c6dda docs: Add 9.0.2 release md5sums 2013-01-22 21:24:58 +01:00
104 changed files with 1251 additions and 391 deletions

View File

@@ -54,7 +54,7 @@ distclean-local:
# Rules for making release tarballs
PACKAGE_VERSION=9.0.2
PACKAGE_VERSION=9.0.3
PACKAGE_DIR = Mesa-$(PACKAGE_VERSION)
PACKAGE_NAME = MesaLib-$(PACKAGE_VERSION)

View File

@@ -13,3 +13,29 @@ b5891286202987dfc2606ac716050c0ee426de11 intel: Fix yet-another-bug in intel_tex
# Introduces performance regressions for other games... don't cherry-pick for now
fa58644855e44830e0b91dc627703c236fa6712a r600g: fix abysmal performance in Reaction Quake
# i965 guardband clipping is disabled in 9.0, so no need to fix bugs in it
23e7b81f2d742d292d77b53ac9cf72c3d89fc798 i965: Use fewer temporary variables in c
lip setup.
d411bbd5bd895617e265e023213895100e4509ef i965: Disable the GB clip test when a li
mited viewport is set.
# Candidates for 9.1
1559994cba380a4e87a5e8dbb04b0a7475711756 i965: Fix assignment instead of comparison in asserts.
5c86a728d4f688c0fe7fbf9f4b8f88060b65c4ee r600g: fix htile buffer leak
a06f03d795153ce060d99aafb61d10c27a47efc1 r300g: always put MSAA resources in VRAM
a8a5055f2dea1960898763d17f28043577c3e64e radeonsi: Fix draws using user index buffer.
257006e2a4201c11ca5f800a74ac4aaf62a7bfc1 r600g/llvm: Select the correct GPU type for RV670
e5fb7347a72118bf06dfabaa453208578c7ad876 radeonsi: Adapt to sample intrinsics changes.
120efeef8b51c16924dafa6bbeb017a856db911b radeonsi: Improve packing of texture address parameters.
6bcb8238446060db665425d9f63eb0c1b3ba9f68 radeonsi: Enable texture arrays.
6455d40b7ec09e3a3923c9b78952dc29627afed1 radeonsi: Remove spurious traces of R16G16B16 support.
2db1f73849260cf8e5a7e390d04f5f26141a0b37 builtin_compiler/build: Don't use *_FOR_BUILD when not cross compiling
11bd1b0f589bfeab8fcad5c70adf4c8a665eebc9 gallium/egl: Fix include dirs for VPATH build
b92900d26a54ef997f2920d6a7371bb7c9caabf8 mesa/glsl: Separate parsing logic from _mesa_get_uniform_location.
b4db34cc4c047427a21efb9bde03d7e125f70e55 glsl: Rename uniform_field_visitor to program_resource_visitor.
53febac02c382fa163a9ad7280fc5f4d2707a665 glsl: Use parse_program_resource_name to parse transform feedback varyings.
99b78337e38308480ee491493b045179f10ed579 glsl: Support transform feedback of varying structs.
83e4407f443fb6baeccf9aefee291c82adcaa58b radeonsi: add support for Oland chips
af0af75881ea99452086afd6907780de77af6e96 radeonsi: default PA_SC_RASTER_CONFIG to 0
4161d70bba567e6e73d5e9e993a74d81930d0e72 radeonsi: add Oland pci ids

View File

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

View File

@@ -6,7 +6,7 @@ dnl Tell the user about autoconf.html in the --help output
m4_divert_once([HELP_END], [
See docs/autoconf.html for more details on the options for Mesa.])
AC_INIT([Mesa], [9.0.2],
AC_INIT([Mesa], [9.0.3],
[https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
AC_CONFIG_AUX_DIR([bin])
AC_CONFIG_MACRO_DIR([m4])
@@ -50,6 +50,7 @@ AM_PROG_CC_C_O
AM_PROG_AS
AC_CHECK_PROGS([MAKE], [gmake make])
AC_CHECK_PROGS([PYTHON2], [python2 python])
AX_PYTHON_MODULE([libxml2], [needed])
AC_PROG_SED
AC_PROG_MKDIR_P
AC_PATH_PROG([MKDEP], [makedepend])
@@ -671,6 +672,17 @@ if test "x$enable_opengl" = xno -a \
AC_MSG_ERROR([at least one API should be enabled])
fi
# Building OpenGL ES1 and/or ES2 without OpenGL is not supported on mesa 9.0.x
if test "x$enable_opengl" = xno -a \
"x$enable_gles1" = xyes; then
AC_MSG_ERROR([Building OpenGL ES1 without OpenGL is not supported])
fi
if test "x$enable_opengl" = xno -a \
"x$enable_gles2" = xyes; then
AC_MSG_ERROR([Building OpenGL ES2 without OpenGL is not supported])
fi
API_DEFINES=""
if test "x$enable_opengl" = xno; then
API_DEFINES="$API_DEFINES -DFEATURE_GL=0"
@@ -694,6 +706,16 @@ if test "x$enable_dri$enable_xlib_glx" = xyesyes; then
AC_MSG_ERROR([DRI and Xlib-GLX cannot be built together])
fi
if test "x$enable_opengl$enable_xlib_glx" = xnoyes; then
AC_MSG_ERROR([Xlib-GLX cannot be built without OpenGL])
fi
# Disable GLX if OpenGL is not enabled
if test "x$enable_glx$enable_opengl" = xyesno; then
AC_MSG_WARN([OpenGL not enabled, disabling GLX])
enable_glx=no
fi
# Disable GLX if DRI and Xlib-GLX are not enabled
if test "x$enable_glx" = xyes -a \
"x$enable_dri" = xno -a \

View File

@@ -9,6 +9,22 @@
<h1>News</h1>
<h2>February 21, 2013</h2>
<p>
<a href="relnotes-9.0.3.html">Mesa 9.0.3</a> is released.
This is a bug fix release.
</p>
<h2>January 22, 2013</h2>
<p>
<a href="relnotes-9.0.2.html">Mesa 9.0.2</a> is released.
This is a bug fix release.
</p>
<h2>November 16, 2012</h2>
<p>

View File

@@ -23,7 +23,9 @@ because GL_ARB_compatibility is not supported.
<h2>MD5 checksums</h2>
<pre>
TBD
5ae216ca9fecfa349f14ecb83aa3f124 MesaLib-9.0.2.tar.gz
dc45d1192203e418163e0017640e1cfc MesaLib-9.0.2.tar.bz2
93d40ec77d656dd04b561ba203ffbb91 MesaLib-9.0.2.zip
</pre>
<h2>New features</h2>

239
docs/relnotes-9.0.3.html Normal file
View File

@@ -0,0 +1,239 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Mesa Release Notes</title>
<link rel="stylesheet" type="text/css" href="mesa.css">
</head>
<body>
<h1>Mesa 9.0.3 Release Notes / February 21th, 2013</h1>
<p>
Mesa 9.0.3 is a bug fix release which fixes bugs found since the 9.0.2 release.
</p>
<p>
Mesa 9.0 implements the OpenGL 3.1 API, but the version reported by
glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) /
glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 3.1. OpenGL
3.1 is <strong>only</strong> available if requested at context creation
because GL_ARB_compatibility is not supported.
</p>
<h2>MD5 checksums</h2>
<pre>
168384ac0101f4600a15edd3561acdc7 MesaLib-9.0.3.tar.gz
d7515cc5116c72ac63d735655bd63689 MesaLib-9.0.3.tar.bz2
a2e1c794572440fd0d839a7d7dfea00c MesaLib-9.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=25201">Bug 25201</a> - Pink artifacts on objects in the distance in ETQW/Quake 4</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31598">Bug 31598</a> - configure: Doesn't check for python libxml2</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=40404">Bug 40404</a> - [softpipe] piglit glsl-max-varyings regression</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=47220">Bug 47220</a> - [bisected] Oglc pxconv-gettex(basic.allCases) regressed</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=48629">Bug 48629</a> - [bisected i965]Oglc shad-compiler(advanced.TestLessThani) regressed</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=54240">Bug 54240</a> - [swrast] piglit fbo-generatemipmap-filtering regression</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=56920">Bug 56920</a> - [sandybridge][uxa] graphics very glitchy and always flickering</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=57166">Bug 57166</a> - [GM45] Chrome experiment &quot;Stars&quot; crash: brw_fs_emit.cpp:708: brw_reg brw_reg_from_fs_reg(fs_reg*): Assertion „!&quot;not reached&quot;“ failed.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=57746">Bug 57746</a> - build test failure: nouveau_fbo.c:198:3: error: too few arguments to function 'nouveau_renderbuffer_del'</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=57754">Bug 57754</a> - [swrast] Mesa 9.1-devel implementation error: Unable to delete renderbuffer, no context</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=58680">Bug 58680</a> - [IVB] Graphical glitches in 0 A.D</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=58972">Bug 58972</a> - [softpipe] util/u_tile.c:795:pipe_put_tile_z: Assertion `0' failed.</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=59364">Bug 59364</a> - [bisected] Mesa build fails: clientattrib.c:33:22: fatal error: indirect.h: No such file or directory</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=59700">Bug 59700</a> - [ILK/SNB/IVB Bisected]Oglc vertexshader(advanced.TestLightsTwoSided) causes GPU hung</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=59873">Bug 59873</a> - [swrast] piglit ext_framebuffer_multisample-interpolation 0 centroid-edges regression</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=60052">Bug 60052</a> - [Bisected]Piglit glx_extension_string_sanity fail</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=60172">Bug 60172</a> - Planeshift: triangles where grass would be</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-9.0.2..mesa-9.0.3
</pre>
<p>Adam Jackson (1):</p>
<ul>
<li>r200: Fix probable thinko in r200EmitArrays</li>
</ul>
<p>Andreas Boll (7):</p>
<ul>
<li>docs: Add 9.0.2 release md5sums</li>
<li>docs: add news item for 9.0.2 release</li>
<li>configure.ac: Allow OpenGL ES1 and ES2 only with enabled OpenGL</li>
<li>build: require python module libxml2</li>
<li>cherry-ignore: Ignore candidates for the 9.1 branch.</li>
<li>mesa: Bump version to 9.0.3</li>
<li>docs: Add 9.0.3 release notes</li>
</ul>
<p>Anuj Phogat (1):</p>
<ul>
<li>mesa: Fix GL_LUMINANCE handling for textures in glGetTexImage</li>
</ul>
<p>Brian Paul (29):</p>
<ul>
<li>st/glx: accept GLX_SAMPLE_BUFFERS/SAMPLES_ARB == 0</li>
<li>draw: set precalc_flat flag for AA lines too</li>
<li>softpipe: fix up FS variant unbinding / deletion</li>
<li>softpipe: fix unreliable FS variant binding bug</li>
<li>xlib: handle _mesa_initialize_visual()'s return value</li>
<li>xlib: allow GLX_DONT_CARE for glXChooseFBConfig() attribute values</li>
<li>st/glx: allow GLX_DONT_CARE for glXChooseFBConfig() attribute values</li>
<li>util: fix addressing bug in pipe_put_tile_z() for PIPE_FORMAT_Z32_FLOAT</li>
<li>util: add get/put_tile_z() support for PIPE_FORMAT_Z32_FLOAT_S8X24_UINT</li>
<li>mesa: use GLbitfield64 when copying program inputs</li>
<li>svga: add NULL pointer check in svga_create_sampler_state()</li>
<li>vbo: add a null pointer check to handle OOM instead of crashing</li>
<li>osmesa: use _mesa_generate_mipmap() for mipmap generation, not meta</li>
<li>xlib: use _mesa_generate_mipmap() for mipmap generation, not meta</li>
<li>st/mesa: set ctx-&gt;Const.MaxSamples = 0, not 1</li>
<li>mesa: fix-up and use _mesa_delete_renderbuffer()</li>
<li>mesa: pass context parameter to gl_renderbuffer::Delete()</li>
<li>st/mesa: fix context use-after-free problem in st_renderbuffer_delete()</li>
<li>dri_glx: fix use after free report</li>
<li>mesa: remove warning message in _mesa_reference_renderbuffer_()</li>
<li>st/mesa: add null pointer check in st_renderbuffer_delete()</li>
<li>util: add some defensive coding in u_upload_alloc()</li>
<li>st/mesa: do proper error checking for u_upload_alloc() calls</li>
<li>util: add new error checking code in vbuf helper</li>
<li>mesa: don't enable GL_EXT_framebuffer_multisample for software drivers</li>
<li>st/mesa: only enable GL_EXT_framebuffer_multisample if GL_MAX_SAMPLES &gt;= 2</li>
<li>mesa: don't expose IBM_rasterpos_clip in a core context</li>
<li>svga: fix sRGB rendering</li>
<li>nouveau: Fix build.</li>
</ul>
<p>Chad Versace (1):</p>
<ul>
<li>i965/disasm: Fix horizontal stride of dest registers</li>
</ul>
<p>Eric Anholt (5):</p>
<ul>
<li>i965/fs: Fix the gen6-specific if handling for 80ecb8f15b9ad7d6edc</li>
<li>i965/fs: Don't generate saturates over existing variable values.</li>
<li>i965: Actually add support for GL_ANY_SAMPLES_PASSED from GL_ARB_oq2.</li>
<li>i965/vs: Try again when we've successfully spilled a reg.</li>
<li>i965/gen7: Set up all samplers even if samplers are sparsely used.</li>
</ul>
<p>Frank Henigman (1):</p>
<ul>
<li>mesa: add bounds checking for uniform array access</li>
</ul>
<p>Jerome Glisse (1):</p>
<ul>
<li>r600g: add cs memory usage accounting and limit it v3 (backport for mesa 9.0)</li>
</ul>
<p>Jordan Justen (1):</p>
<ul>
<li>unpack: support unpacking MESA_FORMAT_ARGB2101010</li>
</ul>
<p>José Fonseca (2):</p>
<ul>
<li>mesa/st: Don't use 4bits for GL_UNSIGNED_BYTE_3_3_2(_REV)</li>
<li>draw: Properly limit vertex buffer fetches on draw arrays.</li>
</ul>
<p>Kenneth Graunke (19):</p>
<ul>
<li>i965: Fix primitive restart on Haswell.</li>
<li>i965: Refactor texture swizzle generation into a helper.</li>
<li>i965: Do texture swizzling in hardware on Haswell.</li>
<li>i965: Lower textureGrad() with samplerCubeShadow.</li>
<li>i965: Use Haswell's sample_d_c for textureGrad with shadow samplers.</li>
<li>i965: Add chipset limits for Haswell GT1/GT2.</li>
<li>cherry-ignore: Ignore i965 guardband bug fixes.</li>
<li>i965: Add missing _NEW_BUFFERS dirty bit in Gen7 SBE state.</li>
<li>i965/vs: Create a 'lod_type' temporary for ir-&gt;lod_info.lod-&gt;type.</li>
<li>i965/vs: Set LOD to 0 for ordinary texture() calls.</li>
<li>i965/vs: Store texturing results into a vec4 temporary.</li>
<li>cherry-ignore: Ignore candidates for the 9.1 branch.</li>
<li>mesa: Disable GL_NV_primitive_restart extension in core contexts.</li>
<li>glsl: Track UBO block names in the symbol table.</li>
<li>build: Fix build on systems where /usr/bin/python isn't python 2.</li>
<li>i965: Refactor Gen6+ SF attribute override code.</li>
<li>i965: Compute the maximum SF source attribute.</li>
<li>i965: Fix the SF Vertex URB Read Length calculation for Sandybridge.</li>
<li>i965: Fix the SF Vertex URB Read Length calculation for Gen7 platforms.</li>
</ul>
<p>Marek Olšák (3):</p>
<ul>
<li>r600g: fix int-&gt;bool conversion in fence_signalled</li>
<li>gallium/u_upload_mgr: fix a serious memory leak</li>
<li>r300g: fix blending with blend color and RGBA formats</li>
</ul>
<p>Matt Turner (3):</p>
<ul>
<li>mesa: Return 0 for XFB_VARYING_MAX_LENGTH if no varyings</li>
<li>mesa: Set transform feedback's default buffer mode to INTERLEAVED_ATTRIBS</li>
<li>mesa/uniform_query: Don't write to *params if there is an error</li>
</ul>
<p>Michel Dänzer (1):</p>
<ul>
<li>configure.ac: GLX cannot work without OpenGL</li>
</ul>
<p>Paul Berry (1):</p>
<ul>
<li>mesa: Allow glReadBuffer(GL_NONE) for winsys framebuffers.</li>
</ul>
<p>Roland Scheidegger (1):</p>
<ul>
<li>softpipe: fix using optimized filter function</li>
</ul>
<p>Stefan Dösinger (3):</p>
<ul>
<li>meta: Disable GL_FRAGMENT_SHADER_ATI in MESA_META_SHADER</li>
<li>radeon: Initialize swrast before setting limits</li>
<li>r200: Initialize swrast before setting limits</li>
</ul>
<p>Zack Rusin (2):</p>
<ul>
<li>glx: only advertise GLX_INTEL_swap_event if it's supported</li>
<li>DRI2: Don't disable GLX_INTEL_swap_event unconditionally</li>
</ul>
</body>
</html>

View File

@@ -14,6 +14,7 @@ The release notes summarize what's new or changed in each Mesa release.
</p>
<ul>
<li><a href="relnotes-9.0.3.html">9.0.3 release notes</a>
<li><a href="relnotes-9.0.2.html">9.0.2 release notes</a>
<li><a href="relnotes-9.0.1.html">9.0.1 release notes</a>
<li><a href="relnotes-9.0.html">9.0 release notes</a>

49
m4/ax_python_module.m4 Normal file
View File

@@ -0,0 +1,49 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_python_module.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PYTHON_MODULE(modname[, fatal])
#
# DESCRIPTION
#
# Checks for Python module.
#
# If fatal is non-empty then absence of a module will trigger an error.
#
# LICENSE
#
# Copyright (c) 2008 Andrew Collier
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 6
AU_ALIAS([AC_PYTHON_MODULE], [AX_PYTHON_MODULE])
AC_DEFUN([AX_PYTHON_MODULE],[
if test -z $PYTHON2;
then
PYTHON2="python"
fi
PYTHON_NAME=`basename $PYTHON2`
AC_MSG_CHECKING($PYTHON_NAME module: $1)
$PYTHON2 -c "import $1" 2>/dev/null
if test $? -eq 0;
then
AC_MSG_RESULT(yes)
eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
else
AC_MSG_RESULT(no)
eval AS_TR_CPP(HAVE_PYMOD_$1)=no
#
if test -n "$2"
then
AC_MSG_ERROR(failed to find required module $1)
exit 1
fi
fi
])

View File

@@ -195,6 +195,7 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage )
if (rast->line_smooth && draw->pipeline.aaline) {
draw->pipeline.aaline->next = next;
next = draw->pipeline.aaline;
precalc_flat = TRUE;
}
if (rast->point_smooth && draw->pipeline.aapoint) {

View File

@@ -189,7 +189,7 @@ draw_pt_fetch_run_linear(struct pt_fetch *fetch,
((char *)draw->pt.user.vbuffer[i] +
draw->pt.vertex_buffer[i].buffer_offset),
draw->pt.vertex_buffer[i].stride,
draw->pt.user.max_index + draw->pt.user.eltBias);
draw->pt.max_index);
}
translate->run( translate,

View File

@@ -701,6 +701,28 @@ pipe_get_tile_z(struct pipe_context *pipe,
}
}
break;
case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
{
const float *ptrc = (const float *)(map + y * pt->stride + x*8);
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
/* convert float Z to 32-bit Z */
if (ptrc[j] <= 0.0) {
pDest[j*2] = 0;
}
else if (ptrc[j] >= 1.0) {
pDest[j*2] = 0xffffffff;
}
else {
double z = ptrc[j] * 0xffffffff;
pDest[j*2] = (uint) z;
}
}
pDest += dstStride;
ptrc += pt->stride/4;
}
}
break;
default:
assert(0);
}
@@ -810,7 +832,7 @@ pipe_put_tile_z(struct pipe_context *pipe,
break;
case PIPE_FORMAT_Z32_FLOAT:
{
float *pDest = (float *) (map + y * pt->stride + x*2);
float *pDest = (float *) (map + y * pt->stride + x*4);
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
/* convert 32-bit integer Z to float Z */
@@ -822,6 +844,20 @@ pipe_put_tile_z(struct pipe_context *pipe,
}
}
break;
case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
{
float *pDest = (float *) (map + y * pt->stride + x*8);
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
/* convert 32-bit integer Z to float Z */
const double scale = 1.0 / 0xffffffffU;
pDest[j*2] = ptrc[j] * scale;
}
pDest += pt->stride/4;
ptrc += srcStride;
}
}
break;
default:
assert(0);
}

View File

@@ -164,6 +164,13 @@ enum pipe_error u_upload_alloc( struct u_upload_mgr *upload,
unsigned alloc_offset = align(min_out_offset, upload->alignment);
unsigned offset;
/* Init these return values here in case we fail below to make
* sure the caller doesn't get garbage values.
*/
*out_offset = ~0;
pipe_resource_reference(outbuf, NULL);
*ptr = NULL;
/* Make sure we have enough space in the upload buffer
* for the sub-allocation. */
if (MAX2(upload->offset, alloc_offset) + alloc_size > upload->size) {
@@ -183,8 +190,7 @@ enum pipe_error u_upload_alloc( struct u_upload_mgr *upload,
PIPE_TRANSFER_UNSYNCHRONIZED,
&upload->transfer);
if (!upload->map) {
pipe_resource_reference(outbuf, NULL);
*ptr = NULL;
upload->transfer = NULL;
return PIPE_ERROR_OUT_OF_MEMORY;
}

View File

@@ -256,7 +256,7 @@ void u_vbuf_destroy(struct u_vbuf *mgr)
FREE(mgr);
}
static void
static enum pipe_error
u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key,
unsigned vb_mask, unsigned out_vb,
int start_vertex, unsigned num_vertices,
@@ -267,7 +267,8 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key,
struct pipe_transfer *vb_transfer[PIPE_MAX_ATTRIBS] = {0};
struct pipe_resource *out_buffer = NULL;
uint8_t *out_map;
unsigned i, out_offset;
unsigned out_offset, i;
enum pipe_error err;
/* Get a translate object. */
tr = translate_cache_find(mgr->translate_cache, key);
@@ -311,6 +312,14 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key,
assert((ib->buffer || ib->user_buffer) && ib->index_size);
/* Create and map the output buffer. */
err = u_upload_alloc(mgr->uploader, 0,
key->output_stride * num_indices,
&out_offset, &out_buffer,
(void**)&out_map);
if (err != PIPE_OK)
return err;
if (ib->user_buffer) {
map = (uint8_t*)ib->user_buffer + offset;
} else {
@@ -319,12 +328,6 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key,
PIPE_TRANSFER_READ, &transfer);
}
/* Create and map the output buffer. */
u_upload_alloc(mgr->uploader, 0,
key->output_stride * num_indices,
&out_offset, &out_buffer,
(void**)&out_map);
switch (ib->index_size) {
case 4:
tr->run_elts(tr, (unsigned*)map, num_indices, 0, out_map);
@@ -342,11 +345,13 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key,
}
} else {
/* Create and map the output buffer. */
u_upload_alloc(mgr->uploader,
key->output_stride * start_vertex,
key->output_stride * num_vertices,
&out_offset, &out_buffer,
(void**)&out_map);
err = u_upload_alloc(mgr->uploader,
key->output_stride * start_vertex,
key->output_stride * num_vertices,
&out_offset, &out_buffer,
(void**)&out_map);
if (err != PIPE_OK)
return err;
out_offset -= key->output_stride * start_vertex;
@@ -368,6 +373,8 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key,
pipe_resource_reference(
&mgr->real_vertex_buffer[out_vb].buffer, NULL);
mgr->real_vertex_buffer[out_vb].buffer = out_buffer;
return PIPE_OK;
}
static boolean
@@ -512,11 +519,14 @@ u_vbuf_translate_begin(struct u_vbuf *mgr,
/* Translate buffers. */
for (type = 0; type < VB_NUM; type++) {
if (key[type].nr_elements) {
u_vbuf_translate_buffers(mgr, &key[type], mask[type],
mgr->fallback_vbs[type],
start[type], num[type],
start_index, num_indices, min_index,
unroll_indices && type == VB_VERTEX);
enum pipe_error err;
err = u_vbuf_translate_buffers(mgr, &key[type], mask[type],
mgr->fallback_vbs[type],
start[type], num[type],
start_index, num_indices, min_index,
unroll_indices && type == VB_VERTEX);
if (err != PIPE_OK)
return FALSE;
/* Fixup the stride for constant attribs. */
if (type == VB_CONST) {
@@ -775,7 +785,7 @@ void u_vbuf_set_index_buffer(struct u_vbuf *mgr,
pipe->set_index_buffer(pipe, ib);
}
static void
static enum pipe_error
u_vbuf_upload_buffers(struct u_vbuf *mgr,
int start_vertex, unsigned num_vertices,
int start_instance, unsigned num_instances)
@@ -840,6 +850,7 @@ u_vbuf_upload_buffers(struct u_vbuf *mgr,
unsigned start, end = end_offset[i];
struct pipe_vertex_buffer *real_vb;
const uint8_t *ptr;
enum pipe_error err;
if (!end) {
continue;
@@ -851,11 +862,15 @@ u_vbuf_upload_buffers(struct u_vbuf *mgr,
real_vb = &mgr->real_vertex_buffer[i];
ptr = mgr->vertex_buffer[i].user_buffer;
u_upload_data(mgr->uploader, start, end - start, ptr + start,
&real_vb->buffer_offset, &real_vb->buffer);
err = u_upload_data(mgr->uploader, start, end - start, ptr + start,
&real_vb->buffer_offset, &real_vb->buffer);
if (err != PIPE_OK)
return err;
real_vb->buffer_offset -= start;
}
return PIPE_OK;
}
static boolean u_vbuf_need_minmax_index(struct u_vbuf *mgr)
@@ -1048,11 +1063,13 @@ void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct pipe_draw_info *info)
if (unroll_indices ||
mgr->incompatible_vb_mask ||
mgr->ve->incompatible_elem_mask) {
/* XXX check the return value */
u_vbuf_translate_begin(mgr, start_vertex, num_vertices,
info->start_instance, info->instance_count,
info->start, info->count, min_index,
unroll_indices);
if (!u_vbuf_translate_begin(mgr, start_vertex, num_vertices,
info->start_instance, info->instance_count,
info->start, info->count, min_index,
unroll_indices)) {
debug_warn_once("u_vbuf_translate_begin() failed");
return;
}
user_vb_mask &= ~(mgr->incompatible_vb_mask |
mgr->ve->incompatible_vb_mask_all);
@@ -1060,8 +1077,12 @@ void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct pipe_draw_info *info)
/* Upload user buffers. */
if (user_vb_mask) {
u_vbuf_upload_buffers(mgr, start_vertex, num_vertices,
info->start_instance, info->instance_count);
if (u_vbuf_upload_buffers(mgr, start_vertex, num_vertices,
info->start_instance,
info->instance_count) != PIPE_OK) {
debug_warn_once("u_vbuf_upload_buffers() failed");
return;
}
}
/*

View File

@@ -430,6 +430,7 @@ nvc0_screen_create(struct nouveau_device *dev)
chan = screen->base.channel;
push = screen->base.pushbuf;
push->user_priv = screen;
push->rsvd_kick = 5;
screen->base.vidmem_bindings |= PIPE_BIND_CONSTANT_BUFFER |
PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER;

View File

@@ -467,6 +467,7 @@ static void r300_set_blend_color(struct pipe_context* pipe,
(struct r300_blend_color_state*)r300->blend_color_state.state;
struct pipe_blend_color c;
enum pipe_format format = fb->nr_cbufs ? fb->cbufs[0]->format : 0;
float tmp;
CB_LOCALS;
state->state = *color; /* Save it, so that we can reuse it in set_fb_state */
@@ -493,6 +494,13 @@ static void r300_set_blend_color(struct pipe_context* pipe,
c.color[2] = c.color[3];
break;
case PIPE_FORMAT_R8G8B8A8_UNORM:
case PIPE_FORMAT_R8G8B8X8_UNORM:
tmp = c.color[0];
c.color[0] = c.color[2];
c.color[2] = tmp;
break;
default:;
}
}
@@ -903,6 +911,9 @@ r300_set_framebuffer_state(struct pipe_context* pipe,
/* Need to reset clamping or colormask. */
r300_mark_atom_dirty(r300, &r300->blend_state);
/* Re-swizzle the blend color. */
r300_set_blend_color(pipe, &((struct r300_blend_color_state*)r300->blend_color_state.state)->state);
/* If zsbuf is set from NULL to non-NULL or vice versa.. */
if (!!old_state->zsbuf != !!state->zsbuf) {
r300_mark_atom_dirty(r300, &r300->dsa_state);

View File

@@ -1721,6 +1721,8 @@ static void evergreen_set_framebuffer_state(struct pipe_context *ctx,
res = (struct r600_resource*)surf->base.texture;
rtex = (struct r600_texture*)res;
r600_context_add_resource_size(ctx, state->cbufs[i]->texture);
if (!surf->color_initialized) {
evergreen_init_color_surface(rctx, surf);
}
@@ -1787,6 +1789,8 @@ static void evergreen_set_framebuffer_state(struct pipe_context *ctx,
surf = (struct r600_surface*)state->zsbuf;
res = (struct r600_resource*)surf->base.texture;
r600_context_add_resource_size(ctx, state->zsbuf->texture);
if (!surf->depth_initialized) {
evergreen_init_depth_surface(rctx, surf);
}

View File

@@ -635,6 +635,16 @@ void r600_need_cs_space(struct r600_context *ctx, unsigned num_dw,
{
struct r600_atom *state;
if (!ctx->ws->cs_memory_below_limit(ctx->cs, ctx->vram, ctx->gtt)) {
ctx->gtt = 0;
ctx->vram = 0;
r600_flush(&ctx->context, NULL, RADEON_FLUSH_ASYNC);
return;
}
/* all will be accounted once relocation are emited */
ctx->gtt = 0;
ctx->vram = 0;
/* The number of dwords we already used in the CS so far. */
num_dw += ctx->cs->cdw;
@@ -953,6 +963,8 @@ void r600_context_flush(struct r600_context *ctx, unsigned flags)
ctx->pm4_dirty_cdwords = 0;
ctx->flags = 0;
ctx->gtt = 0;
ctx->vram = 0;
/* Begin a new CS. */
r600_emit_atom(ctx, &ctx->start_cs_cmd.atom);

View File

@@ -725,7 +725,7 @@ static boolean r600_fence_signalled(struct pipe_screen *pscreen,
struct r600_screen *rscreen = (struct r600_screen *)pscreen;
struct r600_fence *rfence = (struct r600_fence*)fence;
return rscreen->fences.data[rfence->index];
return rscreen->fences.data[rfence->index] != 0;
}
static boolean r600_fence_finish(struct pipe_screen *pscreen,

View File

@@ -371,6 +371,10 @@ struct r600_context {
unsigned default_ps_gprs, default_vs_gprs;
/* current unaccounted memory usage */
uint64_t vram;
uint64_t gtt;
/* States based on r600_atom. */
struct list_head dirty_states;
struct r600_command_buffer start_cs_cmd; /* invariant state mostly */
@@ -886,4 +890,28 @@ static INLINE uint64_t r600_resource_va(struct pipe_screen *screen, struct pipe_
return rscreen->ws->buffer_get_virtual_address(rresource->cs_buf);
}
static INLINE void r600_context_add_resource_size(struct pipe_context *ctx, struct pipe_resource *r)
{
struct r600_context *rctx = (struct r600_context *)ctx;
struct r600_resource *rr = (struct r600_resource *)r;
if (r == NULL) {
return;
}
/*
* The idea is to compute a gross estimate of memory requirement of
* each draw call. After each draw call, memory will be precisely
* accounted. So the uncertainty is only on the current draw call.
* In practice this gave very good estimate (+/- 10% of the target
* memory limit).
*/
if (rr->domains & RADEON_DOMAIN_GTT) {
rctx->gtt += rr->buf->size;
}
if (rr->domains & RADEON_DOMAIN_VRAM) {
rctx->vram += rr->buf->size;
}
}
#endif

View File

@@ -1615,6 +1615,8 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx,
res = (struct r600_resource*)surf->base.texture;
rtex = (struct r600_texture*)res;
r600_context_add_resource_size(ctx, state->cbufs[i]->texture);
if (!surf->color_initialized || force_cmask_fmask) {
r600_init_color_surface(rctx, surf, force_cmask_fmask);
if (force_cmask_fmask) {
@@ -1673,6 +1675,8 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx,
surf = (struct r600_surface*)state->zsbuf;
res = (struct r600_resource*)surf->base.texture;
r600_context_add_resource_size(ctx, state->zsbuf->texture);
if (!surf->depth_initialized) {
r600_init_depth_surface(rctx, surf);
}

View File

@@ -504,7 +504,8 @@ void r600_set_index_buffer(struct pipe_context *ctx,
if (ib) {
pipe_resource_reference(&rctx->index_buffer.buffer, ib->buffer);
memcpy(&rctx->index_buffer, ib, sizeof(*ib));
memcpy(&rctx->index_buffer, ib, sizeof(*ib));
r600_context_add_resource_size(ctx, ib->buffer);
} else {
pipe_resource_reference(&rctx->index_buffer.buffer, NULL);
}
@@ -549,6 +550,7 @@ void r600_set_vertex_buffers(struct pipe_context *ctx, unsigned count,
vb[i].buffer_offset = input[i].buffer_offset;
pipe_resource_reference(&vb[i].buffer, input[i].buffer);
new_buffer_mask |= 1 << i;
r600_context_add_resource_size(ctx, input[i].buffer);
} else {
pipe_resource_reference(&vb[i].buffer, NULL);
disable_mask |= 1 << i;
@@ -648,6 +650,7 @@ void r600_set_sampler_views(struct pipe_context *pipe,
pipe_sampler_view_reference((struct pipe_sampler_view **)&dst->views.views[i], views[i]);
new_mask |= 1 << i;
r600_context_add_resource_size(pipe, views[i]->texture);
} else {
pipe_sampler_view_reference((struct pipe_sampler_view **)&dst->views.views[i], NULL);
disable_mask |= 1 << i;
@@ -822,6 +825,8 @@ void r600_bind_ps_shader(struct pipe_context *ctx, void *state)
rctx->ps_shader = (struct r600_pipe_shader_selector *)state;
r600_context_pipe_state_set(rctx, &rctx->ps_shader->current->rstate);
r600_context_add_resource_size(ctx, (struct pipe_resource *)rctx->ps_shader->current->bo);
if (rctx->chip_class <= R700) {
bool multiwrite = rctx->ps_shader->current->shader.fs_write_all;
@@ -848,6 +853,8 @@ void r600_bind_vs_shader(struct pipe_context *ctx, void *state)
if (state) {
r600_context_pipe_state_set(rctx, &rctx->vs_shader->current->rstate);
r600_context_add_resource_size(ctx, (struct pipe_resource *)rctx->vs_shader->current->bo);
if (rctx->chip_class < EVERGREEN && rctx->ps_shader)
r600_adjust_gprs(rctx);
}
@@ -957,10 +964,13 @@ void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint index,
} else {
u_upload_data(rctx->uploader, 0, input->buffer_size, ptr, &cb->buffer_offset, &cb->buffer);
}
/* account it in gtt */
rctx->gtt += input->buffer_size;
} else {
/* Setup the hw buffer. */
cb->buffer_offset = input->buffer_offset;
pipe_resource_reference(&cb->buffer, input->buffer);
r600_context_add_resource_size(ctx, input->buffer);
}
state->enabled_mask |= 1 << index;
@@ -1023,6 +1033,7 @@ void r600_set_so_targets(struct pipe_context *ctx,
/* Set the new targets. */
for (i = 0; i < num_targets; i++) {
pipe_so_target_reference((struct pipe_stream_output_target**)&rctx->so_targets[i], targets[i]);
r600_context_add_resource_size(ctx, targets[i]->buffer);
}
for (; i < rctx->num_so_targets; i++) {
pipe_so_target_reference((struct pipe_stream_output_target**)&rctx->so_targets[i], NULL);

View File

@@ -66,14 +66,11 @@ exec_prepare( const struct sp_fragment_shader_variant *var,
{
/*
* Bind tokens/shader to the interpreter's machine state.
* Avoid redundant binding.
*/
if (machine->Tokens != var->tokens) {
tgsi_exec_machine_bind_shader( machine,
var->tokens,
PIPE_MAX_SAMPLERS,
samplers );
}
tgsi_exec_machine_bind_shader(machine,
var->tokens,
PIPE_MAX_SAMPLERS,
samplers);
}
@@ -180,8 +177,13 @@ exec_run( const struct sp_fragment_shader_variant *var,
static void
exec_delete( struct sp_fragment_shader_variant *var )
exec_delete(struct sp_fragment_shader_variant *var,
struct tgsi_exec_machine *machine)
{
if (machine->Tokens == var->tokens) {
tgsi_exec_machine_bind_shader(machine, NULL, 0, NULL);
}
FREE( (void *) var->tokens );
FREE(var);
}

View File

@@ -148,13 +148,6 @@ shade_quads(struct quad_stage *qs,
static void
shade_begin(struct quad_stage *qs)
{
struct softpipe_context *softpipe = qs->softpipe;
softpipe->fs_variant->prepare( softpipe->fs_variant,
softpipe->fs_machine,
(struct tgsi_sampler **)
softpipe->tgsi.samplers_list[PIPE_SHADER_FRAGMENT] );
qs->next->begin(qs->next);
}

View File

@@ -88,7 +88,8 @@ struct sp_fragment_shader_variant
struct quad_header *quad);
/* Deletes this instance of the object */
void (*delete)(struct sp_fragment_shader_variant *shader);
void (*delete)(struct sp_fragment_shader_variant *shader,
struct tgsi_exec_machine *machine);
struct sp_fragment_shader_variant *next;
};

View File

@@ -242,6 +242,12 @@ update_fragment_shader(struct softpipe_context *softpipe, unsigned prim)
if (softpipe->fs) {
softpipe->fs_variant = softpipe_find_fs_variant(softpipe,
softpipe->fs, &key);
/* prepare the TGSI interpreter for FS execution */
softpipe->fs_variant->prepare(softpipe->fs_variant,
softpipe->fs_machine,
(struct tgsi_sampler **) softpipe->
tgsi.samplers_list[PIPE_SHADER_FRAGMENT]);
}
else {
softpipe->fs_variant = NULL;

View File

@@ -38,7 +38,6 @@
#include "draw/draw_vs.h"
#include "draw/draw_gs.h"
#include "tgsi/tgsi_dump.h"
#include "tgsi/tgsi_exec.h"
#include "tgsi/tgsi_scan.h"
#include "tgsi/tgsi_parse.h"
@@ -182,13 +181,6 @@ softpipe_delete_fs_state(struct pipe_context *pipe, void *fs)
assert(fs != softpipe->fs);
if (softpipe->fs_machine->Tokens == state->shader.tokens) {
/* unbind the shader from the tgsi executor if we're
* deleting it.
*/
tgsi_exec_machine_bind_shader(softpipe->fs_machine, NULL, 0, NULL);
}
/* delete variants */
for (var = state->variants; var; var = next_var) {
next_var = var->next;
@@ -200,7 +192,7 @@ softpipe_delete_fs_state(struct pipe_context *pipe, void *fs)
draw_delete_fragment_shader(softpipe->draw, var->draw_shader);
#endif
var->delete(var);
var->delete(var, softpipe->fs_machine);
}
draw_delete_fragment_shader(softpipe->draw, state->draw_shader);

View File

@@ -2680,6 +2680,7 @@ sp_create_sampler_variant( const struct pipe_sampler_state *sampler,
case PIPE_TEX_MIPFILTER_LINEAR:
if (key.bits.is_pot &&
key.bits.target == PIPE_TEXTURE_2D &&
sampler->min_img_filter == sampler->mag_img_filter &&
sampler->normalized_coords &&
sampler->wrap_s == PIPE_TEX_WRAP_REPEAT &&

View File

@@ -98,6 +98,9 @@ svga_create_sampler_state(struct pipe_context *pipe,
struct svga_context *svga = svga_context(pipe);
struct svga_sampler_state *cso = CALLOC_STRUCT( svga_sampler_state );
if (!cso)
return NULL;
cso->mipfilter = translate_mip_filter(sampler->min_mip_filter);
cso->magfilter = translate_img_filter( sampler->mag_img_filter );
cso->minfilter = translate_img_filter( sampler->min_img_filter );

View File

@@ -23,6 +23,7 @@
*
**********************************************************/
#include "util/u_format.h"
#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "pipe/p_defines.h"
@@ -248,6 +249,16 @@ emit_rss(struct svga_context *svga, unsigned dirty)
EMIT_RS_FLOAT( svga, bias, DEPTHBIAS, fail );
}
if (dirty & SVGA_NEW_FRAME_BUFFER) {
/* XXX: we only look at the first color buffer's sRGB state */
float gamma = 1.0f;
if (svga->curr.framebuffer.cbufs[0] &&
util_format_is_srgb(svga->curr.framebuffer.cbufs[0]->format)) {
gamma = 2.2f;
}
EMIT_RS_FLOAT(svga, gamma, OUTPUTGAMMA, fail);
}
if (dirty & SVGA_NEW_RAST) {
/* bitmask of the enabled clip planes */
unsigned enabled = svga->curr.rast->templ.clip_plane_enable;

View File

@@ -687,6 +687,20 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
while (*parselist) {
if (fbConfig &&
parselist[1] == GLX_DONT_CARE &&
parselist[0] != GLX_LEVEL) {
/* For glXChooseFBConfig(), skip attributes whose value is
* GLX_DONT_CARE, unless it's GLX_LEVEL (which can legitimately be
* a negative value).
*
* From page 17 (23 of the pdf) of the GLX 1.4 spec:
* GLX DONT CARE may be specified for all attributes except GLX LEVEL.
*/
parselist += 2;
continue;
}
switch (*parselist) {
case GLX_USE_GL:
if (fbConfig) {
@@ -832,11 +846,13 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
* GLX_ARB_multisample
*/
case GLX_SAMPLE_BUFFERS_ARB:
/* ms not supported */
return NULL;
case GLX_SAMPLES_ARB:
/* ms not supported */
return NULL;
parselist++;
if (*parselist++ != 0) {
/* ms not supported */
return NULL;
}
break;
/*
* FBConfig attribs.

View File

@@ -366,6 +366,16 @@ static boolean radeon_drm_cs_validate(struct radeon_winsys_cs *rcs)
return status;
}
static boolean radeon_drm_cs_memory_below_limit(struct radeon_winsys_cs *rcs, uint64_t vram, uint64_t gtt)
{
struct radeon_drm_cs *cs = radeon_drm_cs(rcs);
boolean status =
(cs->csc->used_gart + gtt) < cs->ws->info.gart_size * 0.7 &&
(cs->csc->used_vram + vram) < cs->ws->info.vram_size * 0.7;
return status;
}
static void radeon_drm_cs_write_reloc(struct radeon_winsys_cs *rcs,
struct radeon_winsys_cs_handle *buf)
{
@@ -549,6 +559,7 @@ void radeon_drm_cs_init_functions(struct radeon_drm_winsys *ws)
ws->base.cs_destroy = radeon_drm_cs_destroy;
ws->base.cs_add_reloc = radeon_drm_cs_add_reloc;
ws->base.cs_validate = radeon_drm_cs_validate;
ws->base.cs_memory_below_limit = radeon_drm_cs_memory_below_limit;
ws->base.cs_write_reloc = radeon_drm_cs_write_reloc;
ws->base.cs_flush = radeon_drm_cs_flush;
ws->base.cs_set_flush_callback = radeon_drm_cs_set_flush;

View File

@@ -308,6 +308,16 @@ struct radeon_winsys {
*/
boolean (*cs_validate)(struct radeon_winsys_cs *cs);
/**
* Return TRUE if there is enough memory in VRAM and GTT for the relocs
* added so far.
*
* \param cs A command stream to validate.
* \param vram VRAM memory size pending to be use
* \param gtt GTT memory size pending to be use
*/
boolean (*cs_memory_below_limit)(struct radeon_winsys_cs *cs, uint64_t vram, uint64_t gtt);
/**
* Write a relocated dword to a command buffer.
*

View File

@@ -481,6 +481,7 @@ create_dumb(struct gbm_device *gbm,
bo->base.base.width = width;
bo->base.base.height = height;
bo->base.base.stride = create_arg.pitch;
bo->base.base.format = format;
bo->base.base.handle.u32 = create_arg.handle;
bo->handle = create_arg.handle;
bo->size = create_arg.size;
@@ -529,6 +530,7 @@ gbm_dri_bo_create(struct gbm_device *gbm,
bo->base.base.gbm = gbm;
bo->base.base.width = width;
bo->base.base.height = height;
bo->base.base.format = format;
switch (format) {
case GBM_FORMAT_RGB565:

View File

@@ -4039,6 +4039,12 @@ ast_uniform_block::hir(exec_list *instructions,
struct gl_uniform_block *ubo = get_next_uniform_block(state);
ubo->Name = ralloc_strdup(state->uniform_blocks, this->block_name);
if (!state->symbols->add_uniform_block(ubo)) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(&loc, state, "Uniform block name `%s' already taken in "
"the current scope.\n", ubo->Name);
}
unsigned int num_variables = 0;
foreach_list_typed(ast_declarator_list, decl_list, link, &declarations) {
foreach_list_const(node, &decl_list->declarations) {

View File

@@ -41,13 +41,15 @@ public:
ralloc_free(entry);
}
symbol_table_entry(ir_variable *v) : v(v), f(0), t(0) {}
symbol_table_entry(ir_function *f) : v(0), f(f), t(0) {}
symbol_table_entry(const glsl_type *t) : v(0), f(0), t(t) {}
symbol_table_entry(ir_variable *v) : v(v), f(0), t(0), u(0) {}
symbol_table_entry(ir_function *f) : v(0), f(f), t(0), u(0) {}
symbol_table_entry(const glsl_type *t) : v(0), f(0), t(t), u(0) {}
symbol_table_entry(struct gl_uniform_block *u) : v(0), f(0), t(0), u(u) {}
ir_variable *v;
ir_function *f;
const glsl_type *t;
struct gl_uniform_block *u;
};
glsl_symbol_table::glsl_symbol_table()
@@ -132,6 +134,12 @@ bool glsl_symbol_table::add_function(ir_function *f)
return _mesa_symbol_table_add_symbol(table, -1, f->name, entry) == 0;
}
bool glsl_symbol_table::add_uniform_block(struct gl_uniform_block *u)
{
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(u);
return _mesa_symbol_table_add_symbol(table, -1, u->Name, entry) == 0;
}
void glsl_symbol_table::add_global_function(ir_function *f)
{
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(f);

View File

@@ -98,6 +98,7 @@ public:
bool add_variable(ir_variable *v);
bool add_type(const char *name, const glsl_type *t);
bool add_function(ir_function *f);
bool add_uniform_block(struct gl_uniform_block *u);
/*@}*/
/**

View File

@@ -43,6 +43,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <X11/extensions/Xext.h>
#include <X11/extensions/extutil.h>
#include "xf86dristr.h"
#include <limits.h>
static XExtensionInfo _xf86dri_info_data;
static XExtensionInfo *xf86dri_info = &_xf86dri_info_data;
@@ -201,7 +202,11 @@ XF86DRIOpenConnection(Display * dpy, int screen, drm_handle_t * hSAREA,
}
if (rep.length) {
if (!(*busIdString = (char *) Xcalloc(rep.busIdStringLength + 1, 1))) {
if (rep.busIdStringLength < INT_MAX)
*busIdString = (char *) Xcalloc(rep.busIdStringLength + 1, 1);
else
*busIdString = NULL;
if (*busIdString == NULL) {
_XEatData(dpy, ((rep.busIdStringLength + 3) & ~3));
UnlockDisplay(dpy);
SyncHandle();
@@ -300,9 +305,11 @@ XF86DRIGetClientDriverName(Display * dpy, int screen,
*ddxDriverPatchVersion = rep.ddxDriverPatchVersion;
if (rep.length) {
if (!
(*clientDriverName =
(char *) Xcalloc(rep.clientDriverNameLength + 1, 1))) {
if (rep.clientDriverNameLength < INT_MAX)
*clientDriverName = (char *) Xcalloc(rep.clientDriverNameLength + 1, 1);
else
*clientDriverName = NULL;
if (*clientDriverName == NULL) {
_XEatData(dpy, ((rep.clientDriverNameLength + 3) & ~3));
UnlockDisplay(dpy);
SyncHandle();

View File

@@ -132,8 +132,6 @@ apple_glx_swap_buffers(void *ptr)
{
struct apple_glx_context *ac = ptr;
/* This may not be needed with CGLFlushDrawable: */
glFlush();
apple_cgl.flush_drawable(ac->context_obj);
}

View File

@@ -951,7 +951,8 @@ static const struct glx_context_vtable dri2_context_vtable = {
};
static void
dri2BindExtensions(struct dri2_screen *psc, const __DRIextension **extensions)
dri2BindExtensions(struct dri2_screen *psc, const __DRIextension **extensions,
const char *driverName)
{
int i;
@@ -960,8 +961,17 @@ dri2BindExtensions(struct dri2_screen *psc, const __DRIextension **extensions)
__glXEnableDirectExtension(&psc->base, "GLX_MESA_swap_control");
__glXEnableDirectExtension(&psc->base, "GLX_SGI_make_current_read");
/* FIXME: if DRI2 version supports it... */
__glXEnableDirectExtension(&psc->base, "GLX_INTEL_swap_event");
/*
* GLX_INTEL_swap_event is broken on the server side, where it's
* currently unconditionally enabled. This completely breaks
* systems running on drivers which don't support that extension.
* There's no way to test for its presence on this side, so instead
* of disabling it uncondtionally, just disable it for drivers
* which are known to not support it.
*/
if (strcmp(driverName, "vmwgfx") != 0) {
__glXEnableDirectExtension(&psc->base, "GLX_INTEL_swap_event");
}
if (psc->dri2->base.version >= 3) {
const unsigned mask = psc->dri2->getAPIMask(psc->driScreen);
@@ -1104,7 +1114,7 @@ dri2CreateScreen(int screen, struct glx_display * priv)
}
extensions = psc->core->getExtensions(psc->driScreen);
dri2BindExtensions(psc, extensions);
dri2BindExtensions(psc, extensions, driverName);
configs = driConvertConfigs(psc->core, psc->base.configs, driver_configs);
visuals = driConvertConfigs(psc->core, psc->base.visuals, driver_configs);

View File

@@ -865,7 +865,6 @@ driCreateScreen(int screen, struct glx_display *priv)
}
psc->driver = driOpenDriver(driverName);
Xfree(driverName);
if (psc->driver == NULL)
goto cleanup;
@@ -913,11 +912,15 @@ driCreateScreen(int screen, struct glx_display *priv)
psp->setSwapInterval = driSetSwapInterval;
psp->getSwapInterval = driGetSwapInterval;
free(driverName);
return &psc->base;
cleanup:
CriticalErrorMessageF("failed to load driver: %s\n", driverName);
free(driverName);
if (psc->driver)
dlclose(psc->driver);
glx_screen_cleanup(&psc->base);

View File

@@ -133,6 +133,7 @@ struct save_state
struct gl_vertex_program *VertexProgram;
GLboolean FragmentProgramEnabled;
struct gl_fragment_program *FragmentProgram;
GLboolean ATIFragmentShaderEnabled;
struct gl_shader_program *VertexShader;
struct gl_shader_program *GeometryShader;
struct gl_shader_program *FragmentShader;
@@ -626,6 +627,11 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
_mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB, GL_FALSE);
}
if (ctx->API == API_OPENGL && ctx->Extensions.ATI_fragment_shader) {
save->ATIFragmentShaderEnabled = ctx->ATIFragmentShader.Enabled;
_mesa_set_enable(ctx, GL_FRAGMENT_SHADER_ATI, GL_FALSE);
}
if (ctx->Extensions.ARB_shader_objects) {
_mesa_reference_shader_program(ctx, &save->VertexShader,
ctx->Shader.CurrentVertexProgram);
@@ -942,6 +948,11 @@ _mesa_meta_end(struct gl_context *ctx)
_mesa_reference_fragprog(ctx, &save->FragmentProgram, NULL);
}
if (ctx->API == API_OPENGL && ctx->Extensions.ATI_fragment_shader) {
_mesa_set_enable(ctx, GL_FRAGMENT_SHADER_ATI,
save->ATIFragmentShaderEnabled);
}
if (ctx->Extensions.ARB_vertex_shader)
_mesa_use_shader_program(ctx, GL_VERTEX_SHADER, save->VertexShader);
@@ -3745,6 +3756,7 @@ decompress_texture_image(struct gl_context *ctx,
/* read pixels from renderbuffer */
{
GLenum baseTexFormat = texImage->_BaseFormat;
GLenum destBaseFormat = _mesa_base_tex_format(ctx, destFormat);
/* The pixel transfer state will be set to default values at this point
* (see MESA_META_PIXEL_TRANSFER) so pixel transfer ops are effectively
@@ -3753,9 +3765,19 @@ decompress_texture_image(struct gl_context *ctx,
* returned as red and two-channel texture values are returned as
* red/alpha.
*/
if (baseTexFormat == GL_LUMINANCE ||
baseTexFormat == GL_LUMINANCE_ALPHA ||
baseTexFormat == GL_INTENSITY) {
if ((baseTexFormat == GL_LUMINANCE ||
baseTexFormat == GL_LUMINANCE_ALPHA ||
baseTexFormat == GL_INTENSITY) ||
/* If we're reading back an RGB(A) texture (using glGetTexImage) as
* luminance then we need to return L=tex(R).
*/
((baseTexFormat == GL_RGBA ||
baseTexFormat == GL_RGB ||
baseTexFormat == GL_RG) &&
(destBaseFormat == GL_LUMINANCE ||
destBaseFormat == GL_LUMINANCE_ALPHA ||
destBaseFormat == GL_LUMINANCE_INTEGER_EXT ||
destBaseFormat == GL_LUMINANCE_ALPHA_INTEGER_EXT))) {
/* Green and blue must be zero */
_mesa_PixelTransferf(GL_GREEN_SCALE, 0.0f);
_mesa_PixelTransferf(GL_BLUE_SCALE, 0.0f);

View File

@@ -290,7 +290,23 @@ brwCreateContext(int api,
}
/* WM maximum threads is number of EUs times number of threads per EU. */
if (intel->gen >= 7) {
assert(intel->gen <= 7);
if (intel->is_haswell) {
if (intel->gt == 1) {
brw->max_wm_threads = 102;
brw->max_vs_threads = 70;
brw->urb.size = 128;
brw->urb.max_vs_entries = 640;
brw->urb.max_gs_entries = 256;
} else if (intel->gt == 2) {
brw->max_wm_threads = 204;
brw->max_vs_threads = 280;
brw->urb.size = 256;
brw->urb.max_vs_entries = 1664;
brw->urb.max_gs_entries = 640;
}
} else if (intel->gen == 7) {
if (intel->gt == 1) {
brw->max_wm_threads = 48;
brw->max_vs_threads = 36;

View File

@@ -838,6 +838,7 @@ enum brw_message_target {
#define GEN5_SAMPLER_MESSAGE_SAMPLE_LOD_COMPARE 6
#define GEN5_SAMPLER_MESSAGE_SAMPLE_LD 7
#define GEN5_SAMPLER_MESSAGE_SAMPLE_RESINFO 10
#define HSW_SAMPLER_MESSAGE_SAMPLE_DERIV_COMPARE 20
#define GEN7_SAMPLER_MESSAGE_SAMPLE_LD_MCS 29
#define GEN7_SAMPLER_MESSAGE_SAMPLE_LD2DMS 30
#define GEN7_SAMPLER_MESSAGE_SAMPLE_LD2DSS 31
@@ -1037,6 +1038,9 @@ enum brw_message_target {
# define GEN6_URB_GS_ENTRIES_SHIFT 8
# define GEN6_URB_GS_SIZE_SHIFT 0
#define _3DSTATE_VF 0x780c /* GEN7.5+ */
#define HSW_CUT_INDEX_ENABLE (1 << 8)
#define _3DSTATE_URB_VS 0x7830 /* GEN7+ */
#define _3DSTATE_URB_HS 0x7831 /* GEN7+ */
#define _3DSTATE_URB_DS 0x7832 /* GEN7+ */

View File

@@ -539,7 +539,9 @@ static int dest (FILE *file, struct brw_instruction *inst)
if (inst->bits1.da1.dest_subreg_nr)
format (file, ".%d", inst->bits1.da1.dest_subreg_nr /
reg_type_size[inst->bits1.da1.dest_reg_type]);
format (file, "<%d>", inst->bits1.da1.dest_horiz_stride);
string (file, "<");
err |= control (file, "horiz stride", horiz_stride, inst->bits1.da1.dest_horiz_stride, NULL);
string (file, ">");
err |= control (file, "dest reg encoding", reg_encoding, inst->bits1.da1.dest_reg_type, NULL);
}
else
@@ -550,8 +552,9 @@ static int dest (FILE *file, struct brw_instruction *inst)
reg_type_size[inst->bits1.ia1.dest_reg_type]);
if (inst->bits1.ia1.dest_indirect_offset)
format (file, " %d", inst->bits1.ia1.dest_indirect_offset);
string (file, "]");
format (file, "<%d>", inst->bits1.ia1.dest_horiz_stride);
string (file, "]<");
err |= control (file, "horiz stride", horiz_stride, inst->bits1.ia1.dest_horiz_stride, NULL);
string (file, ">");
err |= control (file, "dest reg encoding", reg_encoding, inst->bits1.ia1.dest_reg_type, NULL);
}
}

View File

@@ -882,7 +882,7 @@ static void brw_emit_index_buffer(struct brw_context *brw)
if (index_buffer == NULL)
return;
if (brw->prim_restart.enable_cut_index) {
if (brw->prim_restart.enable_cut_index && !intel->is_haswell) {
cut_index_setting = BRW_CUT_INDEX_ENABLE;
} else {
cut_index_setting = 0;

View File

@@ -312,8 +312,13 @@ fs_visitor::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src)
msg_type = GEN5_SAMPLER_MESSAGE_SAMPLE_RESINFO;
break;
case SHADER_OPCODE_TXD:
/* There is no sample_d_c message; comparisons are done manually */
msg_type = GEN5_SAMPLER_MESSAGE_SAMPLE_DERIVS;
if (inst->shadow_compare) {
/* Gen7.5+. Otherwise, lowered by brw_lower_texture_gradients(). */
assert(intel->is_haswell);
msg_type = HSW_SAMPLER_MESSAGE_SAMPLE_DERIV_COMPARE;
} else {
msg_type = GEN5_SAMPLER_MESSAGE_SAMPLE_DERIVS;
}
break;
case SHADER_OPCODE_TXF:
msg_type = GEN5_SAMPLER_MESSAGE_SAMPLE_LD;

View File

@@ -201,6 +201,7 @@ fs_visitor::try_emit_saturate(ir_expression *ir)
*/
fs_inst *modify = get_instruction_generating_reg(pre_inst, last_inst, src);
if (!modify || modify->regs_written() != 1) {
this->result = fs_reg(this, ir->type);
fs_inst *inst = emit(BRW_OPCODE_MOV, this->result, src);
inst->saturate = true;
} else {
@@ -1609,28 +1610,14 @@ fs_visitor::emit_if_gen6(ir_if *ir)
switch (expr->operation) {
case ir_unop_logic_not:
inst = emit(BRW_OPCODE_IF, temp, op[0], fs_reg(0));
inst->conditional_mod = BRW_CONDITIONAL_Z;
return;
case ir_binop_logic_xor:
inst = emit(BRW_OPCODE_IF, reg_null_d, op[0], op[1]);
inst->conditional_mod = BRW_CONDITIONAL_NZ;
return;
case ir_binop_logic_or:
temp = fs_reg(this, glsl_type::bool_type);
emit(BRW_OPCODE_OR, temp, op[0], op[1]);
inst = emit(BRW_OPCODE_IF, reg_null_d, temp, fs_reg(0));
inst->conditional_mod = BRW_CONDITIONAL_NZ;
return;
case ir_binop_logic_and:
temp = fs_reg(this, glsl_type::bool_type);
emit(BRW_OPCODE_AND, temp, op[0], op[1]);
inst = emit(BRW_OPCODE_IF, reg_null_d, temp, fs_reg(0));
inst->conditional_mod = BRW_CONDITIONAL_NZ;
return;
/* For operations on bool arguments, only the low bit of the bool is
* valid, and the others are undefined. Fall back to the condition
* code path.
*/
break;
case ir_unop_f2b:
inst = emit(BRW_OPCODE_IF, reg_null_f, op[0], fs_reg(0));
@@ -1650,6 +1637,9 @@ fs_visitor::emit_if_gen6(ir_if *ir)
case ir_binop_all_equal:
case ir_binop_nequal:
case ir_binop_any_nequal:
resolve_bool_comparison(expr->operands[0], &op[0]);
resolve_bool_comparison(expr->operands[1], &op[1]);
inst = emit(BRW_OPCODE_IF, reg_null_d, op[0], op[1]);
inst->conditional_mod =
brw_conditional_for_comparison(expr->operation);
@@ -1661,13 +1651,11 @@ fs_visitor::emit_if_gen6(ir_if *ir)
fail("bad condition\n");
return;
}
return;
}
ir->condition->accept(this);
fs_inst *inst = emit(BRW_OPCODE_IF, reg_null_d, this->result, fs_reg(0));
inst->conditional_mod = BRW_CONDITIONAL_NZ;
emit_bool_to_cond_code(ir->condition);
fs_inst *inst = emit(BRW_OPCODE_IF);
inst->predicated = true;
}
void

View File

@@ -27,6 +27,7 @@
#include "glsl/ir.h"
#include "glsl/ir_builder.h"
#include "program/prog_instruction.h"
using namespace ir_builder;
@@ -89,10 +90,6 @@ lower_texture_grad_visitor::visit_leave(ir_texture *ir)
if (ir->op != ir_txd || !ir->shadow_comparitor)
return visit_continue;
/* Cubes are broken. Avoid assertion failures when swizzling. */
if (ir->sampler->type->sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE)
return visit_continue;
void *mem_ctx = ralloc_parent(ir);
const glsl_type *grad_type = ir->lod_info.grad.dPdx->type;
@@ -106,8 +103,14 @@ lower_texture_grad_visitor::visit_leave(ir_texture *ir)
txs->lod_info.lod = new(mem_ctx) ir_constant(0);
ir_variable *size =
new(mem_ctx) ir_variable(grad_type, "size", ir_var_temporary);
emit(size, expr(ir_unop_i2f,
swizzle_for_size(txs, grad_type->vector_elements)));
if (ir->sampler->type->sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE) {
base_ir->insert_before(size);
base_ir->insert_before(assign(size, expr(ir_unop_i2f, txs), WRITEMASK_XY));
base_ir->insert_before(assign(size, new(mem_ctx) ir_constant(1.0f), WRITEMASK_Z));
} else {
emit(size, expr(ir_unop_i2f,
swizzle_for_size(txs, grad_type->vector_elements)));
}
/* Scale the gradients by width and height. Effectively, the incoming
* gradients are s'(x,y), t'(x,y), and r'(x,y) from equation 3.19 in the

View File

@@ -29,8 +29,11 @@
#include "main/bufferobj.h"
#include "brw_context.h"
#include "brw_defines.h"
#include "brw_draw.h"
#include "intel_batchbuffer.h"
/**
* Check if the hardware's cut index support can handle the primitive
* restart index value.
@@ -39,6 +42,12 @@ static bool
can_cut_index_handle_restart_index(struct gl_context *ctx,
const struct _mesa_index_buffer *ib)
{
struct intel_context *intel = intel_context(ctx);
/* Haswell supports an arbitrary cut index. */
if (intel->is_haswell)
return true;
bool cut_index_will_work;
switch (ib->type) {
@@ -176,3 +185,30 @@ brw_handle_primitive_restart(struct gl_context *ctx,
return GL_TRUE;
}
static void
haswell_upload_cut_index(struct brw_context *brw)
{
struct intel_context *intel = &brw->intel;
struct gl_context *ctx = &intel->ctx;
/* Don't trigger on Ivybridge */
if (!intel->is_haswell)
return;
const unsigned cut_index_setting =
ctx->Array.PrimitiveRestart ? HSW_CUT_INDEX_ENABLE : 0;
BEGIN_BATCH(2);
OUT_BATCH(_3DSTATE_VF << 16 | cut_index_setting | (2 - 2));
OUT_BATCH(ctx->Array.RestartIndex);
ADVANCE_BATCH();
}
const struct brw_tracked_state haswell_cut_index = {
.dirty = {
.mesa = _NEW_TRANSFORM,
.brw = 0,
.cache = 0,
},
.emit = haswell_upload_cut_index,
};

View File

@@ -225,9 +225,30 @@ brwProgramStringNotify(struct gl_context *ctx,
}
}
brw_add_texrect_params(prog);
return true;
}
void
brw_add_texrect_params(struct gl_program *prog)
{
for (int texunit = 0; texunit < BRW_MAX_TEX_UNIT; texunit++) {
if (!(prog->TexturesUsed[texunit] & (1 << TEXTURE_RECT_INDEX)))
continue;
int tokens[STATE_LENGTH] = {
STATE_INTERNAL,
STATE_TEXRECT_SCALE,
texunit,
0,
0
};
_mesa_add_state_reference(prog->Parameters, (gl_state_index *)tokens);
}
}
/* Per-thread scratch space is a power-of-two multiple of 1KB. */
int
brw_get_scratch_size(int size)

View File

@@ -47,5 +47,6 @@ void brw_populate_sampler_prog_key_data(struct gl_context *ctx,
struct brw_sampler_prog_key_data *key);
bool brw_debug_recompile_sampler_key(const struct brw_sampler_prog_key_data *old_key,
const struct brw_sampler_prog_key_data *key);
void brw_add_texrect_params(struct gl_program *prog);
#endif

View File

@@ -191,6 +191,16 @@ brw_queryobj_get_results(struct gl_context *ctx,
}
break;
case GL_ANY_SAMPLES_PASSED:
/* Set true if any of the sub-queries passed. */
for (i = query->first_index; i <= query->last_index; i++) {
if (results[i * 2 + 1] != results[i * 2]) {
query->Base.Result = GL_TRUE;
break;
}
}
break;
case GL_PRIMITIVES_GENERATED:
case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
/* We don't actually query the hardware for this value, so query->bo
@@ -247,6 +257,7 @@ brw_begin_query(struct gl_context *ctx, struct gl_query_object *q)
write_timestamp(intel, query->bo, 0);
break;
case GL_ANY_SAMPLES_PASSED:
case GL_SAMPLES_PASSED_ARB:
/* Reset our driver's tracking of query state. */
drm_intel_bo_unreference(query->bo);
@@ -302,6 +313,7 @@ brw_end_query(struct gl_context *ctx, struct gl_query_object *q)
intel_batchbuffer_flush(intel);
break;
case GL_ANY_SAMPLES_PASSED:
case GL_SAMPLES_PASSED_ARB:
/* Flush the batchbuffer in case it has writes to our query BO.
* Have later queries write to a new query BO so that further rendering

View File

@@ -132,7 +132,8 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
lower_if_to_cond_assign(shader->ir, 16);
do_lower_texture_projection(shader->ir);
brw_lower_texture_gradients(shader->ir);
if (intel->gen < 8 && !intel->is_haswell)
brw_lower_texture_gradients(shader->ir);
do_vec_index_to_cond_assign(shader->ir);
brw_do_cubemap_normalize(shader->ir);
lower_noise(shader->ir);
@@ -203,6 +204,8 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
_mesa_reference_program(ctx, &shader->base.Program, prog);
brw_add_texrect_params(prog);
/* This has to be done last. Any operation that can cause
* prog->ParameterValues to get reallocated (e.g., anything that adds a
* program constant) has to happen before creating this linkage.

View File

@@ -133,6 +133,7 @@ extern const struct brw_tracked_state gen7_wm_constants;
extern const struct brw_tracked_state gen7_wm_constant_surface;
extern const struct brw_tracked_state gen7_wm_state;
extern const struct brw_tracked_state gen7_wm_surfaces;
extern const struct brw_tracked_state haswell_cut_index;
/* brw_misc_state.c */
uint32_t
@@ -201,6 +202,8 @@ GLuint translate_tex_format(gl_format mesa_format,
GLenum depth_mode,
GLenum srgb_decode);
int brw_get_texture_swizzle(const struct gl_texture_object *t);
/* gen7_wm_surface_state.c */
void gen7_set_surface_tiling(struct gen7_surface_state *surf, uint32_t tiling);
void gen7_set_surface_msaa(struct gen7_surface_state *surf,
@@ -229,7 +232,7 @@ void upload_default_color(struct brw_context *brw,
/* gen6_sf_state.c */
uint32_t
get_attr_override(struct brw_vue_map *vue_map, int urb_entry_read_offset,
int fs_attr, bool two_side_color);
int fs_attr, bool two_side_color, uint32_t *max_source_attr);
#ifdef __cplusplus
}

View File

@@ -246,6 +246,8 @@ const struct brw_tracked_state *gen7_atoms[] =
&brw_indices,
&brw_index_buffer,
&brw_vertices,
&haswell_cut_index,
};

View File

@@ -312,8 +312,8 @@ public:
int setup_attributes(int payload_reg);
int setup_uniforms(int payload_reg);
void setup_payload();
void reg_allocate_trivial();
void reg_allocate();
bool reg_allocate_trivial();
bool reg_allocate();
void evaluate_spill_costs(float *spill_costs, bool *no_spill);
int choose_spill_reg(struct ra_graph *g);
void spill_reg(int spill_reg);

View File

@@ -381,8 +381,13 @@ vec4_visitor::generate_tex(vec4_instruction *inst,
}
break;
case SHADER_OPCODE_TXD:
/* There is no sample_d_c message; comparisons are done manually. */
msg_type = GEN5_SAMPLER_MESSAGE_SAMPLE_DERIVS;
if (inst->shadow_compare) {
/* Gen7.5+. Otherwise, lowered by brw_lower_texture_gradients(). */
assert(intel->is_haswell);
msg_type = HSW_SAMPLER_MESSAGE_SAMPLE_DERIV_COMPARE;
} else {
msg_type = GEN5_SAMPLER_MESSAGE_SAMPLE_DERIVS;
}
break;
case SHADER_OPCODE_TXF:
msg_type = GEN5_SAMPLER_MESSAGE_SAMPLE_LD;
@@ -824,7 +829,10 @@ vec4_visitor::run()
}
}
reg_allocate();
while (!reg_allocate()) {
if (failed)
break;
}
if (failed)
return false;

View File

@@ -41,7 +41,7 @@ assign(unsigned int *reg_hw_locations, reg *reg)
}
}
void
bool
vec4_visitor::reg_allocate_trivial()
{
unsigned int hw_reg_mapping[this->virtual_grf_count];
@@ -90,7 +90,10 @@ vec4_visitor::reg_allocate_trivial()
if (prog_data->total_grf > max_grf) {
fail("Ran out of regs on trivial allocator (%d/%d)\n",
prog_data->total_grf, max_grf);
return false;
}
return true;
}
static void
@@ -139,7 +142,7 @@ brw_alloc_reg_set_for_classes(struct brw_context *brw,
ra_set_finalize(brw->vs.regs);
}
void
bool
vec4_visitor::reg_allocate()
{
unsigned int hw_reg_mapping[virtual_grf_count];
@@ -151,10 +154,8 @@ vec4_visitor::reg_allocate()
/* Using the trivial allocator can be useful in debugging undefined
* register access as a result of broken optimization passes.
*/
if (0) {
reg_allocate_trivial();
return;
}
if (0)
return reg_allocate_trivial();
calculate_live_intervals();
@@ -213,7 +214,7 @@ vec4_visitor::reg_allocate()
spill_reg(reg);
}
ralloc_free(g);
return;
return false;
}
/* Get the chosen virtual registers for each node, and map virtual
@@ -239,6 +240,8 @@ vec4_visitor::reg_allocate()
}
ralloc_free(g);
return true;
}
void

View File

@@ -1853,13 +1853,19 @@ vec4_visitor::visit(ir_texture *ir)
shadow_comparitor = this->result;
}
const glsl_type *lod_type;
src_reg lod, dPdx, dPdy;
switch (ir->op) {
case ir_tex:
lod = src_reg(0.0f);
lod_type = glsl_type::float_type;
break;
case ir_txf:
case ir_txl:
case ir_txs:
ir->lod_info.lod->accept(this);
lod = this->result;
lod_type = ir->lod_info.lod->type;
break;
case ir_txd:
ir->lod_info.grad.dPdx->accept(this);
@@ -1867,8 +1873,9 @@ vec4_visitor::visit(ir_texture *ir)
ir->lod_info.grad.dPdy->accept(this);
dPdy = this->result;
lod_type = ir->lod_info.grad.dPdx->type;
break;
case ir_tex:
case ir_txb:
break;
}
@@ -1898,6 +1905,7 @@ vec4_visitor::visit(ir_texture *ir)
inst->mlen = inst->header_present + 1; /* always at least one */
inst->sampler = sampler;
inst->dst = dst_reg(this, ir->type);
inst->dst.writemask = WRITEMASK_XYZW;
inst->shadow_compare = ir->shadow_comparitor != NULL;
if (ir->offset != NULL && ir->op != ir_txf)
@@ -1908,8 +1916,7 @@ vec4_visitor::visit(ir_texture *ir)
if (ir->op == ir_txs) {
int writemask = intel->gen == 4 ? WRITEMASK_W : WRITEMASK_X;
emit(MOV(dst_reg(MRF, param_base, ir->lod_info.lod->type, writemask),
lod));
emit(MOV(dst_reg(MRF, param_base, lod_type, writemask), lod));
} else {
int i, coord_mask = 0, zero_mask = 0;
/* Load the coordinate */
@@ -1952,7 +1959,7 @@ vec4_visitor::visit(ir_texture *ir)
}
/* Load the LOD info */
if (ir->op == ir_txl) {
if (ir->op == ir_tex || ir->op == ir_txl) {
int mrf, writemask;
if (intel->gen >= 5) {
mrf = param_base + 1;
@@ -1967,12 +1974,12 @@ vec4_visitor::visit(ir_texture *ir)
mrf = param_base;
writemask = WRITEMASK_Z;
}
emit(MOV(dst_reg(MRF, mrf, ir->lod_info.lod->type, writemask), lod));
emit(MOV(dst_reg(MRF, mrf, lod_type, writemask), lod));
} else if (ir->op == ir_txf) {
emit(MOV(dst_reg(MRF, param_base, ir->lod_info.lod->type, WRITEMASK_W),
emit(MOV(dst_reg(MRF, param_base, lod_type, WRITEMASK_W),
lod));
} else if (ir->op == ir_txd) {
const glsl_type *type = ir->lod_info.grad.dPdx->type;
const glsl_type *type = lod_type;
if (intel->gen >= 5) {
dPdx.swizzle = BRW_SWIZZLE4(SWIZZLE_X,SWIZZLE_X,SWIZZLE_Y,SWIZZLE_Y);
@@ -2004,13 +2011,16 @@ vec4_visitor::visit(ir_texture *ir)
void
vec4_visitor::swizzle_result(ir_texture *ir, src_reg orig_val, int sampler)
{
this->result = orig_val;
int s = c->key.tex.swizzles[sampler];
this->result = src_reg(this, ir->type);
dst_reg swizzled_result(this->result);
if (ir->op == ir_txs || ir->type == glsl_type::float_type
|| s == SWIZZLE_NOOP)
|| s == SWIZZLE_NOOP) {
emit(MOV(swizzled_result, orig_val));
return;
}
int zero_mask = 0, one_mask = 0, copy_mask = 0;
int swizzle[4];
@@ -2030,9 +2040,6 @@ vec4_visitor::swizzle_result(ir_texture *ir, src_reg orig_val, int sampler)
}
}
this->result = src_reg(this, ir->type);
dst_reg swizzled_result(this->result);
if (copy_mask) {
orig_val.swizzle = BRW_SWIZZLE4(swizzle[0], swizzle[1], swizzle[2], swizzle[3]);
swizzled_result.writemask = copy_mask;

View File

@@ -436,6 +436,8 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx,
const struct gl_program *prog,
struct brw_sampler_prog_key_data *key)
{
struct intel_context *intel = intel_context(ctx);
for (int s = 0; s < MAX_SAMPLERS; s++) {
key->swizzles[s] = SWIZZLE_NOOP;
@@ -449,49 +451,16 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx,
const struct gl_texture_object *t = unit->_Current;
const struct gl_texture_image *img = t->Image[0][t->BaseLevel];
struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, unit_id);
int swizzles[SWIZZLE_NIL + 1] = {
SWIZZLE_X,
SWIZZLE_Y,
SWIZZLE_Z,
SWIZZLE_W,
SWIZZLE_ZERO,
SWIZZLE_ONE,
SWIZZLE_NIL
};
if (img->_BaseFormat == GL_DEPTH_COMPONENT ||
img->_BaseFormat == GL_DEPTH_STENCIL) {
/* We handle GL_DEPTH_TEXTURE_MODE here instead of as surface
* format overrides because shadow comparison always returns the
* result of the comparison in all channels anyway.
*/
switch (t->DepthMode) {
case GL_ALPHA:
swizzles[0] = SWIZZLE_ZERO;
swizzles[1] = SWIZZLE_ZERO;
swizzles[2] = SWIZZLE_ZERO;
swizzles[3] = SWIZZLE_X;
break;
case GL_LUMINANCE:
swizzles[0] = SWIZZLE_X;
swizzles[1] = SWIZZLE_X;
swizzles[2] = SWIZZLE_X;
swizzles[3] = SWIZZLE_ONE;
break;
case GL_INTENSITY:
swizzles[0] = SWIZZLE_X;
swizzles[1] = SWIZZLE_X;
swizzles[2] = SWIZZLE_X;
swizzles[3] = SWIZZLE_X;
break;
case GL_RED:
swizzles[0] = SWIZZLE_X;
swizzles[1] = SWIZZLE_ZERO;
swizzles[2] = SWIZZLE_ZERO;
swizzles[3] = SWIZZLE_ONE;
break;
}
}
const bool alpha_depth = t->DepthMode == GL_ALPHA &&
(img->_BaseFormat == GL_DEPTH_COMPONENT ||
img->_BaseFormat == GL_DEPTH_STENCIL);
/* Haswell handles texture swizzling as surface format overrides
* (except for GL_ALPHA); all other platforms need MOVs in the shader.
*/
if (!intel->is_haswell || alpha_depth)
key->swizzles[s] = brw_get_texture_swizzle(t);
if (img->InternalFormat == GL_YCBCR_MESA) {
key->yuvtex_mask |= 1 << s;
@@ -499,12 +468,6 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx,
key->yuvtex_swap_mask |= 1 << s;
}
key->swizzles[s] =
MAKE_SWIZZLE4(swizzles[GET_SWZ(t->_Swizzle, 0)],
swizzles[GET_SWZ(t->_Swizzle, 1)],
swizzles[GET_SWZ(t->_Swizzle, 2)],
swizzles[GET_SWZ(t->_Swizzle, 3)]);
if (sampler->MinFilter != GL_NEAREST &&
sampler->MagFilter != GL_NEAREST) {
if (sampler->WrapS == GL_CLAMP)

View File

@@ -653,6 +653,62 @@ brw_get_surface_num_multisamples(unsigned num_samples)
}
/**
* Compute the combination of DEPTH_TEXTURE_MODE and EXT_texture_swizzle
* swizzling.
*/
int
brw_get_texture_swizzle(const struct gl_texture_object *t)
{
const struct gl_texture_image *img = t->Image[0][t->BaseLevel];
int swizzles[SWIZZLE_NIL + 1] = {
SWIZZLE_X,
SWIZZLE_Y,
SWIZZLE_Z,
SWIZZLE_W,
SWIZZLE_ZERO,
SWIZZLE_ONE,
SWIZZLE_NIL
};
if (img->_BaseFormat == GL_DEPTH_COMPONENT ||
img->_BaseFormat == GL_DEPTH_STENCIL) {
switch (t->DepthMode) {
case GL_ALPHA:
swizzles[0] = SWIZZLE_ZERO;
swizzles[1] = SWIZZLE_ZERO;
swizzles[2] = SWIZZLE_ZERO;
swizzles[3] = SWIZZLE_X;
break;
case GL_LUMINANCE:
swizzles[0] = SWIZZLE_X;
swizzles[1] = SWIZZLE_X;
swizzles[2] = SWIZZLE_X;
swizzles[3] = SWIZZLE_ONE;
break;
case GL_INTENSITY:
swizzles[0] = SWIZZLE_X;
swizzles[1] = SWIZZLE_X;
swizzles[2] = SWIZZLE_X;
swizzles[3] = SWIZZLE_X;
break;
case GL_RED:
swizzles[0] = SWIZZLE_X;
swizzles[1] = SWIZZLE_ZERO;
swizzles[2] = SWIZZLE_ZERO;
swizzles[3] = SWIZZLE_ONE;
break;
}
}
return MAKE_SWIZZLE4(swizzles[GET_SWZ(t->_Swizzle, 0)],
swizzles[GET_SWZ(t->_Swizzle, 1)],
swizzles[GET_SWZ(t->_Swizzle, 2)],
swizzles[GET_SWZ(t->_Swizzle, 3)]);
}
static void
brw_update_buffer_texture_surface(struct gl_context *ctx,
unsigned unit,

View File

@@ -54,9 +54,8 @@
*/
uint32_t
get_attr_override(struct brw_vue_map *vue_map, int urb_entry_read_offset,
int fs_attr, bool two_side_color)
int fs_attr, bool two_side_color, uint32_t *max_source_attr)
{
int attr_override, slot;
int vs_attr = _mesa_frag_attrib_to_vert_result(fs_attr);
if (vs_attr < 0 || vs_attr == VERT_RESULT_HPOS) {
/* These attributes will be overwritten by the fragment shader's
@@ -67,7 +66,7 @@ get_attr_override(struct brw_vue_map *vue_map, int urb_entry_read_offset,
}
/* Find the VUE slot for this attribute. */
slot = vue_map->vert_result_to_slot[vs_attr];
int slot = vue_map->vert_result_to_slot[vs_attr];
/* If there was only a back color written but not front, use back
* as the color instead of undefined
@@ -89,23 +88,29 @@ get_attr_override(struct brw_vue_map *vue_map, int urb_entry_read_offset,
* Each increment of urb_entry_read_offset represents a 256-bit value, so
* it counts for two 128-bit VUE slots.
*/
attr_override = slot - 2 * urb_entry_read_offset;
assert (attr_override >= 0 && attr_override < 32);
int source_attr = slot - 2 * urb_entry_read_offset;
assert(source_attr >= 0 && source_attr < 32);
/* If we are doing two-sided color, and the VUE slot following this one
* represents a back-facing color, then we need to instruct the SF unit to
* do back-facing swizzling.
*/
if (two_side_color) {
if (vue_map->slot_to_vert_result[slot] == VERT_RESULT_COL0 &&
vue_map->slot_to_vert_result[slot+1] == VERT_RESULT_BFC0)
attr_override |= (ATTRIBUTE_SWIZZLE_INPUTATTR_FACING << ATTRIBUTE_SWIZZLE_SHIFT);
else if (vue_map->slot_to_vert_result[slot] == VERT_RESULT_COL1 &&
vue_map->slot_to_vert_result[slot+1] == VERT_RESULT_BFC1)
attr_override |= (ATTRIBUTE_SWIZZLE_INPUTATTR_FACING << ATTRIBUTE_SWIZZLE_SHIFT);
bool swizzling = two_side_color &&
((vue_map->slot_to_vert_result[slot] == VERT_RESULT_COL0 &&
vue_map->slot_to_vert_result[slot+1] == VERT_RESULT_BFC0) ||
(vue_map->slot_to_vert_result[slot] == VERT_RESULT_COL1 &&
vue_map->slot_to_vert_result[slot+1] == VERT_RESULT_BFC1));
/* Update max_source_attr. If swizzling, the SF will read this slot + 1. */
if (*max_source_attr < source_attr + swizzling)
*max_source_attr = source_attr + swizzling;
if (swizzling) {
return source_attr |
(ATTRIBUTE_SWIZZLE_INPUTATTR_FACING << ATTRIBUTE_SWIZZLE_SHIFT);
}
return attr_override;
return source_attr;
}
static void
@@ -113,7 +118,6 @@ upload_sf_state(struct brw_context *brw)
{
struct intel_context *intel = &brw->intel;
struct gl_context *ctx = &intel->ctx;
uint32_t urb_entry_read_length;
/* BRW_NEW_FRAGMENT_PROGRAM */
uint32_t num_outputs = _mesa_bitcount_64(brw->fragment_program->Base.InputsRead);
/* _NEW_LIGHT */
@@ -130,21 +134,7 @@ upload_sf_state(struct brw_context *brw)
uint16_t attr_overrides[FRAG_ATTRIB_MAX];
uint32_t point_sprite_origin;
/* CACHE_NEW_VS_PROG */
urb_entry_read_length = ((brw->vs.prog_data->vue_map.num_slots + 1) / 2 -
urb_entry_read_offset);
if (urb_entry_read_length == 0) {
/* Setting the URB entry read length to 0 causes undefined behavior, so
* if we have no URB data to read, set it to 1.
*/
urb_entry_read_length = 1;
}
dw1 =
GEN6_SF_SWIZZLE_ENABLE |
num_outputs << GEN6_SF_NUM_OUTPUTS_SHIFT |
urb_entry_read_length << GEN6_SF_URB_ENTRY_READ_LENGTH_SHIFT |
urb_entry_read_offset << GEN6_SF_URB_ENTRY_READ_OFFSET_SHIFT;
dw1 = GEN6_SF_SWIZZLE_ENABLE | num_outputs << GEN6_SF_NUM_OUTPUTS_SHIFT;
dw2 = GEN6_SF_STATISTICS_ENABLE |
GEN6_SF_VIEWPORT_TRANSFORM_ENABLE;
@@ -280,6 +270,7 @@ upload_sf_state(struct brw_context *brw)
/* Create the mapping from the FS inputs we produce to the VS outputs
* they source from.
*/
uint32_t max_source_attr = 0;
for (; attr < FRAG_ATTRIB_MAX; attr++) {
enum glsl_interp_qualifier interp_qualifier =
brw->fragment_program->InterpQualifier[attr];
@@ -315,12 +306,30 @@ upload_sf_state(struct brw_context *brw)
attr_overrides[input_index++] =
get_attr_override(&brw->vs.prog_data->vue_map,
urb_entry_read_offset, attr,
ctx->VertexProgram._TwoSideEnabled);
ctx->VertexProgram._TwoSideEnabled,
&max_source_attr);
}
for (; input_index < FRAG_ATTRIB_MAX; input_index++)
attr_overrides[input_index] = 0;
/* From the Sandy Bridge PRM, Volume 2, Part 1, documentation for
* 3DSTATE_SF DWord 1 bits 15:11, "Vertex URB Entry Read Length":
*
* "This field should be set to the minimum length required to read the
* maximum source attribute. The maximum source attribute is indicated
* by the maximum value of the enabled Attribute # Source Attribute if
* Attribute Swizzle Enable is set, Number of Output Attributes-1 if
* enable is not set.
* read_length = ceiling((max_source_attr + 1) / 2)
*
* [errata] Corruption/Hang possible if length programmed larger than
* recommended"
*/
uint32_t urb_entry_read_length = ALIGN(max_source_attr + 1, 2) / 2;
dw1 |= urb_entry_read_length << GEN6_SF_URB_ENTRY_READ_LENGTH_SHIFT |
urb_entry_read_offset << GEN6_SF_URB_ENTRY_READ_OFFSET_SHIFT;
BEGIN_BATCH(20);
OUT_BATCH(_3DSTATE_SF << 16 | (20 - 2));
OUT_BATCH(dw1);

View File

@@ -195,7 +195,7 @@ gen7_upload_samplers(struct brw_context *brw)
GLbitfield SamplersUsed = vs->SamplersUsed | fs->SamplersUsed;
brw->sampler.count = _mesa_bitcount(SamplersUsed);
brw->sampler.count = _mesa_fls(SamplersUsed);
if (brw->sampler.count == 0)
return;

View File

@@ -34,7 +34,6 @@ upload_sbe_state(struct brw_context *brw)
{
struct intel_context *intel = &brw->intel;
struct gl_context *ctx = &intel->ctx;
uint32_t urb_entry_read_length;
/* BRW_NEW_FRAGMENT_PROGRAM */
uint32_t num_outputs = _mesa_bitcount_64(brw->fragment_program->Base.InputsRead);
/* _NEW_LIGHT */
@@ -48,22 +47,8 @@ upload_sbe_state(struct brw_context *brw)
bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
uint32_t point_sprite_origin;
/* CACHE_NEW_VS_PROG */
urb_entry_read_length = ((brw->vs.prog_data->vue_map.num_slots + 1) / 2 -
urb_entry_read_offset);
if (urb_entry_read_length == 0) {
/* Setting the URB entry read length to 0 causes undefined behavior, so
* if we have no URB data to read, set it to 1.
*/
urb_entry_read_length = 1;
}
/* FINISHME: Attribute Swizzle Control Mode? */
dw1 =
GEN7_SBE_SWIZZLE_ENABLE |
num_outputs << GEN7_SBE_NUM_OUTPUTS_SHIFT |
urb_entry_read_length << GEN7_SBE_URB_ENTRY_READ_LENGTH_SHIFT |
urb_entry_read_offset << GEN7_SBE_URB_ENTRY_READ_OFFSET_SHIFT;
dw1 = GEN7_SBE_SWIZZLE_ENABLE | num_outputs << GEN7_SBE_NUM_OUTPUTS_SHIFT;
/* _NEW_POINT
*
@@ -84,6 +69,7 @@ upload_sbe_state(struct brw_context *brw)
/* Create the mapping from the FS inputs we produce to the VS outputs
* they source from.
*/
uint32_t max_source_attr = 0;
for (; attr < FRAG_ATTRIB_MAX; attr++) {
enum glsl_interp_qualifier interp_qualifier =
brw->fragment_program->InterpQualifier[attr];
@@ -118,9 +104,25 @@ upload_sbe_state(struct brw_context *brw)
attr_overrides[input_index++] =
get_attr_override(&brw->vs.prog_data->vue_map,
urb_entry_read_offset, attr,
ctx->VertexProgram._TwoSideEnabled);
ctx->VertexProgram._TwoSideEnabled,
&max_source_attr);
}
/* From the Ivy Bridge PRM, Volume 2, Part 1, documentation for
* 3DSTATE_SBE DWord 1 bits 15:11, "Vertex URB Entry Read Length":
*
* "This field should be set to the minimum length required to read the
* maximum source attribute. The maximum source attribute is indicated
* by the maximum value of the enabled Attribute # Source Attribute if
* Attribute Swizzle Enable is set, Number of Output Attributes-1 if
* enable is not set.
*
* read_length = ceiling((max_source_attr + 1) / 2)"
*/
uint32_t urb_entry_read_length = ALIGN(max_source_attr + 1, 2) / 2;
dw1 |= urb_entry_read_length << GEN7_SBE_URB_ENTRY_READ_LENGTH_SHIFT |
urb_entry_read_offset << GEN7_SBE_URB_ENTRY_READ_OFFSET_SHIFT;
for (; input_index < FRAG_ATTRIB_MAX; input_index++)
attr_overrides[input_index] = 0;
@@ -142,7 +144,8 @@ upload_sbe_state(struct brw_context *brw)
const struct brw_tracked_state gen7_sbe_state = {
.dirty = {
.mesa = (_NEW_LIGHT |
.mesa = (_NEW_BUFFERS |
_NEW_LIGHT |
_NEW_POINT |
_NEW_PROGRAM),
.brw = (BRW_NEW_CONTEXT |

View File

@@ -35,6 +35,32 @@
#include "brw_defines.h"
#include "brw_wm.h"
/**
* Convert an swizzle enumeration (i.e. SWIZZLE_X) to one of the Gen7.5+
* "Shader Channel Select" enumerations (i.e. HSW_SCS_RED)
*/
static unsigned
swizzle_to_scs(GLenum swizzle)
{
switch (swizzle) {
case SWIZZLE_X:
return HSW_SCS_RED;
case SWIZZLE_Y:
return HSW_SCS_GREEN;
case SWIZZLE_Z:
return HSW_SCS_BLUE;
case SWIZZLE_W:
return HSW_SCS_ALPHA;
case SWIZZLE_ZERO:
return HSW_SCS_ZERO;
case SWIZZLE_ONE:
return HSW_SCS_ONE;
}
assert(!"Should not get here: invalid swizzle mode");
return HSW_SCS_ZERO;
}
void
gen7_set_surface_tiling(struct gen7_surface_state *surf, uint32_t tiling)
{
@@ -343,10 +369,21 @@ gen7_update_texture_surface(struct gl_context *ctx,
*/
if (brw->intel.is_haswell) {
surf->ss7.shader_channel_select_r = HSW_SCS_RED;
surf->ss7.shader_channel_select_g = HSW_SCS_GREEN;
surf->ss7.shader_channel_select_b = HSW_SCS_BLUE;
surf->ss7.shader_channel_select_a = HSW_SCS_ALPHA;
/* Handling GL_ALPHA as a surface format override breaks 1.30+ style
* texturing functions that return a float, as our code generation always
* selects the .x channel (which would always be 0).
*/
const bool alpha_depth = tObj->DepthMode == GL_ALPHA &&
(firstImage->_BaseFormat == GL_DEPTH_COMPONENT ||
firstImage->_BaseFormat == GL_DEPTH_STENCIL);
const int swizzle =
unlikely(alpha_depth) ? SWIZZLE_XYZW : brw_get_texture_swizzle(tObj);
surf->ss7.shader_channel_select_r = swizzle_to_scs(GET_SWZ(swizzle, 0));
surf->ss7.shader_channel_select_g = swizzle_to_scs(GET_SWZ(swizzle, 1));
surf->ss7.shader_channel_select_b = swizzle_to_scs(GET_SWZ(swizzle, 2));
surf->ss7.shader_channel_select_a = swizzle_to_scs(GET_SWZ(swizzle, 3));
}
/* Emit relocation to surface contents */

View File

@@ -87,7 +87,7 @@ intel_new_framebuffer(struct gl_context * ctx, GLuint name)
/** Called by gl_renderbuffer::Delete() */
static void
intel_delete_renderbuffer(struct gl_renderbuffer *rb)
intel_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
struct intel_renderbuffer *irb = intel_renderbuffer(rb);
@@ -95,7 +95,7 @@ intel_delete_renderbuffer(struct gl_renderbuffer *rb)
intel_miptree_release(&irb->mt);
free(irb);
_mesa_delete_renderbuffer(ctx, rb);
}
/**

View File

@@ -573,12 +573,14 @@ intel_miptree_match_image(struct intel_mipmap_tree *mt,
if (target_to_target(image->TexObject->Target) != mt->target)
return false;
if (image->TexFormat != mt->format &&
!(image->TexFormat == MESA_FORMAT_S8_Z24 &&
mt->format == MESA_FORMAT_X8_Z24 &&
mt->stencil_mt)) {
gl_format mt_format = mt->format;
if (mt->format == MESA_FORMAT_X8_Z24 && mt->stencil_mt)
mt_format = MESA_FORMAT_S8_Z24;
if (mt->wraps_etc1)
mt_format = MESA_FORMAT_RGBX8888_REV;
if (image->TexFormat != mt_format)
return false;
}
intel_miptree_get_dimensions_for_image(image, &width, &height, &depth);

View File

@@ -102,12 +102,12 @@ nouveau_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
}
static void
nouveau_renderbuffer_del(struct gl_renderbuffer *rb)
nouveau_renderbuffer_del(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
struct nouveau_surface *s = &to_nouveau_renderbuffer(rb)->surface;
nouveau_surface_ref(NULL, s);
FREE(rb);
_mesa_delete_renderbuffer(ctx, rb);
}
static struct gl_renderbuffer *
@@ -195,7 +195,7 @@ nouveau_renderbuffer_dri_new(GLenum format, __DRIdrawable *drawable)
rb->AllocStorage = nouveau_renderbuffer_dri_storage;
if (!set_renderbuffer_format(rb, format)) {
nouveau_renderbuffer_del(rb);
nouveau_renderbuffer_del(NULL, rb);
return NULL;
}

View File

@@ -289,13 +289,20 @@ GLboolean r200CreateContext( gl_api api,
rmesa->radeon.swtcl.RenderIndex = ~0;
rmesa->radeon.hw.all_dirty = 1;
ctx = rmesa->radeon.glCtx;
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
_ae_create_context( ctx );
/* Set the maximum texture size small enough that we can guarentee that
* all texture units can bind a maximal texture and have all of them in
* texturable memory at once. Depending on the allow_large_textures driconf
* setting allow larger textures.
*/
ctx = rmesa->radeon.glCtx;
ctx->Const.MaxTextureUnits = driQueryOptioni (&rmesa->radeon.optionCache,
"texture_units");
ctx->Const.MaxTextureImageUnits = ctx->Const.MaxTextureUnits;
@@ -345,14 +352,6 @@ GLboolean r200CreateContext( gl_api api,
_mesa_set_mvp_with_dp4( ctx, GL_TRUE );
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
_ae_create_context( ctx );
/* Install the customized pipeline:
*/
_tnl_destroy_pipeline( ctx );

View File

@@ -166,8 +166,9 @@ void r200EmitArrays( struct gl_context *ctx, GLubyte *vimap_rev )
/* fallthrough */
case 4:
vfmt0 |= R200_VTX_W1;
break;
/* fallthrough */
}
break;
default:
assert(0);
emitsize = 0;

View File

@@ -251,13 +251,21 @@ r100CreateContext( gl_api api,
rmesa->radeon.swtcl.RenderIndex = ~0;
rmesa->radeon.hw.all_dirty = GL_TRUE;
ctx = rmesa->radeon.glCtx;
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
_ae_create_context( ctx );
/* Set the maximum texture size small enough that we can guarentee that
* all texture units can bind a maximal texture and have all of them in
* texturable memory at once. Depending on the allow_large_textures driconf
* setting allow larger textures.
*/
ctx = rmesa->radeon.glCtx;
ctx->Const.MaxTextureUnits = driQueryOptioni (&rmesa->radeon.optionCache,
"texture_units");
ctx->Const.MaxTextureImageUnits = ctx->Const.MaxTextureUnits;
@@ -307,14 +315,6 @@ r100CreateContext( gl_api api,
_mesa_set_mvp_with_dp4( ctx, GL_TRUE );
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext( ctx );
_vbo_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
_ae_create_context( ctx );
/* Install the customized pipeline:
*/
_tnl_destroy_pipeline( ctx );

View File

@@ -54,7 +54,7 @@ radeon_new_framebuffer(struct gl_context *ctx, GLuint name)
}
static void
radeon_delete_renderbuffer(struct gl_renderbuffer *rb)
radeon_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
struct radeon_renderbuffer *rrb = radeon_renderbuffer(rb);
@@ -67,7 +67,7 @@ radeon_delete_renderbuffer(struct gl_renderbuffer *rb)
if (rrb && rrb->bo) {
radeon_bo_unref(rrb->bo);
}
free(rrb);
_mesa_delete_renderbuffer(ctx, rb);
}
#if defined(RADEON_R100)

View File

@@ -261,14 +261,14 @@ choose_pixel_format(const struct gl_config *v)
}
static void
swrast_delete_renderbuffer(struct gl_renderbuffer *rb)
swrast_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
struct dri_swrast_renderbuffer *xrb = dri_swrast_renderbuffer(rb);
TRACE;
free(xrb->Base.Buffer);
free(xrb);
_mesa_delete_renderbuffer(ctx, rb);
}
/* see bytes_per_line in libGL */

View File

@@ -41,6 +41,7 @@
#include "main/framebuffer.h"
#include "main/imports.h"
#include "main/macros.h"
#include "main/mipmap.h"
#include "main/mtypes.h"
#include "main/renderbuffer.h"
#include "swrast/swrast.h"
@@ -386,9 +387,9 @@ compute_row_addresses( OSMesaContext osmesa )
* Don't use _mesa_delete_renderbuffer since we can't free rb->Buffer.
*/
static void
osmesa_delete_renderbuffer(struct gl_renderbuffer *rb)
osmesa_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
free(rb);
_mesa_delete_renderbuffer(ctx, rb);
}
@@ -780,6 +781,8 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
ctx->Driver.MapRenderbuffer = osmesa_MapRenderbuffer;
ctx->Driver.UnmapRenderbuffer = osmesa_UnmapRenderbuffer;
ctx->Driver.GenerateMipmap = _mesa_generate_mipmap;
/* Extend the software rasterizer with our optimized line and triangle
* drawing functions.
*/

View File

@@ -900,9 +900,9 @@ static void read_rgba_pixels_16(struct gl_context *ctx,
static void
wmesa_delete_renderbuffer(struct gl_renderbuffer *rb)
wmesa_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
free(rb);
_mesa_delete_renderbuffer(ctx, rb);
}

View File

@@ -917,6 +917,20 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
while (*parselist) {
if (fbConfig &&
parselist[1] == GLX_DONT_CARE &&
parselist[0] != GLX_LEVEL) {
/* For glXChooseFBConfig(), skip attributes whose value is
* GLX_DONT_CARE (-1), unless it's GLX_LEVEL (which can legitimately be
* a negative value).
*
* From page 17 (23 of the pdf) of the GLX 1.4 spec:
* GLX DONT CARE may be specified for all attributes except GLX LEVEL.
*/
parselist += 2;
continue;
}
switch (*parselist) {
case GLX_USE_GL:
if (fbConfig) {

View File

@@ -844,15 +844,18 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
alpha_bits = v->mesa_visual.alphaBits;
}
_mesa_initialize_visual( &v->mesa_visual,
db_flag, stereo_flag,
red_bits, green_bits,
blue_bits, alpha_bits,
depth_size,
stencil_size,
accum_red_size, accum_green_size,
accum_blue_size, accum_alpha_size,
0 );
if (!_mesa_initialize_visual(&v->mesa_visual,
db_flag, stereo_flag,
red_bits, green_bits,
blue_bits, alpha_bits,
depth_size,
stencil_size,
accum_red_size, accum_green_size,
accum_blue_size, accum_alpha_size,
0)) {
FREE(v);
return NULL;
}
/* XXX minor hack */
v->mesa_visual.level = level;

View File

@@ -235,7 +235,7 @@ alloc_back_buffer(XMesaBuffer b, GLuint width, GLuint height)
static void
xmesa_delete_renderbuffer(struct gl_renderbuffer *rb)
xmesa_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
/* XXX Note: the ximage or Pixmap attached to this renderbuffer
* should probably get freed here, but that's currently done in

View File

@@ -34,6 +34,7 @@
#include "main/colormac.h"
#include "main/fbobject.h"
#include "main/macros.h"
#include "main/mipmap.h"
#include "main/image.h"
#include "main/imports.h"
#include "main/mtypes.h"
@@ -872,6 +873,8 @@ xmesa_init_driver_functions( XMesaVisual xmvisual,
driver->MapRenderbuffer = xmesa_MapRenderbuffer;
driver->UnmapRenderbuffer = xmesa_UnmapRenderbuffer;
driver->GenerateMipmap = _mesa_generate_mipmap;
#if ENABLE_EXT_timer_query
driver->NewQueryObject = xmesa_new_query_object;
driver->BeginQuery = xmesa_begin_query;

View File

@@ -534,8 +534,8 @@ _mesa_ReadBuffer(GLenum buffer)
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(buffer));
if (_mesa_is_user_fbo(fb) && buffer == GL_NONE) {
/* This is legal for user-created framebuffer objects */
if (buffer == GL_NONE) {
/* This is legal--it means that no buffer should be bound for reading. */
srcBuffer = -1;
}
else {

View File

@@ -288,7 +288,7 @@ static const struct extension extension_table[] = {
{ "GL_ATI_texture_float", o(ARB_texture_float), GL, 2002 },
{ "GL_ATI_texture_mirror_once", o(ATI_texture_mirror_once), GL, 2006 },
{ "GL_IBM_multimode_draw_arrays", o(IBM_multimode_draw_arrays), GL, 1998 },
{ "GL_IBM_rasterpos_clip", o(IBM_rasterpos_clip), GL, 1996 },
{ "GL_IBM_rasterpos_clip", o(IBM_rasterpos_clip), GLL, 1996 },
{ "GL_IBM_texture_mirrored_repeat", o(dummy_true), GLL, 1998 },
{ "GL_INGR_blend_func_separate", o(EXT_blend_func_separate), GLL, 1999 },
{ "GL_MESA_pack_invert", o(MESA_pack_invert), GL, 2002 },
@@ -308,7 +308,7 @@ static const struct extension extension_table[] = {
{ "GL_NV_light_max_exponent", o(NV_light_max_exponent), GLL, 1999 },
{ "GL_NV_packed_depth_stencil", o(EXT_packed_depth_stencil), GL, 2000 },
{ "GL_NV_point_sprite", o(NV_point_sprite), GL, 2001 },
{ "GL_NV_primitive_restart", o(NV_primitive_restart), GL, 2002 },
{ "GL_NV_primitive_restart", o(NV_primitive_restart), GLL, 2002 },
{ "GL_NV_read_buffer", o(dummy_true), ES2, 2011 },
{ "GL_NV_texgen_reflection", o(NV_texgen_reflection), GLL, 1999 },
{ "GL_NV_texture_barrier", o(NV_texture_barrier), GL, 2009 },
@@ -471,9 +471,6 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
#endif
#if FEATURE_EXT_framebuffer_blit
ctx->Extensions.EXT_framebuffer_blit = GL_TRUE;
#endif
#if FEATURE_ARB_framebuffer_object
ctx->Extensions.EXT_framebuffer_multisample = GL_TRUE;
#endif
ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE;
#if FEATURE_EXT_pixel_buffer_object

View File

@@ -77,7 +77,7 @@ static struct gl_framebuffer IncompleteFramebuffer;
static void
delete_dummy_renderbuffer(struct gl_renderbuffer *rb)
delete_dummy_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
/* no op */
}

View File

@@ -2623,6 +2623,20 @@ unpack_int_rgba_ABGR2101010_UINT(const GLuint *src, GLuint dst[][4], GLuint n)
}
}
static void
unpack_int_rgba_ARGB2101010(const GLuint *src, GLuint dst[][4], GLuint n)
{
unsigned int i;
for (i = 0; i < n; i++) {
GLuint tmp = src[i];
dst[i][0] = (tmp >> 20) & 0x3ff;
dst[i][1] = (tmp >> 10) & 0x3ff;
dst[i][2] = (tmp >> 0) & 0x3ff;
dst[i][3] = (tmp >> 30) & 0x3;
}
}
void
_mesa_unpack_uint_rgba_row(gl_format format, GLuint n,
const void *src, GLuint dst[][4])
@@ -2798,6 +2812,10 @@ _mesa_unpack_uint_rgba_row(gl_format format, GLuint n,
unpack_int_rgba_ABGR2101010_UINT(src, dst, n);
break;
case MESA_FORMAT_ARGB2101010:
unpack_int_rgba_ARGB2101010(src, dst, n);
break;
default:
_mesa_problem(NULL, "%s: bad format %s", __FUNCTION__,
_mesa_get_format_name(format));

View File

@@ -2618,7 +2618,7 @@ struct gl_renderbuffer
gl_format Format; /**< The actual renderbuffer memory format */
/** Delete this renderbuffer */
void (*Delete)(struct gl_renderbuffer *rb);
void (*Delete)(struct gl_context *ctx, struct gl_renderbuffer *rb);
/** Allocate new storage for this renderbuffer */
GLboolean (*AllocStorage)(struct gl_context *ctx,

View File

@@ -75,11 +75,15 @@ _mesa_new_renderbuffer(struct gl_context *ctx, GLuint name)
/**
* Delete a gl_framebuffer.
* This is the default function for renderbuffer->Delete().
* Drivers which subclass gl_renderbuffer should probably implement their
* own delete function. But the driver might also call this function to
* free the object in the end.
*/
void
_mesa_delete_renderbuffer(struct gl_renderbuffer *rb)
_mesa_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
/* no-op */
_glthread_DESTROY_MUTEX(rb->Mutex);
free(rb);
}
@@ -155,7 +159,8 @@ _mesa_reference_renderbuffer_(struct gl_renderbuffer **ptr,
_glthread_UNLOCK_MUTEX(oldRb->Mutex);
if (deleteFlag) {
oldRb->Delete(oldRb);
GET_CURRENT_CONTEXT(ctx);
oldRb->Delete(ctx, oldRb);
}
*ptr = NULL;

View File

@@ -40,7 +40,7 @@ extern struct gl_renderbuffer *
_mesa_new_renderbuffer(struct gl_context *ctx, GLuint name);
extern void
_mesa_delete_renderbuffer(struct gl_renderbuffer *rb);
_mesa_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb);
extern void
_mesa_add_renderbuffer(struct gl_framebuffer *fb,

View File

@@ -186,25 +186,6 @@ validate_shader_target(const struct gl_context *ctx, GLenum type)
}
/**
* Find the length of the longest transform feedback varying name
* which was specified with glTransformFeedbackVaryings().
*/
static GLint
longest_feedback_varying_name(const struct gl_shader_program *shProg)
{
GLuint i;
GLint max = 0;
for (i = 0; i < shProg->TransformFeedback.NumVarying; i++) {
GLint len = strlen(shProg->TransformFeedback.VaryingNames[i]);
if (len > max)
max = len;
}
return max;
}
static GLboolean
is_program(struct gl_context *ctx, GLuint name)
{
@@ -549,11 +530,24 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param
break;
*params = shProg->TransformFeedback.NumVarying;
return;
case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH:
case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH: {
unsigned i;
GLint max_len = 0;
if (!has_xfb)
break;
*params = longest_feedback_varying_name(shProg) + 1;
for (i = 0; i < shProg->TransformFeedback.NumVarying; i++) {
/* Add one for the terminating NUL character.
*/
const GLint len = strlen(shProg->TransformFeedback.VaryingNames[i]) + 1;
if (len > max_len)
max_len = len;
}
*params = max_len;
return;
}
case GL_TRANSFORM_FEEDBACK_BUFFER_MODE:
if (!has_xfb)
break;

View File

@@ -250,6 +250,8 @@ _mesa_init_shader_program(struct gl_context *ctx, struct gl_shader_program *prog
prog->Geom.OutputType = GL_TRIANGLE_STRIP;
#endif
prog->TransformFeedback.BufferMode = GL_INTERLEAVED_ATTRIBS;
prog->InfoLog = ralloc_strdup(prog, "");
}

View File

@@ -271,10 +271,11 @@ delete_framebuffer_cb(GLuint id, void *data, void *userData)
static void
delete_renderbuffer_cb(GLuint id, void *data, void *userData)
{
struct gl_context *ctx = (struct gl_context *) userData;
struct gl_renderbuffer *rb = (struct gl_renderbuffer *) data;
rb->RefCount = 0; /* see comment for FBOs above */
if (rb->Delete)
rb->Delete(rb);
rb->Delete(ctx, rb);
}

View File

@@ -229,6 +229,8 @@ get_tex_rgba_compressed(struct gl_context *ctx, GLuint dimensions,
const gl_format texFormat =
_mesa_get_srgb_format_linear(texImage->TexFormat);
const GLenum baseFormat = _mesa_get_format_base_format(texFormat);
const GLenum destBaseFormat = _mesa_base_tex_format(ctx, format);
GLenum rebaseFormat = GL_NONE;
const GLuint width = texImage->Width;
const GLuint height = texImage->Height;
const GLuint depth = texImage->Depth;
@@ -266,9 +268,31 @@ get_tex_rgba_compressed(struct gl_context *ctx, GLuint dimensions,
}
if (baseFormat == GL_LUMINANCE ||
baseFormat == GL_INTENSITY ||
baseFormat == GL_LUMINANCE_ALPHA) {
/* If a luminance (or intensity) texture is read back as RGB(A), the
* returned value should be (L,0,0,1), not (L,L,L,1). Set rebaseFormat
* here to get G=B=0.
*/
rebaseFormat = texImage->_BaseFormat;
}
else if ((baseFormat == GL_RGBA ||
baseFormat == GL_RGB ||
baseFormat == GL_RG) &&
(destBaseFormat == GL_LUMINANCE ||
destBaseFormat == GL_LUMINANCE_ALPHA ||
destBaseFormat == GL_LUMINANCE_INTEGER_EXT ||
destBaseFormat == GL_LUMINANCE_ALPHA_INTEGER_EXT)) {
/* If we're reading back an RGB(A) texture as luminance then we need
* to return L=tex(R). Note, that's different from glReadPixels which
* returns L=R+G+B.
*/
rebaseFormat = GL_LUMINANCE_ALPHA; /* this covers GL_LUMINANCE too */
}
if (rebaseFormat) {
_mesa_rebase_rgba_float(width * height, (GLfloat (*)[4]) tempImage,
baseFormat);
rebaseFormat);
}
srcRow = tempImage;
@@ -332,7 +356,8 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint dimensions,
rebaseFormat = texImage->_BaseFormat;
}
else if ((texImage->_BaseFormat == GL_RGBA ||
texImage->_BaseFormat == GL_RGB) &&
texImage->_BaseFormat == GL_RGB ||
texImage->_BaseFormat == GL_RG) &&
(destBaseFormat == GL_LUMINANCE ||
destBaseFormat == GL_LUMINANCE_ALPHA ||
destBaseFormat == GL_LUMINANCE_INTEGER_EXT ||
@@ -419,15 +444,6 @@ get_tex_rgba(struct gl_context *ctx, GLuint dimensions,
transferOps |= IMAGE_CLAMP_BIT;
}
}
/* This applies to RGB, RGBA textures. if the format is either LUMINANCE
* or LUMINANCE ALPHA, luminance (L) is computed as L=R+G+B .we need to
* clamp the sum to [0,1].
*/
else if ((format == GL_LUMINANCE ||
format == GL_LUMINANCE_ALPHA) &&
dataType == GL_UNSIGNED_NORMALIZED) {
transferOps |= IMAGE_CLAMP_BIT;
}
if (_mesa_is_format_compressed(texImage->TexFormat)) {
get_tex_rgba_compressed(ctx, dimensions, format, type,

View File

@@ -97,12 +97,16 @@ _mesa_GetActiveUniformsiv(GLuint program,
for (i = 0; i < uniformCount; i++) {
GLuint index = uniformIndices[i];
const struct gl_uniform_storage *uni = &shProg->UniformStorage[index];
if (index >= shProg->NumUserUniformStorage) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniformsiv(index)");
return;
}
}
for (i = 0; i < uniformCount; i++) {
GLuint index = uniformIndices[i];
const struct gl_uniform_storage *uni = &shProg->UniformStorage[index];
switch (pname) {
case GL_UNIFORM_TYPE:
@@ -237,11 +241,14 @@ validate_uniform_parameters(struct gl_context *ctx,
return false;
}
/* This case should be impossible. The implication is that a call like
* glGetUniformLocation(prog, "foo[8]") was successful but "foo" is not an
* array.
/* If the uniform is an array, check that array_index is in bounds.
* If not an array, check that array_index is zero.
* array_index is unsigned so no need to check for less than zero.
*/
if (*array_index != 0 && shProg->UniformStorage[*loc].array_elements == 0) {
unsigned limit = shProg->UniformStorage[*loc].array_elements;
if (limit == 0)
limit = 1;
if (*array_index >= limit) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(location=%d)",
caller, location);
return false;
@@ -728,9 +735,6 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg,
* will have already generated an error.
*/
if (uni->array_elements != 0) {
if (offset >= uni->array_elements)
return;
count = MIN2(count, (int) (uni->array_elements - offset));
}
@@ -885,9 +889,6 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg,
* will have already generated an error.
*/
if (uni->array_elements != 0) {
if (offset >= uni->array_elements)
return;
count = MIN2(count, (int) (uni->array_elements - offset));
}
@@ -1021,10 +1022,13 @@ _mesa_get_uniform_location(struct gl_context *ctx,
if (!found)
return GL_INVALID_INDEX;
/* Since array_elements is 0 for non-arrays, this causes look-ups of 'a[0]'
* to (correctly) fail if 'a' is not an array.
/* If the uniform is an array, fail if the index is out of bounds.
* (A negative index is caught above.) This also fails if the uniform
* is not an array, but the user is trying to index it, because
* array_elements is zero and offset >= 0.
*/
if (array_lookup && shProg->UniformStorage[location].array_elements == 0) {
if (array_lookup
&& offset >= shProg->UniformStorage[location].array_elements) {
return GL_INVALID_INDEX;
}

View File

@@ -34,8 +34,8 @@ struct gl_context;
/* Mesa version */
#define MESA_MAJOR 9
#define MESA_MINOR 0
#define MESA_PATCH 2
#define MESA_VERSION_STRING "9.0.2"
#define MESA_PATCH 3
#define MESA_VERSION_STRING "9.0.3"
/* To make version comparison easy */
#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

View File

@@ -732,7 +732,7 @@ _mesa_combine_programs(struct gl_context *ctx,
const GLuint newLength = lenA + lenB;
GLboolean usedTemps[MAX_PROGRAM_TEMPS];
GLuint firstTemp = 0;
GLbitfield inputsB;
GLbitfield64 inputsB;
GLuint i;
ASSERT(progA->Target == progB->Target);
@@ -760,7 +760,7 @@ _mesa_combine_programs(struct gl_context *ctx,
if (newProg->Target == GL_FRAGMENT_PROGRAM_ARB) {
const struct gl_fragment_program *fprogA, *fprogB;
struct gl_fragment_program *newFprog;
GLbitfield progB_inputsRead = progB->InputsRead;
GLbitfield64 progB_inputsRead = progB->InputsRead;
GLint progB_colorFile, progB_colorIndex;
fprogA = gl_fragment_program_const(progA);

View File

@@ -356,9 +356,8 @@ setup_bitmap_vertex_data(struct st_context *st, bool normalized,
tBot = (GLfloat) height;
}
u_upload_alloc(st->uploader, 0, 4 * sizeof(vertices[0]), vbuf_offset, vbuf,
(void**)&vertices);
if (!vbuf) {
if (u_upload_alloc(st->uploader, 0, 4 * sizeof(vertices[0]),
vbuf_offset, vbuf, (void **) &vertices) != PIPE_OK) {
return;
}

View File

@@ -142,9 +142,8 @@ draw_quad(struct st_context *st,
GLuint i, offset;
float (*vertices)[2][4]; /**< vertex pos + color */
u_upload_alloc(st->uploader, 0, 4 * sizeof(vertices[0]), &offset, &vbuf,
(void**)&vertices);
if (!vbuf) {
if (u_upload_alloc(st->uploader, 0, 4 * sizeof(vertices[0]),
&offset, &vbuf, (void **) &vertices) != PIPE_OK) {
return;
}

View File

@@ -398,6 +398,8 @@ internal_format(struct gl_context *ctx, GLenum format, GLenum type)
case GL_UNSIGNED_BYTE_3_3_2:
case GL_UNSIGNED_BYTE_2_3_3_REV:
return GL_R3_G3_B2;
case GL_UNSIGNED_SHORT_4_4_4_4:
case GL_UNSIGNED_SHORT_4_4_4_4_REV:
return GL_RGBA4;
@@ -571,9 +573,8 @@ draw_quad(struct gl_context *ctx, GLfloat x0, GLfloat y0, GLfloat z,
struct pipe_resource *buf = NULL;
unsigned offset;
u_upload_alloc(st->uploader, 0, 4 * sizeof(verts[0]), &offset, &buf,
(void**)&verts);
if (!buf) {
if (u_upload_alloc(st->uploader, 0, 4 * sizeof(verts[0]), &offset,
&buf, (void **) &verts) != PIPE_OK) {
return;
}

View File

@@ -151,10 +151,9 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
GLfloat *vbuf = NULL;
GLuint attr;
u_upload_alloc(st->uploader, 0,
numAttribs * 4 * 4 * sizeof(GLfloat),
&offset, &vbuffer, (void**)&vbuf);
if (!vbuffer) {
if (u_upload_alloc(st->uploader, 0,
numAttribs * 4 * 4 * sizeof(GLfloat),
&offset, &vbuffer, (void **) &vbuf) != PIPE_OK) {
return;
}

View File

@@ -225,14 +225,16 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx,
* gl_renderbuffer::Delete()
*/
static void
st_renderbuffer_delete(struct gl_renderbuffer *rb)
st_renderbuffer_delete(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
struct st_renderbuffer *strb = st_renderbuffer(rb);
ASSERT(strb);
pipe_surface_reference(&strb->surface, NULL);
if (ctx) {
struct st_context *st = st_context(ctx);
pipe_surface_release(st->pipe, &strb->surface);
}
pipe_resource_reference(&strb->texture, NULL);
free(strb->data);
free(strb);
_mesa_delete_renderbuffer(ctx, rb);
}
@@ -434,7 +436,7 @@ st_render_texture(struct gl_context *ctx,
pipe_resource_reference( &strb->texture, pt );
pipe_surface_reference(&strb->surface, NULL);
pipe_surface_release(pipe, &strb->surface);
assert(strb->rtt_level <= strb->texture->last_level);

View File

@@ -83,7 +83,12 @@ all_varyings_in_vbos(const struct gl_client_array *arrays[])
}
static void
/**
* Basically, translate Mesa's index buffer information into
* a pipe_index_buffer object.
* \return TRUE or FALSE for success/failure
*/
static boolean
setup_index_buffer(struct st_context *st,
const struct _mesa_index_buffer *ib,
struct pipe_index_buffer *ibuffer)
@@ -99,8 +104,12 @@ setup_index_buffer(struct st_context *st,
ibuffer->offset = pointer_to_offset(ib->ptr);
}
else if (st->indexbuf_uploader) {
u_upload_data(st->indexbuf_uploader, 0, ib->count * ibuffer->index_size,
ib->ptr, &ibuffer->offset, &ibuffer->buffer);
if (u_upload_data(st->indexbuf_uploader, 0,
ib->count * ibuffer->index_size, ib->ptr,
&ibuffer->offset, &ibuffer->buffer) != PIPE_OK) {
/* out of memory */
return FALSE;
}
u_upload_unmap(st->indexbuf_uploader);
}
else {
@@ -109,6 +118,7 @@ setup_index_buffer(struct st_context *st,
}
cso_set_index_buffer(st->cso_context, ibuffer);
return TRUE;
}
@@ -219,7 +229,10 @@ st_draw_vbo(struct gl_context *ctx,
vbo_get_minmax_indices(ctx, prims, ib, &min_index, &max_index,
nr_prims);
setup_index_buffer(st, ib, &ibuffer);
if (!setup_index_buffer(st, ib, &ibuffer)) {
/* out of memory */
return;
}
info.indexed = TRUE;
if (min_index != ~0 && max_index != ~0) {

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