Eric Engestrom
8b319c6db8
radv: reformat according to its .clang-format
...
Signed-off-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23253 >
2023-06-16 19:59:52 +00:00
Konstantin Seurer
03a9715a68
amd: Use the Mesa base style
...
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23275 >
2023-05-29 21:06:12 +00:00
Harri Nieminen
f85f511a38
amd: fix typos in code
...
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22432 >
2023-04-13 23:08:22 +00:00
Harri Nieminen
aea48a4ff1
amd: fix typos
...
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22432 >
2023-04-13 23:08:22 +00:00
Konstantin Seurer
2bf9ae78c5
radv: Remove radv_bvh_aabb_node::aabb
...
It was only read by RRA which can infer it from the parenbt internal
node.
Change in average build time (Control):
84.69471 ms -> 84.25319 ms
Reviewed-by: Friedrich Vock <friedrich.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22400 >
2023-04-11 07:57:34 +00:00
Konstantin Seurer
1ce50f0774
radv/bvh: Remove calculate_node_bounds
...
It is unused and will prevent removing the aabb field from
radv_bvh_aabb_node.
Reviewed-by: Friedrich Vock <friedrich.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22400 >
2023-04-11 07:57:34 +00:00
Konstantin Seurer
f791cd9e43
radv: Pack and encode geometry id and flags on the CPU
...
There is no need to do it on the GPU.
Change in average build time (Control):
84.80691 ms -> 84.69471 ms
Reviewed-by: Friedrich Vock <friedrich.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22400 >
2023-04-11 07:57:34 +00:00
Konstantin Seurer
40e9efa2de
radv/bvh: Add a shader for filling the header
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20818 >
2023-02-24 15:14:40 +00:00
Konstantin Seurer
c83ea20683
radv/bvh: Move the size header field up
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20818 >
2023-02-24 15:14:40 +00:00
Konstantin Seurer
07c1b23022
radv/bvh: Implement compact encoding
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20818 >
2023-02-24 15:14:40 +00:00
Konstantin Seurer
da4f498f6f
radv/bvh/encoder: Move dst_node initialization into the loop
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20818 >
2023-02-24 15:14:40 +00:00
Konstantin Seurer
2792d012d2
radv/bvh/encode: Introduce is_root_node
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20818 >
2023-02-24 15:14:40 +00:00
Konstantin Seurer
2c0e158ae2
radv/bvh/encode: Move bvh_offset NULL check to the top of the loop
...
NULL nodes don't have to be encoded and they also don't carry over any
information to their children.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20818 >
2023-02-24 15:14:40 +00:00
Konstantin Seurer
4e87a01b93
radv/bvh: Replace is_final_tree with bvh_offset
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20818 >
2023-02-24 15:14:40 +00:00
Konstantin Seurer
688f598237
radv/bvh/encode: Use the node type for identifying internal nodes
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20818 >
2023-02-24 15:14:40 +00:00
Konstantin Seurer
3eb646efd0
radv: Merge the leaf and internal converter
...
We have everything we need in the internal one already so we can just
encode leaf nodes there. Since this functionality isn't split anymore,
the shader was renamed to "encode".
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20768 >
2023-01-25 15:54:03 +00:00
Konstantin Seurer
c53eb2f3d4
radv: Add a shader variant for PLOC with extended SAH
...
Reviewed-by: Friedrich Vock <friedrich.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20656 >
2023-01-21 20:26:41 +00:00
Konstantin Seurer
b1755c0b21
radv/bvh: Add a define for extended SAH
...
This will be used to only chose depth aware SAH when we know that it's
more optimal and doesn't increase build overhead too much.
Reviewed-by: Friedrich Vock <friedrich.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20656 >
2023-01-21 20:26:41 +00:00
Konstantin Seurer
13a8a4071a
radv/bvh/meson: Add the option to set defines
...
This is useful for compiling different variants of the same shader.
Reviewed-by: Friedrich Vock <friedrich.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20656 >
2023-01-21 20:26:41 +00:00
Friedrich Vock
684eee0748
radv/bvh: Prevent NANs when computing node cost
...
Otherwise the degenerate geometry workaround never triggers, leading to bad performance.
Fixes: 6f45c98b ("radv/bvh: Adjust sah cost based on depth")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20723 >
2023-01-16 14:49:54 +00:00
Konstantin Seurer
c12f7f601c
radv/bvh: Handle inactive triangles and AABBs
...
Reviewed-by: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20325 >
2022-12-19 09:37:56 +00:00
Konstantin Seurer
4686ab731c
radv/bvh: Move leaf node initialization into separate functions
...
Reviewed-by: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20325 >
2022-12-19 09:37:56 +00:00
Friedrich Vock
f0f5d5c5e5
radv/rt: Refactor exiting PLOC
...
The previous approach was susceptible to sync hazards, causing hangs in Doom Eternal.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7897
Fixes: 271865373 ("radv: Add PLOC shader")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20377 >
2022-12-18 21:24:45 +00:00
Friedrich Vock
54ca0665c8
radv/rt: Execute memory barrier before updating the phase end count
...
We want to be sure that the values were updated before letting other invocations continue.
Fixes: 271865373 ("radv: Add PLOC shader")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20377 >
2022-12-18 21:24:45 +00:00
Friedrich Vock
0e0f42723e
radv/rt: PLOC fixes for active_leaf_count
...
Fixes: 271865373 ("radv: Add PLOC shader")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20377 >
2022-12-18 21:24:45 +00:00
Bas Nieuwenhuizen
9a311a1891
radv: Remove the old LBVH shader.
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19891 >
2022-12-01 02:20:48 +00:00
Bas Nieuwenhuizen
ea159e47a5
radv: Add new LBVH shaders.
...
Contrary to the previous implementation, this actually implements an LBVH builder.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19891 >
2022-12-01 02:20:48 +00:00
Bas Nieuwenhuizen
f531f671ef
radv: Handle nodes with 2 invalid children in internal node converter.
...
Fixes: 682dc5c28e ("radv: Add conversion shader for internal nodes")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19891 >
2022-12-01 02:20:48 +00:00
Danylo Piliaiev
703d85485f
meson: do not use source_root() when possible
...
source_root() function is deprecated in Meson version 0.56.0 because
it returns the source root of the parent project if called from a
subproject.
Why would anyone need Mesa as a meson subproject?
It would be used as subproject in a project generated by command buffer
"decompiler" for Freedreno.
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: David Heidelberg <david.heidelberg@collabora.com>
Acked-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19901 >
2022-11-22 06:11:07 +00:00
Bas Nieuwenhuizen
1b5dc33caa
radv: Convert instance bvh address to node in bvh build.
...
So we don't have to do it in the traversal loop. Should 2 and
instructions and a 64-bit shift, so 4/8 cycles per instance node
visit.
Totals from 7 (0.01% of 134913) affected shaders:
CodeSize: 208460 -> 208292 (-0.08%)
Instrs: 38276 -> 38248 (-0.07%)
Latency: 803181 -> 803142 (-0.00%)
InvThroughput: 165384 -> 165376 (-0.00%)
Copies: 4912 -> 4905 (-0.14%)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19706 >
2022-11-19 14:24:36 +00:00
Bas Nieuwenhuizen
d09ed23b9a
radv: Fiddle with opaque flag positions to reduce instructions.
...
Totals from 7 (0.01% of 134913) affected shaders:
CodeSize: 209076 -> 208460 (-0.29%)
Instrs: 38374 -> 38276 (-0.26%)
Latency: 803899 -> 803181 (-0.09%)
InvThroughput: 165530 -> 165384 (-0.09%)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19706 >
2022-11-19 14:24:36 +00:00
Konstantin Seurer
6f45c98b58
radv/bvh: Adjust sah cost based on depth
...
Adds a cost field to radv_ir_node and uses it to model the cost of tree
depth. This improves framerates by 2% if my benchmarking is correct.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19756 >
2022-11-19 10:18:50 +00:00
Friedrich Vock
95ed033066
radv: Use spirv1.5 instead of vulkan1.2
...
Ubuntu 20.04 ships a glslangValidator that doesn't know about vulkan1.2 yet.
Fixes: 27186537 ("radv: Add PLOC shader")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19479 >
2022-11-03 22:58:47 +00:00
Bas Nieuwenhuizen
271865373e
radv: Add PLOC shader
...
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19292 >
2022-10-30 19:48:46 +00:00
Friedrich Vock
0c0f179037
radv: Add global sync utilities
...
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19292 >
2022-10-30 19:48:46 +00:00
Friedrich Vock
608fa1bd25
radv/rt: Track number of inactive leaf nodes
...
To avoid emitting nodes with only invalid children in PLOC.
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19292 >
2022-10-30 19:48:46 +00:00
Friedrich Vock
f502b3aab3
radv/rt: Dispatch internal converter indirectly
...
Preparation for using the converter with PLOC.
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19292 >
2022-10-30 19:48:46 +00:00
Friedrich Vock
49c0995918
radv/rt: Fix internal converter synchronization
...
Fixes: e83e4faf ("radv: Only emit parents from parents that actually end up in the tree.")
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19292 >
2022-10-30 19:48:46 +00:00
Friedrich Vock
030a1f6843
radv: Use a struct for AABBs
...
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19292 >
2022-10-30 19:48:46 +00:00
Bas Nieuwenhuizen
ccf0a69e05
radv: Make the number of internal nodes be written on the GPU.
...
Opens the door of algorithms with a variable number of nodes.
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19292 >
2022-10-30 19:48:46 +00:00
Bas Nieuwenhuizen
0e23df959e
radv: Add BVH IR header.
...
To include GPU state passed between stages but not in a node.
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19292 >
2022-10-30 19:48:46 +00:00
Friedrich Vock
37525c11d1
radv: Rename emulated float helpers
...
Use only conversion functions now.
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19292 >
2022-10-30 19:48:46 +00:00
Konstantin Seurer
7754f208ce
radv: Use half floats for box16 coords
...
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19017 >
2022-10-11 20:27:24 +00:00
Konstantin Seurer
266f0ae948
radv: Add radv_bvh_node_box16
...
Adds the last useful node type. The different triangle types can be
derived by addition.
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19017 >
2022-10-11 20:27:24 +00:00
Konstantin Seurer
5f859f805b
radv: Rename node_internal to node_box32
...
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19017 >
2022-10-11 20:27:24 +00:00
Bas Nieuwenhuizen
243aa6b2ec
radv: Consider inactive internal nodes never in the tree.
...
Since the parent doesn't know to signal it.
Fixes: e83e4fafc8 ("radv: Only emit parents from parents that actually end up in the tree.")
Reviewed-By: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19033 >
2022-10-11 19:33:46 +00:00
Bas Nieuwenhuizen
30ce1676fe
radv: Properly annotate all the invalid node usage.
...
Reviewed-By: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Friedrich Vock <friedrich.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18799 >
2022-10-10 23:35:25 +00:00
Bas Nieuwenhuizen
e83e4fafc8
radv: Only emit parents from parents that actually end up in the tree.
...
Otherwise the wrong parent link might be set.
This kinda relies on waves being launched in order which tends to
be the case on AMD. To avoid the busy-wait loop waiting on stuff
from the same subgroup we do the actual processing in the body of
the loop. This can have performance implications but mostly in the
case we'd otherwise deadlock, so meh.
Reviewed-By: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18799 >
2022-10-10 23:35:25 +00:00
Bas Nieuwenhuizen
4ce1b9b2ff
radv: Generate parent links in BVH.
...
Reviewed-By: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Friedrich Vock <friedrich.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18799 >
2022-10-10 23:35:25 +00:00
Bas Nieuwenhuizen
1e2c95ac1f
radv: Start the BVH after the header.
...
First usage of the offset field, Can put more in it in the follow
up.
Reviewed-By: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Friedrich Vock <friedrich.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18799 >
2022-10-10 23:35:25 +00:00