Commit Graph

8366 Commits

Author SHA1 Message Date
Henri Verbeet
b6acac49f1 vkd3d-shader/msl: Implement VSIR_OP_UREM. 2025-10-14 15:49:18 +02:00
Henri Verbeet
69879129f8 vkd3d-shader/msl: Implement VSIR_OP_IDIV. 2025-10-14 15:49:18 +02:00
Henri Verbeet
320bdd6759 vkd3d-shader/ir: Validate IDIV instructions. 2025-10-14 15:49:18 +02:00
Henri Verbeet
90758b7ca8 vkd3d-shader/msl: Implement VSIR_OP_UDIV_SIMPLE. 2025-10-14 15:49:18 +02:00
Henri Verbeet
11e5b83e79 vkd3d-shader/spirv: Handle VSIR_DATA_MIXED in spirv_get_type_id().
For example, a HLSL shader like this:

    tbuffer t0
    {
        float4 data;
    };

    float4 main() : sv_target
    {
        return data;
    }

would be compiled to the following:

    ps_4_0
    dcl_resource_buffer (mixed,mixed,mixed,mixed) t0
    dcl_output o0.xyzw
    dcl_temps 1
    ld r0.xyzw, l(0, 0, 0, 0), t0.xyzw
    mov o0.xyzw, r0.xyzw
    ret

VSIR_DATA_MIXED used to be mapped to VKD3D_SHADER_COMPONENT_UINT by
vkd3d_component_type_from_data_type(), but we no longer use that.
Found by Giovanni Mascellani.
2025-10-14 15:48:36 +02:00
Anna (navi) Figueiredo Gomes
c73afe94f1 vkd3d-shader/hlsl: Remove the duplicate HLSL_IR_STRING_CONSTANT branch from evaluate_static_expression(). 2025-10-14 15:47:05 +02:00
Francisco Casas
7b017d933b vkd3d-shader: Update the vsir_program_iterator_insert_before() comment.
"ins_it" is not really optional.
2025-10-14 15:45:30 +02:00
Giovanni Mascellani
b5b5c67b34 vkd3d-shader/ir: Lower ABSNEG modifiers to instructions. 2025-10-13 19:25:51 +02:00
Giovanni Mascellani
968eb7467c vkd3d-shader/ir: Use VSIR_OP_NEG in insert_fragment_fog_before_ret(), in the common part.
The NEG source modifier is not generated any more during vsir
transformation, so it can be dropped in backends.
2025-10-13 19:13:05 +02:00
Giovanni Mascellani
ca23db5bae vkd3d-shader/ir: Use VSIR_OP_NEG in insert_fragment_fog_before_ret(), in the doubly exponential case. 2025-10-13 19:13:01 +02:00
Giovanni Mascellani
b2d47693b4 vkd3d-shader/ir: Use VSIR_OP_NEG in insert_fragment_fog_before_ret(), in the exponential case. 2025-10-13 19:12:56 +02:00
Giovanni Mascellani
786ffe69f7 vkd3d-shader/ir: Use VSIR_OP_NEG in insert_fragment_fog_before_ret(), in the linear case. 2025-10-13 19:12:51 +02:00
Giovanni Mascellani
eb1210f517 vkd3d-shader/ir: Lower NEG modifiers to instructions. 2025-10-13 19:07:01 +02:00
Giovanni Mascellani
79736ae6ff vkd3d-shader/ir: Introduce VSIR_OP_NEG to represent floating-point negation. 2025-10-13 19:06:34 +02:00
Henri Verbeet
62fa65066f tests/shader_runner: Use format names if available in trace_format_cap(). 2025-10-13 19:04:19 +02:00
Henri Verbeet
9de229925d vkd3d-shader/ir: Handle integer division by zero in vsir_program_lower_udiv().
This achieves two things:
  - The GLSL backend no longer needs to handle this by itself. Likwise, the
    MSL backend won't have to either.
  - We no longer handle division by zero for DXIL UDiv and URem instructions,
    which leave this undefined.
2025-10-13 19:00:05 +02:00
Henri Verbeet
433adab6ad vkd3d-shader/glsl: Handle integer operands in shader_glsl_movc().
We don't use these yet, but we're about to.
2025-10-13 19:00:05 +02:00
Henri Verbeet
7aa6f4f8b6 tests: Replace the test_shader_instructions() "ps_udiv" test with a shader runner test. 2025-10-13 19:00:05 +02:00
Henri Verbeet
90cbe25d1e vkd3d-shader/spirv: Do not handle division by zero for VSIR_OP_IDIV or VSIR_OP_IREM.
These correspond to the DXIL SDiv and SRem instructions, for which division by
zero is undefined. Division by zero is also undefined for DXIL UDiv and URem;
addressing those is slightly more involved.
2025-10-13 19:00:05 +02:00
Elizabeth Figura
dd55b15865 vkd3d-shader/ir: Implement an initial vsir copy propagation pass. 2025-10-13 18:55:42 +02:00
Elizabeth Figura
cfe51e84df vkd3d-shader/glsl: Wrap gl_GlobalInvocationID in an uvec4.
Callers to shader_glsl_print_register_name() expect this. In particular, this
fixes translation of instructions such as

    store_uav_typed u0.xyzw, vThreadID.xyxx, l(2.00000000e+00)

which is currently translated as the invalid

    imageStore(cs_image_0, ivec4(gl_GlobalInvocationID).xy, vec4(uintBitsToFloat(0x40000000u), 0, 0, 0));
2025-10-13 18:51:24 +02:00
Elizabeth Figura
0bb8272f26 vkd3d-shader: Introduce an interface to specify sm1 shadow samplers. 2025-10-13 18:40:52 +02:00
Elizabeth Figura
539a5be370 vkd3d-shader: Introduce an interface to specify 1.x texture dimensions. 2025-10-13 18:40:44 +02:00
Elizabeth Figura
937b80f3f2 vkd3d-shader: Remove the no longer used flat_constant_count field from struct vsir_program. 2025-10-13 18:40:25 +02:00
Elizabeth Figura
2be9c880ff vkd3d-shader: Remove sm1-specific descriptor scanning logic. 2025-10-13 18:25:05 +02:00