platform/upstream/mesa.git
8 years agoswr: [rasterizer jitter] add mask support for odd format fetch
Tim Rowley [Mon, 8 Aug 2016 19:57:27 +0000 (13:57 -0600)]
swr: [rasterizer jitter] add mask support for odd format fetch

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] routing of viewport indexes through frontend
Tim Rowley [Mon, 8 Aug 2016 19:08:39 +0000 (13:08 -0600)]
swr: [rasterizer core] routing of viewport indexes through frontend

Viewport transform performed based on per-prim viewport index if available.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] split FE and BE stats
Tim Rowley [Sun, 7 Aug 2016 02:10:14 +0000 (20:10 -0600)]
swr: [rasterizer core] split FE and BE stats

Separated FE stats out into its own structure.  There are 17 FE vs 3 BE
stat fields.  Since there is only one FE thread per DC then we don't have
to loop over all threads and sum up FE stats over all the worker threads.
This also reduces size of DC since we only need to store one copy of the
FE stats and not one per worker.  Finally, we can use the new FE callback
mechanism to update these.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] remove all old stats code
Tim Rowley [Fri, 5 Aug 2016 22:45:41 +0000 (16:45 -0600)]
swr: [rasterizer core] remove all old stats code

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] viewport array support
Tim Rowley [Fri, 5 Aug 2016 22:42:24 +0000 (16:42 -0600)]
swr: [rasterizer core] viewport array support

Change viewport matrix storage from AOS to SOA to support viewport arrays.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer jitter] fetch support for offsetting VertexID
Tim Rowley [Fri, 5 Aug 2016 22:19:10 +0000 (16:19 -0600)]
swr: [rasterizer jitter] fetch support for offsetting VertexID

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] fundamentally change how stats work
Tim Rowley [Fri, 5 Aug 2016 17:17:25 +0000 (11:17 -0600)]
swr: [rasterizer core] fundamentally change how stats work

Add a per draw stats callback to update driver stats.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] add rasterizerSampleCount to PS context
Tim Rowley [Thu, 4 Aug 2016 23:37:19 +0000 (17:37 -0600)]
swr: [rasterizer core] add rasterizerSampleCount to PS context

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] remove cygwin threads.cpp stubs
Tim Rowley [Thu, 4 Aug 2016 19:06:49 +0000 (13:06 -0600)]
swr: [rasterizer core] remove cygwin threads.cpp stubs

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] allow override of KNOB thread settings
Tim Rowley [Wed, 3 Aug 2016 23:59:37 +0000 (17:59 -0600)]
swr: [rasterizer core] allow override of KNOB thread settings

- Remove HYPERTHREADED_FE support
- Add threading info as optional data passed to SwrCreateContext.
  If supplied this data will override any KNOB thread settings.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] add SwrWaitForIdleFE
Tim Rowley [Wed, 3 Aug 2016 22:40:27 +0000 (16:40 -0600)]
swr: [rasterizer core] add SwrWaitForIdleFE

This is a blocking call that waits until all FE work is complete.
This is useful for waiting for FE work to complete such as for streamout.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] change threadsDone to be a 32-bit value.
Tim Rowley [Wed, 3 Aug 2016 21:22:20 +0000 (15:22 -0600)]
swr: [rasterizer core] change threadsDone to be a 32-bit value.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] update trivial accept test conditions
Tim Rowley [Tue, 2 Aug 2016 21:07:24 +0000 (15:07 -0600)]
swr: [rasterizer core] update trivial accept test conditions

enable/disable raster tile trivial accept test based on scissor enable trait.
Can be optimized further.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer core] improve implementation for SoWriteOffset
Tim Rowley [Tue, 2 Aug 2016 19:16:52 +0000 (13:16 -0600)]
swr: [rasterizer core] improve implementation for SoWriteOffset

1. SoWriteOffset is no longer treated as a stat
2. Added callback from core to update streamout write offset

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agoswr: [rasterizer common] make disabled asserts always print (but not break)
Tim Rowley [Tue, 2 Aug 2016 00:10:18 +0000 (18:10 -0600)]
swr: [rasterizer common] make disabled asserts always print (but not break)

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
8 years agovl/rbsp: add a check for emulation prevention three byte
Leo Liu [Mon, 8 Aug 2016 20:01:23 +0000 (16:01 -0400)]
vl/rbsp: add a check for emulation prevention three byte

This is the case when the "00 00 03" is very close to the beginning of
nal unit header

v2: move the check to rbsp init

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoRe-apply "glsl: don't try to lower non-gl builtins as if they were gl_FragData"
Ilia Mirkin [Fri, 1 Jul 2016 23:10:36 +0000 (19:10 -0400)]
Re-apply "glsl: don't try to lower non-gl builtins as if they were gl_FragData"

If a shader has an output array, it will get treated as though it were
gl_FragData and rewritten into gl_out_FragData instances. We only want
this to happen on the actual gl_FragData and not everything else.

This is a small part of the problem pointed out by the below bug.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96765
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoradeonsi: set CB_COLORn_INFO.ROUND_MODE
Marek Olšák [Tue, 9 Aug 2016 10:58:25 +0000 (12:58 +0200)]
radeonsi: set CB_COLORn_INFO.ROUND_MODE

just do what the register spec says

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
8 years agoradeonsi: set CB_COLORn_INFO.SIMPLE_FLOAT
Marek Olšák [Tue, 9 Aug 2016 10:49:51 +0000 (12:49 +0200)]
radeonsi: set CB_COLORn_INFO.SIMPLE_FLOAT

This can help enable some blend optimizations (see the register spec).
Vulkan always sets this.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
8 years agoradeonsi: disallow MIN/MAX blend equations for dual source blending
Marek Olšák [Tue, 9 Aug 2016 11:26:23 +0000 (13:26 +0200)]
radeonsi: disallow MIN/MAX blend equations for dual source blending

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
8 years agoradeonsi: only set dual source blending for MRT0
Marek Olšák [Tue, 9 Aug 2016 10:43:13 +0000 (12:43 +0200)]
radeonsi: only set dual source blending for MRT0

This is the proper fix for Overlord and Witcher 2 hangs.

The hang condition is that 1 app must write to MRT0 and MRT1 from a pixel
shader while MRT1 is disabled in CB_TARGET_MASK (does this generate
unflushable pixel quads? I don't know), and another app (e.g. Glamor)
must enable dual source blending in both MRT0 and MRT1. The hw gets
confused, which leads to corruption and hangs.

Cc: 12.0 11.2 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
8 years agost/mesa: in ATI fs don't assume TEMP0=REG0
Miklós Máté [Sun, 7 Aug 2016 22:48:31 +0000 (00:48 +0200)]
st/mesa: in ATI fs don't assume TEMP0=REG0

The temporaries are allocated dynamically.

Signed-off-by: Miklós Máté <mtmkls@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agost/nine: Fix invalid attempt to use indirect draws.
Trevor Davenport [Wed, 10 Aug 2016 03:28:07 +0000 (20:28 -0700)]
st/nine: Fix invalid attempt to use indirect draws.

Since commit 6d7177f01b231e9fe79a558c28d2b562a218d7ea, radeonsi
would take a different path if info->indirect_params was not
initialized properly.  Nine was not initializating this field.

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agoutil: Use win32 intrinsics for util_last_bit if present.
Mathias Fröhlich [Sat, 6 Aug 2016 05:26:51 +0000 (07:26 +0200)]
util: Use win32 intrinsics for util_last_bit if present.

v2: Split into two patches.
v3: Fix off by one problem.

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
8 years agogallium/radeon: use unflushed fences for deferred flushes (v2)
Marek Olšák [Mon, 1 Aug 2016 22:48:04 +0000 (00:48 +0200)]
gallium/radeon: use unflushed fences for deferred flushes (v2)

+23% Bioshock Infinite performance.

v2: - use the new fence_finish interface
    - allow deferred fences with multiple contexts
    - clear the ctx pointer after a deferred flush

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agost/mesa: set the ctx parameter of fence_finish
Marek Olšák [Sat, 6 Aug 2016 15:00:20 +0000 (17:00 +0200)]
st/mesa: set the ctx parameter of fence_finish

for deferred flushes

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium: add a pipe_context parameter to fence_finish
Marek Olšák [Sat, 6 Aug 2016 14:41:42 +0000 (16:41 +0200)]
gallium: add a pipe_context parameter to fence_finish

required by glClientWaitSync (GL 4.5 Core spec) that can optionally flush
the context

Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agost/mesa: use PIPE_USAGE_STREAM for GL_CLIENT_STORAGE_BIT without READ_BIT (v2)
Marek Olšák [Fri, 5 Aug 2016 21:33:52 +0000 (23:33 +0200)]
st/mesa: use PIPE_USAGE_STREAM for GL_CLIENT_STORAGE_BIT without READ_BIT (v2)

v2: keep STAGING for GL_MAP_READ_BIT

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agogallium/radeon: add HUD queries for mapped VRAM/GTT
Marek Olšák [Thu, 4 Aug 2016 23:38:23 +0000 (01:38 +0200)]
gallium/radeon: add HUD queries for mapped VRAM/GTT

mainly for monitoring visible VRAM congestion

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agowinsys/radeon: track the amount of mapped memory
Marek Olšák [Thu, 4 Aug 2016 23:28:17 +0000 (01:28 +0200)]
winsys/radeon: track the amount of mapped memory

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agowinsys/amdgpu: track the amount of mapped memory
Marek Olšák [Thu, 4 Aug 2016 23:28:17 +0000 (01:28 +0200)]
winsys/amdgpu: track the amount of mapped memory

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agowinsys/amdgpu: don't try to unmap userptr buffers
Marek Olšák [Thu, 4 Aug 2016 23:18:08 +0000 (01:18 +0200)]
winsys/amdgpu: don't try to unmap userptr buffers

no app calls this AFAIK

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: increase the size of the renderer string
Marek Olšák [Thu, 4 Aug 2016 14:22:59 +0000 (16:22 +0200)]
gallium/radeon: increase the size of the renderer string

Mine is longer than 64 bytes.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: implement ARB_clear_texture (v3)
Marek Olšák [Thu, 4 Aug 2016 17:04:02 +0000 (19:04 +0200)]
gallium/radeon: implement ARB_clear_texture (v3)

Some ideas copied from Jakob Sinclair's implementation, but the color
clearing is completely different.

v2: remove leftover code, disable conditional rendering
    disable render condition cleanly

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: handle render_condition_enable for clear_rt/ds
Marek Olšák [Mon, 8 Aug 2016 22:42:14 +0000 (00:42 +0200)]
gallium/radeon: handle render_condition_enable for clear_rt/ds

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium: add render_condition_enable param to clear_render_target/depth_stencil
Marek Olšák [Mon, 8 Aug 2016 22:37:39 +0000 (00:37 +0200)]
gallium: add render_condition_enable param to clear_render_target/depth_stencil

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoegl: android: query native window default width and height (v2)
Haixia Shi [Thu, 28 Jul 2016 17:51:12 +0000 (10:51 -0700)]
egl: android: query native window default width and height (v2)

On android platform, the width and height of a native window surface may
be updated after initialization. It is therefore necessary to query android
framework for the current width and height.

v2: remove Android specific #ifdef's and just implement the fallback directly
if the platform query_surface() callback is not provided.

TEST=dEQP-EGL.functional.resize.surface_size#* on cyan-cheets

Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org> (v1)
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Chad Versace <chad@kiwitree.net>
Change-Id: I673f7d2f1d90c3bf572b30f63da537f2cae1496e

8 years agoanv/device: Enable sample shading on gen7+
Anuj Phogat [Mon, 8 Aug 2016 23:10:00 +0000 (16:10 -0700)]
anv/device: Enable sample shading on gen7+

Passes all 30 min_sample_shading tests in vulkan cts.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoanv/gen7_pipeline: Set multisample state using shared function
Anuj Phogat [Mon, 8 Aug 2016 21:36:40 +0000 (14:36 -0700)]
anv/gen7_pipeline: Set multisample state using shared function

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoanv/pipeline: Add sample locations for gen7-7.5
Anuj Phogat [Mon, 8 Aug 2016 21:53:48 +0000 (14:53 -0700)]
anv/pipeline: Add sample locations for gen7-7.5

V1: Add multisample positions (Nanley)
V2: Fix 8x sample positions to match OpenGL (Anuj)
V3: Vulkan has standard sample locations. They need not be same as
    in OpenGL. (Anuj)

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoanv/pipeline: Move emit_ms_state() to genX_pipeline_util.h
Anuj Phogat [Mon, 8 Aug 2016 21:48:07 +0000 (14:48 -0700)]
anv/pipeline: Move emit_ms_state() to genX_pipeline_util.h

This will help sharing multisample state setting code.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agogallium: Add c99_compat.h to u_bitcast.h
Mathias Fröhlich [Sat, 6 Aug 2016 05:26:59 +0000 (07:26 +0200)]
gallium: Add c99_compat.h to u_bitcast.h

We need this for 'inline'.

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Tested-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agoutil: Move _mesa_fsl/util_last_bit into util/bitscan.h
Mathias Fröhlich [Tue, 2 Aug 2016 06:46:04 +0000 (08:46 +0200)]
util: Move _mesa_fsl/util_last_bit into util/bitscan.h

As requested with the initial creation of util/bitscan.h
now move other bitscan related functions into util.

v2: Split into two patches.

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Tested-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agoradeonsi: enable multi-draw related pipe caps
Nicolai Hähnle [Thu, 28 Jul 2016 16:01:54 +0000 (17:01 +0100)]
radeonsi: enable multi-draw related pipe caps

This enables GL_shader_draw_parameters and GL_ARB_indirect_parameters as well
as a properly accelerated implementation of GL_ARB_multi_draw_indirect.

Enabling the feature requires a sufficiently uptodate firmware -- those have
already been released a long time ago, although this does mean that the
feature only works with the amdgpu kernel module, since the radeon module
doesn't have a way to query the firmware version.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: program additional multi draw parameters
Nicolai Hähnle [Mon, 8 Aug 2016 14:00:29 +0000 (16:00 +0200)]
radeonsi: program additional multi draw parameters

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: program the DRAWID SGPR
Nicolai Hähnle [Mon, 8 Aug 2016 13:54:50 +0000 (15:54 +0200)]
radeonsi: program the DRAWID SGPR

Note that for indirect draws, the new MULTI firmware packets are required.

There's also no need to reset last_{start_instance,sh_base_reg}, since
resetting last_base_vertex is sufficient.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: add DRAWID parameter to vertex shaders
Nicolai Hähnle [Mon, 8 Aug 2016 13:38:04 +0000 (15:38 +0200)]
radeonsi: add DRAWID parameter to vertex shaders

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: wire up TGSI_SEMANTIC_BASEINSTANCE
Nicolai Hähnle [Mon, 8 Aug 2016 13:33:14 +0000 (15:33 +0200)]
radeonsi: wire up TGSI_SEMANTIC_BASEINSTANCE

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: remove an incorrect assertion
Nicolai Hähnle [Mon, 8 Aug 2016 15:50:42 +0000 (17:50 +0200)]
radeonsi: remove an incorrect assertion

Byte indices don't need any alignment, so remove this assertion (it got moved
into a path where a piglit test hit it during the refactoring of
commit 64ff23a58c).

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: flush TC L2 cache for indirect draw data
Nicolai Hähnle [Mon, 8 Aug 2016 15:06:22 +0000 (17:06 +0200)]
radeonsi: flush TC L2 cache for indirect draw data

This fixes a bug when indirect draw data is generated by transform
feedback.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi/sid: add additional bits for the DRAW_(INDEX)_INDIRECT_MULTI packets
Nicolai Hähnle [Mon, 8 Aug 2016 13:54:56 +0000 (15:54 +0200)]
radeonsi/sid: add additional bits for the DRAW_(INDEX)_INDIRECT_MULTI packets

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agost/mesa: define ST_NEW_ flags as uint64_t values, not enums
Brian Paul [Mon, 8 Aug 2016 22:37:00 +0000 (16:37 -0600)]
st/mesa: define ST_NEW_ flags as uint64_t values, not enums

MSVC doesn't support 64-bit enum values, at least not with C code.
The compiler was warning:

c:\users\brian\projects\mesa\src\mesa\state_tracker\st_atom_list.h(43) : warning
 C4309: 'initializing' : truncation of constant value
c:\users\brian\projects\mesa\src\mesa\state_tracker\st_atom_list.h(44) : warning
 C4309: 'initializing' : truncation of constant value
...

And at runtime we crashed since the high 32-bits of the 'dirty' bitmask
was always 0xffffffff and the 32+u_bit_scan() index went out of bounds of
the atoms[] array.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agomesa: simplify ff fs generator a bit
Miklós Máté [Sat, 6 Aug 2016 21:34:00 +0000 (15:34 -0600)]
mesa: simplify ff fs generator a bit

Literally.

Signed-off-by: Miklós Máté <mtmkls@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agoddebug: dump driver states and shaders for apitrace calls
Marek Olšák [Sun, 7 Aug 2016 14:24:40 +0000 (16:24 +0200)]
ddebug: dump driver states and shaders for apitrace calls

I think this was an oversight when the PIPE_DUMP flags were added.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agonir: make use of nir_cf_list_extract() helper
Timothy Arceri [Fri, 5 Aug 2016 01:08:20 +0000 (11:08 +1000)]
nir: make use of nir_cf_list_extract() helper

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agonir: Always print non-identity swizzles.
Matt Turner [Tue, 22 Sep 2015 17:30:05 +0000 (10:30 -0700)]
nir: Always print non-identity swizzles.

Previously we would not print a swizzle on ssa_52 when only its .x
component is used (as seen in the definition of ssa_53):

   vec3 ssa_52 = fadd ssa_51, ssa_51
   vec1 ssa_53 = flog2 ssa_52
   vec1 ssa_54 = flog2 ssa_52.y
   vec1 ssa_55 = flog2 ssa_52.z

But this makes the interpretation of the RHS of the definition difficult
to understand and dependent on the size of the LHS. Just print swizzles
when they are not the identity swizzle, so the previous example is now
printed as:

   vec3 ssa_52 = fadd ssa_51.xyz, ssa_51.xyz
   vec1 ssa_53 = flog2 ssa_52.x
   vec1 ssa_54 = flog2 ssa_52.y
   vec1 ssa_55 = flog2 ssa_52.z

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoanv/pipeline/gen7: Set multisample modes
Lionel Landwerlin [Mon, 8 Aug 2016 19:30:08 +0000 (20:30 +0100)]
anv/pipeline/gen7: Set multisample modes

Fixes the following failures :

dEQP-VK.api.copy_and_blit.resolve_image.whole_4_bit
dEQP-VK.api.copy_and_blit.resolve_image.whole_8_bit
dEQP-VK.api.copy_and_blit.resolve_image.partial_4_bit
dEQP-VK.api.copy_and_blit.resolve_image.partial_8_bit
dEQP-VK.api.copy_and_blit.resolve_image.with_regions_4_bit
dEQP-VK.api.copy_and_blit.resolve_image.with_regions_8_bit

Tested on IVB/HSW

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoanv/pipeline: rename info to rs_info in emit_rs_state
Lionel Landwerlin [Mon, 8 Aug 2016 19:30:07 +0000 (20:30 +0100)]
anv/pipeline: rename info to rs_info in emit_rs_state

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoRevert "glsl: don't try to lower non-gl builtins as if they were gl_FragData"
Marek Olšák [Mon, 8 Aug 2016 20:05:29 +0000 (22:05 +0200)]
Revert "glsl: don't try to lower non-gl builtins as if they were gl_FragData"

This reverts commit a37e46323c7e18bec4160f2f66847c10b7041dc1.

It broke the game Overlord such that it hung a GCN GNU. While I don't know
how the hang happened because of its randomness and gfx corruption precedes
it, many of the shaders contain this:

out vec4 FragData[gl_MaxDrawBuffers];

8 years agoegl/android: Add support for YV12 pixel format (v2)
Tomasz Figa [Tue, 2 Aug 2016 11:07:54 +0000 (20:07 +0900)]
egl/android: Add support for YV12 pixel format (v2)

This patch adds support for YV12 pixel format to the Android platform
backend. Only creating EGL images is supported, it is not added to the
list of available visuals.

v2: Use const array defined just for YV12 instead of trying to be overly
    generic.

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
Tested-by: Rob Herring <rob@kernel.org>
Reviewed-by: Chad Versace <chad@kiwitree.net>
Change-Id: I4aeb2d67a95c5cdd10b530c549b23146c8f0b983

8 years agost/mesa: Make Gallium's BlitFramebuffer follow the GL 4.4 sRGB rules.
Kenneth Graunke [Wed, 3 Aug 2016 18:39:18 +0000 (11:39 -0700)]
st/mesa: Make Gallium's BlitFramebuffer follow the GL 4.4 sRGB rules.

OpenGL 4.4 specifies that BlitFramebuffer should perform sRGB encode
and decode like ES 3.x does, but only when GL_FRAMEBUFFER_SRGB is
enabled.  This is technically incompatible in certain cases, but is
more consistent across GL, ES, and WebGL, and more flexible.

The NVIDIA 367.35 drivers appear to follow this behavior.

For the awful spec analysis, please read Piglit's
tests/spec/arb_framebuffer_srgb/blit.c, which explains the differences
between GL 4.1, 4.2, 4.3 (2012), 4.3 (2013), and 4.4, and why this
is the right rule to implement.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agometa: Make Meta's BlitFramebuffer() follow the GL 4.4 sRGB rules.
Kenneth Graunke [Tue, 2 Aug 2016 23:32:52 +0000 (16:32 -0700)]
meta: Make Meta's BlitFramebuffer() follow the GL 4.4 sRGB rules.

Just avoid whacking GL_FRAMEBUFFER_SRGB altogether, so we respect
the application's setting.  This appears to work.

v2: Update one more comment (requested by Ian).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965: Make BLORP's BlitFramebuffer follow the GL 4.4 sRGB rules.
Kenneth Graunke [Tue, 2 Aug 2016 04:56:38 +0000 (21:56 -0700)]
i965: Make BLORP's BlitFramebuffer follow the GL 4.4 sRGB rules.

OpenGL 4.4 specifies that BlitFramebuffer should perform sRGB encode
and decode like ES 3.x does, but only when GL_FRAMEBUFFER_SRGB is
enabled.  This is technically incompatible in certain cases, but is
more consistent across GL, ES, and WebGL, and more flexible.

The NVIDIA 367.35 drivers appear to follow this behavior.

For the awful spec analysis, please read Piglit's
tests/spec/arb_framebuffer_srgb/blit.c, which explains the differences
between GL 4.1, 4.2, 4.3 (2012), 4.3 (2013), and 4.4, and why this
is the right rule to implement.

Note that ctx->Color.sRGBEnabled is initialized to _mesa_is_gles(ctx),
and ES doesn't have enable/disable flags for GL_FRAMEBUFFER_SRGB, so
it's effectively on all the time.  This means the ES behavior should
be unchanged.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965: Make BLORP do sRGB encode/decode on ES 2 as well.
Kenneth Graunke [Wed, 3 Aug 2016 06:48:47 +0000 (23:48 -0700)]
i965: Make BLORP do sRGB encode/decode on ES 2 as well.

This should have no effect, as all drivers which support BLORP also
support ES 3.0 - so ES 2.0 would be promoted and follow the ES 3 rules.

ES 1.0 doesn't have BlitFramebuffer.

This is purely to clarify the next patch a bit.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoRevert "st/mesa: use sRGB formats for MSAA resolving if destination is sRGB"
Kenneth Graunke [Wed, 3 Aug 2016 18:32:21 +0000 (11:32 -0700)]
Revert "st/mesa: use sRGB formats for MSAA resolving if destination is sRGB"

This reverts commit 4e549ddb500cf677b6fa16d9ebdfa67cc23da097,
dropping the hack from Gallium that I just deleted from i965.

See the previous commit for rationale.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoi965: Drop the "do resolves in sRGB" hack.
Kenneth Graunke [Tue, 2 Aug 2016 18:04:01 +0000 (11:04 -0700)]
i965: Drop the "do resolves in sRGB" hack.

I've never quite understood the purpose of this hack - supposedly,
doing resolves in the sRGB colorspace is slightly more accurate.

Currently, BlitFramebuffer() ignores sRGB encoding and decoding
on OpenGL, although it encodes and decodes in GLES 3.x.

The updated OpenGL 4.4 rules also allow for encoding and decoding
if GL_FRAMEBUFFER_SRGB is enabled, allowing the application to
control what colorspace blits are done in.  I don't think this hack
makes any sense in such a world - the application can do what it
wants, and we shouldn't second guess them.

A related Piglit patch, "Make multisample accuracy test set
GL_FRAMEBUFFER_SRGB when resolving." makes the Piglit MSAA accuracy
test explicitly request SRGB encoding/decoding during resolves when
running "srgb" subtests.  Without that patch, this commit will regress
those tests, but with it, they should continue to work just fine.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965: Bail on the BLT path if BlitFramebuffer requires sRGB conversion.
Kenneth Graunke [Wed, 3 Aug 2016 03:58:30 +0000 (20:58 -0700)]
i965: Bail on the BLT path if BlitFramebuffer requires sRGB conversion.

Modern OpenGL BlitFramebuffer require sRGB encode/decode when
GL_FRAMEBUFFER_SRGB is enabled.  The blitter can't handle this,
so we need to bail.  On Gen4-5, this means falling back to Meta,
which should handle it.

We allow sRGB <-> sRGB blits, as decode then encode ought to be a noop
(other than potential precision loss, which nobody wants anyway).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoegl/android: Make get_fourcc() accept HAL formats
Tomasz Figa [Tue, 2 Aug 2016 11:07:53 +0000 (20:07 +0900)]
egl/android: Make get_fourcc() accept HAL formats

There are DRI_IMAGE_FOURCC macros, for which there are no corresponding
DRI_IMAGE_FORMAT macros. To support such formats we need to make the
lookup function take the native format directly. As a side effect, it
simplifies all existing calls to this function, because they all called
get_format() first to convert from native to DRI_IMAGE_FORMAT.

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Rob Herring <rob@kernel.org>
Reviewed-by: Chad Versace <chad@kiwitree.net>
Change-Id: I4674000fb5ccfd02e38b8fa89bc567ac1d4fc16b

8 years agoegl/android: Refactor image creation to separate flink and prime paths (v2)
Tomasz Figa [Tue, 2 Aug 2016 11:07:52 +0000 (20:07 +0900)]
egl/android: Refactor image creation to separate flink and prime paths (v2)

This patch splits current dri2_create_image_android_native_buffer() into
main entry point and two additional functions, one for creating an image
from flink name and one for handling prime FDs using the generic DMA-buf
path. This makes the code cleaner and also prepares for disabling flink
path more easily in the future.

v2: Split into separate patch.
    Add error messages.

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Rob Herring <rob@kernel.org>
Reviewed-by: Chad Versace <chad@kiwitree.net>
Change-Id: Ifdfb5927399d56992fe707160423c29278f49172

8 years agoegl/android: Respect buffer mask in droid_image_get_buffers (v2)
Tomasz Figa [Tue, 2 Aug 2016 11:07:50 +0000 (20:07 +0900)]
egl/android: Respect buffer mask in droid_image_get_buffers (v2)

Drivers can request different set of buffers depending on the buffer
mask they pass to the get_buffers callback. This patch makes
droid_image_get_buffers() respect this mask.

v2: Return error only in case of real error condition and ignore requests
    of unavailable buffers.

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Rob Herring <rob@kernel.org>
Reviewed-by: Chad Versace <chad@kiwitree.net>
Change-Id: I6c3c4eca90f4c618579f6725dec323c004cb44ba

8 years agoegl/android: Remove unused variables in droid_get_buffers_with_format()
Tomasz Figa [Tue, 2 Aug 2016 11:07:49 +0000 (20:07 +0900)]
egl/android: Remove unused variables in droid_get_buffers_with_format()

Fix compilation warnings due to unused variables left after some earlier
code changes.

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Rob Herring <rob@kernel.org>
Reviewed-by: Chad Versace <chad@kiwitree.net>
Change-Id: Iec09eb2a62887f3a38dff156756ed8385f3f3447

8 years agoanv/pipeline/gen7: Set the depth format in 3DSTATE_SF
Jason Ekstrand [Sat, 6 Aug 2016 16:11:53 +0000 (09:11 -0700)]
anv/pipeline/gen7: Set the depth format in 3DSTATE_SF

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoisl: Add a helper for getting a depth format from an isl_format
Jason Ekstrand [Sat, 6 Aug 2016 16:11:10 +0000 (09:11 -0700)]
isl: Add a helper for getting a depth format from an isl_format

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoanv/pipeline: Unify 3DSTATE_RASTER and 3DSTATE_SF setup between gen7 and gen8
Jason Ekstrand [Sat, 6 Aug 2016 15:28:23 +0000 (08:28 -0700)]
anv/pipeline: Unify 3DSTATE_RASTER and 3DSTATE_SF setup between gen7 and gen8

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoanv/pipeline/gen8: Set 3DSTATE_SF::StatisticsEnable
Jason Ekstrand [Mon, 8 Aug 2016 18:08:09 +0000 (11:08 -0700)]
anv/pipeline/gen8: Set 3DSTATE_SF::StatisticsEnable

We've been setting it in gen7 forever but never in gen8; best to make it
consistent.  This hasn't caused any problems yet because we don't advertise
support for statistics queries yet.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoanv/pipeline/gen8: Unconditionally set DXMultisampleRasterizaitonEnable
Jason Ekstrand [Sat, 6 Aug 2016 15:42:51 +0000 (08:42 -0700)]
anv/pipeline/gen8: Unconditionally set DXMultisampleRasterizaitonEnable

The multisample rasterization mode is computed based on this field,
3DSTATE_RASTER::DXMultisampleRasterizationMode (only for forced
multisampling), 3DSTATE_RASTER::APIMode, and the number of samples.  There
are two tables in the SKL PRM that describe how the final multisample mode
is calculated: "Windower (WM) Stage >> Multisampling >> Multisample
ModeState >> Table 1" and the formula for "SF_INT::Multisample
Rasterization Mode".

The "DX Multisample Rasterization Enable" bit changes whether multisample
mode is set to OFF_PIXEL or ON_PATTERN in the samples > 1 case.  In the
samples == 1 case, the bit has no effect.  Since Vulkan has no concept of
disabling multisampling for samples > 1, we can just set the bit.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoanv/pipeline/gen8: Use fewer designated initializers in emit_rs_state
Jason Ekstrand [Sat, 6 Aug 2016 14:55:10 +0000 (07:55 -0700)]
anv/pipeline/gen8: Use fewer designated initializers in emit_rs_state

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agogenxml: Make 3DSTATE_SF more consistent between gen7 and gen8+
Jason Ekstrand [Sat, 6 Aug 2016 15:24:00 +0000 (08:24 -0700)]
genxml: Make 3DSTATE_SF more consistent between gen7 and gen8+

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoanv/pipeline/gen8: Remove an old comment
Jason Ekstrand [Sat, 6 Aug 2016 14:52:23 +0000 (07:52 -0700)]
anv/pipeline/gen8: Remove an old comment

This is now handled in emit_3dstate_clip

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agomesa: Skip ES 3.0/3.1 transform feedback primitive counting error.
Kenneth Graunke [Thu, 29 Oct 2015 07:21:18 +0000 (00:21 -0700)]
mesa: Skip ES 3.0/3.1 transform feedback primitive counting error.

This error condition is not implementable when using tessellation or
geometry shaders.  The text was also removed from the ES 3.2 spec.
I believe the intended behavior is to remove the error condition
when either OES_geometry_shader or OES_tessellation_shader are
exposed.

v2: Quote a better part of issue 13 (suggested by Ian).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: Share code between _mesa_validate_DrawArrays[_Instanced].
Kenneth Graunke [Fri, 8 Jul 2016 23:18:03 +0000 (16:18 -0700)]
mesa: Share code between _mesa_validate_DrawArrays[_Instanced].

Mostly, I want to share the GLES 3 transform feedback handling,
though most of the rest of the code is identical as well.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoglsl: Implicitly enable OES_shader_io_blocks if geom/tess are enabled.
Kenneth Graunke [Sat, 21 May 2016 18:46:22 +0000 (11:46 -0700)]
glsl: Implicitly enable OES_shader_io_blocks if geom/tess are enabled.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoglsl: Expose gl_PointSize if OES/EXT_tessellation_point_size is enabled.
Kenneth Graunke [Fri, 27 May 2016 18:12:45 +0000 (11:12 -0700)]
glsl: Expose gl_PointSize if OES/EXT_tessellation_point_size is enabled.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoglsl: Add extension plumbing for OES/EXT_tessellation_shader.
Kenneth Graunke [Fri, 8 Jul 2016 19:00:30 +0000 (12:00 -0700)]
glsl: Add extension plumbing for OES/EXT_tessellation_shader.

This adds the #extension directive support, built-in #defines,
lexer keyword support, and updates has_tessellation_shader().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: Move tessellation shader gets to GL_CORE, GLES31 section.
Kenneth Graunke [Fri, 8 Jul 2016 18:49:30 +0000 (11:49 -0700)]
mesa: Move tessellation shader gets to GL_CORE, GLES31 section.

This makes them available in the GLES 3.1 API.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: Add {OES,EXT}_tessellation_shader to the extensions table.
Kenneth Graunke [Fri, 8 Jul 2016 18:48:15 +0000 (11:48 -0700)]
mesa: Add {OES,EXT}_tessellation_shader to the extensions table.

Also update _mesa_has_tessellation to know about the new extensions.

For now, these are dummy_false, to avoid turning on the extension
until everything's in place.  Eventually, we'll move them over to
the "ARB_tessellation_shader" bit so that any drivers supporting
both the desktop extension and ES 3.1 get the feature.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomapi: Add PatchParameteriOES and PatchParameteriEXT.
Kenneth Graunke [Fri, 8 Jul 2016 18:42:08 +0000 (11:42 -0700)]
mapi: Add PatchParameteriOES and PatchParameteriEXT.

The OES_tessellation_shader and EXT_tessellation_shader specifications
have suffixed names.  These are identical to the core function, so just
alias them.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoradeonsi: add has_draw_indirect_multi flag
Nicolai Hähnle [Fri, 29 Jul 2016 16:59:11 +0000 (17:59 +0100)]
radeonsi: add has_draw_indirect_multi flag

Prefer to use DRAW_(INDEX)_INDIRECT_MULTI when available in the firmware.

Versions for SI and CI already added as provided by the firmware team, but
keep in mind that they won't currently be used since the radeon kernel module
has no interface to query the firmware version.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: transpose indirect/index draw dispatch
Nicolai Hähnle [Fri, 29 Jul 2016 17:05:30 +0000 (18:05 +0100)]
radeonsi: transpose indirect/index draw dispatch

This allows better code sharing for indirect draw calls.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: move index buffer calculations in si_emit_draw_packets up
Nicolai Hähnle [Fri, 29 Jul 2016 16:56:21 +0000 (17:56 +0100)]
radeonsi: move index buffer calculations in si_emit_draw_packets up

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: unify emitting PKT3_SET_BASE for indirect draws
Nicolai Hähnle [Fri, 29 Jul 2016 16:51:23 +0000 (17:51 +0100)]
radeonsi: unify emitting PKT3_SET_BASE for indirect draws

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agowinsys/amdgpu: query ME/PFP/CE firmware versions
Nicolai Hähnle [Thu, 28 Jul 2016 15:40:21 +0000 (16:40 +0100)]
winsys/amdgpu: query ME/PFP/CE firmware versions

The radeon kernel module doesn't have the firmware query interface, so the
corresponding values will remain 0.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: move spi_ps_input_addr override outside of the loop
Nicolai Hähnle [Wed, 3 Aug 2016 11:30:32 +0000 (13:30 +0200)]
radeonsi: move spi_ps_input_addr override outside of the loop

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: drop unnecessary u_pstipple.h include
Nicolai Hähnle [Wed, 3 Aug 2016 10:54:45 +0000 (12:54 +0200)]
radeonsi: drop unnecessary u_pstipple.h include

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: do not pass the return type to buffer_load_const
Nicolai Hähnle [Wed, 3 Aug 2016 10:52:28 +0000 (12:52 +0200)]
radeonsi: do not pass the return type to buffer_load_const

Overriding it is not allowed anyway, and actually lead to a crash when polygon
stippling was used with monolithic shaders.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoglsl: Combine GS and TES array resizing visitors.
Kenneth Graunke [Fri, 8 Jul 2016 20:29:31 +0000 (13:29 -0700)]
glsl: Combine GS and TES array resizing visitors.

These are largely identical, except that the GS version has a few
extra error conditions.  We can just pass in the stage and skip these.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglsl: Fix location bias for patch variables.
Kenneth Graunke [Fri, 24 Jun 2016 07:09:00 +0000 (00:09 -0700)]
glsl: Fix location bias for patch variables.

We need to subtract VARYING_SLOT_PATCH0, not VARYING_SLOT_VAR0.

Since "patch" only applies to inputs and outputs, we can just handle
this once outside the switch statement, rather than replicating the
check twice and complicating the earlier conditions.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglsl: Fix the program resource names of gl_TessLevelOuter/Inner[].
Kenneth Graunke [Fri, 24 Jun 2016 06:12:45 +0000 (23:12 -0700)]
glsl: Fix the program resource names of gl_TessLevelOuter/Inner[].

These are lowered to gl_TessLevel{Outer,Inner}MESA.  We need them to
appear in the program resource list with their original names and types.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglsl: Delete bogus ir_set_program_inouts assert.
Kenneth Graunke [Wed, 28 Oct 2015 23:39:11 +0000 (16:39 -0700)]
glsl: Delete bogus ir_set_program_inouts assert.

This assertion is bogus.  Varying structs, and arrays of structs, are
allowed by GLSL, and we can see them here.  While we currently don't
have any partial-variable support for those, simply returning false
and marking the entire thing as used is certainly legitimate.

I believe this is often swept under the rug by varying packing,
but that's disabled in certain tessellation situations.

Hit by 20 dEQP-GLES31.functional.tessellation.user_defined_io.* tests.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglsl: Simplify interface qualifier parsing.
Kenneth Graunke [Thu, 2 Jun 2016 01:40:21 +0000 (18:40 -0700)]
glsl: Simplify interface qualifier parsing.

This better matches the grammar in section 4.3.9 of the GLSL 4.5 spec,
and also removes some redundant code.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>