mesa.git
11 years agomesa: Make detach_renderbuffer available outside fbobject.c
Ian Romanick [Thu, 8 Aug 2013 22:26:36 +0000 (15:26 -0700)]
mesa: Make detach_renderbuffer available outside fbobject.c

Also add a return value indicating whether any work was done.

This will be used by the next patch.

v2: Move 'fb->Attachment[i].Texture == att' check to the next
patch... where it was intended to be in the first place.  Noticed by
Chad.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
11 years agometa: Don't call _mesa_Ortho with width or height of 0
Ian Romanick [Thu, 8 Aug 2013 19:33:04 +0000 (12:33 -0700)]
meta: Don't call _mesa_Ortho with width or height of 0

Fixes failures in oglconform fbo mipmap.manual.color,
mipmap.manual.colorAndDepth, mipmap.automatic, and
mipmap.manualIterateTexTargets subtests.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
11 years agor600g/sb: use MULADD workaround on R7xx for MULADD_IEEE
Vadim Girlin [Sat, 10 Aug 2013 22:52:34 +0000 (02:52 +0400)]
r600g/sb: use MULADD workaround on R7xx for MULADD_IEEE

Looks like the same issue that was seen with MULADD in trans slot on
R7xx also affects MULADD_IEEE (maybe all OP3 instructions and MULADD is
just a most frequently used?). So the workaround is to not allow affected
instructions to be placed into the trans slot.

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

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
11 years agogallivm: implement new float comparison instructions returning integer masks
Roland Scheidegger [Mon, 12 Aug 2013 23:16:42 +0000 (01:16 +0200)]
gallivm: implement new float comparison instructions returning integer masks

FSEQ/FSGE/FSLT/FSNE work just the same as SEQ/SGE/SLT/SNE except skip the
select.
And just for consistency use the same appropriate ordered/unordered comparisons
for the old opcodes as well.

Reviewed-by: Zack Rusin <zackr@vmware.com>
11 years agotgsi: implement new float comparison instructions returning integer masks
Roland Scheidegger [Mon, 12 Aug 2013 23:10:59 +0000 (01:10 +0200)]
tgsi: implement new float comparison instructions returning integer masks

Also while here add a bunch of other forgotten (integer) instructions to
tgsi_util_get_inst_usage_mask() (which isn't used for much except optimizing
away unused input components), though it may still be incomplete.

Reviewed-by: Zack Rusin <zackr@vmware.com>
11 years agogallium: add new float comparison instructions returning integer masks
Roland Scheidegger [Mon, 12 Aug 2013 23:07:51 +0000 (01:07 +0200)]
gallium: add new float comparison instructions returning integer masks

Newer graphic languages don't want messy float mask results but instead true
"boolean" mask results for float comparisons. Otherwise just need to convert
the floats back to integers. Need to keep the old opcodes however due to both
legacy (gl and d3d9) needing them and because older hw can't really deal with
integers. These new FSEQ/FSGE/FSLT/FSNE opcodes are part of integer API and
hence must be supported if a driver claims to support glsl 1.30 (or
PIPE_SHADER_CAP_INTEGERS).

Reviewed-by: Zack Rusin <zackr@vmware.com>
11 years agoilo: enable dumping of WM PCB
Chia-I Wu [Wed, 17 Jul 2013 21:42:21 +0000 (05:42 +0800)]
ilo: enable dumping of WM PCB

It was disabled because it wasn't supported.

11 years agoilo: no binding table change when constants are pushed
Chia-I Wu [Tue, 13 Aug 2013 08:11:27 +0000 (16:11 +0800)]
ilo: no binding table change when constants are pushed

When constants can be pushed, and nothing else requires new SURFACE_STATEs,
there is no need to emit BINDING_TABLE_STATE.

11 years agoilo: support push constant model in shaders
Chia-I Wu [Wed, 17 Jul 2013 21:58:45 +0000 (05:58 +0800)]
ilo: support push constant model in shaders

Source constants from URB constant data when the constant data can fit in the
PCB.

11 years agoilo: support copying constant buffer 0 to PCB
Chia-I Wu [Wed, 17 Jul 2013 21:58:42 +0000 (05:58 +0800)]
ilo: support copying constant buffer 0 to PCB

Add ILO_KERNEL_PCB_CBUF0_SIZE so that a kernel can specify how many bytes of
constant buffer 0 need to be copied to PCB.

11 years agoilo: make constant buffer 0 upload optional
Chia-I Wu [Wed, 17 Jul 2013 21:43:00 +0000 (05:43 +0800)]
ilo: make constant buffer 0 upload optional

Add ILO_KERNEL_SKIP_CBUF0_UPLOAD so that we can skip constant buffer 0 upload
when the kernel does not need it.

11 years agoRevert "ilo: initialize constant buffer SURFACE_STATE early"
Chia-I Wu [Tue, 13 Aug 2013 07:23:41 +0000 (15:23 +0800)]
Revert "ilo: initialize constant buffer SURFACE_STATE early"

This reverts commit a9b800aa81cffdcaef2490ff49986099feae2663.  With push
constant support, the constructed SURFACE_STATE is unused and wasted.  The
change only slows things down.

11 years agogbm: Link to libwayland-drm if Wayland EGL platform is enabled
Armin K [Sun, 11 Aug 2013 15:27:23 +0000 (17:27 +0200)]
gbm: Link to libwayland-drm if Wayland EGL platform is enabled

We were relying on libEGL to pull in libwayland-client symbols, but with
commit 2c2e64edaba0f6aeb181ca5b51eb8dea8e9b39f9 cleaned up the
symbol leak.

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

11 years agogallivm: fix exec_mask interaction with geometry shader after end of main
Roland Scheidegger [Mon, 12 Aug 2013 19:18:58 +0000 (21:18 +0200)]
gallivm: fix exec_mask interaction with geometry shader after end of main

Because we must maintain an exec_mask even if there's currently nothing
on the mask stack, we can still have an exec_mask at the end of the program.
Effectively, this mask should be set back to default when returning from main.
Without relying on END/RET opcode (I think it's valid to have neither) it is
actually difficult to do this, as there doesn't seem any reasonable place to
do it, so instead let's just say the exec_mask is invalid outside main (which
it really is effectively).
The problem is that geometry shader called end_primitive outside the shader
(in the epilogue), and as a result used a bogus mask, leading to bugs if we
had to set the (somewhat misnamed) ret_in_main bit anywhere. So just avoid
the mask combining function when called from outside the shader.

Reviewed-by: Zack Rusin <zackr@vmware.com>
11 years agodraw: simplify prim mask construction
Roland Scheidegger [Mon, 12 Aug 2013 16:01:18 +0000 (18:01 +0200)]
draw: simplify prim mask construction

The code was quite weird, the second comparison was in fact a complete no-op
and we can also do the comparison with the vector directly instead of scalar,
which should not also be faster but it is way more obvious how that mask
is actually going to look like.

Reviewed-by: Zack Rusin <zackr@vmware.com>
11 years agogallivm: simplify geometry shader mask handling a bit
Roland Scheidegger [Mon, 12 Aug 2013 15:58:39 +0000 (17:58 +0200)]
gallivm: simplify geometry shader mask handling a bit

Instead of reducing masks to 0/1 simply use the mask directly as -1.
Also use some signed comparison instead of unsigned (as far as I understand
these values have to be (very) small and signed means llvm doesn't have to
apply additional logic to do the unsigned comparisons the cpu can't do).
Saves a couple of instructions in some test geometry shader here.

v2: that was a bit to much optimization, don't skip combining the masks...

Reviewed-by: Zack Rusin <zackr@vmware.com>
11 years agodraw: (trivial) dump tgsi for geometry shaders with GALLIVM_DEBUG_TGSI
Roland Scheidegger [Sat, 10 Aug 2013 01:26:54 +0000 (03:26 +0200)]
draw: (trivial) dump tgsi for geometry shaders with GALLIVM_DEBUG_TGSI

And dump the variant key too (same as vs does).
Just so I can stop wondering why I see the tgsi dump for fs and vs but not
gs...

11 years agogallivm: (trivial) fix typo in argument declaration of lp_build_size_query_soa
Roland Scheidegger [Fri, 9 Aug 2013 19:51:37 +0000 (21:51 +0200)]
gallivm: (trivial) fix typo in argument declaration of lp_build_size_query_soa

Was meant to match the name used elsewhere, spotted by Anthony.

11 years agoi965/fs: Add dump_instruction() support for ARF destinations.
Kenneth Graunke [Mon, 5 Aug 2013 05:37:34 +0000 (22:37 -0700)]
i965/fs: Add dump_instruction() support for ARF destinations.

CMP instructions use BRW_ARF_NULL as a destination.  Prior to this
patch, dump_instruction() decoded the destination as "???".

Now it decodes BRW_ARF_NULL as "(null)" and other ARFs numerically.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoi965/fs: Remove extraneous newline in dump_instruction() for CMP.
Kenneth Graunke [Mon, 5 Aug 2013 05:35:01 +0000 (22:35 -0700)]
i965/fs: Remove extraneous newline in dump_instruction() for CMP.

This resulted in printouts like:

   246: cmp.cmod.f0.0
    ???, vgrf152, 0.000000f, (null),

With this patch, CMP is properly printed on one line.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoi965/fs: Optimize IF/MOV/ELSE/MOV/ENDIF to SEL when possible.
Kenneth Graunke [Sun, 4 Aug 2013 09:05:43 +0000 (02:05 -0700)]
i965/fs: Optimize IF/MOV/ELSE/MOV/ENDIF to SEL when possible.

Many GLSL shaders contain code of the form:

   x = condition ? foo : bar

The compiler emits an ir_if tree for this, since each subexpression
might be a complex tree that could have side-effects and short-circuit
logic operations.

However, the common case is to simply pick one of two constants or
variable's values---which is exactly what SEL is for.  Replacing IF/ELSE
with SEL also simplifies the control flow graph, making optimization
passes which work on basic blocks more effective.

The shader-db statistics:

   total instructions in shared programs: 1655247 -> 1503234 (-9.18%)
   instructions in affected programs:     949188 -> 797175 (-16.02%)

   2,970 shaders were helped, none hurt.  Gained 181 SIMD16 programs.

This helps Valve's Source Engine games (max -41.33%), The Cave
(max -33.33%), Serious Sam 3 (max -18.64%), Yo Frankie! (max -30.19%),
Zen Bound (max -22.22%), GStreamer (max -6.12%), and GLBenchmark 2.7
(max -1.94%).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoi965/fs: Consider predicated SEL instructions as whole variable writes.
Kenneth Graunke [Mon, 5 Aug 2013 23:24:43 +0000 (16:24 -0700)]
i965/fs: Consider predicated SEL instructions as whole variable writes.

The instruction

   (+f0.0) SEL dst, src0, src1

will write either src0 or src1 to dst, depending on the predicate.
Unlike most predicated instructions, it always writes to dst.

fs_inst::is_partial_write() is supposed to return true if the whole
register is guaranteed to be written.  The !inst->predicated check makes
sense for most instructions, which might not write the whole register,
but SEL is a special case.

This caused live interval analysis to ignore the destination of
predicated SEL instructions when computing "def" information.

Requires the previous commit to avoid regressions.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoi965/fs: Explicitly disallow CSE on predicated instructions.
Kenneth Graunke [Tue, 6 Aug 2013 00:12:12 +0000 (17:12 -0700)]
i965/fs: Explicitly disallow CSE on predicated instructions.

The existing inst->is_partial_write() already disallows predicated
instructions, so this has no functional change.  However, it's worth
doing explicitly since the CSE pass does not consider the flag register.
This means it could blindly factor out operations that use the same
sources, but which have different condition codes set.

This prevents a regression in the next commit.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoi965/fs: Log a performance warning if skipping 16-wide due to pulls.
Kenneth Graunke [Sun, 4 Aug 2013 00:31:53 +0000 (17:31 -0700)]
i965/fs: Log a performance warning if skipping 16-wide due to pulls.

Usually, the driver creates both 8-wide and 16-wide variants of every
fragment shader.  When 16-wide compilation fails, it logs a performance
warning explaining why only an 8-wide program exists.

However, when there are pull parameters, the driver won't even bother
trying the 16-wide compile (since it would fail).  In this case, it
failed to emit a performance warning, leaving no explanation for the
missing 16-wide program.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoilo: initialize constant buffer SURFACE_STATE early
Chia-I Wu [Sun, 11 Aug 2013 14:44:44 +0000 (22:44 +0800)]
ilo: initialize constant buffer SURFACE_STATE early

Fix ilo_gpe_init_view_surface_for_buffer to allow buffer to be NULL, and add
ilo_gpe_set_view_surface_bo to set it later.  This allows us to set up
SURFACE_STATE early for constant buffers backed by user buffers.

11 years agoilo: 3DSTATE_INDEX_BUFFER may be wrongly skipped
Chia-I Wu [Fri, 9 Aug 2013 16:48:28 +0000 (00:48 +0800)]
ilo: 3DSTATE_INDEX_BUFFER may be wrongly skipped

In finalize_index_buffer(), when the current index buffer was destroyed due to
u_upload_data(), it may happen that the new index buffer is at the same
address as the old one.  Comparing the pointers to the two buffers could fail
to work, and 3DSTATE_INDEX_BUFFER would be incorrectly skipped.

Holding a reference to the current index buffer before calling u_upload_data()
should fix the problem.

11 years agoi965: add missing BRW_NEW_INTERPOLATION_MAP to state dump
Chris Forbes [Sun, 4 Aug 2013 09:29:49 +0000 (21:29 +1200)]
i965: add missing BRW_NEW_INTERPOLATION_MAP to state dump

Makes this flag appear in the output for INTEL_DEBUG=state

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Add a new debug mode for the VUE map
Chris Forbes [Sun, 4 Aug 2013 07:38:37 +0000 (19:38 +1200)]
i965: Add a new debug mode for the VUE map

INTEL_DEBUG=vue now emits a listing of each slot in the VUE map,
and the corresponding interpolation mode.

V2: Fix whitespace issues.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Don't allow const on out or inout function parameters
Ian Romanick [Thu, 8 Aug 2013 23:42:37 +0000 (16:42 -0700)]
glsl: Don't allow const on out or inout function parameters

Fixes piglit tests const-inout-parameter.frag and
const-out-parameter.frag.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
11 years agogallivm: set non-existing values really to zero in size queries for d3d10
Roland Scheidegger [Thu, 8 Aug 2013 15:18:44 +0000 (17:18 +0200)]
gallivm: set non-existing values really to zero in size queries for d3d10

My previous attempt at doing so double-failed miserably (minification of
zero still gives one, and even if it would not the value was never written
anyway).
While here also rename the confusingly named int_vec bld as we have int vecs
of different sizes, and rename need_nr_mips (as this also changes out-of-bounds
behavior) to is_sviewinfo too.

Reviewed-by: Zack Rusin <zackr@vmware.com>
11 years agogallivm: use texture target from shader instead of static state for size query
Roland Scheidegger [Thu, 8 Aug 2013 01:42:46 +0000 (03:42 +0200)]
gallivm: use texture target from shader instead of static state for size query

d3d10 has no notion of distinct array resources neither at the resource nor
sampler view level. However, shader dcl of resources certainly has, and
d3d10 expects resinfo to return the values according to that - in particular
a resource might have been a 1d texture with some array layers, then the
sampler view might have only used 1 layer so it can be accessed both as 1d
or 1d array texture (I think - the former definitely works). resinfo of a
resource decleared as array needs to return number of array layers but
non-array resource needs to return 0 (and not 1). Hence fix this by passing
the target from the shader decl to emit_size_query and use that (in case of
OpenGL the target will come from the instruction itself).
Could probably do the same for actual sampling, though it may not matter there
(as the bogus components will essentially get clamped away), possibly could
wreak havoc though if it REALLY doesn't match (which is of course an error
but still).

Reviewed-by: Zack Rusin <zackr@vmware.com>
11 years agogallivm: honor d3d10's wishes of out-of-bounds behavior for texture size query
Roland Scheidegger [Thu, 8 Aug 2013 00:34:32 +0000 (02:34 +0200)]
gallivm: honor d3d10's wishes of out-of-bounds behavior for texture size query

Specifically, must return 0 for non-existent mip levels (and non-existent
textures which is an unsolved problem) for everything but total mip count.

Reviewed-by: Zack Rusin <zackr@vmware.com>
11 years agoglsl: Enable ARB_fragment_coord_conventions functionality in GLSL 1.50.
Paul Berry [Tue, 6 Aug 2013 19:17:17 +0000 (12:17 -0700)]
glsl: Enable ARB_fragment_coord_conventions functionality in GLSL 1.50.

GLSL 1.50 incorporates the functionality of the
ARB_fragment_coord_conventions extension, so we need to make this
functionality available even if the extension isn't enabled.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agomain: Fix deprecation of glLineWidth()
Paul Berry [Mon, 5 Aug 2013 22:46:43 +0000 (15:46 -0700)]
main: Fix deprecation of glLineWidth()

From section E.1 (Profiles and Deprecated Features of OpenGL 3.0)
of the OpenGL 3.0 spec:

    "LineWidth is not deprecated, but values greater than 1.0
    will generate an INVALID VALUE error"

From context it is clear that values greater than 1.0 should only
generate an INVALID VALUE error in a forward-compatible context.

The code was correctly quoting this spec text, but it was disallowing
all line widths in forward-compatible contexts, instead of just widths
greater than 1.0.

This patch introduces the correct check, so that setting a line width
of 1.0 or less is permitted.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoutil: (trivial) fix asm input/output list for fxsave
Roland Scheidegger [Fri, 9 Aug 2013 15:29:52 +0000 (17:29 +0200)]
util: (trivial) fix asm input/output list for fxsave

Otherwise gcc might do very unsafe optimizations, spotted by Uros Bizjak.
Hopefully this time it's finally right?

11 years agor600g: disable GPUVM by default
Alex Deucher [Fri, 9 Aug 2013 01:11:22 +0000 (21:11 -0400)]
r600g: disable GPUVM by default

Cayman and trinity systems still seem to suffer from
stability problems with GPUVM.  This also fixes compute
on these asics.  It can still be enabled for testing
by setting env var RADEON_VA=true.

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

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
CC: "9.2" <mesa-stable@lists.freedesktop.org>
CC: "9.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Christian König <christian.koenig@amd.com>
11 years agosoftpipe: fix the regressions
Zack Rusin [Fri, 9 Aug 2013 00:51:11 +0000 (20:51 -0400)]
softpipe: fix the regressions

softpipe has a really weird handling of the draw attrs, lets
just not inject outputs in its data.
Trivial.

11 years agodraw: rewrite primitive assembler
Zack Rusin [Thu, 8 Aug 2013 19:44:10 +0000 (15:44 -0400)]
draw: rewrite primitive assembler

We can't be injecting the primitive id's in the pipeline because
by that time the primitives have already been decomposed. To
properly number the primitives we need to handle the adjacency
primitives by hand. This patch moves the prim id injection into
the original primitive assembler and completely removes the
useless pipeline stage.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agodraw: reset the vertex id when injecting new primitive id
Zack Rusin [Wed, 7 Aug 2013 00:25:53 +0000 (20:25 -0400)]
draw: reset the vertex id when injecting new primitive id

Without reseting the vertex id, with primitives where the same
vertex is used with different primitives (e.g. tri/lines strips)
our vbuf module won't re-emit those vertices with the changed
primitive id. So lets reset the vertex id whenever injecting
new primitive id to make sure that the vertex data is correctly
emitted.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agodraw: cleanup the extra attribs
Zack Rusin [Wed, 7 Aug 2013 00:24:26 +0000 (20:24 -0400)]
draw: cleanup the extra attribs

Before inserting new front face and prim id outputs cleanup
the old extra outputs, otherwise our cache will use previous
output slots which will break as soon as outputs of the current
shader don't match the last.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agoutil: (trivial) fix more compile errors in u_cpu_detect (gcc/x86 this time).
Dieter Nützel [Thu, 8 Aug 2013 23:23:09 +0000 (01:23 +0200)]
util: (trivial) fix more compile errors in u_cpu_detect (gcc/x86 this time).

Oops. Should fix https://bugs.freedesktop.org/show_bug.cgi?id=67921

11 years agoegl: Do not export private symbols
Chad Versace [Thu, 1 Aug 2013 15:10:31 +0000 (08:10 -0700)]
egl: Do not export private symbols

libEGL was incorrectly exporting *all* symbols, public and private.
This patch adds -fvisibility=hidden to libEGL's linker flags to ensure
that only symbols annotated with __attribute__((visibility("default")))
get exported.

Sanity-checked with libEGL's builtin DRI2 driver and the i965 DRI driver
by running Piglit on X/EGL and by running weston-gears on Weston as an
X client.

Sanity-checked with libEGL's Gallium driver (which is not built-in) and
the swrast Gallium driver by running es2gears_x11.

Kristian reviewed the symbol diff in `nm libEGL.so`.

CC: "9.2" <mesa-stable@lists.freedesktop.org>
CC: Ian Romanick <idr@freedesktop.org>
Acked-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoi965: Remember to call intel_prepare_render() before blitting.
Kenneth Graunke [Tue, 6 Aug 2013 21:36:09 +0000 (14:36 -0700)]
i965: Remember to call intel_prepare_render() before blitting.

Otherwise, blits to the window system buffer may cause crashes,
since dst_irb->mt may be NULL.

This code is lifted straight out of brw_blorp_framebuffer()'s
try_blorp_blit() helper.

Fixes crashes in Piglit's fbo-sys-blit on systems without BLORP.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65919
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
11 years agoutil: (trivial) fix compile error with MSVC on x86
Roland Scheidegger [Thu, 8 Aug 2013 17:08:57 +0000 (19:08 +0200)]
util: (trivial) fix compile error with MSVC on x86

11 years agogallivm: honor d3d10 floating point rules for shadow comparisons
Roland Scheidegger [Wed, 7 Aug 2013 18:51:52 +0000 (20:51 +0200)]
gallivm: honor d3d10 floating point rules for shadow comparisons

d3d10 specifies ordered comparisons for everything but not_equal which is
unordered (http://msdn.microsoft.com/en-us/library/windows/desktop/cc308050.aspx).
OpenGL probably doesn't care.

Reviewed-by: Zack Rusin <zackr@vmware.com>
11 years agosoftpipe: don't clamp reference value for shadow comparison for float formats
Roland Scheidegger [Wed, 7 Aug 2013 18:33:54 +0000 (20:33 +0200)]
softpipe: don't clamp reference value for shadow comparison for float formats

Clamping is only done for fixed-point formats as part of conversion to
texture format.

Reviewed-by: Zack Rusin <zackr@vmware.com>
11 years agogallivm: don't clamp reference value for shadow comparison for float formats
Roland Scheidegger [Wed, 7 Aug 2013 18:25:38 +0000 (20:25 +0200)]
gallivm: don't clamp reference value for shadow comparison for float formats

This is wrong both for OpenGL and d3d. (In fact clamping is a side effect
of converting to depth format, so this should really do quantization too
at least in d3d10 for the comparisons to be truly correct.)

Reviewed-by: Zack Rusin <zackr@vmware.com>
11 years agogallivm: propagate scalar_lod to emit_size_query too
Roland Scheidegger [Wed, 7 Aug 2013 15:09:45 +0000 (17:09 +0200)]
gallivm: propagate scalar_lod to emit_size_query too

Clearly the returned values need to be per-element if the lod is per element.
Does not actually change behavior yet.

Reviewed-by: Zack Rusin <zackr@vmware.com>
11 years agogallium: clarify SVIEWINFO opcode
Roland Scheidegger [Wed, 7 Aug 2013 15:03:45 +0000 (17:03 +0200)]
gallium: clarify SVIEWINFO opcode

This opcode is quite problematic in tgsi, while it tries to mirror
d3d10 resinfo it can't really do what's stated there due to missing
the crazy return type modifiers. Hence specify this is ignored along
with the swizzle.
(Other options would be to have multiple opcodes or specify the ret
type modifier maybe in dst_reg as there's padding bits left there but
it is the only instruction allowing this.)

Reviewed-by: Zack Rusin <zackr@vmware.com>
11 years agogallivm: fix out-of-bounds behavior for fetch/ld
Roland Scheidegger [Tue, 6 Aug 2013 18:50:47 +0000 (20:50 +0200)]
gallivm: fix out-of-bounds behavior for fetch/ld

For d3d10 and ARB_robust_buffer_access_behavior, we are required to return
0 for out-of-bounds coordinates (for which we can just enable the code already
there was just disabled). Additionally, also need to return 0 for
out-of-bounds mip level and out-of-bounds layer. This changes the logic
so instead of clamping the level/layer, an out-of-bound mask is computed
instead in this case (actual clamping then can be omitted just like with
coordinates, since we set the fetch offset to zero if that happens anyway).

Reviewed-by: Zack Rusin <zackr@vmware.com>
11 years agoutil: try much harder to set DAZ flag
Roland Scheidegger [Tue, 6 Aug 2013 01:30:37 +0000 (03:30 +0200)]
util: try much harder to set DAZ flag

While so far this only causes some harmless test failures, there's lots more
cpus with DAZ. All 64bit capable ones can do it (particularly relevant for
AMD cpus as they supported sse3 very very late) but if really necessary we
can check support for that for real with some more magic.
(In fact just about ANY cpu with sse2 can support DAZ, I believe the only
exception are first gen P4 (Willamette) and from those only early steppings
which can't do it it's almost like intel forgot to add it... - a real pity
though docs say you can't just try to set it as they will throw a GPF.)
While this was meant to address https://bugs.freedesktop.org/show_bug.cgi?id=67672
it does not fix it. Most likely the tests need fixing as I don't think
there's any guarantee about denorm handling in the reference math library
functions if the flags aren't set to standard values. Nevertheless enabling
DAZ on all cpus which can do it should be the right thing to do.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoutil: implement table-based + linear interpolation linear-to-srgb conversion
Roland Scheidegger [Tue, 6 Aug 2013 14:55:47 +0000 (16:55 +0200)]
util: implement table-based + linear interpolation linear-to-srgb conversion

Should be much faster, seems to work in softpipe.
While here (also it's now disabled) fix up the pow factor - the former value
is what is in GL core it is however not actually accurate to fp32 standard
(as it is 1.0/2.4), and if someone would do all the accurate math there's no
reason to waste 8 mantissa bits or so...

v2: use real table generating function instead of just printing the values
(might take a bit longer as it does calculations on some 3+ million floats
but much more descriptive obviously).
Also fix up another inaccurate pow factor (this time in the python code) -
wondering where the couple one bit errors came from :-(.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
11 years agogallivm: fix comment wrt srgb accuracy.
Roland Scheidegger [Fri, 2 Aug 2013 22:24:29 +0000 (00:24 +0200)]
gallivm: fix comment wrt srgb accuracy.

I think it's actually not good enough now...

11 years agoilo: get rid of GPE tables completely
Chia-I Wu [Thu, 8 Aug 2013 05:43:57 +0000 (13:43 +0800)]
ilo: get rid of GPE tables completely

Move the estimate functions out of the tables and kill the tables.

11 years agoilo: clean up GPE header inclusions
Chia-I Wu [Thu, 8 Aug 2013 05:30:54 +0000 (13:30 +0800)]
ilo: clean up GPE header inclusions

This reduces the number of source files need to be recompiled when GPE
functions are changed other than regular clean ups.

11 years agoilo: initialize alpha test state in ilo_gpe_init_dsa
Chia-I Wu [Thu, 8 Aug 2013 05:18:17 +0000 (13:18 +0800)]
ilo: initialize alpha test state in ilo_gpe_init_dsa

This could speed up BLEND_STATE and COLOR_CALC_STATE emission a bit.

11 years agoilo: fold gen6_translate_index_size into the caller
Chia-I Wu [Thu, 8 Aug 2013 05:10:24 +0000 (13:10 +0800)]
ilo: fold gen6_translate_index_size into the caller

There is only one caller so fold it.

11 years agoilo: fold gen6_translate_depth_format into the caller
Chia-I Wu [Thu, 8 Aug 2013 05:01:39 +0000 (13:01 +0800)]
ilo: fold gen6_translate_depth_format into the caller

There is only one caller so fold it.

11 years agoilo: Call GPE emit functions directly.
Courtney Goeltzenleuchter [Mon, 5 Aug 2013 21:57:31 +0000 (15:57 -0600)]
ilo: Call GPE emit functions directly.

Eliminate pipeline and GPE function vectors and have the pipeline functions
call the GPE emit functions directly.

11 years agoilo: move emit functions so that they can be inlined.
Courtney Goeltzenleuchter [Mon, 5 Aug 2013 20:17:31 +0000 (14:17 -0600)]
ilo: move emit functions so that they can be inlined.

11 years agor300g/compiler/tests: Pass the required LDFLAGS when building the test program
Tom Stellard [Thu, 8 Aug 2013 00:26:17 +0000 (17:26 -0700)]
r300g/compiler/tests: Pass the required LDFLAGS when building the test program

CC: "9.2 <mesa-stable@lists.freedesktop.org>"
11 years agor300g/compiler/tests: Fix segfault
Tom Stellard [Thu, 8 Aug 2013 00:26:01 +0000 (17:26 -0700)]
r300g/compiler/tests: Fix segfault

CC: "9.2" <mesa-stable@lists.freedesktop.org>
11 years agogallium-egl: Commit the rest of the native_wayland_drm_bufmgr_helper v2 patch
Kristian Høgsberg [Wed, 7 Aug 2013 18:19:59 +0000 (11:19 -0700)]
gallium-egl: Commit the rest of the native_wayland_drm_bufmgr_helper v2 patch

I missed Anders v2 on the list which fixed non-wayland compilation:

http://lists.freedesktop.org/archives/mesa-dev/2013-July/042062.html

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
11 years agoegl: Update to Wayland 1.2 server API
Ander Conselvan de Oliveira [Thu, 18 Jul 2013 12:11:25 +0000 (15:11 +0300)]
egl: Update to Wayland 1.2 server API

Since Wayland 1.2, struct wl_buffer and a few functions are deprecated.

References to wl_buffer are replaced with wl_resource and some getter
functions and calls to deprecated functions are replaced with the proper
new API. The latter changes are related to resource versioning.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
11 years agogallium-egl: Don't add a listener for wl_drm twice in wayland platform
Ander Conselvan de Oliveira [Thu, 18 Jul 2013 12:11:24 +0000 (15:11 +0300)]
gallium-egl: Don't add a listener for wl_drm twice in wayland platform

A listener is added just after the interface is bound, in
registry_handle_global().

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
11 years agogallium-egl: Simplify native_wayland_drm_bufmgr_helper interface
Ander Conselvan de Oliveira [Thu, 18 Jul 2013 12:11:23 +0000 (15:11 +0300)]
gallium-egl: Simplify native_wayland_drm_bufmgr_helper interface

The helper provides a series of functions to easy the implementation
of the WL_bind_wayland_display extension on different platforms. But
even with the helpers there was still a bit of duplicated code between
platforms, with the drm authentication being the only part that
differs.

This patch changes the bufmgr interface to provide a self contained
object with a create function that takes a drm authentication callback
as an argument. That way all the helper functions are made static and
the "_helper" suffix was removed from the sources file name.

This change also removes the mix of Wayland client and server code in
the wayland drm platform source file. All the uses of libwayland-server
are now contained in native_wayland_drm_bufmgr.c.

Changes to the drm platform are only compile tested.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
11 years agoilo: speed up 3DSTATE_VERTEX_BUFFERS emission a bit
Chia-I Wu [Wed, 7 Aug 2013 04:21:26 +0000 (12:21 +0800)]
ilo: speed up 3DSTATE_VERTEX_BUFFERS emission a bit

Ignore vbuffer_mask which does not gain us anything.

11 years agoilo: skip state emission when reducing sampler count
Chia-I Wu [Wed, 7 Aug 2013 09:16:46 +0000 (17:16 +0800)]
ilo: skip state emission when reducing sampler count

When the number of sampler states bound is reduced, we are good to keep
referencing the old SAMPLER_STATE array and skip emitting a new one.

11 years agoilo: simplify setting of shader samplers and views
Chia-I Wu [Wed, 7 Aug 2013 08:42:53 +0000 (16:42 +0800)]
ilo: simplify setting of shader samplers and views

Remove the special path that unbinds all samplers/views not in the range.
Just make another call to unbind them.

11 years agoilo: correctly check for stencil ref change
Chia-I Wu [Wed, 7 Aug 2013 09:32:38 +0000 (17:32 +0800)]
ilo: correctly check for stencil ref change

I intended to do a memcmp(), not a memcpy()...

11 years agodraw: fix slot detection
Zack Rusin [Tue, 6 Aug 2013 06:54:36 +0000 (02:54 -0400)]
draw: fix slot detection

Nowadays -1 for slots means that the semantic is not present, so
we need to store it in a signed variables, otherwise <0 comparisons
are pointless. Fixes
http://bugzilla.eng.vmware.com/show_bug.cgi?id=67811 (at least
with softpipe, edgeflags don't work wit llvmpipe)

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agogallivm: Fix build - Remove TargetOptions.RealignStack for llvm>=3.4
Laurent Carlier [Tue, 6 Aug 2013 22:05:25 +0000 (00:05 +0200)]
gallivm: Fix build - Remove TargetOptions.RealignStack for llvm>=3.4

Since llvm -3.4svn r187618, TargetOptions doesn't provide
RealignStack, so only enable it with llvm<3.4

This option must now be specified using function attributes, see LLVM
commit r187618

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
11 years agoi965: Add #defines for the MI_LOAD_REGISTER_MEM command.
Kenneth Graunke [Thu, 1 Aug 2013 22:11:40 +0000 (15:11 -0700)]
i965: Add #defines for the MI_LOAD_REGISTER_MEM command.

This command reads a value from memory and writes it to a register (the
opposite of MI_STORE_REGISTER_MEM).  It's only available on Gen7+.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoi965: Initialize the intel_context::bufmgr pointer earlier.
Kenneth Graunke [Thu, 1 Aug 2013 22:11:39 +0000 (15:11 -0700)]
i965: Initialize the intel_context::bufmgr pointer earlier.

This prevents a crash in a future patch.

_mesa_initialize_context() creates a default transform feedback object
by calling the NewTransformFeedbackObject() driver hook.  Eventually,
we'll want to subclass that and allocate a buffer object.  This means
passing brw->bufmgr to drm_intel_alloc_bo(), and crashing if it isn't
initialized yet.

The buffer manager is actually already initialized; we just hadn't
copied the pointer from intel_screen to intel_context quite early
enough.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoi965: Tidy preprocessor macros for SO_PRIM_STORAGE_NEEDED registers.
Kenneth Graunke [Thu, 1 Aug 2013 22:11:38 +0000 (15:11 -0700)]
i965: Tidy preprocessor macros for SO_PRIM_STORAGE_NEEDED registers.

Gen7+ supports four transform feedback streams.  Using a function-like
macro makes it easy to access them by stream number or loop over them.
"GEN7_" prefixes are more common than "_IVB" suffixes, so use that.

Gen6 only supports a single stream, so the single #define should be
fine.  However, SO_NUM_PRIM_STORAGE_NEEDED was a poor name.  For one,
the word "NUM" doesn't appear in the actual name of the register.
It's also confusingly generic, as it doesn't exist on Gen7+.  Add a
"GEN6_" prefix for clarity.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoi965: Tidy preprocessor macros for SO_NUM_PRIMS_WRITTEN registers.
Kenneth Graunke [Thu, 1 Aug 2013 22:11:37 +0000 (15:11 -0700)]
i965: Tidy preprocessor macros for SO_NUM_PRIMS_WRITTEN registers.

Gen7+ supports four transform feedback streams.  Using a function-like
macro makes it easy to access them by stream number or loop over them.
"GEN7_" prefixes are more common than "_IVB" suffixes, so we use that.

Gen6 only supports a single stream, so the single #define should be
fine.  However, SO_NUM_PRIMS_WRITTEN was confusingly generic, as it
doesn't exist on Gen7+.  Add a "GEN6_" prefix for clarity.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agonvc0: don't access array out of bounds on unexpected sample count
Christoph Bumiller [Tue, 6 Aug 2013 20:20:25 +0000 (22:20 +0200)]
nvc0: don't access array out of bounds on unexpected sample count

11 years agonv50: handle pure integer vertex attributes
Emil Velikov [Fri, 21 Jun 2013 17:04:55 +0000 (18:04 +0100)]
nv50: handle pure integer vertex attributes

And as a side effect fix a crash in the following piglit test:
general/attribs GL3

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Cc: "9.2 and 9.1" mesa-stable@lists.freedesktop.org
11 years agonvc0: implement MP performance counters for nvc0:nvd9
Samuel Pitoiset [Thu, 25 Jul 2013 08:35:36 +0000 (10:35 +0200)]
nvc0: implement MP performance counters for nvc0:nvd9

11 years agonvc0: implement compute support for nvc0
Samuel Pitoiset [Thu, 25 Jul 2013 08:35:35 +0000 (10:35 +0200)]
nvc0: implement compute support for nvc0

Tested on nvc0, nvc1, nvcf and nvd9.

11 years agonvc0: add more MP counters for nve4
Samuel Pitoiset [Thu, 25 Jul 2013 08:35:34 +0000 (10:35 +0200)]
nvc0: add more MP counters for nve4

11 years agomesa: Generate a renderbuffer wrapper even if the texture has no image
Ian Romanick [Sun, 28 Jul 2013 20:08:27 +0000 (13:08 -0700)]
mesa: Generate a renderbuffer wrapper even if the texture has no image

This prevents a segfault in check_begin_texture_render when an FBO is
rebound while in this state.  This fixes the piglit test
fbo-incomplete-invalid-texture.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "9.1 9.2" mesa-stable@lists.freedesktop.org
11 years agomesa: Validate the layer selection of an array texture too
Ian Romanick [Sat, 27 Jul 2013 19:27:45 +0000 (12:27 -0700)]
mesa: Validate the layer selection of an array texture too

Previously only the slice of a 3D texture was validated in the FBO
completeness check.  This fixes the failure in the 'invalid layer of an
array texture' subtest of piglit's fbo-incomplete test.

v2: 1D_ARRAY textures have Depth == 1.  Instead, compare against Height.

v3: Handle CUBE_MAP_ARRAY textures too.  Noticed by Marek.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "9.1 9.2" mesa-stable@lists.freedesktop.org
11 years agomesa: Don't call driver RenderTexture for invalid zoffset
Ian Romanick [Sat, 27 Jul 2013 19:16:56 +0000 (12:16 -0700)]
mesa: Don't call driver RenderTexture for invalid zoffset

This fixes the segfault in the 'invalid slice of 3D texture' and
'invalid layer of an array texture' subtests of piglit's fbo-incomplete
test.

The 'invalid layer of an array texture' subtest still fails.

v2: Fix off-by-one comparison error noticed by Chris Forbes.  Also,
1D_ARRAY textures have Depth == 1.  Instead, compare against Height.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> [v1]
Cc: "9.1 9.2" mesa-stable@lists.freedesktop.org
11 years agomesa: Don't call driver RenderTexture for really broken textures
Ian Romanick [Sat, 27 Jul 2013 19:04:20 +0000 (12:04 -0700)]
mesa: Don't call driver RenderTexture for really broken textures

This fixes the segfault in the '0x0 texture' subtest of piglit's
fbo-incomplete test.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "9.1 9.2" mesa-stable@lists.freedesktop.org
11 years agomesa: Remove stray debug printfs in attachment completeness code
Ian Romanick [Sat, 27 Jul 2013 19:03:45 +0000 (12:03 -0700)]
mesa: Remove stray debug printfs in attachment completeness code

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "9.1 9.2" mesa-stable@lists.freedesktop.org
11 years agomesa: Treat glBindFramebuffer and glBindFramebufferEXT more correctly
Ian Romanick [Fri, 19 Jul 2013 00:39:22 +0000 (17:39 -0700)]
mesa: Treat glBindFramebuffer and glBindFramebufferEXT more correctly

Allow user-generated names for glBindFramebufferEXT on desktop GL.
Disallow its use altogether for core profiles.

Names bound with glBindFramebuffer in desktop OpenGL are still
(incorrectly) shared across the share group instead of being
per-context.  This gets us a bit closer to being strictly conformant.

v2: Disallow glBindFramebufferEXT in 3.1 by not installing it in the
dispatch table.  Suggested by Jordan.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> [v1]
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> [v1]
Cc: mesa-stable@lists.freedesktop.org
11 years agomesa: Treat glBindRenderbuffer and glBindRenderbufferEXT correctly
Ian Romanick [Fri, 19 Jul 2013 00:38:16 +0000 (17:38 -0700)]
mesa: Treat glBindRenderbuffer and glBindRenderbufferEXT correctly

Allow user-generated names for glBindRenderbufferEXT on desktop GL.
Disallow its use altogether for core profiles.

v2: Disallow glBindRenderbufferEXT in 3.1 by not installing it in the
dispatch table.  Suggested by Jordan.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> [v1]
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> [v1]
Cc: mesa-stable@lists.freedesktop.org
11 years agoradeonsi: Number of SGPRs retrieved from LLVM already includes VCC
Michel Dänzer [Tue, 6 Aug 2013 08:45:50 +0000 (10:45 +0200)]
radeonsi: Number of SGPRs retrieved from LLVM already includes VCC

Fixes spurious 'Assertion `num_sgprs <= 104' failed.' with shaders using
all 104 SGPRs.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Christian König <christian.koenig@amd.com>
11 years agoi965: Don't allocate curbe buffers on Gen6+.
Kenneth Graunke [Fri, 2 Aug 2013 07:11:10 +0000 (00:11 -0700)]
i965: Don't allocate curbe buffers on Gen6+.

These are only used on Gen4-5.  Why waste the 8kB of space?

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agollvmpipe: Do not need to free anything if there is no geometry shader.
Vinson Lee [Sun, 4 Aug 2013 08:18:28 +0000 (01:18 -0700)]
llvmpipe: Do not need to free anything if there is no geometry shader.

If gs is null, then freeing state->shader.tokens would result in a null
dereference.

Fixes "Dereference after null check" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agonvc0: Initialize ptr for unexpected sample_count on release builds.
Vinson Lee [Sun, 4 Aug 2013 07:13:53 +0000 (00:13 -0700)]
nvc0: Initialize ptr for unexpected sample_count on release builds.

Fixes "Uninitialized pointer read" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agodraw: Change slot from unsigned to int.
Vinson Lee [Tue, 6 Aug 2013 00:33:51 +0000 (17:33 -0700)]
draw: Change slot from unsigned to int.

unfilled_stage::face_slot is of type int.

Fixes "Unsigned compared against 0" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agopostprocess: Check ppq is null before calling pp_free_bos.
Vinson Lee [Sat, 3 Aug 2013 06:39:24 +0000 (23:39 -0700)]
postprocess: Check ppq is null before calling pp_free_bos.

pp_free_bos dereferences ppq without a null check.

Fixes "Dereference before null check" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agodraw: add back separate input assembler
Zack Rusin [Sat, 3 Aug 2013 06:56:19 +0000 (02:56 -0400)]
draw: add back separate input assembler

the issue is that stream output is run before the pipeline, which
means that unless we decompose the primitives before the so
then things crash. we could convert the entire stream output
code into a pipeline stage but it will take a bit, so for now
fix the crashes by simply re-adding the old input assembler
which is run before the SO.

Signed-off-by: Zack Rusin <zackr@vmware.com>
11 years agodraw: implement proper primitive assembler as a pipeline stage
Zack Rusin [Fri, 2 Aug 2013 06:25:42 +0000 (02:25 -0400)]
draw: implement proper primitive assembler as a pipeline stage

we used to have a face primitive assembler that we ran after if
the gs was missing but we had adjacency primitives in the pipeline,
lets convert it to a pipeline stage, which allows us to use it
to inject outputs (primitive id) into the vertices. it's also
a lot cleaner because the decomposition is already handled for us.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agodraw: fix front face injection
Zack Rusin [Fri, 2 Aug 2013 05:50:05 +0000 (01:50 -0400)]
draw: fix front face injection

Inject front face only if the fragment shader uses it and
propagate through all channels because otherwise we'll
need to figure out the exact swizzle that the fs expects and
it's just simpler to make sure all the components within
the front face register are correctly set.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agotgsi: remove unneeded File == TGSI_FILE_INPUT test
Brian Paul [Fri, 2 Aug 2013 14:00:54 +0000 (08:00 -0600)]
tgsi: remove unneeded File == TGSI_FILE_INPUT test

We're already in an "if (File == TGSI_FILE_INPUT)" block at that point.

11 years agotgsi: clean up tgsi_scan_shader() function
Brian Paul [Mon, 5 Aug 2013 14:19:36 +0000 (08:19 -0600)]
tgsi: clean up tgsi_scan_shader() function

Replace "fulldecl->Semantic.Name/Index" with semName/semIndex.
Simplify if/else logic for TGSI_FILE_OUTPUT code.
Remove old comment.
Fix indentation.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: fix frontface behavior again
Zack Rusin [Sat, 3 Aug 2013 02:08:25 +0000 (22:08 -0400)]
llvmpipe: fix frontface behavior again

Lets make sure the frontface is 1 for front and -1 for back.
Discussed with Roland and Jose.

Signed-off-by: Zack Rusin <zackr@vmware.com>