Commit graph

134 commits

Author SHA1 Message Date
Mike Blumenkrantz
2eb45daa9c gallium: de-pointerize pipe_surface
this allows eliminating surface refcounting and objects
which, relatively speaking, don't serve much purpose

see MR for details

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34054>
2025-05-23 13:21:29 +00:00
Pavel Ondračka
ea6ccb8628 nir: add support for clamping in nir_lower_tex_shadow
From OpenGL 4.6 - 8.23.1 Depth Texture Comparison Mode

Let Dt be the depth texture value and St be the stencil index
component. If there is no stencil component, the value of St is
undefined. Let Dref be the reference value, provided by the shader’s
texture lookup function. If the texture’s internal format indicates
a fixed-point depth texture, then Dt and Dref are clamped to the
range [0, 1]; otherwise no clamping is performed.

Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33140>
2025-01-28 00:01:07 +00:00
Qiang Yu
06b4fd1682 d3d12: add d3d12_init_screen_caps
It's one-one map of d3d12_get_param() and d3d12_get_paramf().

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32955>
2025-01-17 04:39:45 +00:00
Sil Vilerino
73cdb980bf d3d12: Fix warning C4018 signed/unsigned mismatch
Reviewed-By: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Jesse Natalie <None>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32979>
2025-01-15 21:40:20 +00:00
Sil Vilerino
56484fd010 d3d12: Fix warning C4244 'argument' : conversion from 'type1' to 'type2', possible loss of data
Reviewed-By: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Jesse Natalie <None>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32979>
2025-01-15 21:40:20 +00:00
Jesse Natalie
0ae4afe034 d3d12: Fix shader selector hash to hash array instead of pointer-to-array
Fixes: 116d0bf7 ("d3d12: Set fractional var masks")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31083>
2024-09-09 21:17:25 +00:00
Jesse Natalie
dac44e02f7 d3d12: Don't use a vertex re-ordering GS for line primitives
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30903>
2024-08-28 23:54:11 +00:00
Jesse Natalie
116d0bf76b d3d12: Set fractional var masks
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28535>
2024-04-04 20:29:11 +00:00
Jesse Natalie
c21355260b microsoft/compiler: Add a fractional var mask for variable sorting
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28535>
2024-04-04 20:29:11 +00:00
Jesse Natalie
760effefc6 d3d12: Don't compile useless variants during shader creation
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28535>
2024-04-04 20:29:11 +00:00
Jesse Natalie
6928686df9 d3d12: Remove variables instead of adding them for linking
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28535>
2024-04-04 20:29:11 +00:00
Jesse Natalie
dedbd6eea3 d3d12: Gather info less and before the final compilation steps
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28535>
2024-04-04 20:29:11 +00:00
Jesse Natalie
c1e7d0598d d3d12: Add primitive ID sysval to input bitmask (for GS in)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28535>
2024-04-04 20:29:11 +00:00
Jesse Natalie
c8d435373e d3d12: Use TES inputs rather than VS outputs for TCS variant key
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28535>
2024-04-04 20:29:11 +00:00
Jesse Natalie
580f801bac d3d12: Capture always_active_io in varying data
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28535>
2024-04-04 20:29:11 +00:00
Jesse Natalie
d28a552e2a d3d12: Explicitly add tess factor vars to tess signatures
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28535>
2024-04-04 20:29:11 +00:00
Jesse Natalie
33735585a9 d3d12: Lower uniforms to UBO by nir options
Ubo0 is tricky. It exists if there were any uniforms when
lower_uniforms_to_ubo was run. If we try to run that ourselves,
it might be too late and DCE/remove_dead_variables might've been run,
which removed the uniforms and their accesses, without decrementing
num_uniforms. So we have no good way of knowing whether to declare
ubos from [0, N] or [1, N]. In practice this probably doesn't make
much of a difference but the logic is there so ¯\_(ツ)_/¯

If we use the nir option, then dead code isn't run, and num_uniforms
is a true indicator of whether ubo0 exists or not.

Note that this means we are no longer running this pass for internal
shaders that don't come from the GLSL compiler, so various places are
updated to query the nir info bit that's set by running this pass.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28535>
2024-04-04 20:29:11 +00:00
Jesse Natalie
e80cda0512 d3d12: Move some lowering passes to pre-variant
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28535>
2024-04-04 20:29:11 +00:00
Jesse Natalie
9702ddccc2 microsoft/compiler: Don't duplicate work from gather_info in var sorting
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28535>
2024-04-04 20:29:10 +00:00
Jesse Natalie
d4a15a048b microsoft/compiler: Expect front-facing var as an input
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28535>
2024-04-04 20:29:10 +00:00
Jesse Natalie
6d8461f545 d3d12: Subgroup ballot
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27528>
2024-02-08 20:41:58 +00:00
Faith Ekstrand
80376146ed nak: Encode program headers
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:06 +00:00
Jesse Natalie
9fe88dd9b9 d3d12: Support enhanced layouts for VS inputs
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26156>
2023-11-14 00:18:53 +00:00
Jesse Natalie
72341747f4 d3d12: Split dvec3 interpolatns into devc2 and double
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26156>
2023-11-14 00:18:53 +00:00
Jesse Natalie
a07bdf0152 d3d12: Initialize shader key swizzle for non-int textures
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26104>
2023-11-07 22:31:20 +00:00
Yonggang Luo
4a8ec0db90 d3d12: Switch to use nir_foreach_function_impl
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23920>
2023-06-29 11:29:54 +00:00
Jesse Natalie
42877c8b63 dxil: Don't generate load_ubo_dxil directly
Just use load_ubo and let it get lowered appropriately later on.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23173>
2023-06-13 00:43:36 +00:00
Jesse Natalie
f121d8fe12 microsoft/compiler: Un-lower shared/scratch to derefs
Derefs have index-based access semantics, which means we don't need
custom intrinsics to encode an index instead of a byte offset.

Remove the "masked" store intrinsics and just emit the pair of atomics
directly. This massively reduces duplication between scratch, shared,
and constant, while also moving more things into nir so more optimizations
can be done.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23173>
2023-06-13 00:43:36 +00:00
Yonggang Luo
12256136e0 compiler: Rename shader_prim to mesa_prim and replace all usage of pipe_prim_type with mesa_prim
This is a prepare step to remove depends on p_defines.h in src/util/*

This is done by:
replace pipe_prim_type with mesa_prim
replace shader_prim with mesa_prim
replace PIPE_PRIM_MAX  with MESA_PRIM_COUNT
replace SHADER_PRIM_  with MESA_PRIM_
replace PIPE_PRIM_ with MESA_PRIM_

This patch only replace code only

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23369>
2023-06-03 03:29:03 +00:00
Thomas H.P. Andersen
1a6ffb3e9d d3d12: remove unused tgsi includes
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22838>
2023-05-25 08:20:32 +00:00
Jesse Natalie
9dc009e7ae d3d12: Convert from D3D shader model to Mesa shader model earlier
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22952>
2023-05-11 21:56:31 +00:00
Jesse Natalie
b723962418 d3d12: Move forward-front-face pass to common DXIL code
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22277>
2023-04-04 21:48:19 +00:00
Jesse Natalie
79725115c6 d3d12: Remove now-unused UAV format from shader info
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22093>
2023-03-23 18:34:52 +00:00
Giancarlo Devich
70af7fd5e8 d3d12: Unroll shader variant selection loop
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21909>
2023-03-17 07:43:08 +00:00
Giancarlo Devich
777e6b43bc d3d12: Reduce gs variant key init cost; unnecessary validate gs calls
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21909>
2023-03-17 07:43:08 +00:00
Giancarlo Devich
9bbf5505f0 d3d12: Use short circuit in shader key compare; update key hash
Move common key compare to the final step; change to short circuit from
memcmp.

Update key hash to treat varying pointers as uint64.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21909>
2023-03-17 07:43:08 +00:00
Giancarlo Devich
32e058017d d3d12: Use context-level sampler_state array for filling shader keys
This significantly reduces the size of d3d12_shader_key

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21909>
2023-03-17 07:43:08 +00:00
Giancarlo Devich
7854f9283c d3d12: Don't unnecessarily recompute manual_depth_range
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21909>
2023-03-17 07:43:08 +00:00
Giancarlo Devich
f53188b7fa d3d12: Cache varying info to reduce compare/copy cost
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21610>
2023-03-01 19:40:06 +00:00
Giancarlo Devich
e4ba343ac9 d3d12: Compare shader key common parts with memcmp, instead of if's
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21610>
2023-03-01 19:40:06 +00:00
Giancarlo Devich
623a01827c d3d12: Compare shader keys with union-encompassing fields all at once
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21610>
2023-03-01 19:40:06 +00:00
Giancarlo Devich
ebd925e79c d3d12: Compare shader keys with a switch, instead of cascading if's
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21610>
2023-03-01 19:40:06 +00:00
Giancarlo Devich
bf6c214b25 d3d12: Create varying structures as necessary, reference them
This changes instances of d3d12_varying_info to d3d12_varying_info*,
significantly reducing the size of the d3d12_shader_key,
d3d12_gs_variant_key, and d3d12_tcs_variant_key.

Associated changes to key fill, compare, hashing, and gs and tcs variant
maps significantly reduce the amount of time spent clearing and
comparing memory.

The biggest win here is not having to re-zero _or_ re-fill varyings in
d3d12_fill_shader_key, validate_geometry_shader_variant, and
validate_tess_ctrl_shader_variant.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21527>
2023-02-27 22:05:34 +00:00
Giancarlo Devich
41d5e76f2c d3d12: Don't memcmp gs/tcs keys
This is unnecessary and incomplete. Not only is it covered by the hash
map lookup, but also does not consider the other key members.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21527>
2023-02-27 22:05:34 +00:00
Giancarlo Devich
30883c0145 d3d12: Don't unnecessarily zero out gs/tcs keys
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21527>
2023-02-27 22:05:34 +00:00
Giancarlo Devich
56d30bf591 d3d12: Track max varying slot, set and compare less bytes
Often, the full range of available slots don't need to participate in
the comparison or be zeroed out.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21527>
2023-02-27 22:05:34 +00:00
Giancarlo Devich
9a3820fe11 d3d12: Don't recompute has_flat_varyings or missing_dual_src_outputs
Per shader selection, these two flags can be expensive to compute.
Instead, recompute their values as neccessary, and save them in the
context.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21527>
2023-02-27 22:05:34 +00:00
Giancarlo Devich
11bec22647 d3d12: Don't clear d3d12_shader_key
The shader key structure is quite large and memsetting it to zero to be
able to create or often simply find an existing shader is responsible
for a large portion of CPU usage during benchmarks.

This change is more surgical about what, when, and how things get
cleared.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21247>
2023-02-13 22:57:03 +00:00
Giancarlo Devich
b2e5484171 d3d12: Add unions to encompass shader key stage vars, use in hashing
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21247>
2023-02-13 22:57:03 +00:00
Giancarlo Devich
806f100ad2 d3d12: Use varying comparison function for TESS stage key compare
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21247>
2023-02-13 22:57:03 +00:00