6997 Commits

Author SHA1 Message Date
Francisco Casas
f22729461e vkd3d-shader/hlsl: Store hull and domain shader properties in vsir_program.
The alternative to adding the vsir_program->tess_output_primitive and
vsir_program->tess_partitioning fields would be to emit the vsir
DCL_TESSELLATOR_OUTPUT_PRIMITIVE and DCL_TESSELLATOR_PARTITIONING
instructions, like DXIL does, but I think that the preference is to store
these kind of data directly in the vsir_program.
2024-12-10 15:52:52 +01:00
Francisco Casas
347e7a396d vkd3d-shader/hlsl: Generate CTAB outside sm1_generate_vsir().
For consistency with the sm4_generate_rdef() and sm4_generate_vsir()
functions.
2024-12-10 15:52:52 +01:00
Francisco Casas
ca9bb2e089 vkd3d-shader/hlsl: Generate RDEF outside tpf_compile(). 2024-12-10 15:52:52 +01:00
Francisco Casas
ecddc39b31 vkd3d-shader/hlsl: Store SM4 constant buffer declarations in vsir program. 2024-12-10 15:52:52 +01:00
Francisco Casas
aa3a716249 vkd3d-shader/hlsl: Allow lowering separate sampler arrays on deref offset 0. 2024-12-10 15:52:52 +01:00
Francisco Casas
2c9269ac3a vkd3d-shader/hlsl: Allocate samplers by decreasing bind count in SM1. 2024-12-10 15:52:50 +01:00
Francisco Casas
455846a305 vkd3d-shader/hlsl: Support combined samplers from texture arrays. 2024-12-10 15:51:43 +01:00
Francisco Casas
3a6bf3be24 vkd3d-shader/hlsl: Lower separated samplers for SM1.
The combined sampler is created as a SAMPLER instead of a TEXTURE
because that fits all our current infrastructure. The only problem is
that in the CTAB it must appear as a Texture, so the new field
hlsl_type.is_combined_sampler is added.

Co-authored-by: Elizabeth Figura <zfigura@codeweavers.com>
2024-12-10 15:51:43 +01:00
Francisco Casas
58d318719c tests: Test sampler array allocation. 2024-12-10 15:51:34 +01:00
Francisco Casas
a0a555878f tests: Add additional sampler allocation tests for SM1. 2024-12-10 14:02:00 +01:00
Giovanni Mascellani
c1df64b3a6 vkd3d-shader/ir: Check that signature elements do not conflict with each other. 2024-12-09 16:11:34 +01:00
Giovanni Mascellani
b6a00579a2 vkd3d-shader/ir: Validate the signature element register index, for some sysvals. 2024-12-09 16:11:34 +01:00
Giovanni Mascellani
59a3a8e2d6 vkd3d-shader/ir: Validate the signature element stream index. 2024-12-09 16:11:34 +01:00
Giovanni Mascellani
db5a3197b7 vkd3d-shader/ir: Validate the register index and count for signature elements. 2024-12-09 16:11:34 +01:00
Giovanni Mascellani
267c70fa55 vkd3d-shader/ir: Check that signature element masks are left-aligned with in a DCL_INDEX_RANGE. 2024-12-09 16:10:47 +01:00
Giovanni Mascellani
703da18955 vkd3d-shader/ir: Check that the DCL_INDEX_RANGE effective mask stabilizes after one iteration. 2024-12-09 16:10:47 +01:00
Henri Verbeet
bbeecfc835 vkd3d: Drop smaller pools in d3d12_command_allocator_reset_descriptor_pool_array().
Effectively consolidating them.
2024-12-09 16:10:22 +01:00
Francisco Casas
d2feb33b47 vkd3d-shader/hlsl: Store SM4 texture declarations in the vsir program. 2024-12-09 16:09:16 +01:00
Francisco Casas
1d290bf5db vkd3d-shader/hlsl: Store SM4 sampler declarations in the vsir program.
Looking at the implementation of shader_sm4_read_dcl_sampler(), vsir
stores the resource index range both in

    vkd3d_shader_instruction.declaration.sampler.range

and in the

    vkd3d_shader_instruction.declaration.sampler.src.reg.idx[1-2]

indexes, so we do the same.

It is also worth noting that for shader models lower than 5.1, vsir
has a normalization on the ins->declaration src register indexes.
Refer to the following comment:

    /* SM5.1 places a symbol identifier in idx[0] and moves
     * other values up one slot. Normalize to SM5.1. */

on shader_sm4_read_param().

This normalization is also added to the generated vsir instructions.
2024-12-09 16:09:16 +01:00
Francisco Casas
37a61bf41a vkd3d-shader/hlsl: Store the global flags in the vsir program. 2024-12-09 16:09:16 +01:00
Francisco Casas
d3108de72a vkd3d-shader/hlsl: Store ROV feature requirement in the vsir_program. 2024-12-09 16:09:16 +01:00
Francisco Casas
d9c4a257c2 vkd3d-shader/dxbc: Parse the SFI0 ROV requirement. 2024-12-09 16:09:16 +01:00
Henri Verbeet
b484288a82 vkd3d-shader/spirv: Parse SPIR-V instructions. 2024-12-09 16:09:16 +01:00
Giovanni Mascellani
ac2901d2cb vkd3d-shader/spirv: Parse the SPIR-V instruction schema. 2024-12-09 16:09:16 +01:00
Giovanni Mascellani
9b4f5dab77 vkd3d-shader/spirv: Parse the SPIR-V id bound. 2024-12-09 16:09:16 +01:00
Giovanni Mascellani
3f548ccf9c vkd3d-shader/spirv: Parse the SPIR-V generator magic number. 2024-12-09 16:09:16 +01:00
Giovanni Mascellani
e218dae281 vkd3d-shader/spirv: Parse the SPIR-V version number. 2024-12-09 16:08:33 +01:00
Giovanni Mascellani
6cac18e395 vkd3d-shader/spirv: Parse the SPIR-V magic number. 2024-12-09 15:41:24 +01:00
Giovanni Mascellani
49fba97b0a vkd3d-shader/spirv: Introduce a SPIR-V parser. 2024-12-09 14:22:24 +01:00
Conor McCarthy
f3fac95bb6 tests/hlsl: Add int64 wave op tests. 2024-12-09 14:21:49 +01:00
Conor McCarthy
50306a8b08 tests/hlsl: Add uint64 wave op tests. 2024-12-09 14:20:28 +01:00
Conor McCarthy
f0f8bb3f36 tests/hlsl: Add float64 wave op tests. 2024-12-09 14:17:05 +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