Commit Graph

435 Commits

Author SHA1 Message Date
Anna (navi) Figueiredo Gomes
e61046fb23 vkd3d-shader/hlsl: Implement the "earlydepthstencil" attribute. 2024-09-12 18:46:24 +02:00
Francisco Casas
0c621f9e4e vkd3d-shader/hlsl: Save hlsl_ir_jump in the vsir_program for SM1. 2024-09-12 18:43:55 +02:00
Francisco Casas
08fb683784 vkd3d-shader/hlsl: Save hlsl_ir_resource_load in the vsir_program for SM1. 2024-09-12 18:42:25 +02:00
Francisco Casas
961c4f8b23 vkd3d-shader/hlsl: Save CAST hlsl_ir_exprs in the vsir_program for SM1. 2024-09-12 18:39:43 +02:00
Francisco Casas
8933620109 vkd3d-shader/hlsl: Save REINTERPRET hlsl_ir_exprs as vsir_program MOVs for SM1. 2024-09-12 18:33:19 +02:00
Giovanni Mascellani
866f138875 vkd3d-shader/ir: Record the control flow type in the program. 2024-09-12 18:31:32 +02:00
Francisco Casas
6e6e2910d6 vkd3d-shader/hlsl: Save DP2ADD hlsl_ir_exprs in the vsir_program for SM1. 2024-09-11 15:10:16 +02:00
Francisco Casas
4ed16108f0 vkd3d-shader/hlsl: Save COS_REDUCED and SIN_REDUCED in the vsir_program for SM1. 2024-09-11 15:09:58 +02:00
Francisco Casas
5db2c2a949 vkd3d-shader/hlsl: Save DOT hlsl_ir_exprs in the vsir_program for SM1. 2024-09-11 15:09:17 +02:00
Francisco Casas
d70342d66d vkd3d-shader/hlsl: Save per-component hlsl_ir_exprs in the vsir_program for SM1. 2024-09-11 15:07:35 +02:00
Francisco Casas
82dec5db46 vkd3d-shader/hlsl: Save simple hlsl_ir_exprs in the vsir_program for SM1. 2024-09-11 15:06:09 +02:00
Shaun Ren
c1babbc8aa vkd3d-shader/hlsl: Validate hull shader attributes. 2024-09-04 18:30:04 +02:00
Shaun Ren
6c1dc53d15 vkd3d-shader/hlsl: Parse the patchconstantfunc attribute. 2024-09-04 18:30:04 +02:00
Shaun Ren
41cb29c4c8 vkd3d-shader/hlsl: Parse the partitioning attribute. 2024-09-04 18:28:59 +02:00
Shaun Ren
615ffb823b vkd3d-shader/hlsl: Parse the outputtopology attribute. 2024-09-04 18:28:57 +02:00
Shaun Ren
dae88bab52 vkd3d-shader/hlsl: Parse the outputcontrolpoints attribute. 2024-09-04 18:28:46 +02:00
Shaun Ren
4dfd682446 vkd3d-shader/hlsl: Parse the domain attribute. 2024-09-04 18:21:15 +02:00
Shaun Ren
51e9b05fe5 vkd3d-shader/hlsl: Introduce parse_entry_function_attributes() helper. 2024-09-04 18:18:23 +02:00
Francisco Casas
45f18a7838 vkd3d-shader/hlsl: Parse the shader 'compile' syntax.
The hlsl_ir_compile node is introduced to represent the "compile"
syntax, and later the CompileShader() and ConstructGSWithSO()
constructs.

It basically represents a function call that remembers its arguments
using hlsl_srcs and keeps its own instruction block, which is discarded
when working on non-effect shaders.

For shader compilations it can be asserted that args_count is 1, and
that this argument (and the last node in hlsl_ir_effect_call.instrs)
is a regular hlsl_ir_call pointing to the declaration of the function
to be compiled.
2024-09-04 17:58:56 +02:00
Francisco Casas
379cd9b7b5 vkd3d-shader/hlsl: Save hlsl_ir_swizzles in the vsir_program for SM1. 2024-09-04 17:51:32 +02:00
Francisco Casas
b46eac35c0 vkd3d-shader/hlsl: Save hlsl_ir_stores in the vsir_program for SM1. 2024-09-04 17:51:32 +02:00
Francisco Casas
9aace1ac4e vkd3d-shader/hlsl: Save hlsl_ir_loads in the vsir_program for SM1. 2024-09-04 17:51:32 +02:00
Francisco Casas
23e3ec84f7 vkd3d-shader/hlsl: Save hlsl_ir_constants in the vsir_program for SM1. 2024-09-04 17:51:30 +02:00
Francisco Casas
a61846c28a vkd3d-shader/hlsl: Store SM1 sampler dcls on the vsir_program. 2024-09-04 17:47:47 +02:00
Francisco Casas
9a564872c5 vkd3d-shader/hlsl: Store SM1 constant dcls on the vsir_program. 2024-09-04 17:44:46 +02:00
Francisco Casas
7abf3c3a37 vkd3d-shader/hlsl: Introduce hlsl_ir_vsir_instruction_ref.
This node type will be deleted once the hlsl->vsir->d3dbc translation is
complete. For now it serves the purpose of allowing to keep both real
hlsl_ir_nodes and vsir_instructions in the hlsl_block, until all the
former can be translated into the latter.
2024-09-04 16:49:00 +02:00
Henri Verbeet
7a74e79f2d vkd3d-shader/d3dbc: Return a vkd3d_decl_usage from hlsl_sm1_usage_from_semantic(). 2024-09-02 19:14:01 +02:00
Henri Verbeet
1c01560321 vkd3d-shader/tpf: Return a vkd3d_shader_sysval_semantic from hlsl_sm4_usage_from_semantic(). 2024-09-02 19:12:53 +02:00
Nikolay Sivov
b4d957f848 vkd3d-shader/hlsl: Handle NULL constants.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-13 21:10:45 +02:00
Nikolay Sivov
91e88fac2e vkd3d-shader/hlsl: Add parser support for BlendState type. 2024-08-12 14:15:14 +02:00
Nikolay Sivov
b23874dad6 vkd3d-shader/hlsl: Add parser support for GeometryShader type.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-08 23:42:37 +02:00
Nikolay Sivov
de48960b33 vkd3d-shader/fx: Add support for the OMSetRenderTargets() state. 2024-08-08 23:42:37 +02:00
Victor Chiletto
8c3a5e5458 vkd3d-shader/hlsl: Implement f16tof32 intrinsic. 2024-08-08 23:35:02 +02:00
Francisco Casas
016be7e591 vkd3d-shader/hlsl: Lower non-constant row_major matrix loads for SM1. 2024-08-08 23:33:33 +02:00
Francisco Casas
9f515a9daa vkd3d-shader/hlsl: Lower non-constant array loads for SM1.
This is achieved by means of creating a variable storing zero,
loading every array element, comparing if the non-constant index
matches the index of that element at runtime, and in that case
store the corresponding element in the variable.

This seems to be the same strategy that the native compiler uses.
2024-08-08 23:30:39 +02:00
Francisco Casas
eb2d320596 vkd3d-shader/hlsl: Avoid dereferencing rel_offset if it is NULL.
We are currently using &offset_node->loc when offset_node is NULL.

A NULL dereference of rel_offset can also happen if
hlsl_offset_from_deref() fails because the dereference is out of
bounds.
2024-08-08 23:28:31 +02:00
Francisco Casas
e8354ac499 vkd3d-shader/hlsl: Parse string type. 2024-08-07 15:53:07 +02:00
Francisco Casas
090df488ba vkd3d-shader/hlsl: Parse string constants. 2024-08-07 15:48:59 +02:00
Nikolay Sivov
7c3677b114 vkd3d-shader/hlsl: Add parser support for ComputeShader, DomainShader, and HullShader types.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-06 16:54:19 +02:00
Giovanni Mascellani
eff30577af vkd3d-shader: Replace assert() with VKD3D_ASSERT() in hlsl_codegen.c. 2024-08-01 15:18:15 +02:00
Francisco Casas
e6e82ad3f6 vkd3d-shader/hlsl: Add missing src1 and src2 constants to sincos on SM2.
The sincos instruction expects two specific constants on 2.0 and 2.1 profiles.

Consider the following shader:

    uniform float u;
    float4 main() : sv_target
    {
        return sin(u);
    }

On native, with ps_2_0, this compiles as:

    ps_2_0
    def c3, 0.159154937, 0.5, 6.28318548, -3.14159274
    def c1, -1.55009923e-006, -2.17013894e-005, 0.00260416674, 0.00026041668
    def c2, -0.020833334, -0.125, 1, 0.5
    mov r0.xy, c3
    mad r0.x, c0.x, r0.x, r0.y
    frc r0.x, r0.x
    mad r0.x, r0.x, c3.z, c3.w
    sincos r1.y, r0.x, c1, c2
    mov r0, r1.y
    mov oC0, r0

We are not emitting the src1 and src2 constant arguments before this
patch.
2024-07-31 22:22:38 +02:00
Shaun Ren
ea2ffc0b6c vkd3d-shader/hlsl: Allocate registers for HLSL_OP1_{COS,SIN}_REDUCED with the required writemasks. 2024-07-16 19:02:01 +02:00
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