platform/upstream/mesa.git
2 years agocompiler: add VARYING bit for primitive shading rate
Lionel Landwerlin [Mon, 8 Feb 2021 16:29:26 +0000 (18:29 +0200)]
compiler: add VARYING bit for primitive shading rate

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13739>

2 years agor300: replace recursive calls with loops
Filip Gawin [Wed, 6 Oct 2021 14:50:21 +0000 (16:50 +0200)]
r300: replace recursive calls with loops

Recursive "loops" tend to be more difficult to follow
and understand. Additionally iterative approach should be
nicer for compiler. (Less to allocate on stack and easier to optimize)

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13226>

2 years agointel/isl: Add more PRM text for HiZ/STC requirement
Nanley Chery [Tue, 1 Feb 2022 19:02:16 +0000 (14:02 -0500)]
intel/isl: Add more PRM text for HiZ/STC requirement

Add text describing why HierarchicalDepthBufferEnable must be set along
with SeparateStencilBufferEnable.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14825>

2 years agointel/isl: Fix depth buffer TiledSurface programming
Nanley Chery [Mon, 31 Jan 2022 21:07:34 +0000 (16:07 -0500)]
intel/isl: Fix depth buffer TiledSurface programming

The assert for the TiledSurface field caught a programming error, but
with a segfault instead of the usual route of assert-failing. We only
set this field when we have a depth surface, but we also need to set it
when one isn't provided. Fix this issue and drop the assert.

Fixes: b77d694223a ("intel/isl: Allow HiZ with Tile4/64 surfaces")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5950
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14825>

2 years agointel/isl: Simplify Z-buffer tiling config during emit
Nanley Chery [Tue, 1 Feb 2022 18:51:06 +0000 (13:51 -0500)]
intel/isl: Simplify Z-buffer tiling config during emit

For SNB and prior, assert that the surface is Y-tiled and use constants
when configuring the tiling parameters. This makes a follow-on commit
clearer.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14825>

2 years agodocs/features: Add VK_KHR_acceleration_structure, VK_KHR_pipeline_library, VK_KHR_ray...
Shmerl [Sun, 30 Jan 2022 02:08:09 +0000 (21:08 -0500)]
docs/features: Add VK_KHR_acceleration_structure, VK_KHR_pipeline_library, VK_KHR_ray_query, VK_KHR_ray_tracing_pipeline.

Closes: #5901
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14796>

2 years agovenus: update venus-protocol to 1.3.204
Chia-I Wu [Fri, 28 Jan 2022 05:26:28 +0000 (21:26 -0800)]
venus: update venus-protocol to 1.3.204

There should be no visible functional change.  Although an unrelated
change in the codegen replaced vn_info_extension_spec_version by
vn_info_extension_get.  We have to adapt to that.

Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14782>

2 years agor300/r600: Add drm-shim support.
Emma Anholt [Sun, 30 Jan 2022 04:27:01 +0000 (20:27 -0800)]
r300/r600: Add drm-shim support.

I was tired of swapping gpus around just to check shader-db results of MRs
for these.  I put it in src/amd since it doesn't make sense in either of
r300 or r600.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14809>

2 years agor300: Disable fp16 and int16 in swtcl vertex shaders.
Emma Anholt [Mon, 31 Jan 2022 18:11:15 +0000 (10:11 -0800)]
r300: Disable fp16 and int16 in swtcl vertex shaders.

We already had them disabled for hwtcl, but in the swtcl case gallivm's
param query would return (nir) support even though nir-to-tgsi couldn't
handle it because TGSI doesn't do fp16/int16.

Fixes: 7d2ea9b0edef ("r300: Request NIR shaders from mesa/st and use NIR-to-TGSI.")
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14809>

2 years agoanv: Report the right conformance version
Iván Briano [Tue, 1 Feb 2022 21:44:25 +0000 (13:44 -0800)]
anv: Report the right conformance version

Fixes: df8ac77af80 ("anv: Advertise Vulkan 1.3")

Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14827>

2 years agoanv: Handle resolveImageLayout on dynamic rendering
Iván Briano [Sat, 29 Jan 2022 01:17:09 +0000 (17:17 -0800)]
anv: Handle resolveImageLayout on dynamic rendering

Fixes: 5d9e8bc9be6 ("anv: implement the meat of VK_KHR_dynamic_rendering")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5942

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14812>

2 years agodocs: update features/relnotes for zink sparse texture clamp
Mike Blumenkrantz [Tue, 1 Feb 2022 17:20:51 +0000 (12:20 -0500)]
docs: update features/relnotes for zink sparse texture clamp

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

2 years agozink: ARB_sparse_texture_clamp
Mike Blumenkrantz [Fri, 14 Jan 2022 15:43:44 +0000 (10:43 -0500)]
zink: ARB_sparse_texture_clamp

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14813>

2 years agoradv/winsys: fix missing buffer_make_resident() for the null winsys
Samuel Pitoiset [Tue, 1 Feb 2022 14:57:36 +0000 (15:57 +0100)]
radv/winsys: fix missing buffer_make_resident() for the null winsys

With latest Fossilize everything should now be captured correctly
but without this, all Fossilize databases that need
VK_EXT_custom_border_color would just crash.

Cc: mesa-stable
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/14821>

2 years agocompiler, intel: Add gl_shader_stage_is_mesh()
Caio Oliveira [Fri, 28 Jan 2022 21:23:21 +0000 (13:23 -0800)]
compiler, intel: Add gl_shader_stage_is_mesh()

And replace the previous Intel-specific function.

Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14823>

2 years agoir3: opt_deref in opt loop to remove unnecessary tex casts
Danylo Piliaiev [Tue, 1 Feb 2022 12:32:02 +0000 (14:32 +0200)]
ir3: opt_deref in opt loop to remove unnecessary tex casts

Otherwise we may be left with such casts:

 vec1 32 ssa_72 = deref_var &shadow_map (uniform sampler2D)
 vec1 32 ssa_73 = deref_cast (texture2D *)ssa_72 (uniform texture2D)
 vec1 32 ssa_74 = deref_cast (sampler *)ssa_72 (uniform sampler)
 vec1 32 ssa_76 = (float32)tex ssa_73 (texture_deref), ssa_74 (sampler_deref), ssa_75 (coord), ssa_64 (comparator)

And crash in ycbcr lowering since we aren't able to follow deref chain.

Fixes crash in GFXBench Aztec Ruins Vulkan tests.
See issue: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5945

Cc: mesa-stable
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14819>

2 years agoir3,tu: Enable subgroup shuffles and relative shuffles
Connor Abbott [Tue, 4 Jan 2022 14:48:42 +0000 (15:48 +0100)]
ir3,tu: Enable subgroup shuffles and relative shuffles

We still don't use the fast path for relative shuffles, that's left for
future work.

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

2 years agoir3/cp: ir3: Prevent propagating shared regs out of loops harder
Connor Abbott [Wed, 5 Jan 2022 18:45:55 +0000 (19:45 +0100)]
ir3/cp: ir3: Prevent propagating shared regs out of loops harder

We need to check the source of the copy, not the destination. That means
this we need to move this check inside the ifs, where we know that the
source is a copy.

Fixes: 590efd180be ("Prevent propagating shared regs out of loops")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14412>

2 years agoir3: Rewrite (jp) insertion
Connor Abbott [Tue, 4 Jan 2022 15:02:06 +0000 (16:02 +0100)]
ir3: Rewrite (jp) insertion

The old code was both too aggressive and not aggressive enough in
inserting (jp), and it wasn't based at all on a solid understanding of
how the hardware operates. It inserted an extra unnecessary (jp) at the
beginning of an if statement right after the conditional branch, which
is unnecessary. On the other hand, the only case where it didn't
insert a (jp) was a block with one predecessor that has only one
successor. We usually don't emit these kinds of blocks, or if we do then
one of the blocks is empty, but there is a case where we *do* and the
difference actually matters: for something like

while (true) {
   if (...) {
      // do stuff
      ...
      break;
   }
}

The instructions inside the if could be moved below the loop, except
that they are supposed to execute before control flow is merged if the
loop trip count is nonuniform. The subgroup reduce/scan macro does
exactly this, and relies on the control flow being correct. We have to
insert a (jp) after the loop, which this code wasn't doing, breaking the
scan macro.

Since we're now using the physical edges in a non-trivial way, we have
to preserve them better when we modify control flow in ir3_legalize.

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

2 years agoir3: Fix copy-paste mistakes in ir3_block_remove_physical_predecessor()
Connor Abbott [Mon, 6 Dec 2021 18:10:28 +0000 (19:10 +0100)]
ir3: Fix copy-paste mistakes in ir3_block_remove_physical_predecessor()

Fixes: 2768a35e416 ("ir3: Add pass to remove unreachable blocks")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14412>

2 years agonir: Add support for lowering shuffle to a waterfall loop
Connor Abbott [Tue, 4 Jan 2022 14:44:31 +0000 (15:44 +0100)]
nir: Add support for lowering shuffle to a waterfall loop

Qualcomm doesn't natively support shuffle, but it does natively support
relative shuffles where the delta is a constant. Therefore we'll expose
emulated support for both. Add support for this emulation of
subgroupShuffle() to NIR.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14412>

2 years agonir/lower_subgroups: Rename lower_shuffle to lower_relative_shuffle
Connor Abbott [Tue, 4 Jan 2022 13:31:29 +0000 (14:31 +0100)]
nir/lower_subgroups: Rename lower_shuffle to lower_relative_shuffle

This option only applies to relative shuffles (up/down/xor), and in a
moment we're going to add an option to lower normal shuffles, so rename
it.

While we're here, rename lower_shuffle() to lower_to_shuffle() for
similar reasons.

Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14412>

2 years agoturnip: Store the computed iova in the tu_image.
Emma Anholt [Tue, 1 Feb 2022 05:32:30 +0000 (21:32 -0800)]
turnip: Store the computed iova in the tu_image.

Less of a big deal than for buffers, but let's be consistent in how we
handle our bindings.

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

2 years agoturnip: Store the computed iova in the tu_buffer.
Emma Anholt [Tue, 1 Feb 2022 05:24:54 +0000 (21:24 -0800)]
turnip: Store the computed iova in the tu_buffer.

We recently had a bug of forgeting to add the buf->bo_offset.  Just make
the easiest field to get be the bo->iova + buf->bo_offset already.  Plus,
a little less work at emit time.

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

2 years agoaco: fix v_mac_legacy_f32
Rhys Perry [Tue, 1 Feb 2022 13:16:45 +0000 (13:16 +0000)]
aco: fix v_mac_legacy_f32

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: f68797ead72 ("aco: create v_mac_legacy_f32/v_fmac_legacy_f32")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5952
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14820>

2 years agoradeonsi: enable ARB_sparse_texture_clamp
Qiang Yu [Thu, 6 Jan 2022 09:34:46 +0000 (17:34 +0800)]
radeonsi: enable ARB_sparse_texture_clamp

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14488>

2 years agoglsl/nir: convert ir_texture->clamp to nir
Qiang Yu [Thu, 6 Jan 2022 09:31:01 +0000 (17:31 +0800)]
glsl/nir: convert ir_texture->clamp to nir

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14488>

2 years agoglsl: add ARB_sparse_texture_clamp builtin functions
Qiang Yu [Thu, 6 Jan 2022 09:24:00 +0000 (17:24 +0800)]
glsl: add ARB_sparse_texture_clamp builtin functions

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14488>

2 years agoglsl: _textureCubeArrayShadow support clamp
Qiang Yu [Thu, 6 Jan 2022 06:58:45 +0000 (14:58 +0800)]
glsl: _textureCubeArrayShadow support clamp

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14488>

2 years agoglsl: _texture support clamp parameter
Qiang Yu [Thu, 6 Jan 2022 06:34:00 +0000 (14:34 +0800)]
glsl: _texture support clamp parameter

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14488>

2 years agoglsl: ir_texture add clamp field
Qiang Yu [Thu, 6 Jan 2022 06:25:07 +0000 (14:25 +0800)]
glsl: ir_texture add clamp field

For ARB_sparse_texture_clamp to hold the lodClamp parameter.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14488>

2 years agoglsl: add ARB_sparse_texture_clamp extension
Qiang Yu [Wed, 5 Jan 2022 09:55:07 +0000 (17:55 +0800)]
glsl: add ARB_sparse_texture_clamp extension

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14488>

2 years agomesa: add ARB_sparse_texture_clamp extension
Qiang Yu [Wed, 5 Jan 2022 09:33:33 +0000 (17:33 +0800)]
mesa: add ARB_sparse_texture_clamp extension

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14488>

2 years agogallium: add PIPE_CAP_CLAMP_SPARSE_TEXTURE_LOD
Qiang Yu [Wed, 5 Jan 2022 09:29:35 +0000 (17:29 +0800)]
gallium: add PIPE_CAP_CLAMP_SPARSE_TEXTURE_LOD

For ARB_sparse_texture_clamp.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14488>

2 years agoutil/utrace: make generated code a tiny bit nicer to look at
Lionel Landwerlin [Mon, 31 Jan 2022 14:54:53 +0000 (16:54 +0200)]
util/utrace: make generated code a tiny bit nicer to look at

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14818>

2 years agoutil/u_trace: make mako conditional code easier to read
Lionel Landwerlin [Sun, 30 Jan 2022 19:48:13 +0000 (21:48 +0200)]
util/u_trace: make mako conditional code easier to read

It was difficult to read the conditional code.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14818>

2 years agointel/tracepoint: simplify tracepoint descriptions
Lionel Landwerlin [Mon, 31 Jan 2022 14:45:00 +0000 (16:45 +0200)]
intel/tracepoint: simplify tracepoint descriptions

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Suggested-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14818>

2 years agovulkan/wsi/wayland: remove format switch from wl_shm_format_for_vk_format
Simon Ser [Thu, 20 Jan 2022 11:10:42 +0000 (12:10 +0100)]
vulkan/wsi/wayland: remove format switch from wl_shm_format_for_vk_format

Instead of maintaining two similar switches (one for DRM formats,
one for wl_shm formats), only maintain a single switch (for DRM)
and convert DRM formats to enum wl_shm_format. This reduces the
risk to have inconsistencies between these two functions.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14634>

2 years agovulkan/wsi/wayland: use DRM_FORMAT_INVALID
Simon Ser [Thu, 20 Jan 2022 11:08:20 +0000 (12:08 +0100)]
vulkan/wsi/wayland: use DRM_FORMAT_INVALID

Instead of using the magic value 0, use the define.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14634>

2 years agovulkan/wsi/wayland: use enum wl_shm_format
Simon Ser [Thu, 20 Jan 2022 11:05:21 +0000 (12:05 +0100)]
vulkan/wsi/wayland: use enum wl_shm_format

libwayland defines an enum for wl_shm formats. Let's use it instead
of uint32_t.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14634>

2 years agodocs: update INTEL_DEBUG environment variable documentation
Lionel Landwerlin [Mon, 31 Jan 2022 08:50:39 +0000 (10:50 +0200)]
docs: update INTEL_DEBUG environment variable documentation

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5929
Acked-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14800>

2 years agov3dv: don't submit noop job if there is nothing to wait on or signal
Iago Toral Quiroga [Mon, 31 Jan 2022 12:07:32 +0000 (13:07 +0100)]
v3dv: don't submit noop job if there is nothing to wait on or signal

Also, do not unconditionally flag signaling for submits without any
command buffers.

Reviewed-by: Melissa Wen <mwen@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14802>

2 years agoglthread: call _mesa_glthread_BindBuffer unconditionally
Chia-I Wu [Sat, 22 Jan 2022 09:03:07 +0000 (01:03 -0800)]
glthread: call _mesa_glthread_BindBuffer unconditionally

_mesa_marshal_GetIntegerv expects those states to be tracked.  I am not
sure if this covers all states that _mesa_marshal_GetIntegerv needs, but
this fixes Civ5 for virgl at least.

Fixes: e48f676835d ("glthread: don't sync for more glGetIntegerv enums for glretrace")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14659>

2 years agomesa: stop truncating MESA_GLSL=dump
Mike Blumenkrantz [Thu, 27 Jan 2022 15:55:35 +0000 (10:55 -0500)]
mesa: stop truncating MESA_GLSL=dump

this adds a new helper function that can be used to directly dump longer
strings to the log file, such as shaders

fixes #5614

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

2 years agoaux/vbuf: add fastpath for skipping identical vbuf updates
Mike Blumenkrantz [Thu, 20 Jan 2022 17:06:05 +0000 (12:06 -0500)]
aux/vbuf: add fastpath for skipping identical vbuf updates

the overhead of comparing these is MUCH less than the overhead of queuing a
driver method and performing the update

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

2 years agoaux/vbuf: move mask-clearing for vbuf updates after buffer scanning
Mike Blumenkrantz [Thu, 20 Jan 2022 16:51:28 +0000 (11:51 -0500)]
aux/vbuf: move mask-clearing for vbuf updates after buffer scanning

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

2 years agoaux/vbuf: use local var for modifying unaligned_vb_mask during update
Mike Blumenkrantz [Thu, 20 Jan 2022 16:51:06 +0000 (11:51 -0500)]
aux/vbuf: use local var for modifying unaligned_vb_mask during update

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

2 years agoiris: implement inter-context busy-tracking
Paulo Zanoni [Fri, 28 Jan 2022 23:11:49 +0000 (15:11 -0800)]
iris: implement inter-context busy-tracking

Previously, no buffers were ever marked as EXEC_OBJECT_ASYNC so the
Kernel would ensure dependency tracking for us. After we implemented
explicit busy tracking in commit 89a34cb8450a, only the external
objects kept relying on the Kernel's implicit tracking and Iris did
inter-batch busy tracking, meaning we lost inter-screen and
inter-context synchronization. This seemed fine to me since, as far as
I understdood, it is the duty of the application to synchronize itself
against multiple screens and contexts.

The problem here is that applications were actually relying on the old
behavior where the Kernel guarantees synchronization, so 89a34cb8450a
can be seen as a regression. This commit addresses the inter-context
synchronization case.

v2: Rebase after the changes from a90a1f15a7c8. This new version is
significantly different.

Cc: mesa-stable (see the backport in MR !14783)
References: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14783
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5731
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5812
Fixes: 89a34cb8450a ("iris: switch to explicit busy tracking")
References: a90a1f15a7c8 ("iris: Create an IRIS_BATCH_BLITTER for using the BLT command streamer")
Tested-by: Konstantin Kharlamov <hi-angel@yandex.ru> (v1)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14505>

2 years agoiris: save some iris_syncobj_reference() calls at update_bo_syncobjs()
Paulo Zanoni [Thu, 27 Jan 2022 00:56:48 +0000 (16:56 -0800)]
iris: save some iris_syncobj_reference() calls at update_bo_syncobjs()

Save some iris_syncobj_reference() calls at at update_bo_syncobjs() by
refactoring the function, moving the unnecessary calls out of the for
loop. Also improve the documentation and drive-by fix a white space
issue.

Commit a90a1f15a7c8 incremented IRIS_BATCH_COUNT and adjusted the code
involving it. But the way it was done at update_bo_syncobjs() means
we'll now call iris_syncobj_reference() more than the amount of times
we need. This isn't a problem since in the second call we're moving
the reference from something to the same thing, but still we can get
away with just not doing it, so why not?

There is also the question of whether we should really iterate over
IRIS_BATCH_COUNT or something else (to save time on platforms that
don't have as many batches as IRIS_BATCH_COUNT), but this is a matter
for a separate patch (see MR !14747). In this patch we reorder the
operations a little bit so when the time comes there will be just one
loop to adjust.

I also changed the order so first we look at's in bo_deps and only
later we write to bo_deps. This is more future-proof and will make the
next patch easier to land and understand.

Reference: a90a1f15a7c8 ("iris: Create an IRIS_BATCH_BLITTER for using the BLT command streamer")
Reference: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14747
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14505>

2 years agoiris: Return non-zero stride for clear color plane
Nanley Chery [Fri, 21 Jan 2022 18:05:30 +0000 (13:05 -0500)]
iris: Return non-zero stride for clear color plane

Before this patch, when querying the clear color plane's stride, iris
would return the aux surface stride. This was okay because the clear
color plane wasn't really used for anything.

This doesn't work on XeHP however. On that platform, the aux surface
stride is zero (because it doesn't have an ISL surface for the CCS).
This is a problem because mesa's implementation of eglCreateImage
rejects strides of zero (see dri2_check_dma_buf_attribs) and this value
may be queried from GBM and passed into EGL.

When the DG2 clear color modifier is enabled, this avoids EGL_BAD_ACCESS
errors when running the piglit test,
ext_image_dma_buf_import-intel_modifiers.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14759>

2 years agoiris: Pick the right BO in iris_resource_get_param
Nanley Chery [Thu, 30 Dec 2021 23:38:16 +0000 (18:38 -0500)]
iris: Pick the right BO in iris_resource_get_param

Pick the clear color BO if the clear color plane is being queried. This
avoids picking a NULL aux BO on XeHP.

When creating shared resources, we place the gallium-visible planes in
the same buffer object. However, when importing them, we aren't very
strict about each plane sharing the same BO. So, instead of just using
res->bo, we use a couple ternaries to figure out the right one.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14759>

2 years agoiris: Refactor a ternary in iris_resource_get_param
Nanley Chery [Fri, 28 Jan 2022 02:47:08 +0000 (21:47 -0500)]
iris: Refactor a ternary in iris_resource_get_param

Suggested-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14759>

2 years agov3dv: move sems_info from event_wait job to wait_thread info
Melissa Wen [Fri, 28 Jan 2022 18:28:20 +0000 (18:28 +0000)]
v3dv: move sems_info from event_wait job to wait_thread info

Semaphores info was stored as an info of event_wait cpu jobs and this
leads to mem leak when the same event_wait job in the same cmd buffer
batch was submitted more than once. As a result,
`dEQP-VK.api.command_buffers.record_simul_use_primary` fails due to a
double-free of sems_info.

In this patch, we no longer use v3dv_event_wait_cpu_job_info to store
semaphores from a submit info, since semaphores is related to a queue
submission and not to the event_wait job type. If we spawn a wait_thread,
we copy semaphores to an auxiliary struct (v3dv_wait_thread_info) that
will be used in wait_thread to get job and semaphores information. When
the spawned thread finishes, it releases the related
v3dv_wait_thread_info and the semaphores copy as well.

Fixes: d5bd18fb ("v3dv: store wait semaphores in event_wait_cpu_job_info")

Suggested-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Melissa Wen <mwen@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14736>

2 years agod3d12: ARB_transform_feedback3
Jesse Natalie [Thu, 27 Jan 2022 21:23:36 +0000 (13:23 -0800)]
d3d12: ARB_transform_feedback3

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>

2 years agod3d12: Handle indexed queries
Jesse Natalie [Sat, 29 Jan 2022 17:41:03 +0000 (09:41 -0800)]
d3d12: Handle indexed queries

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>

2 years agod3d12: Fix xfb varying matching for vars with location_frac
Jesse Natalie [Fri, 28 Jan 2022 19:48:06 +0000 (11:48 -0800)]
d3d12: Fix xfb varying matching for vars with location_frac

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>

2 years agod3d12: Unpack multi-stream varyings
Jesse Natalie [Fri, 28 Jan 2022 19:46:02 +0000 (11:46 -0800)]
d3d12: Unpack multi-stream varyings

DXIL doesn't support a single varying having components belonging
to multiple streams. For geometry shader outputs, whenever we find
this to be the case, break up that variable into multiple sub-
variables, and update stores to that variable to write to the new
sub-variables instead.

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>

2 years agomicrosoft/compiler: Support multiple GS output streams
Jesse Natalie [Fri, 28 Jan 2022 19:43:21 +0000 (11:43 -0800)]
microsoft/compiler: Support multiple GS output streams

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>

2 years agomicrosoft/compiler: Correctly support I/O on variables with location_frac
Jesse Natalie [Fri, 28 Jan 2022 19:42:59 +0000 (11:42 -0800)]
microsoft/compiler: Correctly support I/O on variables with location_frac

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>

2 years agod3d12: ARB_transform_feedback2
Jesse Natalie [Wed, 26 Jan 2022 16:41:22 +0000 (08:41 -0800)]
d3d12: ARB_transform_feedback2

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>

2 years agod3d12: Switch primitives-generated query to use XFB, GS, and IA data
Jesse Natalie [Sat, 29 Jan 2022 17:37:49 +0000 (09:37 -0800)]
d3d12: Switch primitives-generated query to use XFB, GS, and IA data

Per https://www.supergoodcode.com/primitive-pain/ this is how it should work

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>

2 years agod3d12: Rewrite subquery logic
Jesse Natalie [Thu, 27 Jan 2022 15:19:51 +0000 (07:19 -0800)]
d3d12: Rewrite subquery logic

The previous logic was a bit bolted-on, using a linked list of queries
to implement cases where a GL query needed maybe multiple D3D queries.
Once the sub-query was created, it was always begun/ended along with
the parent query, but that's not sufficient or correct.

Instead, we need to be able to have mutually-exclusive subqueries
underneath a parent query. This will let us handle using different
counters for the same GL query in different pipeline configs, and then
accumulating the results together.

Fixes the arb_transform_feedback2-pause-counting piglit test.

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>

2 years agod3d12: Compute transform UBO0 is actually binding 1
Jesse Natalie [Thu, 27 Jan 2022 17:08:04 +0000 (09:08 -0800)]
d3d12: Compute transform UBO0 is actually binding 1

Since lower_uniforms_to_ubo will unconditionally increment UBO indices
from 0 to 1.

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>

2 years agod3d12: Implement DrawAuto aka DrawTransformFeedback
Jesse Natalie [Wed, 26 Jan 2022 23:51:54 +0000 (15:51 -0800)]
d3d12: Implement DrawAuto aka DrawTransformFeedback

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>

2 years agod3d12: Move "fake" SO buffer handling to compute transforms instead of CPU readback
Jesse Natalie [Wed, 26 Jan 2022 22:34:47 +0000 (14:34 -0800)]
d3d12: Move "fake" SO buffer handling to compute transforms instead of CPU readback

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>

2 years agod3d12: Move compute transform state save/restore to compute_transforms.cpp
Jesse Natalie [Wed, 26 Jan 2022 22:31:48 +0000 (14:31 -0800)]
d3d12: Move compute transform state save/restore to compute_transforms.cpp

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>

2 years agod3d12: Add a compute transform for draw auto
Jesse Natalie [Wed, 26 Jan 2022 21:24:31 +0000 (13:24 -0800)]
d3d12: Add a compute transform for draw auto

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>

2 years agod3d12: Add a couple compute transforms for "fake" SO buffers
Jesse Natalie [Wed, 26 Jan 2022 20:52:31 +0000 (12:52 -0800)]
d3d12: Add a couple compute transforms for "fake" SO buffers

This solves 2 problems with the CPU readback we're doing for this now:
1. It's not on the CPU
2. It handles gaps, leaving the destination buffer intact in those gaps

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>

2 years agod3d12: Add a comment for what the existing compute transform does
Jesse Natalie [Wed, 26 Jan 2022 20:54:21 +0000 (12:54 -0800)]
d3d12: Add a comment for what the existing compute transform does

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>

2 years agod3d12: SO buffer filled size is only 32-bit
Jesse Natalie [Wed, 26 Jan 2022 19:35:11 +0000 (11:35 -0800)]
d3d12: SO buffer filled size is only 32-bit

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>

2 years agod3d12: Move indirect compute to real indirect dispatches
Jesse Natalie [Wed, 26 Jan 2022 17:30:28 +0000 (09:30 -0800)]
d3d12: Move indirect compute to real indirect dispatches

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>

2 years agod3d12: Support transform feedback pause/resume
Jesse Natalie [Wed, 26 Jan 2022 14:49:21 +0000 (06:49 -0800)]
d3d12: Support transform feedback pause/resume

Don't unconditionally reallocate/zero the fill buffer count, only
when a specific value is to be assigned.

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>

2 years agod3d12: Include SO buffer count as a PSO dirty bit
Jesse Natalie [Thu, 27 Jan 2022 18:00:35 +0000 (10:00 -0800)]
d3d12: Include SO buffer count as a PSO dirty bit

ctx->gfx_pipeline_state::num_so_targets is used when compiling PSOs,
so make sure that changes to that value result in PSO recompiles.

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>

2 years agod3d12: Add UAV barriers for UAVs that are being used by compute transforms
Jesse Natalie [Wed, 26 Jan 2022 16:31:33 +0000 (08:31 -0800)]
d3d12: Add UAV barriers for UAVs that are being used by compute transforms

If an indirect arg buffer is being produced by a compute shader, then when
we go to consume it as an SSBO in a compute transform pass, we need to insert
a UAV barrier to prevent the two dispatches from overlapping. For app dispatches,
this is the app's responsibility via explicit barrier APIs, and if they don't,
then they're allowed to overlap.

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>

2 years agod3d12: Fix compute transform for multi-draw indirect with dynamic count + state vars
Jesse Natalie [Thu, 27 Jan 2022 15:58:46 +0000 (07:58 -0800)]
d3d12: Fix compute transform for multi-draw indirect with dynamic count + state vars

NIR validation will complain on the UBO range not being set.

Fixes: 3a8c8d25 ("d3d12: Add a compute transformation to handle indirect draws that need draw params")
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>

2 years agomicrosoft/compiler: Fix UAV resource ID counting for static indexed handles
Jesse Natalie [Thu, 27 Jan 2022 17:55:36 +0000 (09:55 -0800)]
microsoft/compiler: Fix UAV resource ID counting for static indexed handles

Skip resource space 2 after computing the ID it would've used.

Fixes: e5f353f2 ("microsoft/compiler: Emit statically-indexed resource handles and scratch later")
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14787>

2 years agozink: use SpvScopeDevice over SpvScopeWorkgroup for atomic shader ops
Mike Blumenkrantz [Tue, 18 Jan 2022 15:39:25 +0000 (10:39 -0500)]
zink: use SpvScopeDevice over SpvScopeWorkgroup for atomic shader ops

Workgroup is only allowed in compute shaders, and Device should be more
in line with the intended use here

the alternative would be to keep using Workgroup for compute and use Device
otherwise, but this would effectively make atomic ops non-atomic, which seems
like it isn't desirable

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14690>

2 years agozink: cast image atomic op params/results based on image type
Mike Blumenkrantz [Fri, 14 Jan 2022 21:30:28 +0000 (16:30 -0500)]
zink: cast image atomic op params/results based on image type

according to spec, these must match the texel pointer type

cc: mesa-stable

fixes (nvidia):
dEQP-GLES31.functional.image_load_store.2d.atomic.exchange_r32f_return_value
dEQP-GLES31.functional.image_load_store.2d_array.atomic.exchange_r32f_return_value
dEQP-GLES31.functional.image_load_store.cube.atomic.exchange_r32f_return_value

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14690>

2 years agozink: add warning printf for drivers missing VK_EXT_shader_atomic_float
Mike Blumenkrantz [Fri, 14 Jan 2022 21:10:47 +0000 (16:10 -0500)]
zink: add warning printf for drivers missing VK_EXT_shader_atomic_float

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14690>

2 years agozink: enable VK_EXT_shader_atomic_float
Mike Blumenkrantz [Fri, 14 Jan 2022 21:10:11 +0000 (16:10 -0500)]
zink: enable VK_EXT_shader_atomic_float

this is needed for atomic ops, but we can let drivers that don't support
it have some warning messages instead of gating features

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14690>

2 years agozink: handle swizzled offset/count values for shader bitfield ops
Mike Blumenkrantz [Fri, 14 Jan 2022 20:39:11 +0000 (15:39 -0500)]
zink: handle swizzled offset/count values for shader bitfield ops

glsl/nir automatically swizzle the value if a vecN is being used, but spirv
requires a single scalar, so this has to be detected and unswizzled to avoid
violating spec and crashing shader compilers that are less permissive than mesa's

fixes (nvidia):
dEQP-GLES31.functional.shaders.builtin_functions.integer.bitfieldextract*
KHR-GL46.shader_bitfield_operation.bitfieldExtract*

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14690>

2 years agomicrosoft/spirv_to_dxil: Define idep_libspirv_to_dxil
Boris Brezillon [Mon, 24 Jan 2022 12:53:20 +0000 (13:53 +0100)]
microsoft/spirv_to_dxil: Define idep_libspirv_to_dxil

So we can re-use it when we need to define a dependency on spirv_to_dxil.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14765>

2 years agomicrosoft/spirv_to_dxil: Make sure the SampleMask is a uint
Boris Brezillon [Fri, 14 Jan 2022 09:44:04 +0000 (01:44 -0800)]
microsoft/spirv_to_dxil: Make sure the SampleMask is a uint

DXIL doesn't like when SV_Coverage (AKA SampleMask in DXIL) is a
signed integer. Fix the type while we're in the NIR domain.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14765>

2 years agomicrosoft/spirv_to_dxil: Lower atomics to their dxil variants
Boris Brezillon [Fri, 14 Jan 2022 09:05:04 +0000 (01:05 -0800)]
microsoft/spirv_to_dxil: Lower atomics to their dxil variants

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14765>

2 years agomicrosoft/spirv_to_dxil: Discard PSIZ accesses
Boris Brezillon [Mon, 8 Nov 2021 12:51:59 +0000 (13:51 +0100)]
microsoft/spirv_to_dxil: Discard PSIZ accesses

D3D12 doesn't support gl_PointSize, so let's consider PointSize is
always 1.0 and discard any PointSize access.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14765>

2 years agomicrosoft/spirv_to_dxil: Allow passing a vulkan -> d3d12 binding mapping table
Louis-Francis Ratté-Boulianne [Mon, 24 Jan 2022 11:10:49 +0000 (12:10 +0100)]
microsoft/spirv_to_dxil: Allow passing a vulkan -> d3d12 binding mapping table

Vulkan bindings take only one slot per variable, but d3d12 ones take one
slot per entry when the variable is an array. This forces us to pass
an explicit vulkan -> d3d12 mapping table when dealing with vulkan
shaders.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14765>

2 years agomicrosoft/spirv_to_dxil: Lower push constant loads to UBO loads
Louis-Francis Ratté-Boulianne [Mon, 24 Jan 2022 10:59:07 +0000 (11:59 +0100)]
microsoft/spirv_to_dxil: Lower push constant loads to UBO loads

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14765>

2 years agomicrosoft/spirv_to_dxil: lower input attachments
Louis-Francis Ratté-Boulianne [Wed, 10 Nov 2021 03:54:57 +0000 (22:54 -0500)]
microsoft/spirv_to_dxil: lower input attachments

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14765>

2 years agomicrosoft/spirv_to_dxil: check for variables r/w access
Louis-Francis Ratté-Boulianne [Wed, 10 Nov 2021 03:54:29 +0000 (22:54 -0500)]
microsoft/spirv_to_dxil: check for variables r/w access

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14765>

2 years agomicrosoft/spirv_to_dxil: Support [un]conditional YZ-flip
Boris Brezillon [Thu, 14 Oct 2021 10:36:53 +0000 (03:36 -0700)]
microsoft/spirv_to_dxil: Support [un]conditional YZ-flip

The unconditional Y-flip is needed for Vulkan 1.0 since D3D12 and
Vulkan coordinate systems differ. Conditional YZ-flip is needed if
we want to support negative viewport height/depth.

Prepare spirv_to_dxil() to support that, and while at it, prepare
things for multi-viewport: the Y/Z flips are per-viewport and encoded
in a 32bit bitmask, with the upper 16bits reserved for Z flips, and the
lower 16bits reserved for Y flips.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14765>

2 years agomicrosoft/spirv_to_dxil: Allow dumping NIR
Boris Brezillon [Thu, 14 Oct 2021 09:38:42 +0000 (02:38 -0700)]
microsoft/spirv_to_dxil: Allow dumping NIR

Dumping NIR shaders is a useful debug feature. Let's tweak the
spirv_to_nir() helper so we can pass debugging options and
add one to allow dumping NIR.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14765>

2 years agomicrosoft/spirv_to_dxil: Remove dead variables after the struct split pass
Boris Brezillon [Mon, 24 Jan 2022 10:49:33 +0000 (11:49 +0100)]
microsoft/spirv_to_dxil: Remove dead variables after the struct split pass

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14765>

2 years agoanv/image: Call into WSI to create swapchain images
Jason Ekstrand [Fri, 23 Jul 2021 05:30:16 +0000 (00:30 -0500)]
anv/image: Call into WSI to create swapchain images

This guarantees that we get an image that's created with exactly the
swapchain image creation parameters instead of trying to emulate it
inside the driver.  Ideally, we'd use the fancy new bind helper too but
our magic ANV_IMAGE_MEMORY_BINDING_PRIVATE gets in the way and we really
do want to re-bind ourself.

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12031>

2 years agoanv/image: Add some asserts when binding swapchain images
Jason Ekstrand [Fri, 23 Jul 2021 05:30:04 +0000 (00:30 -0500)]
anv/image: Add some asserts when binding swapchain images

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12031>

2 years agovulkan/wsi: Add image create and bind helpers
Jason Ekstrand [Fri, 23 Jul 2021 04:58:14 +0000 (23:58 -0500)]
vulkan/wsi: Add image create and bind helpers

These are needed to properly implement the Vulkan 1.1 swapchain image
create/bind functionality.

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12031>

2 years agowsi/common: Set VK_IMAGE_CREATE_ALIAS_BIT
Jason Ekstrand [Mon, 9 Aug 2021 15:23:18 +0000 (10:23 -0500)]
wsi/common: Set VK_IMAGE_CREATE_ALIAS_BIT

With Vulkan 1.1, we have a VkImageSwapchainCreateInfoKHR struct which
lets you create a new VkImage which aliases a swapchain image.  However,
there is no corresponding swapchain create flag so we have to set
VK_IMAGE_CREATE_ALIAS_BIT all the time.

We need to do a bit of work in ANV to prevent it from asserting the
moment it sees one of these.  Fortunately, they're already safe because
WSI images go through a different bind path for
VkBindImageMemorySwapchainInfoKHR.

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12031>

2 years agovulkan/wsi/drm: Drop wsi_create_native/prime_image
Jason Ekstrand [Fri, 23 Jul 2021 04:50:22 +0000 (23:50 -0500)]
vulkan/wsi/drm: Drop wsi_create_native/prime_image

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12031>

2 years agovulkan/wsi/win32: Break create_win32_image in pieces
Jason Ekstrand [Fri, 23 Jul 2021 03:14:55 +0000 (22:14 -0500)]
vulkan/wsi/win32: Break create_win32_image in pieces

This is similar to the previous two commits that we did for DRM native
images.  It breaks it into configure/create/bind and calls
wsi_create_image to walk through the three-step process.

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12031>

2 years agovulkan/wsi/win32: Delete unnecessary copy+paste from DRM
Jason Ekstrand [Thu, 22 Jul 2021 23:27:09 +0000 (18:27 -0500)]
vulkan/wsi/win32: Delete unnecessary copy+paste from DRM

The Win32 WSI just does a copy into the window on the CPU.  There's no
need for external memory or modifiers or implicit sync or any of that.
While we're at it, rename to create_win32_image.

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12031>

2 years agovulkan/wsi/display: Split image creation
Jason Ekstrand [Fri, 23 Jul 2021 04:49:09 +0000 (23:49 -0500)]
vulkan/wsi/display: Split image creation

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12031>