Commit Graph

480 Commits

Author SHA1 Message Date
Anna (navi) Figueiredo Gomes
6e15664bff vkd3d-shader/fx: Implement shader assignment. 2025-12-09 16:21:48 +01:00
Anna (navi) Figueiredo Gomes
b17923b5ba vkd3d-shader/hlsl: Store parsed values in hlsl_ir_compile().
Makes emitting shaders from fx.c easier, and brings parsing failures
upfront.

Non-effect target profiles don't perform any type checks on
ConstructGSWithSO(), nor use shader objects in any way, but they do
check if the argument count is correct.

So we create a GeometryShader object with NULL decl and profile when
targeting non-effect profiles, so our type checks still work and
implicit conversions aren't attempted.
2025-12-09 15:44:30 +01:00
Giovanni Mascellani
1e4764d555 vkd3d-shader/dxil: Parse the f32 denormalization mode. 2025-12-02 14:26:16 +01:00
Francisco Casas
5fe8a0c70f vkd3d-shader/hlsl: Retrieve error_instr instead of NULL in hlsl_block_add_resource_load().
Fixes: 06a503975f
2025-11-20 11:31:00 +01:00
Francisco Casas
06a503975f vkd3d-shader/hlsl: Avoid member access on NULL resource load (ubsan).
In some scenarios this resource load is NULL, and we are still doing
&load->node on it.

    vkd3d/libs/vkd3d-shader/hlsl.c:2195:12: runtime error: member access
            within null pointer of type 'struct hlsl_ir_resource_load'

This happens in tests/hlsl/sampler-state.shader_test, in the following
test:

    [pixel shader fail]
    Texture2D tex;

    float4 main(): sv_target
    {
        return tex.Sample(sampler_state {}, float2(0, 0));
    }
2025-11-18 17:42:11 +01:00
Anna (navi) Figueiredo Gomes
dd3524444d vkd3d-shader/hlsl: Properly free default values when discarding them. 2025-11-17 15:17:45 +01:00
Shaun Ren
200e66ba4f vkd3d-shader/hlsl: Store the flatten type in struct hlsl_ir_if. 2025-10-30 17:46:12 +01:00
Shaun Ren
cd9a5bf2b4 vkd3d-shader/hlsl: Dump the jump condition node in dump_ir_jump(). 2025-10-30 16:32:30 +01:00
Elizabeth Figura
deb7a67d67 vkd3d-shader/hlsl: Introduce hlsl_block_add_constant(). 2025-10-28 16:30:49 +01:00
Elizabeth Figura
be31842197 vkd3d-shader/hlsl: Return a node from lower_ir().
This allows us to use the same function for "folding" passes, which usually
replace with a node other than the last one added in a block.
2025-10-09 13:20:46 +02:00
Petrichor Park
e35604dbf0 vkd3d-shader/hlsl: Implement the firstbitlow() intrinsic. 2025-09-22 11:26:42 +02:00
Petrichor Park
e6d840170d vkd3d-shader/hlsl: Implement the firstbithigh() intrinsic. 2025-09-22 11:26:42 +02:00
Petrichor Park
e49beca0d5 vkd3d-shader/hlsl: Implement the countbits() intrinsic. 2025-09-22 11:26:42 +02:00
Shaun Ren
b6d274e68e vkd3d-shader/hlsl: Remove the whitespace before the closing parenthesis in dump_ir_expr(). 2025-09-17 12:36:54 +02:00
Shaun Ren
320c3c9652 vkd3d-shader/hlsl: Fold some general conditional identities.
The following conditional identities are applied:

  c ? x : x -> x
  false ? x : y -> y; true ? x : y -> x
  c ? true : false -> c; c ? false : true -> !c
  !c ? x : y -> c ? y : x

Lastly, for expression chains x, y in a conditional expression
  c ? x : y,
we evaluate all conditionals in the expression chains with the
condition c, assuming c is true (for x), or false (for y).
2025-08-21 16:00:51 +02:00
Henri Verbeet
f95fc28851 vkd3d-shader/hlsl: Return a vsir program from hlsl_compile_shader().
This largely brings the HLSL frontend in line with the other frontends.
2025-08-07 20:40:01 +02:00
Henri Verbeet
85603dc9c6 vkd3d-shader/hlsl: Initialise the vsir program in hlsl_compile_shader().
Mostly in preparation for returning a vsir program from
hlsl_compile_shader() in the next commit.
2025-08-07 20:37:41 +02:00
Henri Verbeet
e7be5aa9fd vkd3d-shader/hlsl: Pass a vkd3d_shader_source_list pointer to hlsl_ctx_init().
Instead of storing the list inside struct hlsl_ctx. The source file
names in the list are used by the location information that the HLSL
frontend produces, and end up being referenced by the vsir program. If
we want the vsir program to be able to outlive the hlsl_ctx, its
location information can't reference data owned by the hlsl_ctx.
2025-08-07 20:33:24 +02:00
Henri Verbeet
7c37fc6a8b vkd3d-shader: Introduce struct vkd3d_shader_source_list. 2025-08-07 20:33:24 +02:00
Shaun Ren
4bb880f9ed vkd3d-shader/hlsl: Support interlocked operations on non-indexed groupshared variables. 2025-08-05 16:33:08 +02:00
Shaun Ren
8d0d8d106b vkd3d-shader/hlsl: Support stores to raw groupshared variables. 2025-08-05 16:32:34 +02:00
Victor Chiletto
e718546ee5 vkd3d-shader/hlsl: Transform hlsl_ir_index into structured buffers into field specific hlsl_ir_resource_loads. 2025-08-05 14:25:50 +02:00
Victor Chiletto
5dbf859029 vkd3d-shader/hlsl: Parse SRV structured buffers. 2025-08-05 14:25:50 +02:00
Henri Verbeet
dbaecb3f36 vkd3d-shader/hlsl: Introduce hlsl_compile_effect().
The goal being to allow hlsl_compile_shader() to return a vsir program.
2025-07-29 13:14:30 +02:00
Henri Verbeet
eaebef4265 vkd3d-shader/hlsl: Emit vsir from hlsl_emit_bytecode(). 2025-07-28 16:10:15 +02:00