Commit Graph

393 Commits

Author SHA1 Message Date
Shaun Ren
b4845b9dca vkd3d-shader/hlsl: Implement sin/cos for SM1.
Also introduce HLSL_OP3_MAD.
2024-07-16 18:55:22 +02:00
Elizabeth Figura
98def3214b vkd3d-shader: Introduce struct vkd3d_shader_parameter_info and struct vkd3d_shader_parameter1.
As the newly added documentation describes, this reroll serves two purposes:

* to allow shader parameters to be used for any target type (which allows using
  parameters for things like Direct3D 8-9 alpha test),

* to allow the union in struct vkd3d_shader_parameter to contain types larger
  than 32 bits (by specifying them indirectly through a pointer).
2024-07-11 16:48:09 +02:00
Victor Chiletto
2034a8bab9 vkd3d-shader/hlsl: Implement loop unrolling.
Based on a patch by Nikolay Sivov.

Co-authored-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-11 00:32:53 +02:00
Victor Chiletto
50e28f70ed vkd3d-shader/hlsl: Defer bounds checks to after copy propagation.
We potentially generate OOB accesses during loop unrolling that are later deleted.
2024-07-11 00:32:53 +02:00
Victor Chiletto
317bd46efd vkd3d-shader/hlsl: Use a switch in validate_static_object_references(). 2024-07-11 00:32:49 +02:00
Francisco Casas
daa13934a4 vkd3d-shader/d3dbc: Use vsir_program I/O signatures to write dcls.
Instead of relying on ctx->extern vars, semantics are now stored in the
vsir_program signatures, and then read to write the declarations.
2024-07-09 20:31:14 +02:00
Francisco Casas
704ce03561 vkd3d-shader/d3dbc: Don't require a hlsl_semantic to get register and usage. 2024-07-09 20:12:47 +02:00
Francisco Casas
003f4c7600 vkd3d-shader/d3dbc: Use program->shader_version instead of ctx->profile. 2024-07-09 20:06:23 +02:00
Francisco Casas
dd8aa2ec91 vkd3d-shader/hlsl: Generate CTAB outside d3dbc_compile().
There is no way to store this information from the vsir_program alone,
so we make d3dbc_compile() expect the CTAB blob.
2024-07-09 18:59:54 +02:00
Francisco Casas
130b3335cb vkd3d-shader/d3dbc: Split hlsl_sm1_write().
The idea is to start splitting the

    HLSL IR -> d3dbc

translation into

    HLSL IR -> vsir -> d3dbc

So hlsl_sm1_write is split into two functions, sm1_generate_vsir()
which should handle the first part and d3dbc_compile() which should
handle the second part.

This translation should be completed once the hlsl_ctx and entry_func
are no longer used in d3dbc_compile().
2024-07-09 18:38:00 +02:00
Zebediah Figura
6db2bc3eff vkd3d-shader/d3dbc: Use enum vkd3d_shader_register_type in struct sm1_instruction. 2024-07-09 16:59:02 +02:00
Nikolay Sivov
4ff288bd32 vkd3d-shader: Implement tex*() functions variants with gradient arguments.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:23:38 +02:00
Nikolay Sivov
f03cb7e911 vkd3d-shader/hlsl: Add RasterizerState type.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:12:03 +02:00
Nikolay Sivov
12947aa50d vkd3d-shader/fx: Add support for writing DepthStencilState objects.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:12:03 +02:00
Francisco Casas
597e55691a vkd3d-shader/hlsl: Only error out on bind_count register reservation overlaps for SM1.
While on SM1 a register reservation reserves the whole size in
registers of the variable's data type, overlapping conflicts are only
checked up to the bind_count (used size) for each variable.
2024-07-08 18:12:03 +02:00
Nikolay Sivov
48ff7de8ef vkd3d-shader/hlsl: Add support for ConstantBuffer<> type.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:12:03 +02:00
Victor Chiletto
abbcf0461f vkd3d-shader/hlsl: Reserve register slots for unused buffers. 2024-07-03 17:09:16 -03:00
Victor Chiletto
da36a447b8 vkd3d-shader/hlsl: Validate cbuffer register allocations. 2024-07-03 17:09:16 -03:00
Elizabeth Figura
acc9d79fbb vkd3d-shader/hlsl: Only allocate the aligned size for uniforms. 2024-06-18 13:19:44 -05:00
Nikolay Sivov
402dc94259 vkd3d-shader/fx: Set EXPLICIT_BIND_POINT flag for packoffset() reservations as well.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-06-12 19:02:20 +02:00
Nikolay Sivov
1124ea46ee vkd3d-shader/hlsl: Store original semantic name.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-06-11 15:53:19 +02:00
Elizabeth Figura
4355e6ca69 vkd3d-shader/hlsl: Allocate register spaces for objects. 2024-06-11 15:49:30 +02:00
Elizabeth Figura
7b61b0219e vkd3d-shader/hlsl: Allocate register spaces for constant buffers. 2024-06-11 15:49:30 +02:00
Elizabeth Figura
28a5e23814 vkd3d-shader: Write SM5.1 register indices.
Separate ID and index. Allocate IDs for all external resources (but ignore them
for shader models other than 5).
2024-06-11 15:49:30 +02:00
Francisco Casas
e8dbc36bd2 vkd3d-shader/hlsl: Record default values for uniforms and constant buffers. 2024-06-11 15:46:40 +02:00
Nikolay Sivov
f090d1e80d vkd3d-shader: Remove explicit newlines from hlsl_fixme() messages.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-05-23 23:12:10 +02:00
Francisco Casas
061dc39036 vkd3d-shader/hlsl: Also lower matrix swizzles and index loads in const passes. 2024-05-15 21:17:51 +02:00
Francisco Casas
4f60c7167e vkd3d-shader/hlsl: Run constant passes in a separate function. 2024-05-15 21:17:49 +02:00
Francisco Casas
28d267b7c0 vkd3d-shader/hlsl: Allocate SM1 numeric uniforms in decreasing bind count. 2024-05-13 22:26:21 +02:00
Francisco Casas
f548644222 vkd3d-shader/hlsl: Only allocate numeric bind count for SM1 numeric uniforms.
Unless they have register reservations, in which case the whole
variable is still reserved.
2024-05-13 22:26:08 +02:00
Francisco Casas
573d511344 vkd3d-shader/hlsl: Track bind count according to usage for uniforms.
Where bind count means the number of registers required to include all
dereferences to the variable within the shader as in
hlsl_ir_var.bind_count[].
2024-05-13 22:26:07 +02:00
Francisco Casas
e0a801e796 vkd3d-shader/hlsl: Improve tracking of used components running DCE before.
track_object_components_usage() had to be improved to also
register derefs on resource stores.
It was not doing it because it assumed that for every resource store
there was a resource load already, which was true, before calling DCE.
2024-05-13 22:26:05 +02:00
Francisco Casas
657e460d11 vkd3d-shader/hlsl: Allocate unused variables with register reservations on SM1. 2024-05-13 22:26:03 +02:00
Zebediah Figura
c2eb563e50 vkd3d-shader/fx: Skip uniform copy logic for global variables. 2024-05-08 21:07:58 +02:00
Zebediah Figura
2480eec98b vkd3d-shader/hlsl: Move the "base_type" member to the class-specific union. 2024-05-06 22:12:41 +02:00
Zebediah Figura
d9f7a88329 vkd3d-shader/hlsl: Make HLSL_TYPE_PIXELSHADER into a separate class. 2024-05-06 22:12:37 +02:00
Zebediah Figura
874937dab4 vkd3d-shader/hlsl: Make HLSL_TYPE_VERTEXSHADER into a separate class. 2024-05-06 22:12:34 +02:00
Francisco Casas
b14f935d0f vkd3d-shader/hlsl: Fold x + 0 identities. 2024-04-30 16:31:02 +02:00
Zebediah Figura
d7da278693 vkd3d-shader/hlsl: Make HLSL_TYPE_RENDERTARGETVIEW into a separate class. 2024-04-23 22:37:09 +02:00
Zebediah Figura
ee2bde3aba vkd3d-shader/hlsl: Make HLSL_TYPE_DEPTHSTENCILVIEW into a separate class. 2024-04-23 22:37:06 +02:00
Zebediah Figura
76971d811e vkd3d-shader/hlsl: Make HLSL_TYPE_TECHNIQUE into a separate class. 2024-04-23 22:36:51 +02:00
Zebediah Figura
3c8c7426df vkd3d-shader/hlsl: Make HLSL_TYPE_PASS into a separate class. 2024-04-23 22:36:38 +02:00
Zebediah Figura
24d3a352a6 vkd3d-shader/hlsl: Make HLSL_TYPE_EFFECT_GROUP into a separate class. 2024-04-23 22:36:32 +02:00
Zebediah Figura
171e097268 vkd3d-shader/hlsl: Make HLSL_TYPE_UAV into a separate class. 2024-04-19 22:23:20 +02:00
Zebediah Figura
93d7cd1785 vkd3d-shader/hlsl: Make HLSL_TYPE_TEXTURE into a separate class. 2024-04-19 22:23:19 +02:00
Zebediah Figura
220362cbad vkd3d-shader/hlsl: Make HLSL_TYPE_SAMPLER into a separate class. 2024-04-19 22:23:18 +02:00
Zebediah Figura
f57db442b0 vkd3d-shader/hlsl: Make HLSL_TYPE_STRING into a separate class. 2024-04-19 22:23:16 +02:00
Zebediah Figura
cdcf2da2eb vkd3d-shader/hlsl: Make HLSL_TYPE_VOID into a separate class. 2024-04-19 22:23:14 +02:00
Francisco Casas
80320f6129 vkd3d-shader/hlsl: Introduce hlsl_ir_stateblock_constant. 2024-04-10 08:54:23 -05:00
Francisco Casas
4dedcc5885 vkd3d-shader/hlsl: Also call dce before lowering deref paths. 2024-04-10 08:54:23 -05:00