Conor McCarthy
0610867334
vkd3d-shader/spirv: Emit an error if 64-bit integers are used.
2023-12-12 22:50:48 +01:00
Conor McCarthy
1929432559
vkd3d-shader: Introduce an instruction flag to suppress masking of bitwise shift counts.
...
DXIL does not use implicit masking of shift counts.
2023-12-12 22:50:46 +01:00
Conor McCarthy
2037daae32
vkd3d-shader/spirv: Bitcast if necessary in the spirv_compiler_emit_mov() general implementation.
...
In SM 6, this is needed when storing an asfloat() or asuint() result in
an indexable temp, because dxc performs the bitcast by casting the
destination pointer.
2023-12-11 23:18:52 +01:00
Zebediah Figura
66cb2815f0
vkd3d-shader/spirv: Declare I/O registers from the signature.
...
Instead of parsing DCL instructions.
This allows sm1 to work without further effort, and simplifies sm6 code.
2023-12-11 23:18:44 +01:00
Zebediah Figura
8876030590
vkd3d-shader/spirv: Do not use the output_info array for patch constants.
2023-12-11 23:18:40 +01:00
Conor McCarthy
cb88844a3d
vkd3d-shader: Add a register index to struct vkd3d_shader_immediate_constant_buffer.
2023-12-07 21:56:47 +01:00
Conor McCarthy
ef940cb778
vkd3d-shader/spirv: Support declared component type and count in immediate constant buffers.
2023-12-07 21:56:45 +01:00
Conor McCarthy
16cb6fdbad
vkd3d-shader/spirv: Support constant initialisers in indexable temps.
2023-12-07 21:56:44 +01:00
Conor McCarthy
69c3946c85
vkd3d-shader/spirv: Support declared component type and count in indexable temps.
2023-12-07 21:56:41 +01:00
Henri Verbeet
0c33f82f72
Release 1.10.
2023-12-06 15:31:21 +01:00
Conor McCarthy
9fcc904834
vkd3d-shader/spirv: Always emit clip/cull builtins as an array.
...
Clip/cull distance can appear as input in pixel shaders, and the
array size must not be forced to zero.
2023-12-06 15:31:20 +01:00
Conor McCarthy
b4d03c0221
vkd3d-shader/spirv: Do not emit a fixme for SV_TARGET in vkd3d_get_spirv_builtin().
2023-12-04 22:22:55 +01:00
Conor McCarthy
f11e1461aa
vkd3d-shader/spirv: Do not emit a fixme for SV_TARGET in get_spirv_builtin_for_sysval().
2023-12-04 22:22:54 +01:00
Conor McCarthy
eb05e434ff
vkd3d-shader/dxil: Implement the DXIL LOAD instruction.
2023-11-22 22:07:59 +01:00
Conor McCarthy
a0f5d70792
vkd3d-shader/dxil: Support global variable initialisers.
2023-11-22 22:07:57 +01:00
Conor McCarthy
85d5f83fb7
vkd3d-shader/dxil: Implement default address space global variables.
2023-11-22 22:07:54 +01:00
Conor McCarthy
fb588b8d1a
vkd3d-shader/spirv: Avoid invalid bool-to-bool conversion in spirv_compiler_emit_movc().
...
Shaders parsed from DXIL contain a bool condition register, so calling
spirv_compiler_emit_int_to_bool() results in an invalid bool/uint
comparison.
2023-11-15 21:48:36 +01:00
Conor McCarthy
08b8730866
vkd3d-shader/spirv: Return an error if an invalid handler is encountered.
...
Prevents return of an invalid SPIR-V module.
2023-11-15 21:48:31 +01:00
Henri Verbeet
215a2c4ede
vkd3d-shader/ir: Introduce vsir_register_is_descriptor().
2023-11-13 23:19:10 +01:00
Conor McCarthy
22960753e9
vkd3d-shader/spirv: Introduce orderedness to comparison instructions.
2023-11-10 20:23:51 +01:00
Conor McCarthy
1dd141535c
vkd3d-shader/spirv: Support bool dst register in spirv_compiler_emit_comparison_instruction().
2023-11-10 20:23:48 +01:00
Zebediah Figura
011e31f624
vkd3d-shader/spirv: Remove no longer used private_output_variable_array_idx array.
2023-11-09 21:15:01 +01:00
Zebediah Figura
8513f567fa
vkd3d-shader/spirv: Look up builtins by vkd3d_shader_sysval_semantic.
...
Instead of by vkd3d_shader_input_sysval_semantic.
2023-11-09 21:14:57 +01:00
Zebediah Figura
87cb66dd43
vkd3d-shader/spirv: Simplify spirv_compiler_emit_dcl_input().
2023-11-09 21:14:55 +01:00
Zebediah Figura
c7a7d9a18c
vkd3d-shader/ir: Normalize all I/O registers to INPUT/OUTPUT/PATCHCONST.
...
Specifically, map COLOROUT to OUTPUT, and map INCONTROLPOINT to INPUT for domain
shaders as well as hull shaders.
Obscure the non-existent differences from the view of the backend.
2023-11-09 21:14:52 +01:00
Conor McCarthy
bd77cbb33f
vkd3d-shader/spirv: Support double in spirv_compiler_emit_ftou().
2023-11-09 21:14:40 +01:00
Conor McCarthy
92d546f3a2
vkd3d-shader/spirv: Support double in spirv_compiler_emit_ftoi().
2023-11-09 21:14:37 +01:00
Conor McCarthy
169210558d
vkd3d-shader/spirv: Handle unsigned result in spirv_compiler_emit_ftoi().
2023-11-09 21:14:35 +01:00
Conor McCarthy
58ffb5d181
vkd3d-shader/spirv: Introduce integer width cast instructions.
...
ITOI and UTOU may cast from a bool to a 32-bit integer. Cast to a 64-bit
integer from a smaller type will be added later.
2023-11-09 21:14:32 +01:00
Conor McCarthy
7de4ac2e48
vkd3d-shader/spirv: Support bool cast in spirv_compiler_emit_alu_instruction().
2023-11-09 21:14:30 +01:00
Conor McCarthy
5b87d6419a
vkd3d-shader/spirv: Support bool logic ops in spirv_compiler_emit_alu_instruction().
2023-11-09 21:14:27 +01:00
Conor McCarthy
b43dab50c1
vkd3d-shader/spirv: Support bitcast in spirv_compiler_emit_load_ssa_reg().
2023-11-09 21:14:25 +01:00
Henri Verbeet
e7eec3e023
vkd3d-shader/spirv: Allow the origin of fragment coordinates to be specified.
...
We typically want to use lower-left in OpenGL environments when rendering to
FBOs.
2023-11-09 21:14:12 +01:00
Zebediah Figura
12240efa79
vkd3d-shader/spirv: Use register counts from the signature and shader desc.
2023-11-07 22:26:49 +01:00
Zebediah Figura
0058764f01
vkd3d-shader: Store the control point counts in struct vkd3d_shader_desc.
2023-11-07 22:26:49 +01:00
Zebediah Figura
3ff22ac5af
vkd3d-shader/spirv: Use the array sizes for shader phase builtins as well.
2023-11-07 22:26:47 +01:00
Conor McCarthy
3e0638148a
vkd3d-shader/spirv: Support VKD3D_DATA_UINT in spirv_compiler_emit_neg().
...
The DXIL parser uses unsigned types even if the source code uses signed,
so unsigned values may be negated.
2023-11-06 23:09:02 +01:00
Conor McCarthy
4905d047bd
vkd3d-shader/spirv: Handle the UMUL instruction.
2023-11-06 23:09:01 +01:00
Conor McCarthy
acbc80cba2
vkd3d-shader/spirv: Introduce an IDIV instruction.
2023-11-06 23:09:00 +01:00
Conor McCarthy
c8d3515d8b
vkd3d-shader/spirv: Introduce an FREM instruction.
2023-11-06 23:08:58 +01:00
Giovanni Mascellani
0d4aebd2e7
vkd3d-shader: Explicitly cast vkd3d_shader_global_flags to uint64_t.
...
On macOS vkd3d_shader_global_flags has underlying type unsigned long,
while uint64_t is defined as unsigned long long. This difference
causes a few warnings to be raised.
2023-11-06 23:08:37 +01:00
Zebediah Figura
f05be8ff12
vkd3d-shader/spirv: No longer handle builtin array size mismatch in spirv_compiler_emit_input().
...
This is taken care of by prior I/O lowering. We no longer need to deal with this here.
2023-11-06 23:07:59 +01:00
Zebediah Figura
fa23165cc0
vkd3d-shader/spirv: Remove handling of VKD3DSPR_OUTCONTROLPOINT.
...
I/O normalization removes this register type.
2023-11-06 23:07:58 +01:00
Zebediah Figura
b73d2c978d
vkd3d-shader/ir: Check for vocp usage during IR normalization.
...
The hull shader barrier used for this was broken by I/O normalization, since
vocp is no longer exposed to the spirv backend.
Restore this barrier by checking for vocp during normalization instead.
2023-11-06 23:07:56 +01:00
Conor McCarthy
e899b67bbf
vkd3d-shader/spirv: Support scalar swizzle of vector SSA registers.
2023-11-01 21:47:33 +01:00
Zebediah Figura
a66acea1b5
vkd3d-shader/spirv: Always use the sysval from the signature.
2023-10-31 21:59:40 +01:00
Zebediah Figura
eef62b95c1
vkd3d-shader/spirv: Use the interpolation mode from the signature.
2023-10-31 21:59:39 +01:00
Conor McCarthy
9b64d04ed3
vkd3d-shader/spirv: Align constant buffer sizes to 16 bytes.
...
DXIL constant buffer sizes are not aligned to 16 bytes.
2023-10-19 23:07:40 +02:00
Henri Verbeet
4e8ba62481
vkd3d-shader/spirv: Initialise "symbol.descriptor_array" in spirv_compiler_emit_combined_sampler_declarations().
...
Besides simply avoiding carrying around some uninitialised data, we
check "symbol->descriptor_array" in spirv_compiler_prepare_image(), both
for separate resources and for combined resource/sampler symbols.
2023-10-17 22:18:44 +02:00
Conor McCarthy
06f8a88466
vkd3d-shader: Define more global flags.
2023-10-17 22:18:23 +02:00
Francisco Casas
f0da419a8c
vkd3d-shader: Remove unnecessary fallthroughs (clangd).
2023-10-12 23:27:19 +02:00
Conor McCarthy
df4e1b7393
vkd3d-shader/dxil: Read immediate constant arrays.
2023-10-11 22:21:19 +02:00
Conor McCarthy
75c2af3640
vkd3d-shader/spirv: When declaring a CBV initialise the register with the register index range.
...
The declaration instruction register contains id, range first, and range
last. The backend includes range first in the variable name. After commit
e8b3561252
it was always zero, and since commit 67f0196c33
it is
UINT_MAX, so constant buffers are named, e.g., "%cb0_4294967295".
2023-10-09 21:58:01 +02:00
Zebediah Figura
a4c5f3a798
vkd3d-shader/spirv: Add a debug name for the push constant buffer.
2023-10-09 21:57:53 +02:00
Henri Verbeet
98d158d004
vkd3d-shader/tpf: Get rid of the output map.
...
Map output registers in the backend instead, as needed.
2023-10-09 21:57:46 +02:00
Francisco Casas
e904660497
vkd3d-shader: Turn vkd3d_shader_register.immconst_type into vkd3d_shader_register.dimension.
2023-09-26 22:07:04 +02:00
Francisco Casas
6f5cb219f4
vkd3d-shader/spirv: Use vsir_register_init() in spirv_compiler_emit_default_control_point_phase().
2023-09-26 22:07:00 +02:00
Francisco Casas
81802e27d0
vkd3d-shader/spirv: Use vsir_register_init() in spirv_compiler_emit_resource_declaration().
2023-09-26 22:06:59 +02:00
Francisco Casas
314c6e4808
vkd3d-shader/spirv: Use vsir_register_init() in spirv_compiler_emit_sampler_declaration().
2023-09-26 22:06:58 +02:00
Francisco Casas
b2f262467f
vkd3d-shader/spirv: Use vsir_register_init() in spirv_compiler_emit_dcl_immediate_constant_buffer().
2023-09-26 22:06:56 +02:00
Francisco Casas
67f0196c33
vkd3d-shader/spirv: Use vsir_register_init() in spirv_compiler_emit_cbv_declaration().
2023-09-26 22:06:55 +02:00
Francisco Casas
04529bc0b7
vkd3d-shader/spirv: Use vsir_register_init() in spirv_compiler_emit_dcl_indexable_temp().
2023-09-26 22:06:54 +02:00
Francisco Casas
e174f6b413
vkd3d-shader/spirv: Use vsir_register_init() in spirv_compiler_emit_hull_shader_builtins().
2023-09-26 22:06:53 +02:00
Francisco Casas
89d7bd7a81
vkd3d-shader/spirv: Use vsir_register_init() in spirv_compiler_get_invocation_id().
2023-09-26 22:06:52 +02:00
Conor McCarthy
575135a9ce
vkd3d-shader/spirv: Build undefined values once.
2023-09-25 22:07:05 +02:00
Conor McCarthy
3249723972
vkd3d-shader/spirv: Introduce a Static Single Assignment register type.
2023-09-25 22:07:04 +02:00
Zebediah Figura
257a351f37
vkd3d-shader/spirv: Flush NaN to zero in ftoi.
2023-09-25 22:06:45 +02:00
Zebediah Figura
a5b6162d25
vkd3d-shader/spirv: Clamp ftoi upper bound to INT_MAX.
2023-09-25 22:06:44 +02:00
Zebediah Figura
9dee15da5b
vkd3d-shader/spirv: Clamp ftoi lower bound to INT_MIN.
2023-09-25 22:06:43 +02:00
Zebediah Figura
cc893a3368
vkd3d-shader/spirv: Clamp ftou upper bound to UINT_MAX.
2023-09-25 22:06:41 +02:00
Zebediah Figura
491146fa94
vkd3d-shader/spirv: Clamp ftou lower bound to zero.
2023-09-25 22:06:39 +02:00
Henri Verbeet
90d4529f27
Release 1.9.
2023-09-21 19:16:32 +02:00
Conor McCarthy
3badab2086
vkd3d-shader: Handle size in bytes in spirv_compiler_emit_cbv_declaration().
...
The caller passes a byte size now.
2023-09-04 20:25:33 +02:00
Conor McCarthy
61a550017f
vkd3d-shader/spirv: Handle signature element mask left shift in spirv_compiler_emit_output().
...
Element masks can have a left shift in DXIL, but these must start at
bit 0 in the register info. The SPIR-V declaration will either be a
builtin or have SpvDecorationComponent.
2023-08-30 22:48:43 +02:00
Conor McCarthy
ebc461f795
vkd3d-shader/spirv: Handle signature element mask left shift in calculate_clip_or_cull_distance_mask().
...
In DXIL these masks can have a left shift.
2023-08-30 22:48:41 +02:00
Zebediah Figura
9624e2f904
vkd3d-shader/spirv: Declare SRVs and UAVs from the descriptor info.
2023-08-28 20:40:02 +02:00
Zebediah Figura
e8b3561252
vkd3d-shader/spirv: Declare constant buffers from the descriptor info.
2023-08-28 20:40:01 +02:00
Zebediah Figura
547768bcdd
vkd3d-shader/spirv: Declare samplers from the descriptor info.
2023-08-28 20:39:59 +02:00
Zebediah Figura
a1e10e5c90
vkd3d-shader/spirv: Split spirv_compiler_has_combined_sampler() into two functions.
...
These functions do not really share any code in common.
2023-08-28 20:39:57 +02:00
Conor McCarthy
92021b7a3c
vkd3d-shader/tpf: Use the default vec4 swizzle if a src param contains a mask.
2023-08-28 20:39:46 +02:00
Conor McCarthy
7e5d9e3b6f
vkd3d-shader/tpf: Handle the dimension bitfield in src param tokens.
2023-08-28 20:39:45 +02:00
Zebediah Figura
4e9798f6f7
vkd3d-shader: Introduce struct vkd3d_shader_scan_descriptor_info1.
2023-08-14 18:38:11 +02:00
Zebediah Figura
d932fba7c3
vkd3d-shader/spirv: Make output varyings not consumed by the next stage private variables.
2023-08-03 21:20:42 +09:00
Zebediah Figura
11475ef62a
vkd3d-shader: Implement remapping shader output registers to match the next shader's semantics.
2023-08-03 21:20:42 +09:00
Zebediah Figura
cb96482500
vkd3d-shader: Add a separate field for the target location of a signature element.
...
We want to be able to remap input signatures based on the signature index, but
signature normalization both reorders the signature, and requires the old
register index, so add a new field for this.
2023-08-03 21:20:39 +09:00
Conor McCarthy
402c93fa68
vkd3d-shader/spirv: Introduce an undefined register type.
2023-07-20 22:32:52 +02:00
Zebediah Figura
e0e261eac3
vkd3d-shader/spirv: Emit variables for flat constant buffers.
2023-07-17 22:56:47 +02:00
Zebediah Figura
e9fb067d4c
vkd3d-shader/ir: Move normalization code from spirv.c to ir.c.
...
It is not spirv-specific and will (presumably) be used for GLSL as well.
2023-07-17 22:56:43 +02:00
Andrey Gusev
d4d960cb8b
vkd3d-shader/spirv: Add support for VKD3DSIM_LINEAR_NOPERSPECTIVE_SAMPLE interpolation qualifier.
...
Used by F1 2018.
2023-07-10 23:17:59 +02:00
Zebediah Figura
e489098878
vkd3d-shader: Record a global temporary count per sm4 shader.
...
Store it in the shader_desc, and declare temps from that when compiling SPIR-V,
instead of parsing dcl_instructions.
As part of this change, we declare a single, global temps array (with Private
scope instead of Function) which is as large as the maximum of all dcl_temps
instructions. It is not clear to me whether this will improve, hurt, or have no
significant effect on the lower-level compiler. An alternative is to still
redeclare a new temps array every time (although still with a smaller size).
2023-07-04 22:39:45 +02:00
Henri Verbeet
771e442af1
Release 1.8.
2023-06-22 22:00:20 +02:00
Conor McCarthy
bce2a898b3
vkd3d-shader/spirv: Take ownership of the shader signatures in spirv_compiler_create().
...
Fixes leakage of the replacement elements in shader_signature_merge().
2023-06-19 22:44:07 +02:00
Zebediah Figura
df0a031ad8
vkd3d-shader/spirv: Retrieve input sysvals from the signature for geometry shaders as well.
...
This only affects clip and cull distances. The HLSL compiler emits these using
dcl_input, but the previous shader (vertex or TES) will write them as a SPIRV
builtin, and hence we want to read this as a SPIRV builtin as well.
This fixes validation errors in Wine's test_clip_distance().
2023-06-12 22:50:19 +02:00
Jan Sikorski
bb680e73de
vkd3d-shader/spirv: Ensure that the OpLabel emitted vkd3d_spirv_builder_begin_main_function() gets terminated.
2023-05-26 19:11:55 +02:00
Conor McCarthy
4a64cf74c3
vkd3d-shader/spirv: Use the register index count in I/O relative address assertions.
2023-05-26 19:11:07 +02:00
Conor McCarthy
06dd0ccd4c
vkd3d-shader/spirv: Use the register index count in I/O register assertions.
2023-05-26 19:11:03 +02:00
Conor McCarthy
178a7677e2
vkd3d-shader/spirv: Use the register index count in shader_register_get_io_indices().
2023-05-26 19:11:02 +02:00
Conor McCarthy
d46250a59b
vkd3d-shader/spirv: Use the register index count in default register dereferences.
2023-05-26 19:11:00 +02:00
Conor McCarthy
a2b3f70d8e
vkd3d-shader/spirv: Use the register index count in aggregate register dereferences.
2023-05-26 19:10:58 +02:00
Conor McCarthy
ad08864134
vkd3d-shader/spirv: Use the register index count in spirv_compiler_get_register_name().
2023-05-26 19:10:56 +02:00