Commit Graph

3808 Commits

Author SHA1 Message Date
Nikolay Sivov
ccad49d486 vkd3d-shader/d3d-asm: Fix 3D sampler declaration instruction name. 2023-06-05 22:27:33 +02:00
Giovanni Mascellani
7c360330d7 vkd3d-shader/tpf: Do not emit HLSL_IR_CONSTANT instructions.
Since constants are now inlined.
2023-05-29 20:21:29 +02:00
Giovanni Mascellani
a471c5567a vkd3d-shader/tpf: Emit constant values inline. 2023-05-29 20:21:27 +02:00
Giovanni Mascellani
a7de09d418 vkd3d-shader/tpf: Move sm4_src_from_constant_value() above.
So that it can be used by sm4_src_from_node() in later commits.
2023-05-29 20:21:25 +02:00
Giovanni Mascellani
4ecd3af2af vkd3d-shader/tpf: Use a semicolon to separate statements. 2023-05-29 20:21:23 +02:00
Nikolay Sivov
a2e85a8a76 vkd3d-shader/hlsl: Parse SampleCmpLevelZero() method. 2023-05-29 20:21:17 +02:00
Nikolay Sivov
c33219c97b vkd3d-shader/tpf: Write out comparison mode sampler declarations and corresponding sampling instruction. 2023-05-29 20:21:16 +02:00
Nikolay Sivov
2fd3550ba6 vkd3d-shader/hlsl: Parse SampleCmp() method. 2023-05-29 20:21:14 +02:00
Nikolay Sivov
7c94705c54 vkd3d-shader/hlsl: Parse SamplerComparisonState objects. 2023-05-29 20:21:11 +02:00
Nikolay Sivov
efe107d231 vkd3d-shader/hlsl: Use a function table for object methods handlers. 2023-05-29 20:21:10 +02:00
Nikolay Sivov
87cd3f872b vkd3d-shader/hlsl: Move object type checks to methods handlers. 2023-05-29 20:21:07 +02:00
Ethan Lee
aa17d139be tests: Add a test for arrays with an expression as the index.
Currently, the compiler requires that dereferences be HLSL_IR_CONSTANT, so that
it can compute the offset at compile time. However, scenarios such as this test
will produce a dereference with HLSL_IR_EXPR, which will generate an error.

Passing this test in particular will require adding support for SM4 relative
addressing, as well as support for non-constant indexing in general.

Signed-off-by: Ethan Lee <flibitijibibo@gmail.com>
2023-05-29 20:21:01 +02:00
Jan Sikorski
bb680e73de vkd3d-shader/spirv: Ensure that the OpLabel emitted vkd3d_spirv_builder_begin_main_function() gets terminated. 2023-05-26 19:11:55 +02:00
Zebediah Figura
b453a0acd6 vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_abs(). 2023-05-26 19:11:46 +02:00
Zebediah Figura
c805eb1191 vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_min(). 2023-05-26 19:11:44 +02:00
Zebediah Figura
aa82f61ef3 vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_max(). 2023-05-26 19:11:42 +02:00
Zebediah Figura
ad0ab664d2 vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_mod(). 2023-05-26 19:11:39 +02:00
Zebediah Figura
c8b7dbebe4 vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_div(). 2023-05-26 19:11:36 +02:00
Henri Verbeet
133421a38c vkd3d: Avoid redundantly initialising "descriptors" in d3d12_desc_flush_vk_heap_updates_locked().
As pointed out by Andrey Gusev.
2023-05-26 19:11:26 +02:00
Conor McCarthy
f4778b727d vkd3d-shader/spirv: Use the register index count in shader_register_clone_relative_addresses(). 2023-05-26 19:11:15 +02:00
Conor McCarthy
4a64cf74c3 vkd3d-shader/spirv: Use the register index count in I/O relative address assertions. 2023-05-26 19:11:07 +02:00
Conor McCarthy
06dd0ccd4c vkd3d-shader/spirv: Use the register index count in I/O register assertions. 2023-05-26 19:11:03 +02:00
Conor McCarthy
178a7677e2 vkd3d-shader/spirv: Use the register index count in shader_register_get_io_indices(). 2023-05-26 19:11:02 +02:00
Conor McCarthy
d46250a59b vkd3d-shader/spirv: Use the register index count in default register dereferences. 2023-05-26 19:11:00 +02:00
Conor McCarthy
a2b3f70d8e vkd3d-shader/spirv: Use the register index count in aggregate register dereferences. 2023-05-26 19:10:58 +02:00
Conor McCarthy
ad08864134 vkd3d-shader/spirv: Use the register index count in spirv_compiler_get_register_name(). 2023-05-26 19:10:56 +02:00
Conor McCarthy
b3927726cc vkd3d-shader/spirv: Use the register index count in non-I/O variable registers in vkd3d_symbol_make_register(). 2023-05-26 19:10:54 +02:00
Conor McCarthy
ec5f195b6b vkd3d-shader/spirv: Use the register index count in I/O registers in vkd3d_symbol_make_register(). 2023-05-26 19:10:52 +02:00
Conor McCarthy
532fe01818 vkd3d-shader/spirv: Set the register index count in spirv_compiler_emit_default_control_point_phase(). 2023-05-26 19:10:49 +02:00
Conor McCarthy
9c6040df02 vkd3d-shader/spirv: Set the register index count in spirv_compiler_emit_dcl_indexable_temp(). 2023-05-26 19:10:47 +02:00
Conor McCarthy
bf1ecc0f60 vkd3d-shader/spirv: Set the register index count in spirv_compiler_emit_hull_shader_builtins(). 2023-05-26 19:10:33 +02:00
Conor McCarthy
7e58511b76 vkd3d-shader/spirv: Set the register index count in spirv_compiler_get_invocation_id(). 2023-05-26 19:10:30 +02:00
Ethan Lee
ea7d8c65bd vkd3d-shader/tpf: Add support for emitting sample_l instructions.
Signed-off-by: Ethan Lee <flibitijibibo@gmail.com>
2023-05-24 22:00:41 +02:00
Conor McCarthy
6835e8176f vkd3d-shader/ir: Normalise signatures and input/output registers to the Shader Model 6 pattern.
In Shader Model 6 each signature element can span a range of register
indices, or 'rows', and system values do not share a register index with
non-system values. Inputs and outputs are referenced by element index
instead of register index. This patch merges multiple signature elements
into a single element under the following conditions:

- The register index in a load or store is specified dynamically by
  including a relative address parameter with a base register index. The
  dcl_index_range instruction is used to identify these.
- A register declaration is split across multiple elements which declare
  different components of the register.
- A patch constant function writes tessellation factors. These are an
  array in SPIR-V, but in SM 5.x each factor is declared as a separate
  register, and these are dynamically indexed by the fork/join instance
  id. Elimination of multiple fork/join phases converts the indices to
  constants, but merging the signature elements into a single arrayed
  element matches the SPIR-V output.

All references to input/output register indices are converted to element
indices. If a relative address is present, the element index is moved up
a slot so it cannot be confused with a constant offset. Existing code
only handles register index relative addressing for tessellation factors.
This patch adds generic support for it.
2023-05-24 22:00:29 +02:00
Conor McCarthy
110e48e54d vkd3d-shader/ir: Eliminate struct vkd3d_shader_normaliser. 2023-05-24 22:00:28 +02:00
Conor McCarthy
31682c52c7 vkd3d-shader/spirv: Support emitting multi-dimensional array variables. 2023-05-24 22:00:27 +02:00
Francisco Casas
e060773c19 vkd3d-shader/hlsl: Extend the liveness of nodes produced outside loops.
Otherwise, it is possible that the register used by the temp is
overridden by a subsequent instruction within the same loop.
2023-05-24 22:00:21 +02:00
Francisco Casas
fbd2df2ad5 tests: Add minimal tests for temp lifetimes within a loop. 2023-05-24 22:00:19 +02:00
Zebediah Figura
855bb71f6d vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_nequal(). 2023-05-23 21:08:22 +02:00
Zebediah Figura
d565caafb5 vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_mul(). 2023-05-23 21:08:21 +02:00
Zebediah Figura
623cd94997 vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_add(). 2023-05-23 21:08:20 +02:00
Zebediah Figura
7d9b24fe11 vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_neg(). 2023-05-23 21:08:19 +02:00
Zebediah Figura
eb04829e66 vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_cast(). 2023-05-23 21:08:17 +02:00
Ethan Lee
24d4ab7fb3 vkd3d-shader/hlsl: Add support for SampleGrad() method.
Signed-off-by: Ethan Lee <flibitijibibo@gmail.com>
2023-05-23 21:07:49 +02:00
Ethan Lee
c3f10fe271 tests: Add a test for SampleGrad() method.
Signed-off-by: Ethan Lee <flibitijibibo@gmail.com>
2023-05-23 21:07:47 +02:00
Nikolay Sivov
1af662ae50 tests: Add RWBuffer writing test.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-05-22 22:03:36 +02:00
Zebediah Figura
66dab357eb tests: Add support for UAV buffers in the d3d11 runner.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-05-22 22:03:36 +02:00
Nikolay Sivov
f470c00453 tests: Add support for UAV buffers to d3d12 runner.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-05-22 22:03:36 +02:00
Nikolay Sivov
74c0ad0a7a tests: Rename readback helper to be more generic.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-05-22 22:03:28 +02:00
Nikolay Sivov
a4ebde202a tests: Add support for UAV buffers in Vulkan runner.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-05-22 22:03:28 +02:00