mesa.git
5 years agoac: add ac_build_buffer_store_format() helper
Samuel Pitoiset [Tue, 12 Mar 2019 11:13:37 +0000 (12:13 +0100)]
ac: add ac_build_buffer_store_format() helper

Similar to ac_build_buffer_load_format().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoac/nir: set attrib flags for SSBO and image store operations
Samuel Pitoiset [Tue, 12 Mar 2019 10:37:29 +0000 (11:37 +0100)]
ac/nir: set attrib flags for SSBO and image store operations

For consistency regarding other store operations.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoac: make use of ac_get_store_intr_attribs() where possible
Samuel Pitoiset [Tue, 12 Mar 2019 10:27:13 +0000 (11:27 +0100)]
ac: make use of ac_get_store_intr_attribs() where possible

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agobin/install_megadrivers.py: Correctly handle DESTDIR=''
Dylan Baker [Wed, 20 Mar 2019 17:50:10 +0000 (10:50 -0700)]
bin/install_megadrivers.py: Correctly handle DESTDIR=''

Currently if destdir is set to '' then the resulting libdir will have
it's first character replaced by / instead of / being prepended to the
string. This was the result of ensuring that that DESTDIR wouldn't be
ignored if libdir was absolute, since the only cases that meson allows
the libdir to be absolute is if the prefix is /, this won't be a
problem.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110211
Fixes: ae3f45c11e3f934939b90445471da8f18b057bc5
       ("bin/install_megadrivers: fix DESTDIR and -D*-path")
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agonir: deref only for OpTypePointer
Juan A. Suarez Romero [Wed, 20 Mar 2019 19:20:27 +0000 (19:20 +0000)]
nir: deref only for OpTypePointer

Fixes dEQP-VK.binding_model.buffer_device_address.* and
dEQP-VK.ssbo.phys.layout* Vulkan CTS tests.

v2: set val->type->stride in the section below (Jason)

v3: restore val->type->type to original place (Jason)

Fixes: d0ba326f238 ("nir/spirv: support physical pointers")
CC: Karol Herbst <kherbst@redhat.com>
CC: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agosoftpipe: fix texture view crashes
Dave Airlie [Wed, 20 Mar 2019 03:11:40 +0000 (13:11 +1000)]
softpipe: fix texture view crashes

I noticed we crashed piglit arb_texture_view-rendering-formats
when run on softpipe.

This fixes the clear tiles to use the surface format not the
underlying storage format.

This fixes a bunch of srgb piglits as well.

Fixes: 396ac41fc28 (softpipe: add integer support)
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
5 years agonvc0: Skip new update barrier bits
Kenneth Graunke [Wed, 20 Mar 2019 17:13:22 +0000 (10:13 -0700)]
nvc0: Skip new update barrier bits

I added new barrier bits in 220c1dce1e3194ea867e6d948fc7ff5b9ef2d3a7
and made most drivers skip them.  I thought nvc0 was already skipping
those but missed the else case here, which does something.  So make it
explicitly skip like I did everywhere else.

Thanks to Ilia for catching this.

Fixes: 220c1dce1e3 gallium: Add PIPE_BARRIER_UPDATE_BUFFER and UPDATE_TEXTURE bits.
5 years agoanv: implement VK_EXT_pipeline_creation_feedback
Lionel Landwerlin [Tue, 19 Mar 2019 15:23:37 +0000 (15:23 +0000)]
anv: implement VK_EXT_pipeline_creation_feedback

An extension reporting cache hit in the user supplied pipeline cache
as well as timing information for creating the pipelines & stages.

v2: Don't consider no cache for cache hits (Jason)
    Rework duration accumulation (Jason)

v3: Fold feedback creation writing into pipeline compile functions (Jason/Lionel)

v4: Get cache hit information from anv_device_search_for_kernel() (Jason)
    Only set cache hit from the whole pipeline if all stages also have that bit (Lionel)

v5: Always user_cache_hit in anv_device_search_for_kernel() (Jason)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agofreedreno/ir3/a6xx: fix ssbo comp_swap
Rob Clark [Wed, 20 Mar 2019 15:47:03 +0000 (11:47 -0400)]
freedreno/ir3/a6xx: fix ssbo comp_swap

One line left out of the conversion to ir3 ssbo intrinsics on a6xx.

Fixes: 2e4525883f0 ir3/compiler: Enable lower_io_offsets pass and handle new SSBO intrinsics
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agonir: Constant values are per-column not per-component
Jason Ekstrand [Tue, 19 Mar 2019 19:14:02 +0000 (14:14 -0500)]
nir: Constant values are per-column not per-component

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
5 years agoanv: Bump maxComputeWorkgroupInvocations
Jason Ekstrand [Tue, 19 Mar 2019 15:47:34 +0000 (10:47 -0500)]
anv: Bump maxComputeWorkgroupInvocations

We initially set this lower because we didn't have SIMD32 support yet
but we've supported SIMD32 for quite some time now.  We should bump it
up to the real limit.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoradv: fix binding transform feedback buffers
Samuel Pitoiset [Tue, 5 Mar 2019 17:09:12 +0000 (18:09 +0100)]
radv: fix binding transform feedback buffers

The mask should be accumulated if two calls are used for
binding two buffers at different indexes. Otherwise, the
driver only accounts for the last one.

Noticed while glancing at this code.

Cc: 18.3 19.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoac: use llvm.amdgcn.fract intrinsic for nir_op_ffract
Samuel Pitoiset [Tue, 19 Mar 2019 22:40:32 +0000 (23:40 +0100)]
ac: use llvm.amdgcn.fract intrinsic for nir_op_ffract

Noticed with a Doom shader.

29077 shaders in 15096 tests
Totals:
SGPRS: 1282125 -> 1282133 (0.00 %)
VGPRS: 908716 -> 908616 (-0.01 %)
Spilled SGPRs: 24811 -> 24779 (-0.13 %)
Code Size: 49048176 -> 48936488 (-0.23 %) bytes
Max Waves: 244232 -> 244226 (-0.00 %)

Totals from affected shaders:
SGPRS: 229584 -> 229592 (0.00 %)
VGPRS: 163268 -> 163168 (-0.06 %)
Spilled SGPRs: 8682 -> 8650 (-0.37 %)
Code Size: 12819572 -> 12707884 (-0.87 %) bytes
Max Waves: 24398 -> 24392 (-0.02 %)

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agogallium: Add PIPE_BARRIER_UPDATE_BUFFER and UPDATE_TEXTURE bits.
Kenneth Graunke [Wed, 6 Mar 2019 04:43:11 +0000 (20:43 -0800)]
gallium: Add PIPE_BARRIER_UPDATE_BUFFER and UPDATE_TEXTURE bits.

The glMemoryBarrier() function makes shader memory stores ordered with
respect to things specified by the given bits.  Until now, st/mesa has
ignored GL_TEXTURE_UPDATE_BARRIER_BIT and GL_BUFFER_UPDATE_BARRIER_BIT,
saying that drivers should implicitly perform the needed flushing.

This seems like a pretty big assumption to make.  Instead, this commit
opts to translate them to new PIPE_BARRIER bits, and adjusts existing
drivers to continue ignoring them (preserving the current behavior).

The i965 driver performs actions on these memory barriers.  Shader
memory stores go through a "data cache" which is separate from the
render cache and other read caches (like the texture cache).  All
memory barriers need to flush the data cache (to ensure shader memory
stores are visible), and possibly invalidate read caches (to ensure
stale data is no longer visible).  The driver implicitly flushes for
most caches, but not for data cache, since ARB_shader_image_load_store
introduced MemoryBarrier() precisely to order these explicitly.

I would like to follow i965's approach in iris, flushing the data cache
on any MemoryBarrier() call, so I need st/mesa to actually call the
pipe->memory_barrier() callback.

Fixes KHR-GL45.shader_image_load_store.advanced-sync-textureUpdate
and Piglit's spec/arb_shader_image_load_store/host-mem-barrier on
the iris driver.

Roland said this looks reasonable to him.
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agoiris: mark switch case fallthrough
Tapani Pälli [Tue, 19 Mar 2019 09:30:58 +0000 (11:30 +0200)]
iris: mark switch case fallthrough

CID: 1444103
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoiris: initialize num_cbufs
Tapani Pälli [Tue, 19 Mar 2019 09:17:18 +0000 (11:17 +0200)]
iris: initialize num_cbufs

Currently initialized only if 'ish' is non-NULL.

CID: 1444106
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agopanfrost: Properly align stride
Daniel Stone [Mon, 18 Mar 2019 16:07:00 +0000 (16:07 +0000)]
panfrost: Properly align stride

Handle buffers whose width is not aligned to 16px by padding the stride
and storing it accordingly.

This does not reject imports for images whose stride is not sufficiently
aligned.

v2: make sure bo->stride is set on imported buffers, and add missing
variable definition. (Tomeu)

Tested-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agoanv/icl: Add WA_2204188704 to disable pixel shader panic dispatch
Anuj Phogat [Thu, 24 Jan 2019 22:46:02 +0000 (14:46 -0800)]
anv/icl: Add WA_2204188704 to disable pixel shader panic dispatch

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoi965/icl: Add WA_2204188704 to disable pixel shader panic dispatch
Anuj Phogat [Thu, 24 Jan 2019 22:44:35 +0000 (14:44 -0800)]
i965/icl: Add WA_2204188704 to disable pixel shader panic dispatch

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agogitlab-ci: drop most autotools builds
Eric Engestrom [Fri, 8 Mar 2019 11:16:25 +0000 (11:16 +0000)]
gitlab-ci: drop most autotools builds

With autotools this close to being not supported anymore, let's not
waste half of the CI cycles on it. The default build will catch most
issues, and the rest can be tested by the old Travis.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agov3d: Expose the dma-buf modifiers query.
Eric Anholt [Mon, 18 Mar 2019 20:49:08 +0000 (13:49 -0700)]
v3d: Expose the dma-buf modifiers query.

This allows DRI3 to pick between UIF and raster according to whether we're
pageflipping or not and whether the pageflipping display can do UIF,
avoiding copies for the windowed/composited case that previously was
forced to linear.

Improves windowed glmark2 -b build:use-vbo=false performance by 30.7783%
+/- 13.1719% (n=3)

5 years agov3d: Allow the UIF modifier with renderonly.
Eric Anholt [Mon, 18 Mar 2019 21:19:36 +0000 (14:19 -0700)]
v3d: Allow the UIF modifier with renderonly.

We ask the other side to make a buffer with the right number of pages, and
then just store the UIF in it.  This avoids an extra silent copy of the
buffer from linear to UIF if it gets used for texturing (X11 copy-based
swapbuffers, GL compositors).

5 years agov3d: Always lay out shared tiled buffers with UIF_TOP set.
Eric Anholt [Mon, 18 Mar 2019 21:25:06 +0000 (14:25 -0700)]
v3d: Always lay out shared tiled buffers with UIF_TOP set.

The samplers are already ready for this, we just needed to make sure that
layout chose UIF for level 0.

5 years agoRevert "glsl: relax input->output validation for SSO programs"
Andres Gomez [Fri, 8 Feb 2019 17:06:08 +0000 (19:06 +0200)]
Revert "glsl: relax input->output validation for SSO programs"

This reverts commit 1aa5738e666a9534c7e5b46f077327e6d647c64f.

This patch incorrectly asumed that for SSOs no inner interface
matching check was needed.

From the ARB_separate_shader_objects spec v.25:

  " With separable program objects, interfaces between shader stages
    may involve the outputs from one program object and the inputs
    from a second program object.  For such interfaces, it is not
    possible to detect mismatches at link time, because the programs
    are linked separately.  When each such program is linked, all
    inputs or outputs interfacing with another program stage are
    treated as active.  The linker will generate an executable that
    assumes the presence of a compatible program on the other side of
    the interface.  If a mismatch between programs occurs, no GL error
    will be generated, but some or all of the inputs on the interface
    will be undefined."

This completes the fix from commit:
3be05dd2679 ("glsl/linker: don't fail non static used inputs without matching outputs")

Fixes: 1aa5738e666 ("glsl: relax input->output validation for SSO programs")
Cc: Tapani Pälli <tapani.palli@intel.com>
Cc: Timothy Arceri <tarceri@itsqueeze.com>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Cc: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
5 years agoglsl/linker: simplify xfb_offset vs xfb_stride overflow check
Andres Gomez [Fri, 18 Jan 2019 16:33:10 +0000 (18:33 +0200)]
glsl/linker: simplify xfb_offset vs xfb_stride overflow check

Current implementation uses a complicated calculation which relies in
an implicit conversion to check the integral part of 2 division
results.

However, the calculation actually checks that the xfb_offset is
smaller or a multiplier of the xfb_stride. For example, while this is
expected to fail, it actually succeeds:

  "

    ...

    layout(xfb_buffer = 2, xfb_stride = 12) out block3 {
      layout(xfb_offset = 0) vec3 c;
      layout(xfb_offset = 12) vec3 d; // ERROR, requires stride of 24
    };

    ...

  "

Fixes: 2fab85aaea5 ("glsl: add xfb_stride link time validation")
Cc: Timothy Arceri <tarceri@itsqueeze.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
5 years agoglsl/linker: don't fail non static used inputs without matching outputs
Andres Gomez [Thu, 27 Dec 2018 22:57:29 +0000 (00:57 +0200)]
glsl/linker: don't fail non static used inputs without matching outputs

If there is no Static Use of an input variable, the linker shouldn't
fail whenever there is no defined matching output variable in the
previous stage.

From page 47 (page 51 of the PDF) of the GLSL 4.60 v.5 spec:

  " Only the input variables that are statically read need to be
    written by the previous stage; it is allowed to have superfluous
    declarations of input variables."

Now, we complete this exception whenever the input variable has an
explicit location. Previously, 18004c338f6 ("glsl: fail when a
shader's input var has not an equivalent out var in previous") took
care of the cases in which the input variable didn't have an explicit
location.

v2: do the location based interface matching check regardless on
    whether it is a separable program or not (Ilia).

Fixes: 1aa5738e666 ("glsl: relax input->output validation for SSO programs")
Cc: Timothy Arceri <tarceri@itsqueeze.com>
Cc: Iago Toral Quiroga <itoral@igalia.com>
Cc: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Cc: Tapani Pälli <tapani.palli@intel.com>
Cc: Ian Romanick <ian.d.romanick@intel.com>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
5 years agoglsl/linker: always validate explicit location among inputs
Andres Gomez [Fri, 28 Dec 2018 10:24:53 +0000 (12:24 +0200)]
glsl/linker: always validate explicit location among inputs

Outputs are always validated when having explicit locations and we
were trusting its outcome to catch similar problems with the inputs
since, in case of having undefined outputs for existing inputs, we
would be already reporting a linker error.

However, consider this case:

  " Shader stage n:
    ---------------

    ...

    layout(location = 0) out float a;

    ...

    Shader stage n+1:
    -----------------

    ...

    layout(location = 0) in float b;
    layout(location = 0) in float c;

    ...
  "

Currently, this won't report a linker error even though location
aliasing is happening for the inputs.

Therefore, we also need to validate the inputs independently from the
outcome of the outputs validation.

Cc: Timothy Arceri <tarceri@itsqueeze.com>
Cc: Iago Toral Quiroga <itoral@igalia.com>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
5 years agoglsl: correctly validate component layout qualifier for dvec{3,4}
Andres Gomez [Thu, 20 Dec 2018 01:09:57 +0000 (03:09 +0200)]
glsl: correctly validate component layout qualifier for dvec{3,4}

From page 62 (page 68 of the PDF) of the GLSL 4.50 v.7 spec:

  " A dvec3 or dvec4 can only be declared without specifying a
    component."

Therefore, using the "component" qualifier with a dvec3 or dvec4
should result in a compiling error.

v2: enhance the error message (Timothy).

Fixes: 94438578d21 ("glsl: validate and store component layout qualifier in GLSL IR")
Cc: Timothy Arceri <tarceri@itsqueeze.com>
Cc: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
5 years agoRevert "nir: const `nir_call_instr::callee`"
Jason Ekstrand [Tue, 19 Mar 2019 15:18:49 +0000 (10:18 -0500)]
Revert "nir: const `nir_call_instr::callee`"

This reverts commit db57db5317e81fb4ce31bc294fdcc199db651542.  When
building IR, nothing is really immutable and, since C has no concept of
constness propagating beyond the first pointer, we have to be vary
careful with how we use it.  To just throw const into a function like
this is a lie.

Instead, we should just drop the unneeded const in spirv_to_nir which
this commit does along with the revert.

5 years agogitlab-ci: add clang build
Eric Engestrom [Tue, 19 Mar 2019 07:59:07 +0000 (07:59 +0000)]
gitlab-ci: add clang build

`clang` has a different set of warnings and errors than `gcc`, so it's
useful to do at least a generic pass over Mesa with it.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agonir: const `nir_call_instr::callee`
Eric Engestrom [Tue, 19 Mar 2019 09:04:26 +0000 (09:04 +0000)]
nir: const `nir_call_instr::callee`

Fixes: c95afe56a8033a87dca7 "nir/spirv: handle kernel function parameters"
Cc: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Tapani Pälli <tapani.palli@intel.com>
Acked-by: Karol Herbst <kherbst@redhat.com>
5 years agoiris: Make intel_hiz_exec public.
Rafael Antognolli [Tue, 26 Feb 2019 19:56:32 +0000 (11:56 -0800)]
iris: Make intel_hiz_exec public.

Need to use it for fast clearing depth buffers.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoiris: Enable HiZ for multisampled depth surfaces.
Rafael Antognolli [Wed, 13 Mar 2019 23:56:55 +0000 (16:56 -0700)]
iris: Enable HiZ for multisampled depth surfaces.

Fix this check so that we can get a HiZ aux buffer for multisampled
surfaces as well. Also make sure we don't try to emit a sampler view
surface state for multisampled depth sufaces with HiZ enabled, as
the sampler can't HiZ for multisampled buffers and isl would assert.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agonir/spirv: support physical pointers
Karol Herbst [Thu, 31 Jan 2019 00:56:25 +0000 (01:56 +0100)]
nir/spirv: support physical pointers

v2: add load_kernel_input

Signed-off-by: Karol Herbst <kherbst@redhat.com>
squash! nir/spirv: support physical pointers

5 years agonir/spirv: handle kernel function parameters
Karol Herbst [Tue, 6 Nov 2018 11:06:08 +0000 (12:06 +0100)]
nir/spirv: handle kernel function parameters

the idea here is to generate an entry point stub function wrapping around the
actual kernel function and turn all parameters into shader inputs with byte
addressing instead of vec4.

This gives us several advantages:
1. calling kernel functions doesn't differ from calling any other function
2. CL inputs match uniforms in most ways and we can just take advantage of most
   of nir_lower_io

v2: move code into a seperate function
v3: verify the entry point got a name
    fix minor typo
v4: make vtn_emit_kernel_entry_point_wrapper take the old entry point as an arg

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonir/lower_locals_to_regs: cast array index to 32 bit
Karol Herbst [Fri, 15 Mar 2019 15:06:22 +0000 (16:06 +0100)]
nir/lower_locals_to_regs: cast array index to 32 bit

local memory is too small to require 64 bit pointers, so cast the array index
to a 32 bit value to save up on 64 bit operations.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agoglsl: add cl_size and cl_alignment
Karol Herbst [Mon, 5 Mar 2018 14:04:32 +0000 (15:04 +0100)]
glsl: add cl_size and cl_alignment

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agoglsl: add packed for struct types
Karol Herbst [Sun, 4 Mar 2018 18:06:24 +0000 (19:06 +0100)]
glsl: add packed for struct types

We need this for OpenCL kernels because we have to apply C rules for alignment
and padding inside structs and for this we also have to know if a struct is
packed or not.

v2: fix for kernel params

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agopanfrost: Rewrite varying assembly
Alyssa Rosenzweig [Fri, 15 Mar 2019 23:25:55 +0000 (23:25 +0000)]
panfrost: Rewrite varying assembly

There are two stages to varying assembly in the command stream: creating
the varying buffers in the command stream, and creating the varying meta
descriptors (also in the command stream) linked to the aforementioned
buffers. The previous code for this was ad hoc and brittle, making some
invalid assumptions causing unmaintainable workarounds to pile up across
the driver (both compiler and command stream side).

This patch completely rewrites the varying assembly code. There's a
trivial performance penalty (we now memcpy the varying meta to the
command stream on draw, rather than on compile). That said, the
improvement in flexibility and clarity is well-worth it.

The motivator for these changes was support for gl_PointCoord (and
eventually point sprites for legacy GL), which was impossible to
implement with the old varying assembly code.  With the new refactor,
it's super easy; support for gl_PointCoord is included with this patch.

All in all, I'm quite happy with how this turned out.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost: Replay more varying buffers
Alyssa Rosenzweig [Fri, 15 Mar 2019 03:34:25 +0000 (03:34 +0000)]
panfrost: Replay more varying buffers

This is required for gl_PointCoord to show up on decodes.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost/decode: Respect primitive size pointers
Alyssa Rosenzweig [Fri, 15 Mar 2019 03:21:27 +0000 (03:21 +0000)]
panfrost/decode: Respect primitive size pointers

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost: Disable PIPE_CAP_TGSI_TEXCOORD
Alyssa Rosenzweig [Fri, 15 Mar 2019 02:37:59 +0000 (02:37 +0000)]
panfrost: Disable PIPE_CAP_TGSI_TEXCOORD

I don't know why this was on to begin with...?

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost: Fix primconvert check
Alyssa Rosenzweig [Fri, 15 Mar 2019 02:13:34 +0000 (02:13 +0000)]
panfrost: Fix primconvert check

In addition to fixing actual primconvert bugs, this prevents an infinite
loop when trying to draw POINTS.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost: Workaround buffer overrun with mip level
Alyssa Rosenzweig [Fri, 15 Mar 2019 02:07:55 +0000 (02:07 +0000)]
panfrost: Workaround buffer overrun with mip level

Mipmaps are still broken, but at least this way we don't crash on some
apps using mipmaps.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agoradv: Use correct image view comparison for fast clears.
Bas Nieuwenhuizen [Mon, 18 Mar 2019 21:20:40 +0000 (22:20 +0100)]
radv: Use correct image view comparison for fast clears.

The if is actually returning true on success, enabling fast clears, so we
need to have the test succeed when the iview dimensions are right.

Fixes: d5400a5ec2a "radv: provide a helper for comparing an image extents."
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoanv,radv: Implement VK_KHR_surface_capability_protected
Jason Ekstrand [Wed, 12 Dec 2018 16:54:26 +0000 (10:54 -0600)]
anv,radv: Implement VK_KHR_surface_capability_protected

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
5 years agoanv: Treat zero size XFB buffer as disabled
Danylo Piliaiev [Mon, 18 Mar 2019 10:53:30 +0000 (12:53 +0200)]
anv: Treat zero size XFB buffer as disabled

Vulkan spec doesn't explicitly forbid zero size transform
feedback buffers.
Having zero size xfb caused SurfaceSize overflow and
triggered assert in debug build.

The only way to have zero size SO_BUFFER is to disable
SO_BUFFER as stated in hardware spec.

From SKL PRM, Vol 2a, "3DSTATE_SO_BUFFER":
  "If set, stream output to SO Buffer is enabled,
  if 3DSTATE_STREAMOUT::SO Function ENABLE is also enabled.
  If clear, the SO Buffer is considered "not bound" and effectively
  treated as a zero- length buffer for the purposes of SO output and
  overflow detection. If an enabled stream's Stream to Buffer Selects
  includes this buffer it is by definition an overflow condition.
  That stream will cause no writes to occur,
  and only SO_PRIM_STORAGE_NEEDED[<stream>] will increment."

Fixes: 36ee2fd61c8 "anv: Implement the basic form of VK_EXT_transform_feedback"
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agodocs: update calendar, add news item and link release notes for 18.3.5
Emil Velikov [Mon, 18 Mar 2019 16:02:27 +0000 (16:02 +0000)]
docs: update calendar, add news item and link release notes for 18.3.5

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
5 years agodocs: add sha256 checksums for 18.3.5
Emil Velikov [Mon, 18 Mar 2019 15:57:14 +0000 (15:57 +0000)]
docs: add sha256 checksums for 18.3.5

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

5 years agodocs: add release notes for 18.3.5
Emil Velikov [Mon, 18 Mar 2019 15:45:53 +0000 (15:45 +0000)]
docs: add release notes for 18.3.5

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

5 years agoradv: Implement VK_EXT_host_query_reset.
Bas Nieuwenhuizen [Sat, 17 Nov 2018 17:39:24 +0000 (18:39 +0100)]
radv: Implement VK_EXT_host_query_reset.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Eric Engestrom <eric@engestrom.ch>
5 years agoanv: Implement VK_EXT_host_query_reset
Jason Ekstrand [Tue, 5 Mar 2019 02:01:44 +0000 (20:01 -0600)]
anv: Implement VK_EXT_host_query_reset

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agovulkan: Update the XML and headers to 1.1.104
Bas Nieuwenhuizen [Sun, 17 Mar 2019 17:21:28 +0000 (18:21 +0100)]
vulkan: Update the XML and headers to 1.1.104

Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Eric Engestrom <eric@engestrom.ch>
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agovulkan/util: Handle enums that are in platform-specific headers.
Bas Nieuwenhuizen [Sun, 17 Mar 2019 19:26:07 +0000 (20:26 +0100)]
vulkan/util: Handle enums  that are in platform-specific headers.

VkFullScreenExclusiveEXT comes from the win32 header. Mostly took
the logic from the entrypoint scripts:

1) If there is an ext that has it in the requires and has a platform,
   take the guard for that platform.
2) Otherwise assume it is from the core headers.

Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
5 years agovulkan: factor out wsi dependencies
Lionel Landwerlin [Sun, 17 Mar 2019 16:57:48 +0000 (16:57 +0000)]
vulkan: factor out wsi dependencies

In commit 530927d3f6a303d9 ("vulkan/util: generate instance/device
dispatch tables") we started generating instance dispatch tables some
of them (like wayland) require external headers.

This commit moves the dependencies up one level so that they apply the
whole vulkan directory. We use them for both the util & overlay layer.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 530927d3f6a303 ("vulkan/util: generate instance/device dispatch tables")
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
5 years agoandroid: Build fixes for OMR1
Tapani Pälli [Tue, 5 Mar 2019 07:24:16 +0000 (09:24 +0200)]
android: Build fixes for OMR1

Some of the header file locations are changed between Android
versions (when VNDK is used), patch makes sure we get all the
required headers.

v2: cleanups, put SDK version checks in all places (Tapani)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Chen Lin Z <lin.z.chen@intel.com>
Tested-by: Clayton Craft <clayton.a.craft@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agoradv: Allow fast clears with concurrent queue mask for some layouts.
Bas Nieuwenhuizen [Sun, 17 Mar 2019 02:18:29 +0000 (03:18 +0100)]
radv: Allow fast clears with concurrent queue mask for some layouts.

For VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL and
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL we do not care about
the queue mask because

1) using these is only allowed on the gfx queue
2) transitions for these are only allowed on the gfx queue.

This enables some fast clears for Doom that uses
VK_SHARING_MODE_CONCURRENT.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agoiris: Slightly better bounds on buffer sizes
Kenneth Graunke [Mon, 18 Mar 2019 07:51:18 +0000 (00:51 -0700)]
iris: Slightly better bounds on buffer sizes

5 years agoiris: Don't flush the batch for unsynchronized mappings
Kenneth Graunke [Mon, 18 Mar 2019 07:18:32 +0000 (00:18 -0700)]
iris: Don't flush the batch for unsynchronized mappings

I messed this up when adding the GPU copy path.

5 years agoisl: fix automake build when sse41 is not supported
Tapani Pälli [Fri, 15 Mar 2019 10:32:09 +0000 (12:32 +0200)]
isl: fix automake build when sse41 is not supported

Fixes: 864cc419eb0a41882762 "intel/isl: move tiled_memcpy static libs from i965 to isl"
Cc: mesa-stable@lists.freedesktop.org
Reported-by: Milav Soni <milav.soni@teqdiligent.com>
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agogallium/util: remove pipe_sampler_view_release()
Brian Paul [Fri, 8 Mar 2019 22:36:04 +0000 (15:36 -0700)]
gallium/util: remove pipe_sampler_view_release()

It's no longer used.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-By: Jose Fonseca <jfonseca@vmware.com>
5 years agoi915g: remove calls to pipe_sampler_view_release()
Brian Paul [Fri, 8 Mar 2019 22:20:16 +0000 (15:20 -0700)]
i915g: remove calls to pipe_sampler_view_release()

As with previous patches for svga, llvmpipe, swr drivers.
Compile tested only.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-By: Jose Fonseca <jfonseca@vmware.com>
5 years agoswr: remove call to pipe_sampler_view_release()
Brian Paul [Fri, 8 Mar 2019 22:19:02 +0000 (15:19 -0700)]
swr: remove call to pipe_sampler_view_release()

As with svga, llvmpipe drivers in previous patches.
Compile tested only.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-By: Jose Fonseca <jfonseca@vmware.com>
5 years agollvmpipe: stop using pipe_sampler_view_release()
Brian Paul [Fri, 8 Mar 2019 21:08:13 +0000 (14:08 -0700)]
llvmpipe: stop using pipe_sampler_view_release()

This was used to avoid freeing a sampler view which was created by a
context that was already deleted.  But the state tracker does not
allow that.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-By: Jose Fonseca <jfonseca@vmware.com>
5 years agosvga: stop using pipe_sampler_view_release()
Brian Paul [Fri, 8 Mar 2019 21:02:53 +0000 (14:02 -0700)]
svga: stop using pipe_sampler_view_release()

This function was used in the past to avoid deleting a sampler view
for a context that no longer exists.  But the Mesa state tracker
ensures that cannot happen.  Use the standard refcounting function
instead.

Also, remove the code which checked for context mis-matches in
svga_sampler_view_destroy().  It's no longer needed since implementing
the zombie sampler view code in the state tracker.

Testing Done: google chrome, variety of GL demos/games

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-By: Jose Fonseca <jfonseca@vmware.com>
5 years agost/mesa: stop using pipe_sampler_view_release()
Brian Paul [Fri, 8 Mar 2019 20:39:05 +0000 (13:39 -0700)]
st/mesa: stop using pipe_sampler_view_release()

In all instances here we can replace pipe_sampler_view_release(pipe,
view) with pipe_sampler_view_reference(view, NULL) because the views
in question are private to the state tracker context.  So there's no
danger of freeing a sampler view with the wrong context.

Testing done: google chrome, misc GL demos, games

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-By: Jose Fonseca <jfonseca@vmware.com>
5 years agost/mesa: implement "zombie" shaders list
Brian Paul [Tue, 12 Mar 2019 22:01:56 +0000 (16:01 -0600)]
st/mesa: implement "zombie" shaders list

As with the preceding patch for sampler views, this patch does
basically the same thing but for shaders.  However, reference counting
isn't needed here (instead of calling cso_delete_XXX_shader() we call
st_save_zombie_shader().

The Redway3D Watch is one app/demo that needs this change.  Otherwise,
the vmwgfx driver generates an error about trying to destroy a shader
ID that doesn't exist in the context.

Note that if PIPE_CAP_SHAREABLE_SHADERS = TRUE, then we can use/delete
any shader with any context and this mechanism is not used.

Tested with: google-chrome, google earth, Redway3D Watch/Turbine demos
and a few Linux games.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-By: Jose Fonseca <jfonseca@vmware.com>
5 years agost/mesa: implement "zombie" sampler views (v2)
Brian Paul [Tue, 12 Mar 2019 15:13:00 +0000 (09:13 -0600)]
st/mesa: implement "zombie" sampler views (v2)

When st_texture_release_all_sampler_views() is called the texture may
have sampler views belonging to several contexts.  If we unreference a
sampler view and its refcount hits zero, we need to be sure to destroy
the sampler view with the same context which created it.

This was not the case with the previous code which used
pipe_sampler_view_release().  That function could end up freeing a
sampler view with a context different than the one which created it.
In the case of the VMware svga driver, we detected this but leaked the
sampler view.  This led to a crash with google-chrome when the kernel
module had too many sampler views.  VMware bug 2274734.

Alternately, if we try to delete a sampler view with the correct
context, we may be "reaching into" a context which is active on
another thread.  That's not safe.

To fix these issues this patch adds a per-context list of "zombie"
sampler views.  These are views which are to be freed at some point
when the context is active.  Other contexts may safely add sampler
views to the zombie list at any time (it's mutex protected).  This
avoids the context/view ownership mix-ups we had before.

Tested with: google-chrome, google earth, Redway3D Watch/Turbine demos
a few Linux games.  If anyone can recomment some other multi-threaded,
multi-context GL apps to test, please let me know.

v2: avoid potential race issue by always adding sampler views to the
zombie list if the view's context doesn't match the current context,
ignoring the refcount.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-By: Jose Fonseca <jfonseca@vmware.com>
5 years agodocs: link to the meson_options.txt file gitlab.freedesktop.org
Brian Paul [Tue, 12 Mar 2019 01:58:04 +0000 (19:58 -0600)]
docs: link to the meson_options.txt file gitlab.freedesktop.org

5 years agodocs: separate information for compiler selection and compiler options
Brian Paul [Fri, 8 Mar 2019 17:31:11 +0000 (10:31 -0700)]
docs: separate information for compiler selection and compiler options

Split up the "Environment Variables" section into "Compiler Options"
and "Compiler Specification".  I think this makes the information
easier to find and understand.

5 years agoandroid: nouveau: add support for nir
Mauro Rossi [Sun, 17 Mar 2019 21:52:36 +0000 (22:52 +0100)]
android: nouveau: add support for nir

Add the necessary build rules for android, to avoid building errors.

Fixes: f014ae3 ("nouveau: add support for nir")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
5 years agoac/nir_to_llvm: add assert to emit_bcsel()
Timothy Arceri [Sun, 17 Mar 2019 10:04:20 +0000 (21:04 +1100)]
ac/nir_to_llvm: add assert to emit_bcsel()

nir to llvm assumes we have already split vectors to scalars via
nir_lower_alu_to_scalar().

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradeonsi/nir: call some more var optimisation passes
Timothy Arceri [Thu, 14 Mar 2019 00:02:11 +0000 (11:02 +1100)]
radeonsi/nir: call some more var optimisation passes

shader-db results (VEGA64):

Totals from affected shaders:
SGPRS: 5328912 -> 5329680 (0.01 %)
VGPRS: 2969308 -> 2969164 (-0.00 %)
Spilled SGPRs: 37921 -> 37917 (-0.01 %)
Spilled VGPRs: 32882 -> 29024 (-11.73 %)
Private memory VGPRs: 0 -> 0 (0.00 %)
Scratch size: 1400 -> 1200 (-14.29 %) dwords per thread
Code Size: 121126000 -> 121282784 (0.13 %) bytes
LDS: 1501 -> 1501 (0.00 %) blocks
Max Waves: 933188 -> 933229 (0.00 %)
Wait states: 0 -> 0 (0.00 %)

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agovulkan/util: meson build - add wayland client include
Tobias Klausmann [Sat, 16 Mar 2019 18:56:59 +0000 (19:56 +0100)]
vulkan/util: meson build - add wayland client include

Without this the build breaks with:

In file included from ../src/vulkan/util/vk_util.h:32,
                 from ../src/vulkan/util/vk_util.c:28:
../include/vulkan/vulkan.h:51:10: fatal error: wayland-client.h: No such file or
directory
 #include <wayland-client.h>
          ^~~~~~~~~~~~~~~~~~
compilation terminated.

The above misses the include directory for wayland:
   -I/usr/include/wayland

Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agonv50ir/nir: move immediates before use
Karol Herbst [Thu, 16 Aug 2018 20:11:47 +0000 (22:11 +0200)]
nv50ir/nir: move immediates before use

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonv50/ir/nir: handle user clip planes for each emitted vertex
Karol Herbst [Sat, 30 Jun 2018 14:22:17 +0000 (16:22 +0200)]
nv50/ir/nir: handle user clip planes for each emitted vertex

v9: convert to C++ style comments
    handle for tess eval shaders as well

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonv50/ir/nir: implement intrinsic shader_clock
Karol Herbst [Tue, 9 Jan 2018 23:35:47 +0000 (00:35 +0100)]
nv50/ir/nir: implement intrinsic shader_clock

v9: mark as fixed

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonv50/ir/nir: implement load_per_vertex_output
Karol Herbst [Sat, 6 Jan 2018 23:35:37 +0000 (00:35 +0100)]
nv50/ir/nir: implement load_per_vertex_output

v4: use smarter getIndirect helper
    use new getSlotAddress helper
v5: use loadFrom helper
v8: don't require C++11 features

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonv50/ir/nir: add memory barriers
Karol Herbst [Mon, 25 Dec 2017 22:15:03 +0000 (23:15 +0100)]
nv50/ir/nir: add memory barriers

v5: add more barrier intrinsics

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonv50/ir/nir: implement images
Karol Herbst [Sat, 23 Dec 2017 17:05:49 +0000 (18:05 +0100)]
nv50/ir/nir: implement images

v3: fix compiler warnings
v4: use loadFrom helper
v5: fix signed min/max
v6: set tex mask
    add support for indirect image access
    set cache mode
v7: make compatible with 884d27bcf688d36c3bbe01bceca525595add3b33
    rework the whole deref thing to prepare for bindless
v8: port to deref instructions
    don't require C++11 features
v9: implement MS images
    rebase on master (image modifiers)
    fix regressions due to variable src compnents
    replace '(*it).' with 'it->'
    convert to C++ style comments

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonv50/ir/nir: implement ssbo intrinsics
Karol Herbst [Sat, 23 Dec 2017 01:26:03 +0000 (02:26 +0100)]
nv50/ir/nir: implement ssbo intrinsics

v4: use loadFrom helper
v5: support indirect buffer access
v8: don't require C++11 features

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonv50/ir/nir: implement nir_intrinsic_load_ubo
Karol Herbst [Fri, 22 Dec 2017 17:01:38 +0000 (18:01 +0100)]
nv50/ir/nir: implement nir_intrinsic_load_ubo

v4: use loadFrom helper
v8: don't require C++11 features

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonv50/ir/nir: implement geometry shader nir_intrinsics
Karol Herbst [Thu, 21 Dec 2017 15:30:25 +0000 (16:30 +0100)]
nv50/ir/nir: implement geometry shader nir_intrinsics

v4: use smarter getIndirect helper
    use new getSlotAddress helper
    use loadFrom helper
v8: don't require C++11 features

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonv50/ir/nir: implement variable indexing
Karol Herbst [Mon, 11 Dec 2017 01:11:50 +0000 (02:11 +0100)]
nv50/ir/nir: implement variable indexing

We store those arrays in local memory and reserve some space for each of the
arrays. With NIR we could store those arrays packed, but we don't do that yet
as it causes MemoryOpt to generate unaligned memory accesses.

v3: use fixed size vec4 arrays until we fix MemoryOpt
v4: fix for 64 bit types
v5: use loadFrom helper
v8: don't require C++11 features
v9: convert to C++ style comments

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonv50/ir/nir: implement vote and ballot
Karol Herbst [Wed, 20 Dec 2017 16:06:03 +0000 (17:06 +0100)]
nv50/ir/nir: implement vote and ballot

v2: add vote_eq support
    use the new subop intrinsic helper
    add ballot
v3: add read_(first_)invocation
v8: handle vectorized intrinsics
    don't require C++11 features
v9: lower_subgroups to 32 bit (produces less instructions)
    use getSSA and getScratch instead of new_LValue

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonv50/ir/nir: add skeleton getOperation for intrinsics
Karol Herbst [Sat, 23 Dec 2017 01:25:41 +0000 (02:25 +0100)]
nv50/ir/nir: add skeleton getOperation for intrinsics

v7: don't assert in default case for getSubOp

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
5 years agonv50/ir/nir: implement nir_instr_type_tex
Karol Herbst [Tue, 12 Dec 2017 17:07:01 +0000 (18:07 +0100)]
nv50/ir/nir: implement nir_instr_type_tex

a lot of those fields are not valid for a lot of tex ops. Not quite sure if
it's worth the effort to check for those or just keep it like that. It seems
to kind of work.

v2: reworked offset handling
    add tex support with indirect R/S arguments
    handle GLSL_SAMPLER_DIM_EXTERNAL
    drop reference in convert(glsl_sampler_dim&, bool, bool)
    fix tg4 component selection
v5: fill up coords args with scratch values if coords provided is less than TexTarget.getArgCount()
v7: prepare for bindless_texture support
v8: don't require C++11 features
v9: convert to C++ style comments
    fix txf with a uniform constant 0 lod

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonv50/ir/nir: implement nir_ssa_undef_instr
Karol Herbst [Thu, 14 Dec 2017 00:15:55 +0000 (01:15 +0100)]
nv50/ir/nir: implement nir_ssa_undef_instr

v2: use mkOp
v8: don't require C++11 features

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
5 years agonv50/ir/nir: implement loading system values
Karol Herbst [Wed, 13 Dec 2017 21:14:03 +0000 (22:14 +0100)]
nv50/ir/nir: implement loading system values

v2: support more sys values
    fixed a bug where for multi component reads all values ended up in x
v3: add load_patch_vertices_in
v4: add subgroup stuff
v5: add helper invocation
v6: fix loading 64 bit system values
v8: don't require C++11 features
v9: convert to C++ style comments

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonv50/ir/nir: implement intrinsic_discard(_if)
Karol Herbst [Wed, 13 Dec 2017 20:59:29 +0000 (21:59 +0100)]
nv50/ir/nir: implement intrinsic_discard(_if)

v9: use getSSA instead of new_LValue

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonv50/ir/nir: implement load_(interpolated_)input/output
Karol Herbst [Mon, 11 Dec 2017 15:21:06 +0000 (16:21 +0100)]
nv50/ir/nir: implement load_(interpolated_)input/output

v3: and load_output
v4: use smarter getIndirect helper
    use new getSlotAddress helper
v5: don't use const_offset directly
    fix for indirects
v6: add support for interpolateAt
v7: fix compiler warnings
    add load_barycentric_sample
    handle load_output for fragment shaders
v8: set info->prop.fp.readsSampleLocations for at_sample interpolation
    don't require C++11 features
v9: convert to C++ style comments

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonv50/ir/nir: implement nir_intrinsic_store_(per_vertex_)output
Karol Herbst [Mon, 11 Dec 2017 14:46:19 +0000 (15:46 +0100)]
nv50/ir/nir: implement nir_intrinsic_store_(per_vertex_)output

v3: add workaround for RA issues
    indirects have to be multiplied by 0x10
    fix indirect access
v4: use smarter getIndirect helper
    use storeTo helper
v5: don't use const_offset directly
v8: don't require C++11 features
v9: convert to C++ style comments
    handle clip planes correctly

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonv50/ir/nir: implement nir_intrinsic_load_uniform
Karol Herbst [Tue, 12 Dec 2017 20:02:37 +0000 (21:02 +0100)]
nv50/ir/nir: implement nir_intrinsic_load_uniform

v2: use new getIndirect helper
    fixes symbols for 64 bit types
v4: use smarter getIndirect helper
    simplify address calculation
    use loadFrom helper
v8: don't require C++11 features

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonv50/ir/nir: implement nir_alu_instr handling
Karol Herbst [Tue, 12 Dec 2017 20:05:30 +0000 (21:05 +0100)]
nv50/ir/nir: implement nir_alu_instr handling

v2: user bitfield_insert instead of bfi
    rework switch helper macros
    remove some lowering code (LoweringHelper is now used for this)
v3: add pack_half_2x16_split
    add unpack_half_2x16_split_x/y
v5: replace first argument with nullptr in loadImm calls
    prefer getSSA over getScratch
v8: fix setting precise modifier for first instruction inside a block
    add guard in case no instruction gets inserted into an empty block
    don't require C++11 features
v9: use CC_NE for integer compares
    convert to C++ style comments
    fix b2f for doubles
    remove macros around nir ops to make it easier to grep them
    add handling for fpow

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonv50/ir/nir: add skeleton for nir_intrinsic_instr
Karol Herbst [Thu, 21 Dec 2017 12:33:23 +0000 (13:33 +0100)]
nv50/ir/nir: add skeleton for nir_intrinsic_instr

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
5 years agonv50/ir/nir: implement nir_load_const_instr
Karol Herbst [Tue, 12 Dec 2017 20:01:39 +0000 (21:01 +0100)]
nv50/ir/nir: implement nir_load_const_instr

v8: fix loading 8/16 bit constants

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
5 years agonv50/ir/nir: parse NIR shader info
Karol Herbst [Fri, 15 Dec 2017 16:40:15 +0000 (17:40 +0100)]
nv50/ir/nir: parse NIR shader info

v2: parse a few more fields
v3: add special handling for GL_ISOLINES
v8: set info->prop.fp.readsSampleLocations
    don't require C++11 features
v9: replace '(*it).' with 'it->'
    convert to C++ style comments

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonv50/ir/nir: add loadFrom and storeTo helpler
Karol Herbst [Tue, 9 Jan 2018 02:22:00 +0000 (03:22 +0100)]
nv50/ir/nir: add loadFrom and storeTo helpler

v8: don't require C++11 features

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonv50/ir/nir: run assignSlots
Karol Herbst [Mon, 11 Dec 2017 17:01:29 +0000 (18:01 +0100)]
nv50/ir/nir: run assignSlots

v2: add support for geometry shaders
    set idx
    add some missing mappings
    fix for 64bit inputs/outputs
    fix up some FP color output index messup
    parse centroid flag
v3: fix arrays in outputs as well
    fix input/ouput size calculation for tessellation shaders
v4: add getSlotAddress helper
    fix for 64 bit typed inputs
v5: change getSlotAddress interface for easier use
    fix sample inputs
    fix slot counting for mat
v7: fix driver_location of images
v8: don't require C++11 features
v9: convert to C++ style comments
    support VERT_ATTRIB_POINT_SIZE
    add more error checking to slots

Signed-off-by: Karol Herbst <kherbst@redhat.com>
5 years agonv50/ir/nir: add nir type helper functions
Karol Herbst [Mon, 18 Dec 2017 02:57:06 +0000 (03:57 +0100)]
nv50/ir/nir: add nir type helper functions

v4: treat imul as unsigned
v5: remove pointless !!
v7: inot is unsigned as well
v8: don't require C++11 features
v9: convert to C++ style comments
    improve formatting
    print error in all cases where codegen doesn't support a given type

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Acked-by: Pierre Moreau <pierre.morrow@free.fr>