Commit Graph

3941 Commits

Author SHA1 Message Date
Zebediah Figura
25cf6a720b vkd3d-shader/ir: Normalise sm1-style constants. 2023-07-17 22:56:45 +02:00
Zebediah Figura
e9fb067d4c vkd3d-shader/ir: Move normalization code from spirv.c to ir.c.
It is not spirv-specific and will (presumably) be used for GLSL as well.
2023-07-17 22:56:43 +02:00
Zebediah Figura
d077562f79 vkd3d-shader/d3dbc: Scan descriptors for constant register sets. 2023-07-17 22:56:39 +02:00
Zebediah Figura
55c5129ad9 include: Define an API for d3dbc constants. 2023-07-17 22:56:39 +02:00
Nikolay Sivov
a18ace731d tests: Add a test for side effects of ternary operator.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-07-17 22:56:32 +02:00
Zebediah Figura
44bf5556ae vkd3d-shader/hlsl: Free the constant defs array in hlsl_ctx_cleanup().
Spotted by Francisco Casas.
2023-07-17 22:56:19 +02:00
Nikolay Sivov
63631a8fd4 vkd3d-shader/tpf: Support some of the UAV types when writing RDEF records.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-07-17 22:56:05 +02:00
Francisco Casas
3bafd036bb vkd3d-shader/hlsl: Don't allocate all texture registers for synthetic separated samplers. 2023-07-17 22:55:53 +02:00
Zebediah Figura
a55973d695 vkd3d-shader/hlsl: Lower combined samplers to separate sampler and texture objects for SM4.
Co-authored-by: Francisco Casas <fcasas@codeweavers.com>
2023-07-17 22:55:51 +02:00
Francisco Casas
15ea5ff9db vkd3d-shader/hlsl: Separate tracking of sampler_dim and usage for object components. 2023-07-17 22:55:48 +02:00
Francisco Casas
c4f074d25d vkd3d-shader/hlsl: Introduce hlsl_new_synthetic_var_named(). 2023-07-17 22:55:46 +02:00
Francisco Casas
866c5d9531 vkd3d-shader/hlsl: Check is_uniform instead of HLSL_STORAGE_UNIFORM when validating object refs.
We are using the hlsl_ir_var.is_uniform flag to indicate when an object
is a uniform copy created from a variable with the HLSL_STORAGE_UNIFORM
modifier.

We should be checking for this instead of the HLSL_STORAGE_UNIFORM flag
which is also set to 1 for the original variables, and there should be
no reason to use this flag instead of "is_uniform" after the uniform
copies and combined/separated samplers are created.
2023-07-17 22:55:43 +02:00
Francisco Casas
b8a85c6ad5 tests: Add lowering combined samplers tests. 2023-07-17 22:55:43 +02:00
Francisco Casas
ab37b27a7d tests: Pass D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY when compiling with the shader-runner. 2023-07-17 22:55:43 +02:00
Francisco Casas
c58d666d1b vkd3d-shader/hlsl: Handle resource components individually for SM 5.0. 2023-07-17 22:55:40 +02:00
Francisco Casas
8f8c7a02ee vkd3d-shader/tpf: Introduce struct extern_resource.
This struct is required for handling both whole-variable resources for
SM < 5 and single-component resources for SM 5 in the same way, when
writting the RDEF block and resource declarations within the shader.
2023-07-17 22:55:39 +02:00
Francisco Casas
ae6bc398d6 vkd3d-shader/hlsl: Allow derefs to provide the data_type.
After lowering the derefs path to a single offset node, there was no way
of knowing the type of the referenced part of the variable. This little
modification allows to avoid having to pass the data type everywhere and
it is required for supporting instructions that reference objects
components within struct types.

Since deref->data_type allows us to retrieve the type of the deref,
deref->offset_regset is no longer necessary.
2023-07-17 22:55:36 +02:00
Zebediah Figura
d4b5e79c8b vkd3d-shader/hlsl: Skip unallocated variables when looking for reservation conflicts. 2023-07-13 23:00:03 +02:00
Zebediah Figura
aec9ea085e vkd3d-shader/hlsl: Return a hlsl_block from the "postfix_expr" rule. 2023-07-11 22:44:15 +02:00
Zebediah Figura
e222a786a1 vkd3d-shader/hlsl: Return a hlsl_block from binary and ternary expression rules. 2023-07-11 22:44:12 +02:00
Zebediah Figura
3079c874e3 vkd3d-shader/hlsl: Return a hlsl_block from the "unary_expr" rule. 2023-07-11 22:44:10 +02:00
Zebediah Figura
28dff58fb5 vkd3d-shader/hlsl: Return a hlsl_block from the "initializer_expr" rule. 2023-07-11 22:44:09 +02:00
Zebediah Figura
53d5ea639c vkd3d-shader/hlsl: Return a hlsl_block from the "assignment_expr" rule. 2023-07-11 22:44:06 +02:00
Conor McCarthy
1ec112e3d7 vkd3d-shader/dxil: Read function bodies. 2023-07-11 22:43:58 +02:00
Conor McCarthy
5d33fb4633 vkd3d-shader/dxil: Read numeric constants. 2023-07-11 22:43:57 +02:00
Conor McCarthy
c96143abdc vkd3d-shader/dxil: Read global function declarations. 2023-07-11 22:43:55 +02:00
Conor McCarthy
22157c3da3 vkd3d-shader/dxil: Validate the module format version. 2023-07-11 22:43:53 +02:00
Conor McCarthy
eca4b62c7e vkd3d-shader/dxil: Read the value symbol table. 2023-07-11 22:43:49 +02:00
Conor McCarthy
571d807dd8 vkd3d-shader/dxil: Read the type table. 2023-07-11 22:43:48 +02:00
Conor McCarthy
41a5d37935 vkd3d-shader/dxil: Use size_t where applicable. 2023-07-11 22:43:46 +02:00
Andrey Gusev
d4d960cb8b vkd3d-shader/spirv: Add support for VKD3DSIM_LINEAR_NOPERSPECTIVE_SAMPLE interpolation qualifier.
Used by F1 2018.
2023-07-10 23:17:59 +02:00
Giovanni Mascellani
2a3413e0f0 demos: Use a fence to synchronize D3D12 and Vulkan work. 2023-07-06 20:09:53 +02:00
Giovanni Mascellani
b2a1f6b5e4 include: Document vkd3d_acquire_vk_queue() and vkd3d_release_vk_queue(). 2023-07-06 20:09:53 +02:00
Evan Tang
574239e3e3 vkd3d: Make CopyResource use a temp buffer for depth <-> color copies.
depth <-> color copies aren't allowed in Vulkan
2023-07-06 20:09:50 +02:00
Zebediah Figura
6e303af519 vkd3d-shader/hlsl: Free the "iter" block pointer on success in create_loop().
Spotted by Giovanni Mascellani.
2023-07-05 22:32:48 +02:00
Zebediah Figura
b0ac77b44d vkd3d-shader/hlsl: Return a hlsl_block from the "expr_statement" and "expr" rules. 2023-07-05 22:32:47 +02:00
Zebediah Figura
07ce711583 vkd3d-shader/hlsl: Return a hlsl_block from the "jump_statement" rule. 2023-07-05 22:32:46 +02:00
Zebediah Figura
e4bf5933b9 vkd3d-shader/hlsl: Return a hlsl_block from the "selection_statement" rule. 2023-07-05 22:32:45 +02:00
Zebediah Figura
79dd9544b7 vkd3d-shader/hlsl: Return a hlsl_block from the "loop_statement" rule. 2023-07-05 22:32:43 +02:00
Zebediah Figura
23ff83e8a0 vkd3d-shader/hlsl: Return a hlsl_block from the "statement" rule.
As well as from the "statement_list" and "compound_statement" rules, which
trivially pass through from "statement".
2023-07-05 22:32:41 +02:00
Zebediah Figura
53e9ad3e4c vkd3d-shader/hlsl: Do not emit DEF instructions for uniform constants. 2023-07-04 22:40:20 +02:00
Zebediah Figura
e5afbda34a vkd3d-shader/hlsl: Simplify allocate_const_registers_recurse() to stop accounting for constants larger than a vector.
That cannot happen with the current code.
2023-07-04 22:40:16 +02:00
Zebediah Figura
8a2b357855 vkd3d-shader/hlsl: Allocate anonymous constants after uniforms. 2023-07-04 22:40:13 +02:00
Zebediah Figura
717cd3f5bb vkd3d-shader/hlsl: Consistently use the destination width in constant folding instructions (Valgrind). 2023-07-04 22:40:06 +02:00
Zebediah Figura
e390bc35e2 vkd3d-shader/d3dbc: Set the source count for DEF instructions to 1 (Valgrind).
We emit one source with multiple components.
2023-07-04 22:40:04 +02:00
Nikolay Sivov
06040d2a30 vkd3d-shader/hlsl: Disallow certain instruction types from constant expressions.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-07-04 22:39:57 +02:00
Nikolay Sivov
a65c0b0e22 vkd3d-shader/hlsl: Support evaluated expressions for sample count in multisampled textures declarations.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-07-04 22:39:55 +02:00
Zebediah Figura
73d422a0e0 vkd3d-shader/d3dbc: Scan for the maximum temporary register index. 2023-07-04 22:39:48 +02:00
Zebediah Figura
e489098878 vkd3d-shader: Record a global temporary count per sm4 shader.
Store it in the shader_desc, and declare temps from that when compiling SPIR-V,
instead of parsing dcl_instructions.

As part of this change, we declare a single, global temps array (with Private
scope instead of Function) which is as large as the maximum of all dcl_temps
instructions. It is not clear to me whether this will improve, hurt, or have no
significant effect on the lower-level compiler. An alternative is to still
redeclare a new temps array every time (although still with a smaller size).
2023-07-04 22:39:45 +02:00
Zebediah Figura
dfb2a316e6 vkd3d-shader/dxbc: Remove redundant zero-initialization of the vkd3d_shader_desc structure. 2023-07-04 22:39:43 +02:00