mesa.git
8 years agonir: Lower bitfield_extract.
Matt Turner [Wed, 13 Jan 2016 19:09:11 +0000 (11:09 -0800)]
nir: Lower bitfield_extract.

The OpenGL specifications for bitfieldExtract() says:

   The result will be undefined if <offset> or <bits> is negative, or if
   the sum of <offset> and <bits> is greater than the number of bits
   used to store the operand.

Therefore passing bits=32, offset=0 is legal and defined in GLSL.

But the earlier SM5 ubfe/ibfe opcodes are specified to accept a bitfield width
ranging from 0-31. As such, Intel and AMD instructions read only the low 5 bits
of the width operand, making them not able to implement the GLSL-specified
behavior directly.

This commit adds ubfe/ibfe operations from SM5 and a lowering pass for
bitfield_extract to to handle the trivial case of <bits> = 32 as

   bitfieldExtract:
      bits > 31 ? value : bfe(value, offset, bits)

Fixes:
   ES31-CTS.shader_bitfield_operation.bitfieldExtract.uvec3_0
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92595
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Tested-by: Marta Lofstedt <marta.lofstedt@intel.com>
8 years agonir: Handle <bits>=32 case in bitfield_insert lowering.
Matt Turner [Wed, 13 Jan 2016 19:08:37 +0000 (11:08 -0800)]
nir: Handle <bits>=32 case in bitfield_insert lowering.

The OpenGL specifications for bitfieldInsert() says:

   The result will be undefined if <offset> or <bits> is negative, or if
   the sum of <offset> and <bits> is greater than the number of bits
   used to store the operand.

Therefore passing bits=32, offset=0 is legal and defined in GLSL.

But the earlier SM5 bfi opcode is specified to accept a bitfield width
ranging from 0-31. As such, Intel and AMD instructions read only the low
5 bits of the width operand, making them not able to implement the
GLSL-specified behavior directly.

This commit fixes the lowering of bitfield_insert to handle the trivial
case of <bits> = 32 as

   bitfieldInsert:
      bits > 31 ? insert : bfi(bfm(bits, offset), insert, base)

Fixes:
   ES31-CTS.shader_bitfield_operation.bitfieldInsert.uint_2
   ES31-CTS.shader_bitfield_operation.bitfieldInsert.uvec4_3
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92595
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Tested-by: Marta Lofstedt <marta.lofstedt@intel.com>
8 years agost/mesa: add check for color logicop in blit_copy_pixels()
Brian Paul [Wed, 13 Jan 2016 23:20:09 +0000 (16:20 -0700)]
st/mesa: add check for color logicop in blit_copy_pixels()

We check that a bunch of raster operations are disabled in
blit_copy_pixels().  We also need to check that color logicop is
disabled.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: do not reallocate user memory buffers
Nicolai Hähnle [Tue, 12 Jan 2016 14:29:18 +0000 (09:29 -0500)]
gallium/radeon: do not reallocate user memory buffers

The whole point of AMD_pinned_memory is that applications don't have to map
buffers via OpenGL - but they're still allowed to, so make sure we don't break
the link between buffer object and user memory unless explicitly instructed
to.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: implement PIPE_CAP_INVALIDATE_BUFFER
Nicolai Hähnle [Thu, 14 Jan 2016 14:41:04 +0000 (09:41 -0500)]
gallium/radeon: implement PIPE_CAP_INVALIDATE_BUFFER

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: reset valid_buffer_range on PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE
Nicolai Hähnle [Mon, 11 Jan 2016 00:54:44 +0000 (19:54 -0500)]
gallium/radeon: reset valid_buffer_range on PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE

This accomodates a streaming pattern where the discard flag is set when the
application wraps back to the beginning of the buffer.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agost/mesa: implement Driver.InvalidateBufferSubData
Nicolai Hähnle [Sat, 9 Jan 2016 23:05:58 +0000 (18:05 -0500)]
st/mesa: implement Driver.InvalidateBufferSubData

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agost/mesa: use pipe->invalidate_resource instead of buffer re-allocation
Nicolai Hähnle [Mon, 11 Jan 2016 22:44:45 +0000 (17:44 -0500)]
st/mesa: use pipe->invalidate_resource instead of buffer re-allocation

Drivers are expected to avoid unnecessary work when possible in this code
path.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium: add PIPE_CAP_INVALIDATE_BUFFER
Nicolai Hähnle [Mon, 11 Jan 2016 22:38:08 +0000 (17:38 -0500)]
gallium: add PIPE_CAP_INVALIDATE_BUFFER

It makes sense to re-use pipe->invalidate_resource for the purpose of
glInvalidateBufferData, but this function is already implemented in vc4
where it doesn't have the expected behavior. So add a capability flag
to indicate that the driver supports the expected behavior.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agomesa: add Driver.InvalidateBufferSubData
Nicolai Hähnle [Sat, 9 Jan 2016 22:53:07 +0000 (17:53 -0500)]
mesa: add Driver.InvalidateBufferSubData

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: fix the checks in _mesa_InvalidateBuffer(Sub)Data
Nicolai Hähnle [Sat, 9 Jan 2016 22:51:39 +0000 (17:51 -0500)]
mesa: fix the checks in _mesa_InvalidateBuffer(Sub)Data

Change the check to be in line with what the quoted spec fragment says.

I have sent out a piglit test for this as well.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agowinsys/radeon: fix warnings about incompatible pointer types
Nicolai Hähnle [Tue, 12 Jan 2016 17:28:11 +0000 (12:28 -0500)]
winsys/radeon: fix warnings about incompatible pointer types

Some confusion between pb_buffer and radeon_bo as well as between
radeon_drm_winsys and radeon_winsys.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agotexobj: Check completeness with InternalFormat rather than Mesa format
Neil Roberts [Wed, 13 Jan 2016 19:28:45 +0000 (19:28 +0000)]
texobj: Check completeness with InternalFormat rather than Mesa format

The internal Mesa format used for a texture might not match the one
requested in the internalFormat when the texture was created, for
example if the driver is internally remapping RGB textures to RGBA.
Otherwise it can cause false positives for completeness if one mipmap
image is created as RGBA and the other as RGB because they would both
have an RGBA Mesa format. If we check the InternalFormat instead then
we are directly checking the API usage which I think better matches
the intention of the check.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93700
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agoi965: Remove unused hw_must_use_separate_stencil
Ben Widawsky [Wed, 30 Dec 2015 17:47:17 +0000 (09:47 -0800)]
i965: Remove unused hw_must_use_separate_stencil

I spotted this while looking for what needs updating in future platforms.

I'm too lazy to go through the git logs, but it was probably missed by Jason
when all the brw refactoring happened.

Signed-off-by: Ben Widawsky <benjamin.widawsky@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Drop extra newline from shader compile messages.
Matt Turner [Thu, 14 Jan 2016 00:17:26 +0000 (16:17 -0800)]
i965: Drop extra newline from shader compile messages.

Ilia changed shader-db's run.c to not expect messages to contain a
newline in shader-db commit 51bbc8035.

8 years agonir: Change bfm's semantics to match Intel/AMD/SM5.
Matt Turner [Fri, 8 Jan 2016 00:16:35 +0000 (16:16 -0800)]
nir: Change bfm's semantics to match Intel/AMD/SM5.

Intel/AMD's hardware instructions do not handle arguments of 32.
Constant evaluation should not produce a result different from the
hardware instruction.

The s/1ull/1u/ change is intentional: previously we wanted defined
behavior for the "1 << 32" case, but we're making this case undefined so
we can make it 1u and save ourselves a 64-bit operation.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoglsl: Fix undefined shifts.
Matt Turner [Wed, 30 Dec 2015 19:48:22 +0000 (14:48 -0500)]
glsl: Fix undefined shifts.

Shifting into the sign bit is undefined, as is shifting by 32.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoglsl: Handle failure of Python codegen scripts.
Matt Turner [Mon, 11 Jan 2016 18:54:19 +0000 (10:54 -0800)]
glsl: Handle failure of Python codegen scripts.

If a Python codegen script failed, it would write a zero-byte file,
which on subsequent invocations of make would trick it into thinking the
file was appropriately generated.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoglsl, nir: Make ir_triop_bitfield_extract a vectorized operation.
Kenneth Graunke [Fri, 8 Jan 2016 00:01:51 +0000 (16:01 -0800)]
glsl, nir: Make ir_triop_bitfield_extract a vectorized operation.

We would like to be able to combine

   result.x = bitfieldExtract(src0.x, src1.x, src2.x);
   result.y = bitfieldExtract(src0.y, src1.y, src2.y);
   result.z = bitfieldExtract(src0.z, src1.z, src2.z);
   result.w = bitfieldExtract(src0.w, src1.w, src2.w);

into a single ivec4 bitfieldInsert operation.  This should be possible
with most drivers.

This patch changes the offset and bits parameters from scalar ints
to ivecN or uvecN.  The type of all three operands will be the same,
for simplicity.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoglsl, nir: Make ir_quadop_bitfield_insert a vectorized operation.
Kenneth Graunke [Tue, 5 Jan 2016 12:01:11 +0000 (04:01 -0800)]
glsl, nir: Make ir_quadop_bitfield_insert a vectorized operation.

We would like to be able to combine

   result.x = bitfieldInsert(src0.x, src1.x, src2.x, src3.x);
   result.y = bitfieldInsert(src0.y, src1.y, src2.y, src3.y);
   result.z = bitfieldInsert(src0.z, src1.z, src2.z, src3.z);
   result.w = bitfieldInsert(src0.w, src1.w, src2.w, src3.w);

into a single ivec4 bitfieldInsert operation.  This should be possible
with most drivers.

This patch changes the offset and bits parameters from scalar ints
to ivecN or uvecN.  The type of all four operands will be the same,
for simplicity.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoglsl: Delete the ir_binop_bfm and ir_triop_bfi opcodes.
Kenneth Graunke [Thu, 7 Jan 2016 23:54:16 +0000 (15:54 -0800)]
glsl: Delete the ir_binop_bfm and ir_triop_bfi opcodes.

TGSI doesn't use these - it just translates ir_quadop_bitfield_insert
directly.  NIR can handle ir_quadop_bitfield_insert as well.

These opcodes were only used for i965, and with Jason's recent patches,
we can do this lowering in NIR (which also gains us SPIR-V handling).
So there's not much point to retaining this GLSL IR lowering code.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agonir: Fix constant evaluation of bfm.
Matt Turner [Mon, 11 Jan 2016 20:13:24 +0000 (12:13 -0800)]
nir: Fix constant evaluation of bfm.

NIR's bfm, like Intel/AMD's hardware instructions and GLSL IR's
ir_binop_bfm takes <bits> as src0 and <offset> as src1.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoi965/fs: Skip assertion on NaN.
Matt Turner [Mon, 11 Jan 2016 17:34:50 +0000 (09:34 -0800)]
i965/fs: Skip assertion on NaN.

A shader in Unreal4 uses the result of divide by zero in its color
output, producing NaN and triggering this assertion since NaN is not
equal to itself.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93560
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoi965/fs: Add debugging to constant combining pass.
Matt Turner [Fri, 27 Feb 2015 00:06:45 +0000 (16:06 -0800)]
i965/fs: Add debugging to constant combining pass.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agometa: remove const qualifier on _mesa_meta_fb_tex_blit_begin()
Brian Paul [Tue, 12 Jan 2016 15:46:40 +0000 (08:46 -0700)]
meta: remove const qualifier on _mesa_meta_fb_tex_blit_begin()

To silence a compiler warning about a const/non-const mismatch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agost/mesa: fix incorrect buffer token passed to _mesa_BindFramebuffer()
Brian Paul [Tue, 12 Jan 2016 01:22:50 +0000 (18:22 -0700)]
st/mesa: fix incorrect buffer token passed to _mesa_BindFramebuffer()

I added this code right at the end, and got it wrong.
Only used by the WGL_ARB_render_texture code.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agodocs: add news item and link release notes for 11.1.1
Emil Velikov [Wed, 13 Jan 2016 13:27:50 +0000 (15:27 +0200)]
docs: add news item and link release notes for 11.1.1

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agodocs: add sha256 checksums for 11.1.1
Emil Velikov [Wed, 13 Jan 2016 13:23:53 +0000 (15:23 +0200)]
docs: add sha256 checksums for 11.1.1

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 4b2d9f29e9b75cbbeb76ccf753a256e11f07ee1a)

8 years agodocs: add release notes for 11.1.1
Emil Velikov [Wed, 13 Jan 2016 10:11:33 +0000 (12:11 +0200)]
docs: add release notes for 11.1.1

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 330aa44a0da7548000a6b2fc2bb580e9c8e733cc)

8 years agoi965/gen9: Don't allow the RGBX formats for texturing/rendering
Neil Roberts [Thu, 19 Nov 2015 15:25:21 +0000 (16:25 +0100)]
i965/gen9: Don't allow the RGBX formats for texturing/rendering

The RGBX surface formats aren't renderable so we internally remap them
to RGBA when rendering. They are retained as RGBX when used as
textures. However since the previous patch fast clears are disabled
for surfaces that use a different format for rendering than for
texturing. To avoid this situation we can just pretend not to support
RGBX formats at all. This will cause the upper layers of mesa to pick
an RGBA format internally instead. This should be safe because we
always override the alpha component to 1.0 for RGBX in the texture
swizzle anyway. We could also do this for all gens except that it's a
bit more difficult when the hardware doesn't support texture
swizzling. Gens using the blorp have further problems because that
doesn't implement this swizzle override.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agoradeonsi: move POSITION and FACE fragment shader inputs to system values
Marek Olšák [Sat, 2 Jan 2016 22:09:58 +0000 (23:09 +0100)]
radeonsi: move POSITION and FACE fragment shader inputs to system values

And FACE becomes integer instead of float.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agoradeonsi: simplify gl_FragCoord behavior
Marek Olšák [Thu, 7 Jan 2016 19:00:34 +0000 (20:00 +0100)]
radeonsi: simplify gl_FragCoord behavior

It will become a system value, not an input.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agoglsl: add image_format check in cross_validate_globals()
Samuel Iglesias Gonsálvez [Tue, 5 Jan 2016 12:21:17 +0000 (13:21 +0100)]
glsl: add image_format check in cross_validate_globals()

Fixes CTS test:

ES31-CTS.shader_image_load_store.negative-linkErrors

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

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agomesa: do not validate io of non-compute and compute stage
Tapani Pälli [Mon, 4 Jan 2016 07:55:52 +0000 (09:55 +0200)]
mesa: do not validate io of non-compute and compute stage

Fixes regression on SSO tests that have both non-compute and
compute programs in a program pipeline.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93532
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
8 years agoglsl: add packed varyings for outputs with single stage program
Tapani Pälli [Tue, 12 Jan 2016 09:03:14 +0000 (11:03 +0200)]
glsl: add packed varyings for outputs with single stage program

Commit 8926dc8 added a check where we add packed varyings of output
stage only when we have multiple stages,  however duplicates are already
handled by changes in commit 0508d950 and we want to add outputs also in
case where we have only one stage.

Fixes regression caused by 8926dc8 for following test:
   ES31-CTS.program_interface_query.separate-programs-vertex

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agollvmpipe: (trivial) use cast wrapper for __m128d to __m128 casts
Roland Scheidegger [Wed, 13 Jan 2016 03:48:41 +0000 (04:48 +0100)]
llvmpipe: (trivial) use cast wrapper for __m128d to __m128 casts

some compiler was unhappy.

8 years agollvmpipe: avoid most 64 bit math in rasterization
Roland Scheidegger [Wed, 6 Jan 2016 00:05:35 +0000 (01:05 +0100)]
llvmpipe: avoid most 64 bit math in rasterization

The trick here is to recognize that in the c + n * dcdx calculations,
not only can the lower FIXED_ORDER bits not change (as the dcdx values
have those all zero) but that this means the sign bit of the calculations
cannot be different as well, that is
sign(c + n*dcdx) == sign((c >> FIXED_ORDER) + n*(dcdx >> FIXED_ORDER)).
That shaves off more than enough bits to never require 64bit masks.
A shifted plane c value could still easily exceed 32 bits, however since we
throw out planes which are trivial accept even before binning (and similarly
don't even get to see tris for which there was a trivial reject plane)) this
is never a problem.
The idea isnt't all that revolutionary, in fact something similar was tried
ages ago (9773722c2b09d5f0615a47cecf4347859474dc56) back when the values were
only 32 bit anyway. I believe now it didn't quite work then because the
adjustment needed for testing trivial reject / partial masks wasn't handled
correctly.
This still keeps the separate 32/64 bit paths for now, as the 32 bit one still
looks minimally simpler (and also because if we'd pass in dcdx/dcdy/eo unscaled
from setup which would be a good reason to ditch the 32 bit path, we'd need to
change the special-purpose rasterization functions for small tris).

This passes piglit triangle-rasterization (-fbo -auto -max_size
-subpixelbits 8) and triangle-rasterization-overdraw (with some hacks
to make it work correctly with large sizes) easily (full piglit as
well of course, but most tests wouldn't use triangles large enough to
be affected, that is tris with a bounding box over 128x128).
The profiler says indeed time spent in rast_tri functions is reduced
substantially, BUT of course only if the tris are large. I measured a 3%
improvement in mesa gloss demo when supersized to twice the screen size...

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agollvmpipe: scale up bounding box planes to subpixel precision
Roland Scheidegger [Sun, 3 Jan 2016 00:13:45 +0000 (01:13 +0100)]
llvmpipe: scale up bounding box planes to subpixel precision

Otherwise some planes we get in rasterization have subpixel precision, others
not. Doesn't matter so far, but will soon. (OpenGL actually supports viewports
with subpixel accuracy, so could even do bounding box calcs with that).

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agollvmpipe: add sse code for fixed position calculation
Roland Scheidegger [Sat, 2 Jan 2016 03:59:16 +0000 (04:59 +0100)]
llvmpipe: add sse code for fixed position calculation

This is quite a few less instructions, albeit still do the 2 64bit muls
with scalar c code (they'd need way more shuffles, plus fixup for the signed
mul so it totally doesn't seem worth it - x86 can do 32x32->64bit signed
scalar muls natively just fine after all (even on 32bit).

(This still doesn't have a very measurable performance impact in reality,
although profiler seems to say time spent in setup indeed has gone down by
10% or so overall. Maybe good for a 3% or so improvement in openarena.)

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agodraw: fix key comparison with uninitialized value
Roland Scheidegger [Tue, 12 Jan 2016 17:47:44 +0000 (18:47 +0100)]
draw: fix key comparison with uninitialized value

Discovered by accident, valgrind was complaining (could have possibly caused
us to create redundant geometry shader variants).

v2: convinced by Brian and Jose, just use memset for both gs and vs keys,
just as easy and less error prone.

8 years agomesa: print the invalid enum when CreateShader fails
Timothy Arceri [Tue, 12 Jan 2016 08:37:38 +0000 (19:37 +1100)]
mesa: print the invalid enum when CreateShader fails

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: Make read_from_write_only_variable_visitor ignore .length().
Kenneth Graunke [Mon, 11 Jan 2016 22:51:38 +0000 (14:51 -0800)]
glsl: Make read_from_write_only_variable_visitor ignore .length().

.length() on an unsized SSBO variable doesn't actually read any data
from the SSBO, and is allowed on variables marked 'writeonly'.

Fixes compute shader compilation in Shadow of Mordor.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoi965: Mark TCS URB writes as having side effects.
Kenneth Graunke [Mon, 11 Jan 2016 20:25:12 +0000 (12:25 -0800)]
i965: Mark TCS URB writes as having side effects.

This adds barrier dependencies around TCS_OPCODE_URB_WRITE, preventing
reads and writes from being incorrectly scheduled.

Fixes rendering in GFXBench 4.0's tessellation demo.

For some reason, we haven't ever listed URB writes as having
side-effects.  This hasn't been a problem because in most stages, we
never read from the URB, and only write to each location once.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93526
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
8 years agost/omx: Avoid segfault in deconstructor if constructor fails
Tom St Denis [Tue, 3 Nov 2015 17:41:54 +0000 (12:41 -0500)]
st/omx: Avoid segfault in deconstructor if constructor fails

If the constructor fails before the LIST_INIT calls the pointers
will be null and the deconstructor will segfault.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agovl: use preferred format for deinterlacing
Christian König [Wed, 16 Dec 2015 13:19:41 +0000 (14:19 +0100)]
vl: use preferred format for deinterlacing

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agovl: improve motion adaptive deinterlacer
Christian König [Tue, 15 Dec 2015 20:21:50 +0000 (21:21 +0100)]
vl: improve motion adaptive deinterlacer

Handle other formats than YV12 as well.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agost/va: add BOB deinterlacing v2
Christian König [Tue, 8 Dec 2015 12:18:43 +0000 (13:18 +0100)]
st/va: add BOB deinterlacing v2

Tested with MPV.

v2: correctly handle compositor deinterlacing as well.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agost/va: add NV12 -> NV12 post processing v2
Christian König [Mon, 7 Dec 2015 15:40:29 +0000 (16:40 +0100)]
st/va: add NV12 -> NV12 post processing v2

Usefull for mpv and GStreamer.

v2: use common functionality for size adjustment.

Signed-off-by: Indrajit-kumar Das <Indrajit-kumar.Das@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agost/va: use vl_video_buffer_adjust_size
Christian König [Wed, 16 Dec 2015 20:11:17 +0000 (21:11 +0100)]
st/va: use vl_video_buffer_adjust_size

Use the new helper function instead of open coding it.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agost/vdpau: use vl_video_buffer_adjust_size
Christian König [Tue, 15 Dec 2015 10:53:48 +0000 (11:53 +0100)]
st/vdpau: use vl_video_buffer_adjust_size

Use the new helper function instead of open coding it.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agovl/buffers: extract vl_video_buffer_adjust_size helper
Christian König [Tue, 15 Dec 2015 10:51:44 +0000 (11:51 +0100)]
vl/buffers: extract vl_video_buffer_adjust_size helper

Useful for the state trackers as well.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agost/va: make the implementation thread safe v2
Christian König [Wed, 16 Dec 2015 19:58:49 +0000 (20:58 +0100)]
st/va: make the implementation thread safe v2

Otherwise we might crash with MPV.

v2: minor cleanups suggested on the list.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Julien Isorce <j.isorce@samsung.com>
Tested-by: Julien Isorce <j.isorce@samsung.com>
8 years agomesa: use gl_shader_variable in program resource list
Tapani Pälli [Tue, 12 Jan 2016 06:52:12 +0000 (08:52 +0200)]
mesa: use gl_shader_variable in program resource list

Patch changes linker to allocate gl_shader_variable instead of using
ir_variable. This makes it possible to get rid of ir_variables and ir
in memory after linking.

v2: check that we do not create duplicate entries with
    packed varyings

v3: document 'patch' bit (Ilia Mirkin)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoglsl: track total amount of uniform locations used
Tapani Pälli [Fri, 8 Jan 2016 06:20:25 +0000 (08:20 +0200)]
glsl: track total amount of uniform locations used

Linker missed a check for situation where we exceed max amount of
uniform locations with explicit + implicit locations. Patch adds this
check to already existing iteration over uniforms in linker.

Fixes following CTS test:
   ES31-CTS.explicit_uniform_location.uniform-loc-negative-link-max-num-of-locations

v2: use var->type->uniform_locations() (Timothy)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agomain: get rid of needless conditional
Erik Faye-Lund [Wed, 16 Dec 2015 16:09:50 +0000 (17:09 +0100)]
main: get rid of needless conditional

We already check if the driver changed the completeness, we don't
need to duplicate that check. Let's just early out there instead.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agogallium/util: removed unused header-file
Erik Faye-Lund [Wed, 16 Dec 2015 16:09:49 +0000 (17:09 +0100)]
gallium/util: removed unused header-file

This hasn't been in use since c476305 ("gallium/util: pregenerate
half float tables"), where the last bit of run-time init using this
was killed. So let's just get rid of the pointless header.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agonvc0: do not force re-binding of compute constbufs on Fermi
Samuel Pitoiset [Mon, 11 Jan 2016 23:31:11 +0000 (00:31 +0100)]
nvc0: do not force re-binding of compute constbufs on Fermi

Re-binding compute constant buffers after launching a grid have no effects
because they are not currently validated and because dirty_cp is not updated
accordingly. This might also prevent weird future behaviours when UBOs will
be bound for compute.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agometa: Unconditionally set GL_SKIP_DECODE_EXT
Ian Romanick [Tue, 10 Nov 2015 23:18:54 +0000 (15:18 -0800)]
meta: Unconditionally set GL_SKIP_DECODE_EXT

The path that depends on this will be avoided (by fallback_required) if
the extension is not supported.  _mesa_set_sampler_srgb_decode does not
generate GL errors (by design), so there are no problems there.

I kept this change separate and last because it is one of the few in the
series that is not a candidate for the stable branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agometa: Only bind the sampler in one place
Ian Romanick [Tue, 10 Nov 2015 23:16:33 +0000 (15:16 -0800)]
meta: Only bind the sampler in one place

All of the calls after the first _mesa_bind_sampler call are DSA style
calls that don't depend on the current binding.

I kept this change separate and last because it is one of the few in the
series that is not a candidate for the stable branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agometa/decompress: Don't pollute the sampler object namespace
Ian Romanick [Wed, 11 Nov 2015 00:33:02 +0000 (16:33 -0800)]
meta/decompress: Don't pollute the sampler object namespace

tl;dr: For many types of GL object, we can *NEVER* use the Gen function.

In OpenGL ES (all versions!) and OpenGL compatibility profile,
applications don't have to call Gen functions.  The GL spec is very
clear about how you can mix-and-match generated names and non-generated
names: you can use any name you want for a particular object type until
you call the Gen function for that object type.

Here's the problem scenario:

 - Application calls a meta function that generates a name.  The first
   Gen will probably return 1.

 - Application decides to use the same name for an object of the same
   type without calling Gen.  Many demo programs use names 1, 2, 3,
   etc. without calling Gen.

 - Application calls the meta function again, and the meta function
   replaces the data.  The application's data is lost, and the app
   fails.  Have fun debugging that.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92363
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agometa/decompress: Save and restore the sampler using gl_sampler_object instead of...
Ian Romanick [Wed, 11 Nov 2015 19:01:46 +0000 (11:01 -0800)]
meta/decompress: Save and restore the sampler using gl_sampler_object instead of GL API object handle

Some meta operations can be called recursively.  Future changes (the
"Don't pollute the ... namespace" changes) will cause objects with
invalid names to be used.  If a nested meta operation tries to restore
an object named 0xDEADBEEF, it will fail.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agometa/decompress: Track sampler using gl_sampler_object instead of GL API object handle
Ian Romanick [Wed, 11 Nov 2015 00:26:38 +0000 (16:26 -0800)]
meta/decompress: Track sampler using gl_sampler_object instead of GL API object handle

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agometa/decompress: Use internal functions for sampler object access
Ian Romanick [Tue, 10 Nov 2015 23:33:20 +0000 (15:33 -0800)]
meta/decompress: Use internal functions for sampler object access

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agometa/generate_mipmap: Don't pollute the sampler object namespace
Ian Romanick [Tue, 10 Nov 2015 23:12:13 +0000 (15:12 -0800)]
meta/generate_mipmap: Don't pollute the sampler object namespace

tl;dr: For many types of GL object, we can *NEVER* use the Gen function.

In OpenGL ES (all versions!) and OpenGL compatibility profile,
applications don't have to call Gen functions.  The GL spec is very
clear about how you can mix-and-match generated names and non-generated
names: you can use any name you want for a particular object type until
you call the Gen function for that object type.

Here's the problem scenario:

 - Application calls a meta function that generates a name.  The first
   Gen will probably return 1.

 - Application decides to use the same name for an object of the same
   type without calling Gen.  Many demo programs use names 1, 2, 3,
   etc. without calling Gen.

 - Application calls the meta function again, and the meta function
   replaces the data.  The application's data is lost, and the app
   fails.  Have fun debugging that.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92363
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agometa/generate_mipmap: Save and restore the sampler using gl_sampler_object instead...
Ian Romanick [Wed, 11 Nov 2015 05:33:52 +0000 (21:33 -0800)]
meta/generate_mipmap: Save and restore the sampler using gl_sampler_object instead of GL API object handle

Some meta operations can be called recursively.  Future changes (the
"Don't pollute the ... namespace" changes) will cause objects with
invalid names to be used.  If a nested meta operation tries to restore
an object named 0xDEADBEEF, it will fail.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agometa/generate_mipmap: Track sampler using gl_sampler_object instead of GL API object...
Ian Romanick [Tue, 10 Nov 2015 23:06:04 +0000 (15:06 -0800)]
meta/generate_mipmap: Track sampler using gl_sampler_object instead of GL API object handle

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agometa/generate_mipmap: Use internal functions for sampler object access
Ian Romanick [Tue, 10 Nov 2015 03:22:25 +0000 (19:22 -0800)]
meta/generate_mipmap: Use internal functions for sampler object access

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agometa/blit: Don't pollute the sampler object namespace in _mesa_meta_setup_sampler
Ian Romanick [Tue, 10 Nov 2015 03:10:48 +0000 (19:10 -0800)]
meta/blit: Don't pollute the sampler object namespace in _mesa_meta_setup_sampler

tl;dr: For many types of GL object, we can *NEVER* use the Gen function.

In OpenGL ES (all versions!) and OpenGL compatibility profile,
applications don't have to call Gen functions.  The GL spec is very
clear about how you can mix-and-match generated names and non-generated
names: you can use any name you want for a particular object type until
you call the Gen function for that object type.

Here's the problem scenario:

 - Application calls a meta function that generates a name.  The first
   Gen will probably return 1.

 - Application decides to use the same name for an object of the same
   type without calling Gen.  Many demo programs use names 1, 2, 3,
   etc. without calling Gen.

 - Application calls the meta function again, and the meta function
   replaces the data.  The application's data is lost, and the app
   fails.  Have fun debugging that.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92363
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agometa/blit: Save and restore the sampler using gl_sampler_object instead of GL API...
Ian Romanick [Wed, 11 Nov 2015 02:46:12 +0000 (18:46 -0800)]
meta/blit: Save and restore the sampler using gl_sampler_object instead of GL API object handle

Some meta operations can be called recursively.  Future changes (the
"Don't pollute the ... namespace" changes) will cause objects with
invalid names to be used.  If a nested meta operation tries to restore
an object named 0xDEADBEEF, it will fail.

v2: Add a comment explaining why samp_obj_save is set to NULL in
_mesa_meta_fb_tex_blit_begin.  This came out of review feedback from
Jason.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agometa/blit: Use internal functions for sampler object access
Ian Romanick [Mon, 9 Nov 2015 20:41:47 +0000 (12:41 -0800)]
meta/blit: Use internal functions for sampler object access

This requires tracking the sampler object using the gl_sampler_object*
instead of the object name.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agometa/blit: Group the SamplerParameteri calls with the other sampler operations
Ian Romanick [Mon, 9 Nov 2015 19:39:15 +0000 (11:39 -0800)]
meta/blit: Group the SamplerParameteri calls with the other sampler operations

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agomesa: Refator _mesa_BindSampler to make _mesa_bind_sampler
Ian Romanick [Tue, 10 Nov 2015 03:02:21 +0000 (19:02 -0800)]
mesa: Refator _mesa_BindSampler to make _mesa_bind_sampler

Pulls the parts of _mesa_BindSampler that aren't just parameter
validation out into a function that can be called from other parts of
Mesa (e.g., meta).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agomesa: Add _mesa_set_sampler_srgb_decode method
Ian Romanick [Mon, 9 Nov 2015 20:16:58 +0000 (12:16 -0800)]
mesa: Add _mesa_set_sampler_srgb_decode method

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agomesa: Add _mesa_set_sampler_filters method
Ian Romanick [Mon, 9 Nov 2015 19:59:19 +0000 (11:59 -0800)]
mesa: Add _mesa_set_sampler_filters method

v2: Add filter enum assertions.  Suggested by Jason.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agomesa: Add _mesa_set_sampler_wrap method
Ian Romanick [Mon, 9 Nov 2015 19:55:59 +0000 (11:55 -0800)]
mesa: Add _mesa_set_sampler_wrap method

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agonvc0: remove useless goto in nvc0_launch_grid()
Samuel Pitoiset [Mon, 11 Jan 2016 23:11:06 +0000 (00:11 +0100)]
nvc0: remove useless goto in nvc0_launch_grid()

Trivial.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agomesa: Mark Identity as const
Ian Romanick [Thu, 7 Jan 2016 23:10:16 +0000 (15:10 -0800)]
mesa: Mark Identity as const

I was going to send this as review for dce1e1a8, but I missed that
window.  This saves 64 bytes of unshared data and prelaces it with 96
bytes shared text.  My guess is that some of the calls to memcpy get
optimized to something else.

   text    data     bss     dec     hex filename
7847613  220208   27432 8095253  7b8615 i965_dri.so before
7847709  220144   27432 8095285  7b8635 i965_dri.so after

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: Brian Paul <brianp@vmware.com>
8 years agoconfigure.ac: always define __STDC_CONSTANT_MACROS
Oded Gabbay [Mon, 11 Jan 2016 19:55:15 +0000 (21:55 +0200)]
configure.ac: always define __STDC_CONSTANT_MACROS

The ISO C99 standard (7.18.4) specifies that C++
implementations should define UINT64_C only when
__STDC_CONSTANT_MACROS is defined.

Because we now use UINT64_C in our cpp files (since commit
208bfc493debe0344d0b9cb93975981f14412628), we need to add this define.

This also solves compilation errors with GCC 4.8.x on ppc64le machines.

v2: add this define to SCons build system

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agoi965: Upload 3DSTATE_BINDING_TABLE_POINTERS_HS when !TCS on Gen9+.
Kenneth Graunke [Sun, 10 Jan 2016 23:01:03 +0000 (15:01 -0800)]
i965: Upload 3DSTATE_BINDING_TABLE_POINTERS_HS when !TCS on Gen9+.

Gen9+ requires us to emit 3DSTATE_BINDING_TABLE_POINTERS_HS for the
hull shader push constants to take effect.  The passthrough TCS uses
push constants for the default tessellation levels.  So, when those
change, we need to re-upload the binding table as well.

Fixes five Piglit tests on Skylake:
- spec/arb_tessellation_shader/vs-tes-vertex
- spec/arb_tessellation_shader/vs-tes-tessinner-tessouter-inputs-quads
- spec/arb_tessellation_shader/vs-tes-tessinner-tessouter-inputs-tris
- spec/arb_tessellation_shader/tes-read-texture
- spec/arb_tessellation_shader/tess_with_geometry

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoAdd missing platform information for KBL
Mark Janes [Sat, 9 Jan 2016 00:30:20 +0000 (16:30 -0800)]
Add missing platform information for KBL

In testing KBL, I found:

 - urb size was not set for slices gt1.5, gt2, and gt3.  The value I
   used for these slices (384) was taken from an earlier patch authored
   by Ben Widawsky.

 - slice count was missing.  This field was added by
   a403ad4f5a034e52a3cd845e91c4aa3e6927b731

With this commit, KBL passes piglit at parity with SKL.

Note: As requested by Kristian, Sarah modified this patch to drop
setting urb size for gt1.5, gt2, and gt3, since the correct default is
set in the GEN9 macro by commit c1e38ad37042b0ec261eb0ba5631b7ff0ee7a9da
"i965/skl: Use larger URB size where available."

Signed-off-by: Mark Janes <mark.a.janes@intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Reviewed-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Cc: "11.1" <mesa-stable@lists.freedesktop.org>
8 years agonv50/ir: the whole point of data array is to hand out regular registers
Ilia Mirkin [Mon, 11 Jan 2016 17:58:19 +0000 (12:58 -0500)]
nv50/ir: the whole point of data array is to hand out regular registers

Fixes: 0d3051f75a (nv50/ir: Fix scratch allocation size and file)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agomesa/uniform_query: add IROUNDD and use for doubles->ints (v2)
Dave Airlie [Thu, 15 Oct 2015 04:07:40 +0000 (05:07 +0100)]
mesa/uniform_query: add IROUNDD and use for doubles->ints (v2)

For the case where we convert a double to an int, we should
round the same as we do for floats.

This fixes GL41-CTS.gpu_shader_fp64.state_query

v2: add IROUNDD (Ilia)

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: replace unreachable code path with assert
Timothy Arceri [Fri, 8 Jan 2016 04:25:37 +0000 (15:25 +1100)]
glsl: replace unreachable code path with assert

The lower_named_interface_blocks() pass is called before we try
assign locations to varyings so this shouldn't be reachable.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agoRevert "glsl: replace unreachable code path with assert"
Timothy Arceri [Sun, 10 Jan 2016 22:20:39 +0000 (09:20 +1100)]
Revert "glsl: replace unreachable code path with assert"

This reverts commit 98270fd20d4d58db8ae5af3b6f10ed6a81c058a6.

Something went terribly wrong the commit is not what the commit
message says.

8 years agoglsl: replace unreachable code path with assert
Timothy Arceri [Fri, 8 Jan 2016 04:25:37 +0000 (15:25 +1100)]
glsl: replace unreachable code path with assert

The lower_named_interface_blocks() pass is called before we try
assign locations to varyings so this shouldn't be reachable.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agoglsl: combine if blocks
Timothy Arceri [Fri, 8 Jan 2016 04:25:36 +0000 (15:25 +1100)]
glsl: combine if blocks

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agomesa: Update todo regarding StencilOp and StencilOpSeparate.
Rhys Kidd [Thu, 20 Aug 2015 13:03:29 +0000 (23:03 +1000)]
mesa: Update todo regarding StencilOp and StencilOpSeparate.

OpenGL 2.0 function StencilOp() is in part internally implemented via
StencilOpSeparate(). This change happened some time ago, however the
accompanying doxygen todo comment was not accordingly updated.

Replace the outdated portion of this doxygen todo comment, leaving the
remainder unchanged.

Also better respect the 80 character suggested line length in this file.

v2: Fully remove comment, following code review by t_arceri@yahoo.com.au

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglsl: Make bitfield_insert/extract and bfi/bfm non-vectorizable.
Kenneth Graunke [Thu, 7 Jan 2016 23:45:21 +0000 (15:45 -0800)]
glsl: Make bitfield_insert/extract and bfi/bfm non-vectorizable.

Currently, opt_vectorize() tries to combine:

    result.x = bitfieldInsert(src0.x, src1.x, src2.x, src3.x);
    result.y = bitfieldInsert(src0.y, src1.y, src2.y, src3.y);
    result.z = bitfieldInsert(src0.z, src1.z, src2.z, src3.z);
    result.w = bitfieldInsert(src0.w, src1.w, src2.w, src3.w);

into a single ir_quadop_bitfield_insert opcode, which operates on
ivec4s.  However, GLSL IR's opcodes currently require the bits and
offset parameters to be scalar integers.  So, this breaks.

We want to be able to vectorize this eventually, but for now, just
chicken out and make opt_vectorize() bail by marking all the bitfield
insert/extract related opcodes as horizontal.  This is a relatively
uncommon case today, so we'll do the simple fix for stable branches,
and fix it properly on master.

Fixes assertion failures when compiling Shadow of Mordor vertex shaders
on i965 in vec4 mode (where OptimizeForAOS enables opt_vectorize()).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: mesa-stable@lists.freedesktop.org
8 years agonv50/ir: Fix scratch allocation size and file
Pierre Moreau [Fri, 1 Jan 2016 12:09:42 +0000 (13:09 +0100)]
nv50/ir: Fix scratch allocation size and file

Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agomesa: merge bind_atomic_buffers_{base|range}
Nicolai Hähnle [Wed, 6 Jan 2016 22:30:18 +0000 (17:30 -0500)]
mesa: merge bind_atomic_buffers_{base|range}

Reduced code duplication should make the code more maintainable.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: merge bind_shader_storage_buffers_{base|range}
Nicolai Hähnle [Wed, 6 Jan 2016 22:26:14 +0000 (17:26 -0500)]
mesa: merge bind_shader_storage_buffers_{base|range}

Reduced code duplication should make the code more maintainable.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: merge bind_uniform_buffers_{base|range}
Nicolai Hähnle [Wed, 6 Jan 2016 22:20:57 +0000 (17:20 -0500)]
mesa: merge bind_uniform_buffers_{base|range}

Reduced code duplication should make the code more maintainable.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: merge bind_xfb_buffers_{base|range}
Nicolai Hähnle [Wed, 6 Jan 2016 20:47:01 +0000 (15:47 -0500)]
mesa: merge bind_xfb_buffers_{base|range}

Reduced code duplication should make the code more maintainable.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoglsl: Don't add nir files to libglsl_la_SOURCES
Kristian Høgsberg Kristensen [Fri, 8 Jan 2016 23:23:56 +0000 (15:23 -0800)]
glsl: Don't add nir files to libglsl_la_SOURCES

SCons doesn't understand nir yet and doesn't want to compile the glsl to
nir pass. Move the files to their own variable so we can add it only for
automake.

Tested-by: Brian Paul <brianp@vmware.com>
8 years agonv50,nvc0: use a face sysval to avoid the useless back-and-forth conversion
Ilia Mirkin [Fri, 8 Jan 2016 22:32:56 +0000 (17:32 -0500)]
nv50,nvc0: use a face sysval to avoid the useless back-and-forth conversion

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoglsl: Move _mesa_shader_stage_to_string/abbrev to shader_enums.c
Kristian Høgsberg Kristensen [Fri, 8 Jan 2016 20:35:48 +0000 (12:35 -0800)]
glsl: Move _mesa_shader_stage_to_string/abbrev to shader_enums.c

These are used by code that doesn't necessarily link to libglsl.la. Move
them to shader_enums.[ch] where we keep similar helpers.

Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoi965: Move GLSL lowering passes out of libi965_compiler.la
Kristian Høgsberg Kristensen [Fri, 8 Jan 2016 20:35:38 +0000 (12:35 -0800)]
i965: Move GLSL lowering passes out of libi965_compiler.la

The scope of libi965_compiler.la is to be able to take nir shaders and
generate i965 EU code.  As such, we don't want the GLSL IR lowering
passes in the library. With this change, libi965_compiler.la no longer
needs to link to libglsl.la.

Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoglsl: Move glsl_to_nir files to LIBGLSL_FILES
Kristian Høgsberg Kristensen [Fri, 8 Jan 2016 20:35:18 +0000 (12:35 -0800)]
glsl: Move glsl_to_nir files to LIBGLSL_FILES

libglsl_la_SOURCES includes both NIR_FILES and LIBGLSL_FILES, so for
libglsl.la consumers, this is a no-op. libnir.la however no longer uses
any GLSL IR infrastructure and can be used without also linking to
libglsl.la.

Acked-by: Matt Turner <mattst88@gmail.com>
8 years agomesa: Use separate indices for UBO & SSBO during binding
Jordan Justen [Sat, 24 Oct 2015 00:08:33 +0000 (17:08 -0700)]
mesa: Use separate indices for UBO & SSBO during binding

Previously we were treating the binding index for Uniform Buffer
Objects and Shader Storage Buffer Objects as being part of the
combined BufferInterfaceBlocks array.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93322
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agomesa: Map program UBOs and SSBOs to Interface Blocks
Jordan Justen [Sat, 24 Oct 2015 00:07:42 +0000 (17:07 -0700)]
mesa: Map program UBOs and SSBOs to Interface Blocks

v2:
 * Fill UboInterfaceBlockIndex and SsboInterfaceBlockIndex in
   split_ubos_and_ssbos (Iago)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>