Commit Graph

412 Commits

Author SHA1 Message Date
Giovanni Mascellani
835044dd8e vkd3d-shader/ir: Introduce VSIR_OP_SATURATE to represent floating-point clamping to [0, 1]. 2025-10-14 15:53:26 +02:00
Henri Verbeet
c89fd93859 vkd3d-shader/ir: Require signed operands for IREM instructions. 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
Giovanni Mascellani
79736ae6ff vkd3d-shader/ir: Introduce VSIR_OP_NEG to represent floating-point negation. 2025-10-13 19:06:34 +02:00
Giovanni Mascellani
781bb10ed0 vkd3d-shader/dxil: Rename "handler_idx" to "opcode" in sm6_parser_emit_dcl_primitive_topology(). 2025-10-09 15:52:10 +02:00
Giovanni Mascellani
6a9147b66b vkd3d-shader/dxil: Rename "handler_idx" to "opcode" in sm6_parser_emit_dcl_count(). 2025-10-09 15:52:03 +02:00
Giovanni Mascellani
0a9fd13b25 vkd3d-shader/dxil: Rename "handler_idx" to "opcode" in struct sm6_cmp_info. 2025-10-09 15:51:55 +02:00
Giovanni Mascellani
0a3d2f877d vkd3d-shader/dxil: Rename "handler_idx" to "opcode" in sm6_parser_emit_dx_dot(). 2025-10-09 15:51:48 +02:00
Giovanni Mascellani
00993b7fa9 vkd3d-shader/dxil: Rename "handler_idx" to "opcode" in sm6_parser_dcl_register_builtin(). 2025-10-09 15:51:40 +02:00
Giovanni Mascellani
ebb320346a vkd3d-shader/dxil: Rename "handler_idx" to "opcode" in sm6_parser_emit_dx_atomic_binop(). 2025-10-09 15:51:33 +02:00
Giovanni Mascellani
9779b62699 vkd3d-shader/dxil: Rename "handler_idx" to "opcode" in instruction_init_with_resource(). 2025-10-09 15:51:25 +02:00
Giovanni Mascellani
39a9f0921c vkd3d-shader/dxil: Rename "handler_idx" to "opcode" in sm6_parser_emit_binop(). 2025-10-09 15:51:18 +02:00
Henri Verbeet
32a6967778 vkd3d-shader/dxil: Ignore ORDERING_SEQCST.
More recent versions of the Vulkan/SPIR-V validation layers have started
to complain about our usage of "SequentiallyConsistent" in our SPIR-V
output. Specifically, VUID-StandaloneSpirv-MemorySemantics-10866 "Memory
Semantics with SequentiallyConsistent memory order must not be used in
the Vulkan API".

The SPIR-V specification says: "If the declared memory model is Vulkan,
SequentiallyConsistent must not be used." However, we're using the
GLSL450 memory model with SPIR-V 1.3, and "Vulkan" is not available
before SPIR-V 1.5.

The Vulkan specification says "Sequentially consistent atomics and
barriers are not supported and SequentiallyConsistent is treated as
AcquireRelease. SequentiallyConsistent should not be used." in the
"Shader Memory Access Ordering" section.

Those don't quite add up to the "... must not be used in the Vulkan
API", from the validation layers, but it does seem clear that
SequentiallyConsistent isn't actually supported. On the DXIL side, when
targetting SPIR-V with dxc, the generated SPIR-V uses the
"None"/"Relaxed" memory semantics. I wasn't immediately able to find a
reference for what seq_cst is supposed to mean in the context of DXIL,
but "None"/"Relaxed" does seem consistent with how the HLSL
atomic/interlocked intrinsics are expected to behave, as well as with
our behaviour for tpf shaders.
2025-10-09 15:39:41 +02:00
Giovanni Mascellani
c0db7f7ff5 vkd3d-shader/dxil: Generate ABS instructions instead of using modifiers. 2025-10-08 13:30:17 +02:00
Conor McCarthy
2d508a2fa6 vkd3d-shader: Set the program block count to the maximum for any function.
The block count is intended to be used for allocation of block info.
2025-10-03 00:22:03 +02:00
Francisco Casas
da4d5ef339 vkd3d-shader/dxil: Get rid of sm6_parser_require_space().
It's not obvious what this last remaining use of
sm6_parser_require_space() is preallocating space for, and that's as
good of a reason as any to get rid of it.
2025-10-03 00:10:06 +02:00
Francisco Casas
03a58d74b9 vkd3d-shader/dxil: Don't preallocate instructions in sm6_function_emit_blocks(). 2025-10-02 23:53:32 +02:00
Francisco Casas
626ad24ffe vkd3d-shader/dxil: Don't preallocate instructions in sm6_parser_globals_init(). 2025-10-02 23:53:27 +02:00
Francisco Casas
f30141f086 vkd3d-shader/dxil: Propagate parser errors in sm6_parser_init(). 2025-10-02 23:52:19 +02:00
Francisco Casas
d774cde932 vkd3d-shader/dxil: Propagate the vkd3d_result of sm6_parser_declare_global(). 2025-10-02 23:49:28 +02:00
Francisco Casas
1512c6c809 vkd3d-shader/dxil: Set the parser status to VKD3D_ERROR_NOT_IMPLEMENTED on missing functionality. 2025-10-02 23:47:50 +02:00
Francisco Casas
aa943c51ea vkd3d-shader/dxil: Handle sm6_parser_add_instruction() returning NULL.
Only calls to sm6_parser_add_instruction() where we are using the
returned vkd3d_shader_instruction are checked for, since these return
values might cause NULL dereferences if unchecked.

Other calls to sm6_parser_add_instruction() can be left alone since the
error is still recorded via sm6->p.status.
2025-10-02 23:40:56 +02:00
Francisco Casas
bdba25d028 vkd3d-shader: Store a vkd3d_result in struct vkd3d_shader_parser. 2025-10-02 23:40:51 +02:00
Henri Verbeet
a1451f8113 vkd3d-shader/ir: Require signed operands for IMIN instructions. 2025-09-18 11:30:20 +02:00
Henri Verbeet
8eebc71c13 vkd3d-shader/ir: Require signed operands for IMAX instructions. 2025-09-18 11:30:19 +02:00