Commit Graph

8101 Commits

Author SHA1 Message Date
Henri Verbeet
5bbd44c063 vkd3d-shader: Implement scanning compute shader thread group size information.
Metal doesn't allow the thread group size to be specified by shaders,
instead requiring it to be specified by the dispatch API.
2025-08-21 16:02:44 +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
Shaun Ren
245430002a vkd3d-shader/hlsl: Fold some general unary identities.
The following unary identities are applied:

  ||x|| -> |x|
  |-x| -> |x|
  ~(~x) -> x
  f(g(x)) -> g(x), where f(), g() are floor() or ceil() functions.
  -(-x) -> x
  !!x -> x
  !(x == y) -> x != y, !(x < y) -> x >= y, etc (for integers).
2025-08-21 16:00:46 +02:00
Shaun Ren
45e549c1b2 vkd3d-shader/msl: Implement VSIR_OP_UGE. 2025-08-21 15:32:37 +02:00
Shaun Ren
b8776bb6bd vkd3d-shader/glsl: Implement VSIR_OP_UGE. 2025-08-21 15:32:37 +02:00
Shaun Ren
4c37800f52 vkd3d-shader/hlsl: Check whether "expr" has more than 2 operands in hlsl_normalize_binary_exprs(). 2025-08-21 15:32:27 +02:00
Petrichor Park
d964d55b4a vkd3d-shader/hlsl: Implement the frexp() intrinsic. 2025-08-21 15:29:27 +02:00
Petrichor Park
ea6104cf5e tests/hlsl: Add some tests for the frexp() intrinsic. 2025-08-21 15:29:27 +02:00
Petrichor Park
0b8abe754a tests: Normalise NAN values in compare_float() and compare_double().
I.e., ignore the mantissa/payload of NAN values.
2025-08-21 15:29:27 +02:00
Henri Verbeet
a083748626 tests/shader_runner: Use read_f64() to parse "uniform" directives. 2025-08-21 15:29:27 +02:00
Henri Verbeet
31136ead05 tests/shader_runner: Use read_f32() to parse "uniform" directives. 2025-08-21 15:29:27 +02:00
Henri Verbeet
f732fb7889 Release 1.17. vkd3d-1.17 2025-08-21 12:52:13 +02:00
Brendan Shanks
44fffee5e1 tests: Add dxcompiler.h to .gitignore. 2025-08-14 10:34:44 +02:00
Brendan Shanks
bb2a6a0322 include: Add additional generated files to .gitignore. 2025-08-14 10:34:44 +02:00
Henri Verbeet
975ba8f9da vkd3d-shader: Document that vkd3d_shader_scan() supports HLSL sources. 2025-08-14 10:33:45 +02:00
Francisco Casas
7007a1e264 vkd3d-compiler: Set a default target type even when preprocessing.
We largely ignore the target type when preprocessing, but still
dereference options.target_type in a couple of places. E.g. when setting
info.target_type. We could add more checks for options.preprocess_only
to account for that, but it seems more robust to make sure
options.target_type is never NULL.
2025-08-13 16:12:50 +02:00
Henri Verbeet
cab0bd07e5 vkd3d-shader/glsl: Resolve SSA values.
Since commit eaebef4265 we may receive
vsir generated from HLSL sources, which typically contains SSA values.
We could previously receive vsir with SSA values as well, but HLSL
sources would go through d3dbc/tpf as an intermediate step, making the
resulting vsir much less likely to contain SSA values.
2025-08-13 15:56:06 +02:00
Henri Verbeet
9336b4647c vkd3d-shader/d3d-asm: Resolve SSA values when outputting SM<6 assembly.
In particular, since commit eaebef4265 we
may receive vsir generated from HLSL sources, which typically contains
SSA values.
2025-08-13 15:55:31 +02:00
Henri Verbeet
8334386d99 vkd3d-shader/spirv: Avoid emitting duplicate built-in inputs in spirv_compiler_emit_input().
This works around an issue introduced by commit
66cb2815f0. SV_PRIMITIVE_ID inputs in
geometry shaders use VKD3DSPR_PRIMID registers, and we create the
corresponding SPIR-V inputs using spirv_compiler_emit_io_register().
Unfortunately we also have an input signature element for the same
input, and simply creating another PrimitiveId input would run into
VUID-StandaloneSpirv-OpEntryPoint-09658.

Before the commit mentioned above, we'd use DCL_INPUT instructions to
emit input declarations, and these would help to distinguish whether
VKD3DSPR_INPUT or VKD3DSPR_PRIMID registers were used for primitive ID
inputs. Note that we can't simply ignore input signature element with
SIGNATURE_TARGET_LOCATION_UNUSED; the DXIL parser emits SV_SAMPLE_INDEX
inputs with that target location, but does require them to use a
VKD3DSPR_INPUT register.
2025-08-13 15:54:12 +02:00
Francisco Casas
880cb1083f vkd3d-shader/ir: Use iterators in vsir_program_insert_point_coord(). 2025-08-07 20:43:28 +02:00
Francisco Casas
a91b880afa vkd3d-shader/ir: Use iterators in vsir_program_insert_point_size_clamp(). 2025-08-07 20:43:28 +02:00
Francisco Casas
0ed34c22c9 vkd3d-shader/ir: Use iterators in vsir_program_insert_point_size(). 2025-08-07 20:43:28 +02:00
Francisco Casas
14643b02f6 vkd3d-shader/ir: Use iterators in vsir_program_insert_clip_planes(). 2025-08-07 20:43:28 +02:00
Francisco Casas
bd52ed8918 vkd3d-shader/ir: Use iterators in vsir_program_insert_alpha_test(). 2025-08-07 20:43:28 +02:00
Henri Verbeet
f7890fc54c vkd3d-shader/hlsl: Support HLSL sources in vkd3d_shader_scan(). 2025-08-07 20:40:01 +02:00