Rob Clark [Fri, 25 Oct 2013 19:22:06 +0000 (15:22 -0400)]
gallium/auxiliary/indices: add start param
Add 'start' parameter to generator/translator.
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Rob Clark [Fri, 25 Oct 2013 14:45:15 +0000 (10:45 -0400)]
freedreno: update generated headers
pull in some fixes to draw-initiator/prim-type.
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Eric Anholt [Tue, 29 Oct 2013 00:00:23 +0000 (17:00 -0700)]
i965/fs: Drop our dead push constants before overflowing to pull constants.
The idea of the original order was that you'd dead code eliminate accesses
to push constants. But I've never seen a case of that (nor has
shader-db), while we frequently see sparse accesses of large constant
arrays that would overflow into pull constants.
Cuts pull constant use on csgo, serious sam, planeshift, and the cave:
total instructions in shared programs:
1695103 ->
1688795 (-0.37%)
instructions in affected programs: 92024 -> 85716 (-6.85%)
GAINED: 339
LOST: 0
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Alexander von Gluck IV [Mon, 28 Oct 2013 17:56:43 +0000 (12:56 -0500)]
haiku-softpipe: Minor cleanup and color space fixes
* Use more consistant data sources
* Fix improper color space assignments
* Remove unnecessary comments and code
* Drop unnecessary round_up function (this was leftover
from moving winsys code out of renderer)
Acked-by: Brian Paul <brianp@vmware.com>
Alexander von Gluck IV [Mon, 28 Oct 2013 16:38:27 +0000 (11:38 -0500)]
winsys: Correct Haiku winsys display target code
* Instead of assuming the displaytarget is the same
stride / colorspace as the destination, lets
actually check the source bitmap.
* Fixes random stride issues in rendering
Acked-by: Brian Paul <brianp@vmware.com>
Francisco Jerez [Tue, 29 Oct 2013 18:21:09 +0000 (11:21 -0700)]
clover: Use context device list for error checking in clGetProgramBuildInfo.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=70891.
Reported-by: Bruno Jiménez <brunojimen@gmail.com>
Francisco Jerez [Sun, 20 Oct 2013 21:05:24 +0000 (14:05 -0700)]
i965: Simplify the shader time code by using atomic counter helpers.
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Francisco Jerez [Wed, 11 Sep 2013 21:19:47 +0000 (14:19 -0700)]
i965: Add brw_reg constructors taking a dynamically determined vector width.
The MRF variant is going to be used extensively by the atomic counter
intrinsics to assemble untyped atomic and surface read messages
easily.
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Francisco Jerez [Wed, 11 Sep 2013 21:03:13 +0000 (14:03 -0700)]
i965/gen7: Implement code generation for untyped surface read instructions.
Francisco Jerez [Wed, 11 Sep 2013 21:01:50 +0000 (14:01 -0700)]
i965/gen7: Implement code generation for untyped atomic instructions.
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Francisco Jerez [Sun, 20 Oct 2013 20:09:57 +0000 (13:09 -0700)]
i965: Implement ABO surface state emission.
The maximum number of atomic buffer objects is somewhat arbitrary, we
can change it in the future easily if it turns out it's not enough...
v2: Add comments with the relevant mesa dirty bits. Fix usage of
BRW_NEW_UNIFORM_BUFFER in the GS ABO state atom.
v3: Update binding table layout diagrams.
v4: Resolve conflicts with the recent dynamic surface index assignment changes.
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Francisco Jerez [Sun, 22 Sep 2013 22:33:49 +0000 (15:33 -0700)]
i965: Define vtbl method that initializes an untyped R/W surface.
And add Gen7 implementation.
v2: Fix off by one error in buffer size calculation.
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Francisco Jerez [Mon, 30 Sep 2013 19:54:57 +0000 (12:54 -0700)]
glsl: Fix the function inlining pass to deal with general opaque arguments.
Almost a trivial change, it boils down to renaming a few identifiers
so their names still make sense for opaque types other than sampler.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Francisco Jerez [Sun, 20 Oct 2013 19:39:16 +0000 (12:39 -0700)]
glsl: Add built-in functions and constants required for ARB_shader_atomic_counters.
v2: Represent atomics as GLSL intrinsics.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Francisco Jerez [Wed, 25 Sep 2013 18:55:06 +0000 (11:55 -0700)]
glsl: Basic support for built-in intrinsics.
Fix the linker to deal with intrinsic functions which are undefined
all the way down to the driver back-end, and introduce intrinsic
definition helpers in the built-in generator.
We still need to figure out what kind of interface we want for drivers
to communicate to the GLSL front-end which of the supported intrinsics
should use a default GLSL implementation and which should use a
hardware-specific override. As there's no default GLSL implementation
for atomic ops, this seems like something we can worry about later on.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
v2: Define local helper function to generate ir_call nodes in the
builtin generator.
Francisco Jerez [Fri, 20 Sep 2013 21:58:03 +0000 (14:58 -0700)]
glsl: Add type predicate to check whether a type contains any opaque types.
And use it to forbid comparisons of opaque operands. According to the
GL 4.2 specification:
> Except for array indexing, structure member selection, and
> parentheses, opaque variables are not allowed to be operands in
> expressions.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Francisco Jerez [Sun, 20 Oct 2013 19:35:47 +0000 (12:35 -0700)]
glsl: Add new atomic_uint built-in GLSL type.
v2: Fix GLSL version in which the type became available. Add
contains_atomic() convenience method. Split off atomic counter
comparison error checking to a separate patch that will handle all
opaque types. Include new ir_variable fields for atomic types.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Francisco Jerez [Tue, 8 Oct 2013 01:55:18 +0000 (18:55 -0700)]
glsl: Add extension enables for ARB_shader_atomic_counters.
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Francisco Jerez [Tue, 8 Oct 2013 01:53:40 +0000 (18:53 -0700)]
mesa: Add support for ARB_shader_atomic_counters.
This patch implements the common support code required for the
ARB_shader_atomic_counters extension. It defines the necessary data
structures for tracking atomic counter buffer objects (from now on
"ABOs") associated with some specific context or shader program, it
implements support for binding buffers to an ABO binding point and
querying the existing atomic counters and buffers declared by GLSL
shaders.
v2: Fix extension checks. Drop unused MAX_ATOMIC_BUFFERS constant.
Acked-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Francisco Jerez [Wed, 11 Sep 2013 18:31:01 +0000 (11:31 -0700)]
glapi: Add support for ARB_shader_atomic_counters.
Add XML file for the dispatch code generator, update the
dispatch_sanity test and add stub definition for the new entry point.
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Francisco Jerez [Wed, 23 Oct 2013 18:16:26 +0000 (11:16 -0700)]
i965: Handle deallocation of some private ralloc contexts explicitly.
These ralloc contexts belong to a specific object and are being
deallocated manually from the class destructor. Now that we've hooked
up destructors to ralloc there's no reason for them to be children of
any other context, and doing so might to lead to double frees under
some circumstances. The class destructor has all the responsibility
of freeing class memory resources now.
Francisco Jerez [Wed, 9 Oct 2013 18:02:51 +0000 (11:02 -0700)]
ralloc: Hook up C++ destructors to ralloc when necessary.
This patch makes sure that class destructors are called as they should
be when a C++ object allocated by ralloc is released.
Based on a previous patch by Kenneth Graunke, but it doesn't exhibit
the ~0.8% performance regression in shader compilation times because
we now use the HAS_TRIVIAL_DESTRUCTOR() macro to detect the typical
case where the indirect function call can be avoided because the
object's destructor doesn't need to do anything.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Francisco Jerez [Wed, 9 Oct 2013 17:37:21 +0000 (10:37 -0700)]
mesa: Define introspection macro to determine whether a type is trivially destructible.
Only implemented on GCC and Clang for now. Other compilers use a
dummy implementation that always returns false, which should be a safe
[but slightly inefficient] assumption in all cases.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Paul Berry [Sat, 26 Oct 2013 17:25:46 +0000 (10:25 -0700)]
glsl: Generalize MSVC fix for strcasecmp().
This will let us use strcasecmp() from anywhere inside Mesa without
having to worry about the fact that it doesn't exist in MSVC.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Roland Scheidegger [Sat, 26 Oct 2013 02:22:55 +0000 (04:22 +0200)]
llvmpipe: fix bogus layer clamping in setup
The layer coming from GS needs to be clamped (not sure if that's actually
the correct error behavior but we need something) as the number can be higher
than the amount of layers in the fb. However, this code was using the layer
calculation from the scene, and this was actually calculated in
lp_scene_begin_rasterization() hence too late (so setup was using the value
from the _previous_ scene or just zero if it was the first scene).
Since the value is used in both rasterization and setup, move calculation up
to lp_scene_begin_binning() though it's a bit more inconvenient to calculate
there. (Theoretically could move _all_ code which was in
lp_scene_begin_rasterization() to there, because ever since we got rid of
swizzled render/depth buffers our "map" functions preparing the fb data for
render don't actually change the data in there at all, but it feels like
it would be a hack.)
v2: improve comments
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Matthew McClure [Tue, 22 Oct 2013 22:48:00 +0000 (15:48 -0700)]
util,llvmpipe: correctly set the minimum representable depth value
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Brian Paul [Tue, 29 Oct 2013 00:33:32 +0000 (18:33 -0600)]
st/mesa: move out of memory check in st_draw_vbo()
Before we were only checking the st->vertex_array_out_of_memory flag
after updating array state. But if there's two consecutive glDrawArrays
calls and the first one is skipped because of OOM, the second one should
be skipped too.
Cc: 9.2 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Brian Paul [Mon, 28 Oct 2013 15:43:08 +0000 (09:43 -0600)]
svga: reindent drawing code
Eric Anholt [Mon, 21 Oct 2013 17:57:29 +0000 (10:57 -0700)]
i965/vec4: Reduce working set size of live variables computation.
Orbital Explorer was generating a 4000 instruction geometry shader, which
was taking 275 trips through dead code elimination and register
coalescing, each of which updated live variables to get its work done, and
invalidated those live variables afterwards.
By using bitfields instead of bools (reducing the working set size by a
factor of 8) in live variables analysis, it drops from 88% of the profile
to 57%, and reduces overall runtime from I-got-bored-and-killed-it (Paul
says 3+ minutes) to 10.5 seconds.
Compare to
f179f419d1d0a03fad36c2b0a58e8b853bae6118 on the FS side.
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Vadim Girlin [Tue, 29 Oct 2013 01:49:21 +0000 (05:49 +0400)]
r600g/sb: fix value::is_fixed()
This prevents unnecessary (and wrong) register allocation in the
scheduler for preloaded values in fixed registers.
Fixes interpolation-mixed.shader_test on rv770
(and probably on all other pre-evergreen chips).
Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
Eric Anholt [Tue, 22 Oct 2013 00:01:49 +0000 (17:01 -0700)]
glsl: Drop no-op shifts involving 0.
I noticed this in a shader in Unigine Heaven that was spilling. While it
doesn't really reduce register pressure, it shaves a few instructions
anyway (7955 -> 7882).
v2: Fix turning "0 >> x" into "x" instead of "0" (caught by Erik
Faye-Lund).
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Eric Anholt [Thu, 24 Oct 2013 22:03:45 +0000 (15:03 -0700)]
glsl: Use ir_builder more in opt_algebraic.
While ir_builder is slightly less efficient, we're only increasing the
work when there's actual optimization being done, and it's way more
readable code.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Eric Anholt [Thu, 24 Oct 2013 21:55:50 +0000 (14:55 -0700)]
glsl: Move common code out of opt_algebraic's handle_expression().
Matt and I had each screwed up these common required patterns recently, in
ways that wouldn't have been noticed for a long time if not for code
review. Just enforce it in the caller so that we don't rely on code
review catching these bugs.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Carl Worth [Thu, 17 Oct 2013 17:54:56 +0000 (10:54 -0700)]
Remove error when calling glGenQueries/glDeleteQueries while a query is active
There is nothing in the OpenGL specification which prevents the user from
calling glGenQueries to generate a new query object while another object is
active. Neither is there anything in the Mesa implementation which prevents
this. So remove the INVALID_OPERATION errors in this case.
Similarly, it is explicitly allowed by the OpenGL specification to delete an
active query, so remove the assertion for that case, replacing it with the
necesssary state updates to end the query, (clear the bindpt pointer and call
into the driver's EndQuery hook).
CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
Kenneth Graunke [Tue, 13 Aug 2013 20:57:13 +0000 (13:57 -0700)]
i965: Also emit HiZ and Stencil packets when disabling depth on Gen6.
The normal drawing path does this, and it's necessary on Ivybridge,
so let's try it on Sandybridge too. It's not explicitly documented
as necessary, but might help with hangs.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Xinkai Chen <yeled.nova@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
Kenneth Graunke [Tue, 13 Aug 2013 20:54:37 +0000 (13:54 -0700)]
i965: Also emit HIER_DEPTH and STENCIL packets when disabling depth.
From the documentation:
"[DevIVB] 3DSTATE_DEPTH_BUFFER must always be programmed along with the
other Depth/Stencil state commands(i.e. 3DSTATE_CLEAR_PARAMS,
3DSTATE_STENCIL_BUFFER, or 3DSTATE_HIER_DEPTH_BUFFER)."
We normally do this, but BLORP was failing to do so in the case where it
disables depth.
Not observed to fix anything yet.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Xinkai Chen <yeled.nova@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
Kenneth Graunke [Thu, 24 Oct 2013 07:38:27 +0000 (00:38 -0700)]
i965: Move post-sync non-zero flush for 3DSTATE_MULTISAMPLE.
For some reason, we put the flush in the caller, rather than just before
emitting the packet. This is more than a cosmetic problem: BLORP calls
gen6_emit_3dstate_multisample() directly, and so it missed the flush.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Xinkai Chen <yeled.nova@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
Kenneth Graunke [Thu, 24 Oct 2013 07:45:56 +0000 (00:45 -0700)]
i965: Also guard 3DSTATE_DRAWING_RECTANGLE with a flush in blorp.
Non-pipelined commands need this flush.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Xinkai Chen <yeled.nova@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
Kenneth Graunke [Thu, 24 Oct 2013 07:36:42 +0000 (00:36 -0700)]
i965: Emit post-sync non-zero flush before 3DSTATE_DRAWING_RECTANGLE.
This is another non-pipelined command that needs a flush on Sandybridge.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Xinkai Chen <yeled.nova@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
Kenneth Graunke [Thu, 24 Oct 2013 07:32:52 +0000 (00:32 -0700)]
i965: Emit post-sync non-zero flush before 3DSTATE_GS_SVB_INDEX.
From the comments above intel_emit_post_sync_nonzero_flush:
"[DevSNB-C+{W/A}] Before any depth stall flush (including those
produced by non-pipelined state commands), software needs to first
send a PIPE_CONTROL with no bits set except Post-Sync Operation != 0."
This suggests that every non-pipelined (0x79xx) command needs a
post-sync non-zero flush before it.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Xinkai Chen <yeled.nova@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
Daniel Vetter [Wed, 9 Oct 2013 13:49:11 +0000 (15:49 +0200)]
i965: CS writes/reads should use I915_GEM_INSTRUCTION
Otherwise the gen6 w/a in the kernel won't kick in and the write will
land nowhere.
Inspired by a patch Ken pointed me at which had the same issue (but
isn't yet merged and also for a gen7+ feature). An audit of the entire
driver didn't reveal any other case than the one in in the write_reg
helper used by the gen6 queryobj code.
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Tested-by: Xinkai Chen <yeled.nova@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
Anuj Phogat [Fri, 18 Oct 2013 23:07:42 +0000 (16:07 -0700)]
i965: Do not set bilinear_filter flag in case of multisample blits
Setting bilinear_filter flag in case of multisample blits with
GL_LINEAR filter causes incorrect behavior in translate_dst_to_src()
function. This broke Modern Warfare (1, 2 and 3) on SNB, IVB and HSW.
Tested on SNB and IVB, no Piglit regressions. Trace file of the game
(taken with apitrace) works fine with this patch.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=69078
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reported-by: Armin K <krejzi@email.com>
Tested-by: Armin K <krejzi@email.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Rico Schüller [Sun, 27 Oct 2013 14:02:00 +0000 (08:02 -0600)]
mesa: Remove trailing whitespace in texparam.c
Signed-off-by: Rico Schüller <kgbricola@web.de>
Signed-off-by: Brian Paul <brianp@vmware.com>
Brian Paul [Sat, 26 Oct 2013 14:11:46 +0000 (08:11 -0600)]
mesa: use void in _mesa_VDPAUFiniNV() as in the header file
Timothy Arceri [Wed, 23 Oct 2013 10:31:27 +0000 (21:31 +1100)]
glsl: Add check for unsized arrays to glsl types
The main purpose of this patch is to increase readability of
the array code by introducing is_unsized_array() to glsl_types.
Some redundent is_array() checks are also removed, and small number
of other related clean ups.
The introduction of is_unsized_array() should also make the
ARB_arrays_of_arrays code simpler and more readable when it arrives.
V2: Also replace code that checks for unsized arrays directly with the
length variable
Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
v3 (Paul Berry <stereotype441@gmail.com>): clean up formatting.
Separate whitespace cleanups to their own patch.
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Timothy Arceri [Wed, 23 Oct 2013 10:31:27 +0000 (21:31 +1100)]
glsl: whitespace cleanups.
Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
v2 (Paul Berry <stereotype441@gmail.com>): Separate from "glsl: Add
check for unsized arrays to glsl types".
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Timothy Arceri [Tue, 22 Oct 2013 11:38:12 +0000 (22:38 +1100)]
glsl: Fix comment
Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Christian König [Tue, 24 Sep 2013 09:03:33 +0000 (03:03 -0600)]
vl/h264: split fields into SPS/PPS
Add alot of missing fields as well.
Signed-off-by: Christian König <christian.koenig@amd.com>
Christian König [Thu, 24 Oct 2013 11:12:58 +0000 (05:12 -0600)]
radeon/uvd: fix H264 chroma format handling
Signed-off-by: Christian König <christian.koenig@amd.com>
Christian König [Thu, 24 Oct 2013 11:47:08 +0000 (05:47 -0600)]
vl: add 400 chroma format as well
Signed-off-by: Christian König <christian.koenig@amd.com>
Chia-I Wu [Mon, 28 Oct 2013 03:18:43 +0000 (11:18 +0800)]
ilo: minor cleanups for recent interface changes
Kill ilo_bind_sampler_states2 and ilo_set_sampler_views2. Map
PIPE_FORMAT_R10G10B10A2_UINT to BRW_SURFACEFORMAT_R10G10B10A2_UINT.
Timothy Arceri [Thu, 17 Oct 2013 11:42:18 +0000 (22:42 +1100)]
glsl: Move error message inside validation check reducing duplicate message handling
v2 (Paul Berry <stereotype441@gmail.com): Fix precedence error in call
to _mesa_glsl_error().
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Paul Berry [Wed, 23 Oct 2013 03:34:30 +0000 (20:34 -0700)]
i965: Make fs gl_PrimitiveID input work even when there's no gs.
When a geometry shader is present, the fragment shader gl_PrimitiveID
input acts like an ordinary varying, receiving data from the gs
gl_PrimitiveID output. When there's no geometry shader, we have to
ask the fixed function SF hardware to provide the primitive ID to the
fragment shader instead.
Previously, the SF setup code would handle this situation by
recognizing that the FS gl_PrimitiveID input didn't match to any VS
output; since normally an FS input with no corresponding VS output
leads to undefined data, the SF setup code used to just arbitrarily
assign it to receive data from attribute 0.
This patch changes the SF setup code so that instead of arbitrarily
using attribute 0, it assigns the unmatched FS input to receive
gl_PrimitiveID. In the case where the FS input really is
gl_PrimitiveID, this produces the intended result. In all other
cases, no harm is done since GL specifies that the behaviour is
undefined.
Fixes piglit test primitive-id-no-gs.
v2: If an attribute is already being overridden with point
coordinates, don't try to also override it with gl_PrimitiveID. This
is necessary to avoid regressing piglit tests such as
shaders/glsl-fs-pointcoord.
Reviewed-by: Eric Anholt <eric@anholt.net>
Vinson Lee [Sun, 27 Oct 2013 06:09:30 +0000 (23:09 -0700)]
mesa: Add GL_NV_vdpau_interop functions to dispatch_sanity.cpp.
Fixes 'make check' failures introduced with commit
80964226e9b8a05c39157f9305c06c0b2861e080.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70900
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Brian Paul [Sat, 26 Oct 2013 13:17:53 +0000 (07:17 -0600)]
mesa: add vdpau.c and st_vdpau.c to src/mesa/SConscript
Fixes SCons build.
Christian König [Wed, 15 May 2013 13:10:11 +0000 (15:10 +0200)]
implement NV_vdpau_interop v7
v2: Actually implement interop between the gallium
state tracker and the VDPAU backend.
v3: Make it also available in non legacy contexts,
fix video buffer sharing.
v4: deny interop if we don't have the same screen object
v5: rebased on upstream changes
v6: implemented VDPAUGetSurfaceivNV, improved error handling,
unregister all surfaces in VDPAUFiniNV
v7: squash merge with Mareks changes
Signed-off-by: Christian König <christian.koenig@amd.com>
Christian König [Fri, 11 Oct 2013 09:07:44 +0000 (11:07 +0200)]
winsys/radeon: make radeon_drm_winsys_create public
Otherwise OpenGL/VDPAU interop won't work as expected.
Signed-off-by: Christian König <christian.koenig@amd.com>
Chris Forbes [Sat, 12 Oct 2013 11:02:04 +0000 (00:02 +1300)]
i965: Remove ir_txf coord+offset special case in visitors
Just let it be handled by the lowering pass.
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Chris Forbes [Sat, 12 Oct 2013 11:02:55 +0000 (00:02 +1300)]
i965: Generalize coord+offset lowering pass for ir_txf
ir_txf expects an ivec* coordinate, and may be larger than ivec2;
shuffle things around so that this will work.
V2: Fix style nits, use ir_builder
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Chris Forbes [Sat, 12 Oct 2013 10:14:15 +0000 (23:14 +1300)]
i965: Add lowering pass to fold offset into unnormalized coords
It turns out that nonzero offsets with gsampler2DRect don't work -- they
just return garbage. Work around this by folding the offset into the
coord.
Done as an IR pass rather than yet another hack in the visitors because
it's clear what's going on this way. Can possibly reuse this to replace
the existing txf coord+offset hacks.
V2: Use ir_builder
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Chris Forbes [Thu, 10 Oct 2013 09:15:14 +0000 (22:15 +1300)]
i965: Add lowering pass for splitting textureGatherOffsets
Rewrites textureGatherOffsets(s, p, offsets) into
gvec4(
textureGatherOffset(s, p, offsets[0]).w,
textureGatherOffset(s, p, offsets[1]).w,
textureGatherOffset(s, p, offsets[2]).w,
textureGatherOffset(s, p, offsets[3]).w
)
V2: Use ir_builder to be slightly clearer.
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Chris Forbes [Thu, 10 Oct 2013 08:40:46 +0000 (21:40 +1300)]
i965: Add asserts to ensure that ir_tg4 offset arrays are lowered
We don't have a message that does 4 independent offsets; a lowering
pass needs to lower it to 4 normal gather4s before reaching this
point.
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Chris Forbes [Thu, 10 Oct 2013 08:38:43 +0000 (21:38 +1300)]
glsl: add signatures for textureGatherOffsets()
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Chris Forbes [Thu, 10 Oct 2013 08:34:03 +0000 (21:34 +1300)]
glsl: add support for texture functions with offset arrays
This is needed for textureGatherOffsets()
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Chris Forbes [Thu, 10 Oct 2013 06:57:29 +0000 (19:57 +1300)]
i965/fs: Add support for shadow comparitors with gather4
Note that gather4_po_c's parameters are too long for SIMD16. It might be
worth emitting 2xSIMD8 messages in this case at some point.
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Chris Forbes [Thu, 10 Oct 2013 06:42:47 +0000 (19:42 +1300)]
i965/vs: Add support for shadow comparitors with gather4
gather4_c's argument layout is straightforward -- refz just goes on the
end.
gather4_po_c's layout however -- the array index is replaced with refz.
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Chris Forbes [Thu, 10 Oct 2013 06:39:54 +0000 (19:39 +1300)]
i965: Add Gen7 gather4_c and gather4_po_c message types
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Chris Forbes [Thu, 10 Oct 2013 06:35:36 +0000 (19:35 +1300)]
glsl: Add new textureGather[Offset]() overloads for shadow samplers
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Chris Forbes [Thu, 10 Oct 2013 06:32:34 +0000 (19:32 +1300)]
glsl: Add support for separate reference Z for shadow samplers
ARB_gpu_shader5's textureGather*() functions which take shadow samplers
have a separate `refz` parameter rather than adding it to the
coordinate.
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Chris Forbes [Tue, 8 Oct 2013 09:19:58 +0000 (22:19 +1300)]
i965/vs: add support for gather4 with nonconstant offsets
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Chris Forbes [Tue, 8 Oct 2013 09:10:34 +0000 (22:10 +1300)]
i965/fs: add support for gather4 with nonconstant offsets
V3: fixup crazy check for whether we need to emit the coordinate after
custom handling.
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Chris Forbes [Tue, 8 Oct 2013 09:09:28 +0000 (22:09 +1300)]
i965: relax brw_texture_offset assert
Some texturing ops are about to have nonconstant offset support; the
offset in the header in these cases should be zero.
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Chris Forbes [Tue, 8 Oct 2013 08:42:10 +0000 (21:42 +1300)]
i965: Add SHADER_OPCODE_TG4_OFFSET for gather with nonconstant offsets.
The generator code ends up clearer this way than if we had to sniff
via the message length. Implemented via the gather4_po message in
hardware, which is present in Gen7 and later.
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Chris Forbes [Tue, 8 Oct 2013 08:34:22 +0000 (21:34 +1300)]
i965: add missing tg4 case in brw_instruction_name
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Chris Forbes [Sun, 6 Oct 2013 01:26:01 +0000 (14:26 +1300)]
glsl: relax const offset requirement for textureGatherOffset
Prior to ARB_gpu_shader5 / GLSL 4.0, the offset is required to be
a constant expression.
With that extension, it is relaxed to be an arbitrary expression.
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Chris Forbes [Sun, 6 Oct 2013 00:23:59 +0000 (13:23 +1300)]
glsl: Add ARB_gpu_shader5 textureGatherOffset signatures
- gsampler2DRect
- optional `comp` parameter
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Kenneth Graunke [Tue, 28 May 2013 02:18:14 +0000 (19:18 -0700)]
i965: Weaken the flushing in gen7_end_transform_feedback().
Since
062317d6671 (i965: Go back to using the kernel SOL reset feature.)
we've been flushing the batch on BeginTransformFeedback(). So it's not
necessary to do it on EndTransformFeedback(). A PIPE_CONTROL will work.
This makes gen7_end_transform_feedback() exactly the same as the gen6
variant. However, they'll diverge again shortly.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Eric Anholt [Tue, 22 Oct 2013 19:38:14 +0000 (12:38 -0700)]
i965/fs: Stop trying to hack around MRF dep chains on gen7+ LIFO scheduling.
This was a hack to avoid choosing to schedule all texturing before
consumption of any texture results due to the way dependency chains worked
out in the presence of MRFs. On gen7, we don't have MRFs, so the problem
doesn't apply, and this was just badly constraining our scheduling.
total instructions in shared programs:
1615306 ->
1612534 (-0.17%)
instructions in affected programs: 9958 -> 7186 (-27.84%)
GAINED: 259
LOST: 9
Reviewed-by: Matt Turner <mattst88@gmail.com>
Eric Anholt [Tue, 22 Oct 2013 19:27:06 +0000 (12:27 -0700)]
i965: Try not to reverse-schedule things when doing LIFO scheduling.
The LIFO plan was simple: Take the most recently made available
instructions, and pick those first.
But because of the order we were pushing things onto our list of
available-to-schedule instructions, it meant that when a set of
instructions was made available at the same time (for example, everything
at the start of the program that didn't depend on other instructions) we'd
schedule them in reverse order.
If you had 10 texture calls in a row in your program, each with
independent argument setup, we'd set up the last texture call's args and
execute it first, even though we wouldn't be able to consume its results
until we'd finished the other 9 texture calls (assuming consumption of
texture results happens near each texture call, and combines it with
another texture result, which is normal for a convolution shader).
To fix this, walk the list for doing LIFO in the order that instructions
were originally generated in the program, but choose to push
newly-made-available instructions to the other end of the list instead.
total instructions in shared programs:
1587242 ->
1586290 (-0.06%)
instructions in affected programs: 7801 -> 6849 (-12.20%)
GAINED: 76
LOST: 67
Thanks to Chia-I Wu for pointing out the bug in my first version of the
patch that made it a huge loss.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Ilia Mirkin [Fri, 4 Oct 2013 08:32:16 +0000 (04:32 -0400)]
mesa/st: disable ARB_framebuffer_object when no driver support.
When PIPE_CAP_MIXED_FRAMEBUFFER_SIZES is not provided, parts of
ARB_framebuffer_object can't be supported, such as on NV30.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
Ilia Mirkin [Fri, 4 Oct 2013 08:32:15 +0000 (04:32 -0400)]
gallium: add PIPE_CAP_MIXED_FRAMEBUFFER_SIZES
This CAP will determine whether ARB_framebuffer_object can be enabled.
The nv30 driver does not allow mixing swizzled and linear zsbuf/cbuf
textures.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
Adam Jackson [Fri, 25 Oct 2013 19:12:04 +0000 (15:12 -0400)]
glx: Fix return value from indirect_bind_context
_XReply returns 1 on success, but indirect_bind_context returns 0 on
success.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70486
Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Matt Turner [Wed, 23 Oct 2013 23:42:34 +0000 (16:42 -0700)]
glsl: Optimize (not A) and (not B) into not (A or B).
No shader-db changes, but seems like a good idea.
Reviewed-by: Eric Anholt <eric@anholt.net>
Matt Turner [Wed, 23 Oct 2013 23:40:16 +0000 (16:40 -0700)]
glsl: Optimize (not A) or (not B) into not (A and B).
A few Serious Sam 3 shaders affected:
instructions in affected programs: 4384 -> 4344 (-0.91%)
Reviewed-by: Eric Anholt <eric@anholt.net>
Matt Turner [Fri, 18 Oct 2013 23:02:11 +0000 (16:02 -0700)]
i965/fs: Match commutative expressions with reversed arguments.
total instructions in shared programs:
1645011 ->
1644938 (-0.00%)
instructions in affected programs: 17543 -> 17470 (-0.42%)
Reviewed-by: Eric Anholt <eric@anholt.net>
Matt Turner [Sat, 19 Oct 2013 23:40:19 +0000 (16:40 -0700)]
i965: s/Muchnik/Muchnick/.
Reviewed-by: Eric Anholt <eric@anholt.net>
Marek Olšák [Tue, 8 Oct 2013 19:50:43 +0000 (21:50 +0200)]
r600g,radeonsi: use fences provided by the winsys
Marek Olšák [Tue, 8 Oct 2013 19:26:34 +0000 (21:26 +0200)]
winsys/radeon: add the implementation of fences from r300g
Marek Olšák [Wed, 23 Oct 2013 14:10:38 +0000 (16:10 +0200)]
radeonsi: add the vertex shader position output if it's missing
This fixes a lockup in piglit/spec/glsl-1.40/execution/tf-no-position.
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Marek Olšák [Tue, 22 Oct 2013 20:05:35 +0000 (22:05 +0200)]
radeonsi: respect semantic indices for COLOR[i] fragment shader outputs
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Paul Berry [Tue, 15 Oct 2013 21:56:28 +0000 (14:56 -0700)]
glsl: When disabling gl_PerVertex variables, check that mode matches.
In commit
1b4a737 (glsl: Support redeclaration of VS and GS
gl_PerVertex output), I added code to ensure that when an unnamed
gl_PerVertex interface block is redeclared, any ir_variables that
weren't included in the redeclaration are removed from the IR (and the
symbol table). This ensures that only those variables that were
explicitly redeclared may be used.
However, when I wrote this code, I neglected to match the variable
mode when finding variables to remove. This meant that redeclaring a
built-in output block might cause the built-in input gl_in to be
accidentally removed.
Fixes piglit test gs-redeclares-pervertex-out-only.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Paul Berry [Tue, 15 Oct 2013 22:13:59 +0000 (15:13 -0700)]
glsl: Remove unused gl_PerVertex interface blocks.
The GLSL 4.10 rules for redeclaration of built-in interface blocks
(which we've chosen to regard as clarifications of GLSL 1.50) only
require gl_PerVertex blocks to match in shaders that actually use
those blocks. The easiest way to implement this is to detect
situations where a compiled shader doesn't refer to any elements of
gl_PerVertex, and remove all the associated ir_variables from the
shader at the end of ast-to-ir conversion.
Fixes piglit tests
linker/interstage-{pervertex,pervertex-in,pervertex-out}-redeclaration-unneeded.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Paul Berry [Tue, 15 Oct 2013 23:48:59 +0000 (16:48 -0700)]
glsl: Call check_builtin_array_max_size when redeclaring gl_in.
Normally when a built-in array (such as gl_ClipDistance) is
redeclared, we call get_variable_being_redeclared() to do the
redeclaration, and it in turn calls check_builtin_array_max_size() to
make sure that the redeclared array size isn't too large.
However when a built-in array is redeclared as part of redeclaring
gl_in, we don't call get_variable_being_redeclared() (since the
individual built-ins aren't each represented by their own ir_variable
anymore). So we need to add an explicit call to
check_builtin_array_max_size() to make sure the new array size isn't
too large.
Note: at the moment this is redundant with a test that's done at link
time, so there's no change to piglit results. But the patch that
follows will prevent link errors from being reported if gl_PerVertex
isn't used, so in order to prevent that patch from causing
regressions, we need to add the compile check now. Besides, it's
nicer to report this error at compile time anyhow.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Paul Berry [Wed, 16 Oct 2013 18:01:42 +0000 (11:01 -0700)]
mesa: Fix geometry shader program queries.
The queries GEOMETRY_VERTICES_OUT, GEOMETRY_INPUT_TYPE, and
GEOMETRY_OUTPUT_TYPE (defined by GL 3.2) differ from the corresponding
queries in ARB_geometry_shader4 in the following ways:
- They use different enum values
- They can only be queried; they cannot be set.
- Attempting to query them yields INVALID_OPERATION if the program is
not linked, or lacks a geometry shader.
This patch switches us over from the ARB_geometry_shader4 behaviour to
the GL 3.2 behaviour.
Fixes piglit test query-gs-prim-types.
v2: Improve comment above has_core_gs.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Paul Berry [Tue, 22 Oct 2013 04:09:47 +0000 (21:09 -0700)]
glsl: Account for interface block lowering in program_resource_visitor.
When program_resource_visitor visits variables that were created by
lower_named_interface_blocks, it needs to do extra work to un-do the
effects of lower_named_interface_blocks and construct the proper API
names.
Fixes piglit test
spec/glsl-1.50/execution/interface-blocks-api-access-members.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Paul Berry [Tue, 22 Oct 2013 03:27:23 +0000 (20:27 -0700)]
glsl: mark variables produced by lower_named_interface_blocks.
These variables will need to be treated specially by
program_resource_visitor, so that they can be addressed through the
API using their interface block name (and array index, for interface
block arrays).
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Paul Berry [Tue, 22 Oct 2013 22:11:51 +0000 (15:11 -0700)]
glsl: Keep track of centroid/interpolation mode for interface block members.
Fixes piglit tests:
- interface-block-interpolation-{array,named,unnamed}
- glsl-1.50-interface-block-centroid {array,named,unnamed}
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Paul Berry [Tue, 22 Oct 2013 22:03:29 +0000 (15:03 -0700)]
glsl: Pass variable mode into ast_process_structure_or_interface_block().
Later patches will use this information to do proper error checking of
interpolation qualifiers that appear inside of interface blocks.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Paul Berry [Tue, 22 Oct 2013 21:54:10 +0000 (14:54 -0700)]
glsl: Extract interpretation of interpolation to its own function.
In future patches, we will need this in order to interpret
interpolation qualifiers that appear inside interface blocks.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Paul Berry [Tue, 22 Oct 2013 21:48:08 +0000 (14:48 -0700)]
glsl: Pull interpolation_string() out of ir_variable.
Future patches will need to call this function when there isn't an
ir_varible present to refer to.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>