5030 Commits

Author SHA1 Message Date
Giovanni Mascellani
49fba97b0a vkd3d-shader/spirv: Introduce a SPIR-V parser. 2024-12-09 14:22:24 +01:00
Feifan He
9d4bcc951d vkd3d-shader/msl: Implement VKD3DSIH_USHR. 2024-12-05 21:26:03 +01:00
Feifan He
138e7caa03 vkd3d-shader/msl: Implement VKD3DSIH_ISHR. 2024-12-05 21:26:03 +01:00
Feifan He
5d6ed0fa30 vkd3d-shader/msl: Implement VKD3DSIH_ISHL. 2024-12-05 21:26:03 +01:00
Feifan He
a425c242a4 vkd3d-shader/msl: Implement VKD3DSIH_MAD. 2024-12-05 21:26:03 +01:00
Feifan He
8e0de82c74 vkd3d-shader/msl: Implement support for VKD3DSPDM_SATURATE modifiers. 2024-12-05 21:26:03 +01:00
Feifan He
ebf5828542 vkd3d-shader/msl: Implement VKD3DSIH_ELSE. 2024-12-05 21:25:35 +01:00
Feifan He
bbe10dcf17 vkd3d-shader/msl: Implement VKD3DSIH_NOT. 2024-12-05 21:13:29 +01:00
Giovanni Mascellani
74fa51d57c vkd3d-shader/ir: Check that DCL_INDEX_RANGE ranges do not overlap with unrelated signature elements. 2024-12-05 21:06:31 +01:00
Giovanni Mascellani
aae0a74d60 vkd3d-shader/ir: Validate the DCL_INDEX_RANGE instruction. 2024-12-05 21:06:31 +01:00
Giovanni Mascellani
38c53dca08 vkd3d-shader/ir: Introduce a helper function to determine the signature for a register type. 2024-12-05 21:05:50 +01:00
Giovanni Mascellani
b5e1c45827 vkd3d-shader/ir: Validate the register type for registers used as relative addresses. 2024-12-05 21:00:43 +01:00
Giovanni Mascellani
abf7a91834 vkd3d-shader/ir: Validate the array index when it is statically known. 2024-12-05 21:00:43 +01:00
Giovanni Mascellani
239c88e8d3 vkd3d: Do not use more than a few million descriptors in Vulkan heap set layouts.
Currently, when using Vulkan heaps, we create descriptor set
layouts with as many descriptors as allowed by the Vulkan
implementation limits. For some implementations this can mean
hundreds of millions of descriptors or more, which is wasteful,
given that even on the best resource binding tier Direct3D 12
applications should not expect to have more than a million usable
descriptors.

Recently this began being a problem, because since Mesa 24.2.7
the Intel driver advertises more than 200 million descriptors,
but pipeline compilation takes linear RAM in the number of
descriptors declared in the pipeline layout. This means that
compiling even a simple shader requires 10-20 GB of RAM.

In order to avoid using too much memory, with this commit we clamp
the number of descriptors declared in the set layouts to how many
we actually need to guarantee tier 3 resource binding support.
2024-12-05 21:00:03 +01:00
Conor McCarthy
a43f6a6600 vkd3d: Create descriptor pools of geometrically increasing size.
Creating a pool of 16k descriptors is wasteful if an allocator only uses
a fraction of them, so start at 1k and double for each subsequent
allocation until 16k is reached.
2024-12-05 20:54:45 +01:00
Conor McCarthy
e729ceeb1a vkd3d: Create separate descriptor pools for each vkd3d descriptor type.
Now that our Vulkan descriptor sets contain only a single vkd3d
descriptor type, we're able to create descriptor pools containing only a
single vkd3d descriptor type as well. This avoids wasting unallocated
descriptors of one type when we run out of descriptors of another type.
2024-12-05 20:54:45 +01:00
Henri Verbeet
a97c7c1fda vkd3d: Introduce d3d12_descriptor_set_layout_init(). 2024-12-05 20:54:45 +01:00
Conor McCarthy
19c6df1adb vkd3d: Introduce vkd3d_vk_descriptor_pool_array_destroy_pools(). 2024-12-05 20:54:45 +01:00
Conor McCarthy
8dc9fe725a vkd3d: Introduce vkd3d_vk_descriptor_pool_array_pop(). 2024-12-05 20:54:45 +01:00
Conor McCarthy
9d46a1863b vkd3d: Introduce vkd3d_vk_descriptor_pool_array_push(). 2024-12-05 20:54:45 +01:00
Conor McCarthy
7c0ce25bb7 vkd3d: Introduce vkd3d_vk_descriptor_pool_array_push_array(). 2024-12-05 20:54:45 +01:00
Conor McCarthy
3c620e88a0 vkd3d: Introduce struct vkd3d_vk_descriptor_pool_array. 2024-12-05 20:54:45 +01:00
Conor McCarthy
4a94bfc2f6 vkd3d: Store only a single vkd3d descriptor type in each Vulkan descriptor set.
We currently create statically sized descriptor pools, shared among
different descriptor types. Once we're unable to allocate a descriptor
set from a pool, we create a new pool. The unfortunate but predictable
consequence is that when we run out of descriptors of one type, we waste
any unallocated descriptors of the other types.

Dynamically adjusting the pool sizes could mitigate the issue, but it
seems non-trivial to handle all the edge cases, particularly in
situations where the descriptor count ratios change significantly
between frames. Instead, by storing only a single vkd3d descriptor type
in each Vulkan descriptor set we're able to create separate descriptor
pools for each vkd3d descriptor type, which also avoids the issue.

The main drawback of using separate descriptor sets for each descriptor
type is that we can no longer pack all bounded descriptor ranges into a
single descriptor set, potentially leaving fewer descriptor sets
available for unbounded ranges. That seems worth it, but we may end up
having to switch to a more complicated strategy if this ends up being a
problem on Vulkan implementations with a very limited number of
available descriptor sets.
2024-12-05 20:54:45 +01:00
Elizabeth Figura
01117c716d vkd3d-shader/hlsl: Remove unused expr ops.
These correspond to specific SM1 opcodes which we don't use (and which the native compiler never uses either).
2024-12-04 14:38:32 +01:00
Giovanni Mascellani
82963035e9 vkd3d-shader/ir: Validate the control point index when it is statically known. 2024-12-04 14:36:36 +01:00
Feifan He
a06e664730 vkd3d-shader/msl: Implement VKD3DSIH_RSQ. 2024-12-04 14:26:20 +01:00
Feifan He
bc67f2eb75 vkd3d-shader/msl: Implement VKD3DSIH_MIN. 2024-12-04 14:26:20 +01:00
Feifan He
ab2cb43e15 vkd3d-shader/msl: Implement VKD3DSIH_MAX. 2024-12-04 14:26:20 +01:00
Feifan He
64ea033c81 vkd3d-shader/msl: Implement VKD3DSIH_LOG. 2024-12-04 14:26:20 +01:00
Feifan He
b1e6dbe83f vkd3d-shader/msl: Handle SV_IS_FRONT_FACE inputs. 2024-12-04 14:26:20 +01:00
Feifan He
568296c88f vkd3d-shader/msl: Implement VKD3DSIH_ROUND_NE. 2024-12-04 14:26:20 +01:00
Feifan He
610a11ddf8 vkd3d-shader/msl: Implement VKD3DSIH_IF and VKD3DSIH_ENDIF. 2024-12-04 14:26:20 +01:00
Feifan He
28068c9d4c vkd3d-shader/msl: Implement VKD3DSIH_ROUND_NI. 2024-12-04 14:26:20 +01:00
Elizabeth Figura
36fda8e28c vkd3d-shader: Correct the disassembly for POSITIONT. 2024-12-03 14:49:02 +01:00
Elizabeth Figura
3d6f836801 vkd3d-shader: Fix the disassembly names of IFC and BREAKC. 2024-12-03 14:49:02 +01:00
Elizabeth Figura
7a7dc4bf0e vkd3d-shader/d3dbc: Mark some more instructions as version-limited. 2024-12-03 14:47:00 +01:00
Elizabeth Figura
e2961a2e3c vkd3d-shader/d3dbc: Omit unnecessary instruction maximum versions. 2024-12-03 14:47:00 +01:00
Feifan He
a81a9fb7bc vkd3d-shader/msl: Implement VKD3DSIH_LTO. 2024-12-03 14:44:32 +01:00
Feifan He
24753747a1 vkd3d-shader/msl: Implement VKD3DSIH_EXP. 2024-12-03 14:44:32 +01:00
Feifan He
ac897781ba vkd3d-shader/msl: Implement VKD3DSIH_IEQ. 2024-12-03 14:44:32 +01:00
Feifan He
67dd1d2b0c vkd3d-shader/msl: Handle the VKD3DSIM_LINEAR interpolation modifier on inputs. 2024-12-03 14:42:49 +01:00
Feifan He
8ae6a04561 vkd3d-shader/msl: Implement VKD3DSIH_SQRT. 2024-12-03 14:42:27 +01:00
Feifan He
77ed788a60 vkd3d-shader/msl: Implement VKD3DSIH_DP2. 2024-12-03 14:42:27 +01:00
Feifan He
6f7ee57e29 vkd3d-shader/msl: Implement VKD3DSIH_DP4. 2024-12-03 14:42:27 +01:00
Feifan He
046e9b5286 vkd3d-shader/msl: Implement VKD3DSIH_DP3. 2024-12-03 14:42:19 +01:00
Henri Verbeet
74365417ac vkd3d-shader/hlsl: Output the candidates for ambiguous function calls. 2024-12-03 14:38:33 +01:00
Henri Verbeet
4ca4dc0b2a vkd3d-shader/hlsl: Introduce hlsl_dump_ir_function_decl(). 2024-12-03 14:38:33 +01:00
Henri Verbeet
0b726e4408 vkd3d-shader/hlsl: Introduce hlsl_dump_type(). 2024-12-03 14:38:33 +01:00
Henri Verbeet
d0e4331640 vkd3d-shader/hlsl: Use hlsl_error() instead of hlsl_fixme() for ambiguous function calls.
This changes the return code, and some tests start passing as a result.
2024-12-03 14:38:33 +01:00
Giovanni Mascellani
1c93d706d7 vkd3d-shader/ir: Merge removing I/O declarations in the general instruction lowering pass. 2024-12-03 14:36:13 +01:00