mesa.git
20 months agofreedreno/fdl: Align after dividing by block size
Kristian H. Kristensen [Tue, 5 May 2020 07:03:18 +0000 (00:03 -0700)]
freedreno/fdl: Align after dividing by block size

For compressed formats, we need to align the number of blocks, not the
logical number of pixels in the texture.  Only compressed formats have
block width/height > 1, so we can just unconditionally multiply the
alignment by the block width/height.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4868>

20 months agodocs: update calendar for 20.1.0-rc2
Eric Engestrom [Wed, 6 May 2020 21:48:26 +0000 (23:48 +0200)]
docs: update calendar for 20.1.0-rc2

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4927>

20 months agoci: Fix the nick used in IRC reporting.
Eric Anholt [Tue, 5 May 2020 19:17:49 +0000 (12:17 -0700)]
ci: Fix the nick used in IRC reporting.

robclark found that we needed unique IDs when multiple runners were trying
to report flakes at the same time, but it turns out due to nick limits (16
chars on freenode) we were just getting all the runners appended with
"-142" (or whatever the prefix of the pipelines are these days).  And, for
the new flake reporting from baremetal, all the runners ended up being
just "google-freedreno".

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4896>

20 months agoci: Improve the flakes reports on IRC.
Eric Anholt [Tue, 5 May 2020 17:44:46 +0000 (10:44 -0700)]
ci: Improve the flakes reports on IRC.

We were incorrectly taking the merge-request on non-MR pipelines (the
master build after merge) due to a missing '$'.  And, for those pipelines,
it would be nice to note whether they're for master or a stable branch.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4896>

20 months agoci: Enable IRC flake reporting on freedreno baremetal boards.
Eric Anholt [Fri, 1 May 2020 16:57:00 +0000 (09:57 -0700)]
ci: Enable IRC flake reporting on freedreno baremetal boards.

The IRC channel is useful for me to track and ban flaky tests before they
irritate people too much.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2654
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4896>

20 months agoci: Clean up setup of the job-specific env vars in baremetal testing.
Eric Anholt [Mon, 4 May 2020 20:42:41 +0000 (13:42 -0700)]
ci: Clean up setup of the job-specific env vars in baremetal testing.

Avoids copy and paste errors when adding more vars.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4896>

20 months agoradeonsi: fix compilation of monolithic PS
Marek Olšák [Wed, 6 May 2020 13:42:55 +0000 (09:42 -0400)]
radeonsi: fix compilation of monolithic PS

This was totally broken. Monolithic PS is only used if FBFETCH or
interpolateAtSample are used.

When the PS prolog was built, it overwrote ctx->main_fn.

Discovered by @eefano.

Fixes: 8832a884345686e6a8b2c0c8aa7515ad3f775b9e "radeonsi: move PS LLVM code into si_shader_llvm_ps.c"
Closes: #2814
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4918>

20 months agotgsi_to_nir: translate non-vec4 image stores correctly
Marek Olšák [Tue, 5 May 2020 16:44:54 +0000 (12:44 -0400)]
tgsi_to_nir: translate non-vec4 image stores correctly

set the correct number of components for src data and the intrinsic

Reviewed-by: Rob Clark <robdclark@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4908>

20 months agoi965: Fix out-of-bounds access to brw_stage_state::surf_offset
Danylo Piliaiev [Fri, 27 Mar 2020 14:55:52 +0000 (16:55 +0200)]
i965: Fix out-of-bounds access to brw_stage_state::surf_offset

../src/mesa/drivers/dri/i965/brw_wm_surface_state.c:1378:32: runtime error: index 3503345872 out of bounds for type 'uint32_t [149]'

brw_assign_common_binding_table_offsets has the following comment:
 "Unused groups are initialized to 0xd0d0d0d0 to make it obvious that they're
 unused but also make sure that addition of small offsets to them will
 trigger some of our asserts that surface indices are < BRW_MAX_SURFACES."

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4350>

20 months agozink: lower b2b to b2i
Erik Faye-Lund [Tue, 5 May 2020 15:04:46 +0000 (17:04 +0200)]
zink: lower b2b to b2i

Zink requires 1-bit booleans, but this requirement was missed before
b2b1s started getting automatically inserted. Let's lower these away, to
avoid piglit regressions.

Fixes the following piglits:
- shaders@glsl-vs-if-bool
- spec@!opengl 2.0@vertex-program-two-side

Fixes: c217ee8d35f ("nir: Insert b2b1s around booleans in nir_lower_to")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2902
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4903>

20 months agoradv/winsys: do not count visible VRAM buffers twice in the budget
Samuel Pitoiset [Thu, 30 Apr 2020 16:42:27 +0000 (18:42 +0200)]
radv/winsys: do not count visible VRAM buffers twice in the budget

The VRAM size returned to apps is computed as follows:
vram_size = real_hw_vram_size - visible_vram_size.

Visible VRAM buffers should be counted only in the visible VRAM
counter and not twice. Buffers with the NO_CPU_ACCESS flag are
known to not be mappable, so they are counted in the VRAM counter.

Other buffers, with the CPU_ACCESS flag, or without any of both
(imported buffers) are counted in the visible VRAM counter because
they are mappable.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4834>

20 months agoradv: display an error message if the winsys init failed
Samuel Pitoiset [Wed, 29 Apr 2020 12:09:10 +0000 (14:09 +0200)]
radv: display an error message if the winsys init failed

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4806>

20 months agoradv: use a linked list for physical devices
Samuel Pitoiset [Wed, 29 Apr 2020 11:53:35 +0000 (13:53 +0200)]
radv: use a linked list for physical devices

Instead of a static array inside the instance object.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4806>

20 months agoradv: don't report error with other vendor DRM devices
Samuel Pitoiset [Wed, 29 Apr 2020 11:23:22 +0000 (13:23 +0200)]
radv: don't report error with other vendor DRM devices

Enumeration should just skip unsupported DRM devices.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4806>

20 months agoradv: report INITIALIZATION_FAILED when the amdgpu winsys init failed
Samuel Pitoiset [Wed, 29 Apr 2020 11:24:36 +0000 (13:24 +0200)]
radv: report INITIALIZATION_FAILED when the amdgpu winsys init failed

The driver should be capable if it reaches the winsys initialization.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4806>

20 months agoradv: fix a memleak if the physical device initialization failed
Samuel Pitoiset [Wed, 29 Apr 2020 12:03:24 +0000 (14:03 +0200)]
radv: fix a memleak if the physical device initialization failed

The disk cache object should be freed.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4806>

20 months agoradv: rename radv_devices() to radv_enumerate_physical_devices()
Samuel Pitoiset [Wed, 29 Apr 2020 09:56:50 +0000 (11:56 +0200)]
radv: rename radv_devices() to radv_enumerate_physical_devices()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4806>

20 months agoradv: cleanup radv_CreateInstance()
Samuel Pitoiset [Wed, 6 May 2020 06:25:38 +0000 (08:25 +0200)]
radv: cleanup radv_CreateInstance()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4806>

20 months agollvmpipe: enable ARB_sample_shading
Dave Airlie [Tue, 24 Mar 2020 22:01:27 +0000 (08:01 +1000)]
llvmpipe: enable ARB_sample_shading

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: add min samples support to the fragment shader.
Dave Airlie [Tue, 24 Mar 2020 21:57:33 +0000 (07:57 +1000)]
llvmpipe: add min samples support to the fragment shader.

This isn't enabled yet until the state gets hooked up

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: enable GL_ARB_shader_texture_image_samples
Dave Airlie [Mon, 23 Mar 2020 21:48:31 +0000 (07:48 +1000)]
llvmpipe: enable GL_ARB_shader_texture_image_samples

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agogallivm/nir: hooks up texture samples queries
Dave Airlie [Mon, 23 Mar 2020 21:47:56 +0000 (07:47 +1000)]
gallivm/nir: hooks up texture samples queries

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agogallivm/sample: add num samples query for txqs (v2)
Dave Airlie [Mon, 23 Mar 2020 21:47:16 +0000 (07:47 +1000)]
gallivm/sample: add num samples query for txqs (v2)

v2: add false to the existing users (Roland)

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: enable 4x sample MSAA + texture multisample
Dave Airlie [Fri, 20 Mar 2020 21:40:48 +0000 (07:40 +1000)]
llvmpipe: enable 4x sample MSAA + texture multisample

This enables proper support for 4xMSAA and for texture mulitsample
extension.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agodrisw: add multisample support to sw dri layer.
Dave Airlie [Wed, 25 Mar 2020 02:47:20 +0000 (12:47 +1000)]
drisw: add multisample support to sw dri layer.

This allocates the msaa resources like the dri2 layer
and adds the flushes

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: don't choose pixel centers for multisample
Dave Airlie [Fri, 20 Mar 2020 21:38:13 +0000 (07:38 +1000)]
llvmpipe: don't choose pixel centers for multisample

Don't pick the pixel centers for multisample rendering, fix
the setup program.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: choose correct position for multisample
Dave Airlie [Fri, 20 Mar 2020 21:36:35 +0000 (07:36 +1000)]
llvmpipe: choose correct position for multisample

For multisample we don't want pixel centers at this stage,
so don't add them in for that case.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: choose multisample rasterizer functions per triangle (v2)
Dave Airlie [Fri, 20 Mar 2020 21:34:53 +0000 (07:34 +1000)]
llvmpipe: choose multisample rasterizer functions per triangle (v2)

This just picks the correct cmds to add to the scene.

v2: drop using 32-bit ms (Roland)

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: generate multisample triangle rasterizer functions (v2)
Dave Airlie [Fri, 20 Mar 2020 21:29:04 +0000 (07:29 +1000)]
llvmpipe: generate multisample triangle rasterizer functions (v2)

This uses the templating to generate multisample version of the
tri plane raster functions

This doesn't generate any optimised version for lower plane numbers,
maybe this is worth doing in the future.

v2: drop generating 32-bit msaa (Roland)

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: fixup multisample coverage masks for covered tiles
Dave Airlie [Fri, 20 Mar 2020 21:16:35 +0000 (07:16 +1000)]
llvmpipe: fixup multisample coverage masks for covered tiles

For fully covered tiles just pass in the filled out mask.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: build 64-bit coverage mask in rasterizer
Dave Airlie [Fri, 20 Mar 2020 21:09:15 +0000 (07:09 +1000)]
llvmpipe: build 64-bit coverage mask in rasterizer

This adds the logic to build the per-sample masks at the lowest
level of the rasterizer block hierarchy

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: add fixed point sample positions to scene.
Dave Airlie [Fri, 20 Mar 2020 21:11:39 +0000 (07:11 +1000)]
llvmpipe: add fixed point sample positions to scene.

These will be used in the rasterizer to generate the coverage masks

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: add new rast api to pass full 64-bit mask.
Dave Airlie [Fri, 20 Mar 2020 21:07:53 +0000 (07:07 +1000)]
llvmpipe: add new rast api to pass full 64-bit mask.

The 64-bit mask is a 16-bit mask per sample for up to 4 samples.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: disable opaque variant for multisample
Dave Airlie [Fri, 20 Mar 2020 20:58:01 +0000 (06:58 +1000)]
llvmpipe: disable opaque variant for multisample

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: fix multisample occlusion queries.
Dave Airlie [Tue, 24 Mar 2020 02:54:52 +0000 (12:54 +1000)]
llvmpipe: fix multisample occlusion queries.

This needs to check the per-sample mask inside the loop if
multisample is enabled.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: move color storing earlier in frag shader
Dave Airlie [Fri, 20 Mar 2020 20:54:26 +0000 (06:54 +1000)]
llvmpipe: move color storing earlier in frag shader

Move the color storage before the late Z test as for sample
shading it needs to be inside a loop with the fragment shader.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: pass mask store into interp for centroid interpolation
Dave Airlie [Fri, 20 Mar 2020 20:50:48 +0000 (06:50 +1000)]
llvmpipe: pass mask store into interp for centroid interpolation

This enables centroid interpolation to work, using the current
coverage masks.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: don't allow branch to end for early Z with multisample
Dave Airlie [Fri, 20 Mar 2020 20:47:31 +0000 (06:47 +1000)]
llvmpipe: don't allow branch to end for early Z with multisample

Don't allow the branching optimisation with multisample enabled
as we have to check all samples.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: handle gl_SampleMask writing.
Dave Airlie [Fri, 20 Mar 2020 09:38:50 +0000 (19:38 +1000)]
llvmpipe: handle gl_SampleMask writing.

This is using a load/store to make it easier to add sample shading later.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: add multisample alpha to one support
Dave Airlie [Fri, 20 Mar 2020 09:30:06 +0000 (19:30 +1000)]
llvmpipe: add multisample alpha to one support

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: add multisample alpha to coverage support.
Dave Airlie [Fri, 20 Mar 2020 09:28:59 +0000 (19:28 +1000)]
llvmpipe: add multisample alpha to coverage support.

Converts alpha into coverage mask.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: hook up sample position system value
Dave Airlie [Fri, 20 Mar 2020 04:29:46 +0000 (14:29 +1000)]
llvmpipe: hook up sample position system value

This creates a global static with the current sample positions,
and passes it to the fragment shader which uses it for interpolation
and sample position support.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: handle multisample color stores.
Dave Airlie [Fri, 20 Mar 2020 04:10:48 +0000 (14:10 +1000)]
llvmpipe: handle multisample color stores.

Extract the final per-sample masks and store to the multisample
color buffers using them.

This retypes the pointer to a uint8_t at entry to make the
GEP simpler, then recasts to the blend type.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: interpolate Z at sample points for early depth test.
Dave Airlie [Wed, 25 Mar 2020 02:47:53 +0000 (12:47 +1000)]
llvmpipe: interpolate Z at sample points for early depth test.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: handle multisample early depth test/late depth write
Dave Airlie [Fri, 20 Mar 2020 04:01:54 +0000 (14:01 +1000)]
llvmpipe: handle multisample early depth test/late depth write

A set of values have to be passed from the early depth test to the
late depth write, when multisampling is enabled, a range of those
values have to be stored between stages, so create storage for them
and pass the values through the storage.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: multisample sample mask + early/late depth pass
Dave Airlie [Fri, 20 Mar 2020 03:48:08 +0000 (13:48 +1000)]
llvmpipe: multisample sample mask + early/late depth pass

Start adding support for multisample masks and the depth passes

The depth passes have to run per-sample, this isn't complete support
it adds the loops, and handles the execution masks.

One mask is stored per sample, they are combined post the early Z
pass into a single shader execution mask, and then the resulting
shader execution mask is anded back in for the late Z pass.

Init the vars to NULL to avoid gcc warnings

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: move some fs code around
Dave Airlie [Fri, 20 Mar 2020 03:29:13 +0000 (13:29 +1000)]
llvmpipe: move some fs code around

this just moves the num_fs loop around for follow on refactors

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: add per-sample depth/stencil test
Dave Airlie [Thu, 19 Mar 2020 05:54:08 +0000 (15:54 +1000)]
llvmpipe: add per-sample depth/stencil test

The current depth stencil test code has some optimisations using
the mask when there is only one depth value, multisample requires
per-sample zstencil testing, and for that case just pass in the
mask that needs updating.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: move getting mask value out of depth code. (v2)
Dave Airlie [Thu, 19 Mar 2020 05:47:14 +0000 (15:47 +1000)]
llvmpipe: move getting mask value out of depth code. (v2)

In order to add per-sample support to this code, the mask
value is needed not the value from the exec mask.

v2: update comment

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: add per-sample interpolation.
Dave Airlie [Thu, 19 Mar 2020 05:40:31 +0000 (15:40 +1000)]
llvmpipe: add per-sample interpolation.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: add centroid interpolation support.
Dave Airlie [Thu, 19 Mar 2020 05:24:11 +0000 (15:24 +1000)]
llvmpipe: add centroid interpolation support.

This just adds the implementation and API to the interpolation builders.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: pass interp location into interpolation code.
Dave Airlie [Thu, 19 Mar 2020 04:41:22 +0000 (14:41 +1000)]
llvmpipe: pass interp location into interpolation code.

This just tracks the attribute interpolation location into the
interp code.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agonir/tgsi: translate the interp location
Dave Airlie [Thu, 19 Mar 2020 04:25:25 +0000 (14:25 +1000)]
nir/tgsi: translate the interp location

translate sample and centroid locations.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agogallivm: add mask api to force mask
Dave Airlie [Thu, 19 Mar 2020 04:10:31 +0000 (14:10 +1000)]
gallivm: add mask api to force mask

For per-sample shading the mask needs to be forced for each
iteration of the fragment shader.

Just adds the API for now.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agogallivm: add sample id/pos intrinsic support
Dave Airlie [Thu, 19 Mar 2020 04:04:47 +0000 (14:04 +1000)]
gallivm: add sample id/pos intrinsic support

The sample position is looked up in an incoming array using the
sample id.

(These are mostly for ARB_sample_shading support)

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: add cbuf/zsbuf + coverage samples to the fragment shader key.
Dave Airlie [Tue, 10 Mar 2020 22:44:40 +0000 (08:44 +1000)]
llvmpipe: add cbuf/zsbuf + coverage samples to the fragment shader key.

These will cause different fragment shaders to be generated.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: change mask input to fragment shader to 64-bit.
Dave Airlie [Tue, 10 Mar 2020 22:23:10 +0000 (08:23 +1000)]
llvmpipe: change mask input to fragment shader to 64-bit.

In order to handle a 4xMSAA mask (16-bits per sample) increase
the fragment shader API to be 64-bit.

v2: drop pointless if (Roland)

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: add multisample bit to fragment shader key.
Dave Airlie [Tue, 10 Mar 2020 22:11:31 +0000 (08:11 +1000)]
llvmpipe: add multisample bit to fragment shader key.

The fragment shader needs to be regenerated when multisample changes.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: plumb multisample state bit into setup code.
Dave Airlie [Tue, 10 Mar 2020 22:09:22 +0000 (08:09 +1000)]
llvmpipe: plumb multisample state bit into setup code.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe/rast: fix tile clearing for multisample color and depth tiles
Dave Airlie [Tue, 10 Mar 2020 05:28:02 +0000 (15:28 +1000)]
llvmpipe/rast: fix tile clearing for multisample color and depth tiles

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: record sample info for color/depth buffers in scene
Dave Airlie [Tue, 10 Mar 2020 05:09:37 +0000 (15:09 +1000)]
llvmpipe: record sample info for color/depth buffers in scene

This adds the nr_samples + sample_stride to the scene records
for cbufs and zsbuf.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: pass color and depth sample strides into fragment shader.
Dave Airlie [Tue, 7 Apr 2020 23:49:47 +0000 (09:49 +1000)]
llvmpipe: pass color and depth sample strides into fragment shader.

This just adds the interface and passes the depth and sample strides
into the fragment shader, nothing uses them yet.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agodraw: disable point/line smoothing for multisample (v2)
Dave Airlie [Tue, 10 Mar 2020 03:51:24 +0000 (13:51 +1000)]
draw: disable point/line smoothing for multisample (v2)

When MSAA is enabled smoothing is ignored

v2: As pointed out by Roland I got this completely wrong,
fix this to work the other way

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: handle multisample render target clears
Dave Airlie [Tue, 24 Mar 2020 06:18:46 +0000 (16:18 +1000)]
llvmpipe: handle multisample render target clears

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: add clear texture support for multisample textures.
Dave Airlie [Tue, 10 Mar 2020 03:37:07 +0000 (13:37 +1000)]
llvmpipe: add clear texture support for multisample textures.

This adds the clear paths for multisample textures.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: add multisample resource copy region support.
Dave Airlie [Tue, 10 Mar 2020 03:36:36 +0000 (13:36 +1000)]
llvmpipe: add multisample resource copy region support.

This allows direct copies of all samples between two resources.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: add internal multisample texture mapping path.
Dave Airlie [Tue, 10 Mar 2020 03:34:33 +0000 (13:34 +1000)]
llvmpipe: add internal multisample texture mapping path.

For clearing and copying textures llvmpipe needs to internally
access the per-sample data.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: pass incoming sample_mask into fragment shader context.
Dave Airlie [Tue, 10 Mar 2020 03:21:48 +0000 (13:21 +1000)]
llvmpipe: pass incoming sample_mask into fragment shader context.

This links up the api changing the sample mask to passing it into
the fragment shader.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe/jit: pass fragment sample mask via jit context.
Dave Airlie [Tue, 10 Mar 2020 03:06:30 +0000 (13:06 +1000)]
llvmpipe/jit: pass fragment sample mask via jit context.

The incoming sample mask for the fragment shader can be passed
via the jit context

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: add get_sample_position support (v2)
Dave Airlie [Tue, 10 Mar 2020 03:04:01 +0000 (13:04 +1000)]
llvmpipe: add get_sample_position support (v2)

This just adds the sample values for 4xmsaa, and hooks them
up to the get_sample_position API

v2: move to vulkan standard sample positions

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: fix race between draw and setting fragment shader.
Dave Airlie [Tue, 10 Mar 2020 02:55:31 +0000 (12:55 +1000)]
llvmpipe: fix race between draw and setting fragment shader.

There is a race with u_blitter shaders + pipeline shaders (aaline/aapoint)
where the draw bind can cause a pipeline flush which can use bind_fs_state to
 be reenters and llvmpipe->fs gets the wrong value. Fix this by only
setting the llvmpipe->fs value after the draw binding is complete.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agogallium/util: split out zstencil clearing code.
Dave Airlie [Tue, 10 Mar 2020 02:46:02 +0000 (12:46 +1000)]
gallium/util: split out zstencil clearing code.

llvmpipe will want to reuse this for it's multisample clears.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: add a max samples define set to 4.
Dave Airlie [Tue, 10 Mar 2020 00:50:49 +0000 (10:50 +1000)]
llvmpipe: add a max samples define set to 4.

I doubt I'll care about much higher MSAA levels, so 4 it is.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: add multisample support to texture allocator.
Dave Airlie [Tue, 10 Mar 2020 00:30:13 +0000 (10:30 +1000)]
llvmpipe: add multisample support to texture allocator.

This adds a sample stride field and allocates enough memory for
each sample storage. Hook up the sample_stride field to draw
and jit textures and images

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agoutil: add a resource wrapper to get resource samples
Dave Airlie [Mon, 30 Dec 2019 21:03:26 +0000 (07:03 +1000)]
util: add a resource wrapper to get resource samples

This return 1 as a baseline and should be used in allocator paths.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: add samples support to image jit
Dave Airlie [Mon, 23 Mar 2020 05:11:37 +0000 (15:11 +1000)]
llvmpipe: add samples support to image jit

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agollvmpipe: add num_samples/sample_stride support to jit textures
Dave Airlie [Tue, 10 Mar 2020 00:22:49 +0000 (10:22 +1000)]
llvmpipe: add num_samples/sample_stride support to jit textures

This adds the support for num_samples/sample_stride retrieval to the
jit texture infrastructure.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agodraw: add support for num_samples + sample_stride to the image paths
Dave Airlie [Mon, 23 Mar 2020 05:07:11 +0000 (15:07 +1000)]
draw: add support for num_samples + sample_stride to the image paths

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agodraw: introduce sampler num samples + stride members
Dave Airlie [Tue, 10 Mar 2020 00:15:21 +0000 (10:15 +1000)]
draw: introduce sampler num samples + stride members

This adds the num samples + sampler stride into the texture mapping paths,
currently drivers just pass 0 for now.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agogallivm/nir: add multisample image operations
Dave Airlie [Mon, 23 Mar 2020 05:15:51 +0000 (15:15 +1000)]
gallivm/nir: add multisample image operations

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agogallivm/nir: add multisample support to image size
Dave Airlie [Mon, 23 Mar 2020 03:55:08 +0000 (13:55 +1000)]
gallivm/nir: add multisample support to image size

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agogallivm/nir/tgsi: add multisample texture sampling.
Dave Airlie [Mon, 9 Mar 2020 23:51:17 +0000 (09:51 +1000)]
gallivm/nir/tgsi: add multisample texture sampling.

Both paths are required as u_blitter needs the TGSI path.

This just hooks the instructions up to the sampling code.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agogallivm/sample: add multisample image operation support
Dave Airlie [Mon, 23 Mar 2020 05:15:27 +0000 (15:15 +1000)]
gallivm/sample: add multisample image operation support

Just adds in the sample stride.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agogallivm/sample: add multisample support for texel fetch
Dave Airlie [Mon, 9 Mar 2020 23:38:07 +0000 (09:38 +1000)]
gallivm/sample: add multisample support for texel fetch

This adds a new callback to get the stride between the per-sample
images, adds a new value for the per-sample index to lookup,
and a flag to use multisampling.

gallivm/sample: add num samples interface for dynamic samplers

This will be used for getting number of samples in jit code.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

20 months agovirgl: Properly check for encode_stride when encoding transfers
Tomeu Vizoso [Mon, 27 Apr 2020 07:16:49 +0000 (09:16 +0200)]
virgl: Properly check for encode_stride when encoding transfers

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4763>

20 months agollvmpipe: simple texture barrier implementation.
Dave Airlie [Thu, 26 Mar 2020 02:06:34 +0000 (12:06 +1000)]
llvmpipe: simple texture barrier implementation.

Just flush.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4774>

20 months agollvmpipo/nir: free compute shader NIR
Dave Airlie [Tue, 5 May 2020 06:03:34 +0000 (16:03 +1000)]
llvmpipo/nir: free compute shader NIR

I forgot this in the last round.

Fixes: 18f896e55d96 (llvmpipe: add initial nir support)
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4899>

20 months agodraw/tess: free tessellation control shader i/o memory.
Dave Airlie [Tue, 5 May 2020 06:02:39 +0000 (16:02 +1000)]
draw/tess: free tessellation control shader i/o memory.

Fixes: 0d02a7b8ca79 (draw: add main tessellation code)
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4899>

20 months agonir: add missing group_memory_barrier handling
Rhys Perry [Mon, 4 May 2020 17:54:11 +0000 (18:54 +0100)]
nir: add missing group_memory_barrier handling

Totals from 2 (0.00% of 127638) affected shaders:
VGPRs: 164 -> 168 (+2.44%)
CodeSize: 18420 -> 18756 (+1.82%)
Instrs: 3658 -> 3700 (+1.15%)
Cycles: 82912 -> 83080 (+0.20%)
VMEM: 70 -> 69 (-1.43%)
PreVGPRs: 155 -> 168 (+8.39%)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
CC: <mesa-stable@lists.freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4889>

20 months agofreedreno/ir3: Disable sin/cos range reduction for mediump.
Eric Anholt [Mon, 4 May 2020 21:10:40 +0000 (14:10 -0700)]
freedreno/ir3: Disable sin/cos range reduction for mediump.

robclark noted that the blob wasn't doing range reduction in the mediump
case, and I confirmed it on
dEQP-GLES3.functional.shaders.operator.angle_and_trigonometry.sin.mediump_float_fragment
vs
dEQP-GLES3.functional.shaders.operator.angle_and_trigonometry.sin.highp_float_fragment.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4893>

20 months agost/nine: Set correctly blend max_rt
Axel Davy [Mon, 4 May 2020 20:40:08 +0000 (22:40 +0200)]
st/nine: Set correctly blend max_rt

Currently nine_convert_blend_state has no way
of knowing the number of rts.
For now set to an upper bound.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4891>

20 months agoradeonsi: enable TC-compatible HTILE on demand for best Z/S performance
Marek Olšák [Sat, 2 May 2020 21:58:15 +0000 (17:58 -0400)]
radeonsi: enable TC-compatible HTILE on demand for best Z/S performance

I haven't measured this, but it can only help.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4866>

20 months agoradeonsi: allow tc_compatible_htile to be mutable
Marek Olšák [Sat, 2 May 2020 21:34:16 +0000 (17:34 -0400)]
radeonsi: allow tc_compatible_htile to be mutable

Move the relevant code from si_init_depth_surface to
si_emit_framebuffer_state, so that it can be changed after a pipe_surface
is initialized.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4866>

20 months agoradeonsi/gfx9: always use IMG_DATA_FORMAT_S8_32 for 8-bit stencil
Marek Olšák [Sat, 2 May 2020 20:35:16 +0000 (16:35 -0400)]
radeonsi/gfx9: always use IMG_DATA_FORMAT_S8_32 for 8-bit stencil

I wanna remove dependency on tc_compatible_htile from non-dynamic states.
This should be the same as 8_UINT if HTILE is disabled.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4866>

20 months agoac/surface: unset RADEON_SURF_TC_COMPATIBLE_HTILE if HTILE hasn't been computed
Marek Olšák [Sat, 2 May 2020 20:19:00 +0000 (16:19 -0400)]
ac/surface: unset RADEON_SURF_TC_COMPATIBLE_HTILE if HTILE hasn't been computed

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4866>

20 months agoradeonsi: don't wait for idle at the end of gfx IBs
Marek Olšák [Mon, 4 May 2020 21:41:41 +0000 (17:41 -0400)]
radeonsi: don't wait for idle at the end of gfx IBs

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4894>

20 months agoac/nir: export some undef as zero
Pierre-Eric Pelloux-Prayer [Tue, 28 Apr 2020 14:34:49 +0000 (16:34 +0200)]
ac/nir: export some undef as zero

NIR already optimizes undef usage.
If undef reaches llvm, it's probably because of a broken shader.

In this situation, rather than letting llvm use the undef values
to do more optimization and probably produce incorrect results,
we replace undef values by 0.

"undef" values that are directly used in exports are kept as undef,
because this allows llvm to optimize them away.

This is only enabled for radeonsi.

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2689
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4607>

20 months agogallium: add a new cap PIPE_CAP_GLSL_ZERO_INIT
Pierre-Eric Pelloux-Prayer [Fri, 24 Apr 2020 16:14:40 +0000 (18:14 +0200)]
gallium: add a new cap PIPE_CAP_GLSL_ZERO_INIT

Allows driver to select a zero init mode between the 3 possible values.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4607>

20 months agomesa: extend GLSLZeroInit semantics
Pierre-Eric Pelloux-Prayer [Fri, 24 Apr 2020 16:32:02 +0000 (18:32 +0200)]
mesa: extend GLSLZeroInit semantics

This commit introduces a new way to zero-init variables but keep the
old one to not break any existing behavior.

With this change GLSLZeroInit becomes an integer, with the following
possible values:
 - 0: no 0 init
 - 1: current behavior
 - 2: new behavior. Similar to 1, except ir_var_function_out type are
      0 initialized but ir_var_shader_out.

The rationale behind 2 is: zero initializing ir_var_shader_out can
prevent some optimization where out variables are completely eliminated
when not written to.

On the other hand, zero initializing "ir_var_function_out" has no
effect on correct shaders but typically helps shadertoy since the main
function is:

   void mainImage(out vec4 fragColor) { ... }

So with this change we're sure that fragColor will always get a value.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4607>

20 months agoglsl: add a is_implicit_initializer flag
Pierre-Eric Pelloux-Prayer [Thu, 30 Apr 2020 13:06:08 +0000 (15:06 +0200)]
glsl: add a is_implicit_initializer flag

Shared globals and glsl_zero_init can cause linker errors if the
variable is only initialized in 1 place.

This commit adds a flag to variables that have been implicitely
initialized to be able in this situation to keep the explicit
initialization value.

Without this change the global-single-initializer-2-shaders piglit
test fails when using glsl_zero_init.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4607>