Francisco Casas
51aa5a45e9
vkd3d-shader/tpf: Use vsir_register_init() in shader_sm1_parse_src_param().
2023-09-26 22:07:02 +02:00
Francisco Casas
c1d9e776e2
vkd3d-shader/tpf: Use vsir_register_init() in shader_sm4_read_param().
2023-09-26 22:07:01 +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
Francisco Casas
5d6899888d
vkd3d-shader: Rename shader_register_init() to vsir_register_init().
2023-09-26 22:06:50 +02:00
Giovanni Mascellani
d9c8b49ea0
vkd3d-shader/ir: Remove dead code during normalisation.
...
The SPIR-V backend generates invalid SPIR-V code when
VSIR has dead code (except for NOPs).
2023-09-25 22:07:27 +02:00
Zebediah Figura
fcda20a8c3
vkd3d-shader/hlsl: Use lower_ir() for lower_sqrt().
2023-09-25 22:07:23 +02:00
Zebediah Figura
496a3a2093
vkd3d-shader/hlsl: Use lower_ir() for lower_division().
2023-09-25 22:07:22 +02:00
Zebediah Figura
ecd781e809
vkd3d-shader/hlsl: Use lower_ir() for lower_int_abs().
2023-09-25 22:07:21 +02:00
Zebediah Figura
7944ee9bed
vkd3d-shader/hlsl: Use lower_ir() for lower_casts_to_bool().
2023-09-25 22:07:20 +02:00
Zebediah Figura
65bf6e997c
vkd3d-shader/hlsl: Use lower_ir() for more passes.
2023-09-25 22:07:18 +02:00
Petrichor Park
976fd67f51
vkd3d-shader/hlsl: Implement intrinsic tan.
...
This commit also extends the trigonometry tests a little bit to make
sure that tan works right.
2023-09-25 22:07:13 +02:00
Conor McCarthy
6ec5e5bf54
vkd3d-shader/dxil: Implement DX instruction LoadInput.
2023-09-25 22:07:09 +02:00
Conor McCarthy
644a06dcca
vkd3d-shader/dxil: Declare shader inputs.
2023-09-25 22:07:08 +02:00
Conor McCarthy
5984b4e455
vkd3d-shader/dxbc: Load input signatures also from ISG1 chunks.
...
When DXBC contains DXIL code it uses ISG1 signatures.
2023-09-25 22:07:06 +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
Conor McCarthy
a67a85989f
vkd3d-shader/d3d-asm: Trace undefined registers.
2023-09-25 22:07:02 +02:00
Conor McCarthy
b765f3c770
vkd3d-shader: Make the paramater allocator slab size at least MAX_REG_OUTPUT.
...
The allocator is used for DXIL input/output parameter arrays.
2023-09-25 22:07:01 +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
Giovanni Mascellani
b9fa8cfaa6
vkd3d: Set the image aspect when clearing UAVs.
...
This fixes a number of tests on Mesa on Intel.
2023-09-22 11:06:55 +02:00
Nikolay Sivov
485cbe8cb7
vkd3d-shader/hlsl: Add constant folding for 'sat'.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-22 11:06:35 +02:00
Nikolay Sivov
89c99cccce
vkd3d-shader/hlsl: Add constant folding for 'exp2'.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-22 11:06:34 +02:00
Nikolay Sivov
c16c5caad8
vkd3d-shader/hlsl: Add constant folding for 'fract'.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-22 11:06:33 +02:00
Giovanni Mascellani
c69562128a
vkd3d-shader/hlsl: Correctly fold casts from double.
2023-09-22 11:06:29 +02:00
Giovanni Mascellani
49bbd98a04
vkd3d-shader/hlsl: Correctly fold casts from float.
...
I.e., without invoking undefined behavior in the compiler. The rules
are desumed from the the MSDN documentation for ftoi and ftou.
2023-09-22 11:06:28 +02:00
Nikolay Sivov
d9c984c11a
vkd3d-shader/hlsl: Add constant folding for the ternary operator.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-22 11:06:23 +02:00
Nikolay Sivov
6d1ba83856
vkd3d-shader/hlsl: Use conditional moves for arithmetic operators instead of branching.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-22 11:06:22 +02:00
Giovanni Mascellani
34b1c0fe5d
vkd3d-shader/ir: Validate source parameters.
2023-09-22 11:06:18 +02:00
Giovanni Mascellani
603170106c
vkd3d-shader/ir: Validate destination parameters.
2023-09-22 11:06:17 +02:00
Giovanni Mascellani
585e60ad3b
vkd3d-shader/ir: Validate register types.
2023-09-22 11:06:16 +02:00
Giovanni Mascellani
b09cfbda90
vkd3d-shader/ir: Validate instruction handlers.
2023-09-22 11:06:15 +02:00
Giovanni Mascellani
c052cd8998
vkd3d-shader/ir: Introduce a boilerplate to validate the generated IR.
...
For the moment the validator is trivial, it never fails. Checks will
be added incrementally.
2023-09-22 11:06:13 +02:00
Giovanni Mascellani
cf871d2cb2
vkd3d-shader: Embed the parsing location in vkd3d_shader_instruction.
...
So that it can be used for printing meaningful error locations by
downstream processors.
2023-09-22 11:06:12 +02:00
Giovanni Mascellani
531c41306d
vkd3d-shader/dxil: Destroy the SM6 parser on parsing errors.
2023-09-22 11:06:11 +02:00
Giovanni Mascellani
78220ed07e
vkd3d-shader/tpf: Destroy the SM4 parser on parsing errors.
2023-09-22 11:06:10 +02:00
Giovanni Mascellani
a2fb9588c7
vkd3d-shader/d3dbc: Destroy the SM1 parser on parsing errors.
2023-09-22 11:06:09 +02:00
Giovanni Mascellani
d1cb6b41b1
vkd3d-shader/d3dbc: Skip DCL semantic tokens properly.
2023-09-22 11:06:08 +02:00
Giovanni Mascellani
9487cc6ab5
vkd3d-shader/ir: Simplify the control flow in shader_instruction_normalise_io_params().
2023-09-22 11:06:06 +02:00
Giovanni Mascellani
5220125c9f
vkd3d-shader/ir: Fully reinitialize an instruction when making it a NOP.
2023-09-22 11:06:05 +02:00
Giovanni Mascellani
05af25eecb
vkd3d-shader: Rename shader_instruction_init().
2023-09-22 11:06:05 +02:00
Andrey Gusev
78ff0f3df4
vkd3d: Add ID3D12Device2 interface.
2023-09-22 11:05:59 +02:00
Henri Verbeet
90d4529f27
Release 1.9.
2023-09-21 19:16:32 +02:00
Zebediah Figura
9417c7cfb7
vkd3d-shader/d3dbc: Translate sm1 fragment outputs to system values.
2023-09-21 19:16:31 +02:00
Zebediah Figura
1615e5a76b
vkd3d-shader/dxbc: Map sm4 fragment outputs to system values based on their name.
2023-09-21 19:16:29 +02:00
Zebediah Figura
fd120d8f2d
vkd3d-shader: Rename vkd3d_shader_next_stage_info to vkd3d_shader_varying_map_info.
...
It was originally intended that this structure could hold other information
about the next stage which compilation might depend on. For example, compilation
to GLSL needs to know the type of the next shader in some circumstances.
That was never actualized, and since the API is fixed at this point for 1.9, it
makes the most sense to rename the structure to match its actual scope.
The documentation was written and arranged to imply that the structure would
hold other information about the next shader than the varying map; this is
changed accordingly as well.
2023-09-21 19:16:27 +02:00
Henri Verbeet
f796d8668e
vkd3d-shader: Export vkd3d_shader_build_varying_map.
2023-09-19 21:30:35 +02:00
Henri Verbeet
da89da2bf3
vkd3d-shader: Hide support for DXIL sources.
...
Unfortunately this is not sufficiently ready to release.
2023-09-18 21:04:19 +02:00
Giovanni Mascellani
ee28861837
vkd3d-shader/hlsl: Document some possibly obscure HLSL opcodes.
2023-09-14 20:28:55 +02:00
Giovanni Mascellani
f251da574c
vkd3d-shader/hlsl: Remove HLSL_OP3_LERP.
...
It is unused, and it's not clear whether it would be of any help to
have it.
2023-09-14 20:28:54 +02:00
Nikolay Sivov
45541dd9b2
vkd3d-shader/asm: Tweak TEXCOORD declaration name.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-13 23:11:16 +02:00
Nikolay Sivov
ee6c66eb1b
vkd3d-shader/d3dbc: Disallow 1D sampler types when writing sampler declaration.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-13 23:11:14 +02:00
Nikolay Sivov
177ea3bcbd
vkd3d-shader/hlsl: Produce 2D resource declarations and loads for tex1D().
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-13 23:11:11 +02:00
Francisco Casas
39563aa5b3
vkd3d-shader/hlsl: Lower matrix swizzles.
2023-09-13 23:10:38 +02:00
Nikolay Sivov
fc2aaee224
vkd3d-shader: Use ternary operator in fmod() implementation.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-07 19:15:26 +02:00
Nikolay Sivov
1002a6b357
vkd3d-shader/tpf: Use 'movc' to implement ternary operator.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-07 19:15:25 +02:00
Nikolay Sivov
c5d680d141
vkd3d-shader/hlsl: Add tex1D() function.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-07 19:15:06 +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
bad4c74002
vkd3d-shader: Match only UAV descriptors in vkd3d_shader_scan_add_uav_flag().
...
Fixes compilation failures in Cyberpunk 2077 due to missing UAV counter
flag.
2023-09-04 20:25:31 +02:00
Zebediah Figura
a597dc8755
vkd3d-shader/hlsl: Define lit() in HLSL.
2023-08-30 22:49:03 +02:00
Zebediah Figura
9ab77658f2
vkd3d-shader/hlsl: Define smoothstep() in HLSL.
2023-08-30 22:49:01 +02:00
Zebediah Figura
d396c4ce27
vkd3d-shader/hlsl: Store the internal name counter in struct hlsl_ctx.
...
This is minutely more efficient than using a global variable and atomic instructions.
2023-08-30 22:48:59 +02:00
Zebediah Figura
f22e52f358
vkd3d-shader/hlsl: Separate an add_user_call() helper.
2023-08-30 22:48:57 +02:00
Zebediah Figura
63e056512d
vkd3d-shader/hlsl: Introduce an hlsl_sprintf_alloc() helper.
2023-08-30 22:48:55 +02:00
Conor McCarthy
d27b8eb2c0
vkd3d-shader/dxil: Implement DX instruction StoreOutput.
2023-08-30 22:48:52 +02:00
Conor McCarthy
bf49a1a95b
vkd3d-shader/dxil: Declare shader outputs.
2023-08-30 22:48:50 +02:00
Conor McCarthy
e54f770669
vkd3d-shader/dxil: Implement the DXIL CALL instruction.
2023-08-30 22:48:48 +02:00
Conor McCarthy
720a087c28
vkd3d-shader/dxil: Replace the result type enum with a bool.
...
Changes to failure handling make the enum unnecessary.
2023-08-30 22:48:47 +02:00
Conor McCarthy
58d6e44501
vkd3d-shader/dxil: Validate the function block count.
2023-08-30 22:48:45 +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
Nikolay Sivov
c39c5b3907
vkd3d-shader/hlsl: Add texCUBE() function.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-29 22:07:56 +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
Nikolay Sivov
18c1477464
vkd3d-shader/hlsl: Ignore 'inline' modifier for functions.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-28 20:39:53 +02:00
Conor McCarthy
61841e9423
vkd3d-shader/tpf: Handle the swizzle type bitfield in dst param tokens.
2023-08-28 20:39:49 +02:00
Conor McCarthy
eddae47062
vkd3d-shader/tpf: Handle the dimension bitfield in dst param tokens.
...
A zero mask is still emitted for some scalar registers. This has no
effect on current tests, but keeping the correction is probably a good
idea.
2023-08-28 20:39:48 +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
Conor McCarthy
5c706152fa
vkd3d-shader/tpf: Validate the src register of case conditions.
...
Case values are constants in TPF.
2023-08-28 20:39:43 +02:00
Conor McCarthy
5c09752194
vkd3d: Do not flush descriptor heaps stored in the command list when the array size is exceeded.
...
An earlier patch introduced a bug which overflows the descriptor heap
array. The array should not be emptied here in case the list is
resubmitted, so just flush the new heap.
2023-08-24 21:44:03 +02:00
Francisco Casas
ed9e236b01
vkd3d-shader/tpf: Avoid reading constant value components beyond type's width (Valgrind).
...
We are passing map writemasks that may have more components than the
constant's data type, so a (j < width) check is added to avoid reading
components from the constant that are not intended to be used.
Remaining values in the register are initialized to zero.
2023-08-24 21:43:55 +02:00
Nikolay Sivov
89eda51855
vkd3d-shader/hlsl: Change warning code for unknown loop attributes.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-24 21:43:50 +02:00
Nikolay Sivov
1153f6bb34
vkd3d-shader/hlsl: Parse "if" statement attributes.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-24 21:43:49 +02:00
Zebediah Figura
926575a6f3
vkd3d-shader/hlsl: Force sm1 inputs to be 4-component only for vertex shaders.
...
Pixel shaders still have an appropriate writemask.
2023-08-24 21:43:44 +02:00
Zebediah Figura
622311da8e
vkd3d-shader: Add a flag marking raw buffers to struct vkd3d_shader_descriptor_info.
2023-08-23 22:45:04 +02:00
Zebediah Figura
c1ebba9515
vkd3d-shader: Add structure stride to struct vkd3d_shader_descriptor_info1.
2023-08-23 22:45:04 +02:00
Zebediah Figura
88f85ffb50
vkd3d-shader: Add constant buffer size to struct vkd3d_shader_descriptor_info1.
2023-08-23 22:45:04 +02:00
Zebediah Figura
8c465c81cf
vkd3d-shader: Add sample count to struct vkd3d_shader_descriptor_info1.
2023-08-23 22:45:04 +02:00
Zebediah Figura
ccedb7f711
vkd3d-shader: Set descriptor flags in the caller to vkd3d_shader_scan_add_descriptor().
...
Return the vkd3d_shader_descriptor_info1 from that function.
2023-08-23 22:45:02 +02:00
Conor McCarthy
f3baf55d97
vkd3d: Implement ID3D12Device1 with stubs.
2023-08-23 22:44:58 +02:00
Giovanni Mascellani
8f8c89fb87
vkd3d: Update a warning so that it aligns with the check that triggers it.
2023-08-23 22:44:52 +02:00
Conor McCarthy
3ca2259807
vkd3d: Fix invalid atomic behaviour in the view cache linked list.
...
The list suffers from the ABA problem, where comparison with the head
succeeds but the head's `next` pointer has changed. Occurs in Cyberpunk
2077, on NVIDIA at least.
2023-08-23 22:44:45 +02:00
Nikolay Sivov
4f2e07a45d
vkd3d-shader/hlsl: Allow 'const' modifier without initializer in the global scope.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-15 21:51:50 +02:00
Zebediah Figura
240b9424fb
vkd3d-shader/hlsl: Pass an hlsl_block pointer to append_output_copy().
2023-08-15 21:51:47 +02:00
Zebediah Figura
a04e3a51dd
vkd3d-shader/hlsl: Pass an hlsl_block pointer to prepend_input_copy().
2023-08-15 21:51:39 +02:00
Zebediah Figura
7a4ac1afb1
vkd3d-shader/hlsl: Pass an hlsl_block pointer to prepend_uniform_copy().
2023-08-15 21:51:37 +02:00
Francisco Casas
96f66aa4f8
vkd3d-shader/d3dbc: Use the bind count instead of the allocation size in d3dbc.c.
...
This should have no effect, since in SM1 the allocation size is the
same as the bind count because there are no texture registers.
It is just done for consistency.
2023-08-15 21:51:33 +02:00
Francisco Casas
d4a49d788a
vkd3d-shader/hlsl: Simplify computation of allocation size.
2023-08-15 21:51:32 +02:00
Francisco Casas
37cfbe47d7
vkd3d-shader/hlsl: Sort synthetic separated samplers first for SM4.
2023-08-15 21:51:31 +02:00
Francisco Casas
81afe43569
vkd3d-shader/tpf: Put the actual bind count in the RDEF table.
2023-08-15 21:51:29 +02:00
Francisco Casas
7eba063136
vkd3d-shader/hlsl: Rename hlsl_reg.bind_count to hlsl_reg.allocation_size.
...
We have to distinguish between the "bind count" and the "allocation size"
of variables.
The "allocation size" affects the starting register id for the resource to
be allocated next, while the "bind count" is determined by the last field
actually used. The former may be larger than the latter.
What we are currently calling hlsl_reg.bind_count is actually the
"allocation size", so a rename is in order.
The real "bind count", which will be introduced in following patches,
is important because it is what should be shown in the RDEF table and
some resource allocation rules depend on it.
For instance, for this shader:
texture2D texs[3];
texture2D tex;
float4 main() : sv_target
{
return texs[0].Load(int3(0, 0, 0)) + tex.Load(int3(0, 0, 0));
}
the variable "texs" has a "bind count" of 1, but an "allocation size" of
3:
// Resource Bindings:
//
// Name Type Format Dim HLSL Bind Count
// ------------------------------ ---------- ------- ----------- -------------- ------
// texs texture float4 2d t0 1
// tex texture float4 2d t3 1
2023-08-15 21:51:27 +02:00
Nikolay Sivov
98f63c46f8
vkd3d-shader/hlsl: Use type width in fold_rcp().
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-14 18:38:21 +02:00
Nikolay Sivov
932c5e36dc
vkd3d-shader/hlsl: Add constant folding for 'log2'.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-14 18:38:20 +02:00
Nikolay Sivov
58bc61e48d
vkd3d-shader/hlsl: Add constant folding for 'sqrt'.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-14 18:38:18 +02:00
Nikolay Sivov
7e99188dc7
vkd3d-shader: Add constant folding for 'dp2add' operation.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-14 18:38:15 +02:00
Nikolay Sivov
25ff56769b
vkd3d-shader: Add constant folding for the 'dot' operation.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-14 18:38:15 +02:00
Zebediah Figura
983d01df8c
vkd3d-shader: Get rid of the uav_ranges array.
...
This is now redundant; the register ID is encoded into the scan descriptors.
2023-08-14 18:38:11 +02:00
Zebediah Figura
7d02922541
vkd3d-shader: Add register ID to struct vkd3d_shader_descriptor_info1.
2023-08-14 18:38:11 +02:00
Zebediah Figura
4e9798f6f7
vkd3d-shader: Introduce struct vkd3d_shader_scan_descriptor_info1.
2023-08-14 18:38:11 +02:00
Zebediah Figura
fd4a820c4b
vkd3d-shader: Centralize cleanup on error in scan_with_parser().
2023-08-14 18:38:11 +02:00
Zebediah Figura
9c5cb2de18
vkd3d-shader: Factor more code into vkd3d_shader_scan_get_uav_descriptor_info().
2023-08-14 18:38:11 +02:00
Francisco Casas
8484bd59a6
vkd3d-shader/tpf: Separate dst register write function.
2023-08-14 18:38:08 +02:00
Francisco Casas
d1c45fe2f0
vkd3d-shader/tpf: Separate src register write function.
2023-08-14 18:38:07 +02:00
Francisco Casas
2258e9d0f3
vkd3d-shader/tpf: Make register_type_table an array of structs with lookup tables.
2023-08-14 18:38:06 +02:00
Francisco Casas
c77e5f1c1f
vkd3d-shader/tpf: Introduce struct tpf_writer to group sm4 write arguments.
...
We will add register information lookup tables on this struct later.
They will be used by sm4_encode_register(), and thus, they will be
required by write_sm4_instruction().
2023-08-14 18:38:05 +02:00
Francisco Casas
a584499c8a
vkd3d-shader/tpf: Use struct vkd3d_shader_register_index in sm4_register.idx[].
2023-08-14 18:38:04 +02:00
Francisco Casas
fc589add49
vkd3d-shader/tpf: Allow passing NULL register type on hlsl_sm4_register_from_semantic().
2023-08-14 18:38:03 +02:00
Francisco Casas
8a6a620ee2
vkd3d-shader/tpf: Use enum vkd3d_shader_register_type in sm4_register.type.
2023-08-14 18:38:01 +02:00
Zebediah Figura
cf6bc95a3d
vkd3d-shader/hlsl: Use hlsl_block_add_instr() in clone_block().
2023-08-08 21:15:16 +09:00
Zebediah Figura
4ae00cea43
vkd3d-shader/hlsl: Clean up the static_initializers block when the context is destroyed (Valgrind).
...
This is currently leaked if we fail parsing before reaching codegen.
2023-08-08 21:15:13 +09:00
Zebediah Figura
b22e2113a6
vkd3d-shader/hlsl: Pass a hlsl_block pointer to dump_instr_list().
2023-08-08 21:15:10 +09:00
Zebediah Figura
0652bb1950
vkd3d-shader/hlsl: Store the "instrs" field of struct hlsl_attribute as a hlsl_block.
2023-08-08 21:15:08 +09:00
Zebediah Figura
372ddd1f29
vkd3d-shader/hlsl: Pass an hlsl_block pointer to add_load_component().
2023-08-08 21:15:05 +09:00
Zebediah Figura
f649db23a5
vkd3d-shader: Introduce a function to build a varying map between sm1 stages.
2023-08-03 21:20:44 +09: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
Zebediah Figura
bad72d1874
vkd3d-shader/d3dbc: Make sure all inter-stage varyings have a unique register index.
...
spirv will need this.
2023-08-03 21:20:22 +09:00
Zebediah Figura
b4bb3931c5
vkd3d-shader/preproc: Append spaces between tokens in macro invocations.
2023-08-02 20:19:21 +09:00
Zebediah Figura
250a24bd3f
vkd3d-shader/preproc: Strip whitespace when stringifying.
2023-08-02 20:19:20 +09:00
Zebediah Figura
6fc3ae2b5c
vkd3d-shader/preproc: Stringify text immediately in macro invocations.
2023-08-02 20:19:19 +09:00
Zebediah Figura
cbb1d84069
vkd3d-shader/preproc: Separate a preproc_stringify() helper.
2023-08-02 20:19:18 +09:00
Zebediah Figura
3a235b57f6
vkd3d-shader/preproc: Expand macro arguments in macro invocations.
...
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55361
2023-08-02 20:19:17 +09:00
Zebediah Figura
9b98489155
vkd3d-shader/preproc: Parse hash marks as two separate tokens when not in stringification contexts.
2023-08-02 20:19:15 +09:00
Zebediah Figura
9a80ff28e4
vkd3d-shader/tpf: Check buffer->status in add_section().
2023-08-02 20:19:00 +09:00
Zebediah Figura
71afb78126
vkd3d-shader/d3dbc: Return ctx->result from hlsl_sm1_write().
2023-08-02 20:18:59 +09:00
Zebediah Figura
6e370777b4
vkd3d-shader/d3dbc: Free vkd3d_bytecode_buffer data on failure.
2023-08-02 20:18:58 +09:00
Zebediah Figura
1bd873fb2b
vkd3d-shader/d3dbc: Skip generic sampler declarations.
...
Instead of asserting.
2023-08-02 20:18:56 +09:00
Conor McCarthy
c2e09e4c4f
vkd3d: Implement ID3D12Fence1.
2023-08-02 20:18:37 +09:00
Conor McCarthy
0d1bc77b2a
vkd3d: Implement ID3D12GraphicsCommandList3 with a stub.
2023-07-31 21:08:02 +09:00
Conor McCarthy
4433dacb4f
vkd3d: Implement ID3D12Device::GetResourceTiling() for textures.
2023-07-31 21:07:58 +09:00
Conor McCarthy
71a9feac8e
vkd3d: Implement ID3D12Device::GetResourceTiling() for buffers.
2023-07-31 21:07:57 +09:00
Nikolay Sivov
bfdd5c142d
vkd3d-shader/tpf: Add support for writing 'resinfo' instruction.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-07-31 21:07:50 +09:00
Nikolay Sivov
78719dc814
vkd3d-shader/tpf: Add support for writing 'sampleinfo' instruction.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-07-31 21:07:49 +09:00
Nikolay Sivov
d50b5fe767
vkd3d-shader/hlsl: Parse GetDimensions() method.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-07-31 21:07:48 +09:00
Conor McCarthy
3d49b59a68
vkd3d: Handle the case where a descriptor is null and is concurrently written non-null.
...
If view is null and the comparison (view == src->s.u.object) is false,
vkd3d_view_decref will be called on null.
2023-07-27 17:17:55 +09:00
Zebediah Figura
819c5f1943
vkd3d-shader/hlsl: Pass an hlsl_block pointer to add_expr().
2023-07-27 17:17:48 +09:00
Zebediah Figura
9d94506313
vkd3d-shader/hlsl: Pass an hlsl_block pointer to add_cast().
2023-07-27 17:17:47 +09:00
Zebediah Figura
fe70ee2158
vkd3d-shader/hlsl: Pass an hlsl_block pointer to add_implicit_conversion().
2023-07-27 17:17:46 +09:00
Zebediah Figura
21d5ee4df2
vkd3d-shader/hlsl: Pass an hlsl_block pointer to add_array_access().
2023-07-27 17:17:41 +09:00
Zebediah Figura
c861a937e8
vkd3d-shader/hlsl: Pass an hlsl_block pointer to add_method_call().
2023-07-27 17:17:37 +09:00
Zebediah Figura
f95ab2a5e8
vkd3d-shader/hlsl: Pass an hlsl_block pointer to add_assignment().
2023-07-24 22:41:16 +02:00
Zebediah Figura
7e7a6d3691
vkd3d-shader/hlsl: Pass a hlsl_block pointer to hlsl_add_conditional().
2023-07-24 22:41:15 +02:00
Zebediah Figura
80b9f52010
vkd3d-shader/hlsl: Use a hlsl_block to build replacement instructions in lower_discard_neg().
2023-07-24 22:41:14 +02:00
Zebediah Figura
3a07df8476
vkd3d-shader/hlsl: Use a hlsl_block to build replacement instructions in lower_float_modulus().
2023-07-24 22:41:13 +02:00
Zebediah Figura
0dee96ead6
vkd3d-shader/hlsl: Use a hlsl_block to build replacement instructions in lower_int_modulus().
2023-07-24 22:41:12 +02:00
Nikolay Sivov
bd3d4a6c06
vkd3d-shader: Add compiler option to specify matrix majority.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-07-24 22:41:09 +02:00
Conor McCarthy
acc68aef94
vkd3d: Add a pending execution count to struct d3d12_command_signature.
...
Buffering of command list commands will depend upon command signatures
persisting until the buffer is flushed.
2023-07-24 22:41:07 +02:00
Conor McCarthy
95bad60281
vkd3d: Store the command buffer in the allocator upon creation.
...
For correct function it cannot be freed until the command allocator
is reset, and d3d12_command_allocator_free_command_buffer() normally
does not free it.
2023-07-24 22:40:53 +02:00
Conor McCarthy
9187a41733
vkd3d: Move descriptor heap tracking to d3d12_command_list_set_descriptor_table().
...
This is the simplest way to gather this information when command lists
are executed later.
2023-07-24 22:40:52 +02:00
Conor McCarthy
42d46d2513
vkd3d: Do not create Vulkan descriptor sets for non-shader-visible heaps.
2023-07-20 22:33:17 +02:00
Conor McCarthy
9014183100
vkd3d: Return a null handle from GetGPUDescriptorHandleForHeapStart() for non-shader-visible heaps.
2023-07-20 22:33:17 +02:00
Conor McCarthy
0a98d09145
vkd3d: Enable Vulkan-backed heaps for each heap instead of per device.
...
Provides a simple way to disable Vulkan writes for non-shader-visible
heaps. Also there is a chance of avoiding access to the d3d12_device
object which helps memory cache performance.
2023-07-20 22:33:05 +02:00
Zebediah Figura
d52eb8595f
vkd3d-shader/hlsl: Use a hlsl_block to build replacement instructions in lower_int_division().
2023-07-20 22:33:01 +02:00
Zebediah Figura
cdabe172cb
vkd3d-shader/hlsl: Return a hlsl_block from the "declaration" and "struct_declaration" rules.
2023-07-20 22:33:00 +02:00
Zebediah Figura
54bd6f7b4b
vkd3d-shader/hlsl: Return a hlsl_block from the "declaration_statement" rule.
2023-07-20 22:32:59 +02:00
Zebediah Figura
77e1c5893e
vkd3d-shader/hlsl: Return a hlsl_block from the "primary_expr" rule.
2023-07-20 22:32:57 +02:00
Conor McCarthy
c0a2bb1095
vkd3d-shader/dxil: Emit undefined constants.
2023-07-20 22:32:53 +02:00
Conor McCarthy
402c93fa68
vkd3d-shader/spirv: Introduce an undefined register type.
2023-07-20 22:32:52 +02:00
Conor McCarthy
3e553aaaa7
vkd3d-shader/dxil: Emit the shader instructions.
...
Sufficient for compiling a no-op pixel shader.
2023-07-20 22:32:51 +02:00
Conor McCarthy
f26d47585f
vkd3d-shader/spirv: Do not normalise Shader Model 6 shaders.
2023-07-20 22:32:50 +02:00
Conor McCarthy
8fe6d2eeac
vkd3d-shader/dxil: Return an error from sm6_parser_globals_init() on invalid operand count.
2023-07-20 22:32:48 +02:00
Zebediah Figura
e0e261eac3
vkd3d-shader/spirv: Emit variables for flat constant buffers.
2023-07-17 22:56:47 +02:00
Zebediah Figura
25cf6a720b
vkd3d-shader/ir: Normalise sm1-style constants.
2023-07-17 22:56:45 +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
Zebediah Figura
d077562f79
vkd3d-shader/d3dbc: Scan descriptors for constant register sets.
2023-07-17 22:56:39 +02:00
Zebediah Figura
44bf5556ae
vkd3d-shader/hlsl: Free the constant defs array in hlsl_ctx_cleanup().
...
Spotted by Francisco Casas.
2023-07-17 22:56:19 +02:00
Nikolay Sivov
63631a8fd4
vkd3d-shader/tpf: Support some of the UAV types when writing RDEF records.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-07-17 22:56:05 +02:00
Francisco Casas
3bafd036bb
vkd3d-shader/hlsl: Don't allocate all texture registers for synthetic separated samplers.
2023-07-17 22:55:53 +02:00
Zebediah Figura
a55973d695
vkd3d-shader/hlsl: Lower combined samplers to separate sampler and texture objects for SM4.
...
Co-authored-by: Francisco Casas <fcasas@codeweavers.com>
2023-07-17 22:55:51 +02:00
Francisco Casas
15ea5ff9db
vkd3d-shader/hlsl: Separate tracking of sampler_dim and usage for object components.
2023-07-17 22:55:48 +02:00
Francisco Casas
c4f074d25d
vkd3d-shader/hlsl: Introduce hlsl_new_synthetic_var_named().
2023-07-17 22:55:46 +02:00
Francisco Casas
866c5d9531
vkd3d-shader/hlsl: Check is_uniform instead of HLSL_STORAGE_UNIFORM when validating object refs.
...
We are using the hlsl_ir_var.is_uniform flag to indicate when an object
is a uniform copy created from a variable with the HLSL_STORAGE_UNIFORM
modifier.
We should be checking for this instead of the HLSL_STORAGE_UNIFORM flag
which is also set to 1 for the original variables, and there should be
no reason to use this flag instead of "is_uniform" after the uniform
copies and combined/separated samplers are created.
2023-07-17 22:55:43 +02:00
Francisco Casas
c58d666d1b
vkd3d-shader/hlsl: Handle resource components individually for SM 5.0.
2023-07-17 22:55:40 +02:00
Francisco Casas
8f8c7a02ee
vkd3d-shader/tpf: Introduce struct extern_resource.
...
This struct is required for handling both whole-variable resources for
SM < 5 and single-component resources for SM 5 in the same way, when
writting the RDEF block and resource declarations within the shader.
2023-07-17 22:55:39 +02:00
Francisco Casas
ae6bc398d6
vkd3d-shader/hlsl: Allow derefs to provide the data_type.
...
After lowering the derefs path to a single offset node, there was no way
of knowing the type of the referenced part of the variable. This little
modification allows to avoid having to pass the data type everywhere and
it is required for supporting instructions that reference objects
components within struct types.
Since deref->data_type allows us to retrieve the type of the deref,
deref->offset_regset is no longer necessary.
2023-07-17 22:55:36 +02:00
Zebediah Figura
d4b5e79c8b
vkd3d-shader/hlsl: Skip unallocated variables when looking for reservation conflicts.
2023-07-13 23:00:03 +02:00
Zebediah Figura
aec9ea085e
vkd3d-shader/hlsl: Return a hlsl_block from the "postfix_expr" rule.
2023-07-11 22:44:15 +02:00
Zebediah Figura
e222a786a1
vkd3d-shader/hlsl: Return a hlsl_block from binary and ternary expression rules.
2023-07-11 22:44:12 +02:00
Zebediah Figura
3079c874e3
vkd3d-shader/hlsl: Return a hlsl_block from the "unary_expr" rule.
2023-07-11 22:44:10 +02:00
Zebediah Figura
28dff58fb5
vkd3d-shader/hlsl: Return a hlsl_block from the "initializer_expr" rule.
2023-07-11 22:44:09 +02:00
Zebediah Figura
53d5ea639c
vkd3d-shader/hlsl: Return a hlsl_block from the "assignment_expr" rule.
2023-07-11 22:44:06 +02:00
Conor McCarthy
1ec112e3d7
vkd3d-shader/dxil: Read function bodies.
2023-07-11 22:43:58 +02:00
Conor McCarthy
5d33fb4633
vkd3d-shader/dxil: Read numeric constants.
2023-07-11 22:43:57 +02:00
Conor McCarthy
c96143abdc
vkd3d-shader/dxil: Read global function declarations.
2023-07-11 22:43:55 +02:00
Conor McCarthy
22157c3da3
vkd3d-shader/dxil: Validate the module format version.
2023-07-11 22:43:53 +02:00
Conor McCarthy
eca4b62c7e
vkd3d-shader/dxil: Read the value symbol table.
2023-07-11 22:43:49 +02:00
Conor McCarthy
571d807dd8
vkd3d-shader/dxil: Read the type table.
2023-07-11 22:43:48 +02:00
Conor McCarthy
41a5d37935
vkd3d-shader/dxil: Use size_t where applicable.
2023-07-11 22:43:46 +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
Evan Tang
574239e3e3
vkd3d: Make CopyResource use a temp buffer for depth <-> color copies.
...
depth <-> color copies aren't allowed in Vulkan
2023-07-06 20:09:50 +02:00
Zebediah Figura
6e303af519
vkd3d-shader/hlsl: Free the "iter" block pointer on success in create_loop().
...
Spotted by Giovanni Mascellani.
2023-07-05 22:32:48 +02:00
Zebediah Figura
b0ac77b44d
vkd3d-shader/hlsl: Return a hlsl_block from the "expr_statement" and "expr" rules.
2023-07-05 22:32:47 +02:00
Zebediah Figura
07ce711583
vkd3d-shader/hlsl: Return a hlsl_block from the "jump_statement" rule.
2023-07-05 22:32:46 +02:00
Zebediah Figura
e4bf5933b9
vkd3d-shader/hlsl: Return a hlsl_block from the "selection_statement" rule.
2023-07-05 22:32:45 +02:00
Zebediah Figura
79dd9544b7
vkd3d-shader/hlsl: Return a hlsl_block from the "loop_statement" rule.
2023-07-05 22:32:43 +02:00
Zebediah Figura
23ff83e8a0
vkd3d-shader/hlsl: Return a hlsl_block from the "statement" rule.
...
As well as from the "statement_list" and "compound_statement" rules, which
trivially pass through from "statement".
2023-07-05 22:32:41 +02:00
Zebediah Figura
53e9ad3e4c
vkd3d-shader/hlsl: Do not emit DEF instructions for uniform constants.
2023-07-04 22:40:20 +02:00
Zebediah Figura
e5afbda34a
vkd3d-shader/hlsl: Simplify allocate_const_registers_recurse() to stop accounting for constants larger than a vector.
...
That cannot happen with the current code.
2023-07-04 22:40:16 +02:00
Zebediah Figura
8a2b357855
vkd3d-shader/hlsl: Allocate anonymous constants after uniforms.
2023-07-04 22:40:13 +02:00
Zebediah Figura
717cd3f5bb
vkd3d-shader/hlsl: Consistently use the destination width in constant folding instructions (Valgrind).
2023-07-04 22:40:06 +02:00
Zebediah Figura
e390bc35e2
vkd3d-shader/d3dbc: Set the source count for DEF instructions to 1 (Valgrind).
...
We emit one source with multiple components.
2023-07-04 22:40:04 +02:00
Nikolay Sivov
06040d2a30
vkd3d-shader/hlsl: Disallow certain instruction types from constant expressions.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-07-04 22:39:57 +02:00
Nikolay Sivov
a65c0b0e22
vkd3d-shader/hlsl: Support evaluated expressions for sample count in multisampled textures declarations.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-07-04 22:39:55 +02:00
Zebediah Figura
73d422a0e0
vkd3d-shader/d3dbc: Scan for the maximum temporary register index.
2023-07-04 22:39:48 +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
Zebediah Figura
dfb2a316e6
vkd3d-shader/dxbc: Remove redundant zero-initialization of the vkd3d_shader_desc structure.
2023-07-04 22:39:43 +02:00
Nikolay Sivov
300f3462a4
vkd3d-shader/hlsl: Add constant folding for 'rcp'.
2023-07-04 22:39:36 +02:00
Giovanni Mascellani
68764b74a1
vkd3d: Release op data when destroying the queue.
2023-07-04 22:39:31 +02:00
Giovanni Mascellani
dcac2646e4
vkd3d: Always emit an error when failing to reserve for the op array.
2023-07-04 22:39:31 +02:00
Giovanni Mascellani
52d5cb749f
vkd3d: Release the op mutex on allocation failure.
2023-07-04 22:39:31 +02:00
Francisco Casas
01800942a9
vkd3d-shader/hlsl: Declare vars individually when parsing struct declarations.
...
A struct declaration with variables is now absorbed into the 'declaration'
rule, like any other variable declaration.
A struct declaration without variables is now reduced to the
'struct_declaration_without_vars' rule.
They both are reduced to a 'declaration_statement' in the end.
2023-07-04 22:39:24 +02:00
Francisco Casas
62c891b796
vkd3d-shader/hlsl: Declare vars individually when parsing regular declarations.
...
In a declaration with multiple variables, the variables must be created
before the initializer of the next variable is parsed. This is required
for initializers such as:
float a = 1, b = a, c = b + 1;
A requisite for this is that the type information is parsed in the same
rule as the first variable (as a variable_def_typed) so it is
immediately available to declare the first variable. Then, the next
untyped variable declaration is parsed, and the type from the first
variable can be used to declare the second, before the third is parsed,
and so on.
2023-07-04 22:39:21 +02:00
Francisco Casas
a34cf2e64e
vkd3d-shader/hlsl: Split declare_vars().
...
Basically, declare_vars() is separated in three functions:
1. check_invalid_in_out_modifiers(), which is to be called once per
declaration and emits an error when in or out modifiers are used for
these non-parameter variables.
2. declare_var(), which now handles one variable at the time and doesn't
free any memory.
3. initialize_vars(), which takes care of preparing the initialization
instructions of several variables and frees their struct
parse_variable_def, using exclusively free_parse_variable_def().
This allows to declare variables individually before the initializer of
the next variable in the same declaration is parsed, which is used in
the following patches.
Also, simplifies memory management.
2023-07-04 22:39:18 +02:00
Francisco Casas
e4d94d955c
vkd3d-shader/hlsl: Support fine derivates.
2023-07-04 22:39:12 +02:00
Francisco Casas
ff31284f8d
vkd3d-shader/hlsl: Support coarse derivates.
2023-07-04 22:39:10 +02:00
Conor McCarthy
08cece3a92
vkd3d: Print the thread id in trace messages.
2023-06-28 21:40:40 +02:00
Conor McCarthy
de25e88901
vkd3d-shader/dxil: Read and validate global abbreviated operands.
2023-06-28 21:40:37 +02:00
Conor McCarthy
e9a8bfb2c4
vkd3d-shader/dxil: Read and validate local abbreviated operands.
2023-06-28 21:40:36 +02:00
Conor McCarthy
d3e6a3a78f
include: Introduce a function to detect the DXBC source type.
2023-06-28 21:40:36 +02:00
Conor McCarthy
6775f7ba66
vkd3d-shader/dxil: Read and validate DXIL bitcode unabbreviated blocks.
2023-06-28 21:40:34 +02:00
Nikolay Sivov
69f32796b0
vkd3d-shader: Unify static string arrays initialization pattern.
2023-06-28 21:40:21 +02:00
Zebediah Figura
9ccba35dde
vkd3d-shader/hlsl: Store the fields of struct parse_if_body as hlsl_block pointers.
2023-06-28 21:40:18 +02:00
Zebediah Figura
8fa1750206
vkd3d-shader/hlsl: Store the "instrs" field of struct parse_initializer as a hlsl_block pointer.
2023-06-28 21:40:16 +02:00
Zebediah Figura
7d521db3db
vkd3d-shader/hlsl: Merge the "discard_statement" rule into "jump_statement".
2023-06-28 21:40:15 +02:00
Zebediah Figura
588784e4dc
vkd3d-shader/hlsl: Use add_unary_arithmetic_expr() in the subtraction rule.
2023-06-28 21:40:14 +02:00
Zebediah Figura
b4bf5af475
vkd3d-shader/hlsl: Factor out add_binary_expr_merge().
2023-06-28 21:40:12 +02:00
Giovanni Mascellani
bdfec4886d
vkd3d-shader/hlsl: Fold logical expressions.
2023-06-27 22:34:33 +02:00
Giovanni Mascellani
5a05fabe62
vkd3d-shader/hlsl: Fold floating point minimum expressions.
2023-06-27 22:34:30 +02:00
Giovanni Mascellani
2a2943c2cf
vkd3d-shader/hlsl: Fold floating point maximum expressions.
2023-06-27 22:34:29 +02:00
Giovanni Mascellani
358d656262
vkd3d-shader/hlsl: Fold greater-than-or-equal comparisons.
2023-06-27 22:34:28 +02:00
Giovanni Mascellani
bf452b5907
vkd3d-shader/hlsl: Fold less-than comparisons.
2023-06-27 22:34:27 +02:00
Giovanni Mascellani
488af14144
vkd3d-shader/hlsl: Fold equality comparisons.
2023-06-27 22:34:25 +02:00
Giovanni Mascellani
6c9f6d0fcf
vkd3d-shader/hlsl: Sort constant folding helpers alphabetically.
2023-06-27 22:34:24 +02:00
Nikolay Sivov
4ed60cda13
vkd3d-shader: Remove extra newlines from compiler messages.
2023-06-27 22:34:19 +02:00
Nikolay Sivov
9ccf291971
vkd3d-shader/hlsl: Use profile version testing helpers in more places.
2023-06-27 22:34:05 +02:00
Nikolay Sivov
5c02e12187
vkd3d-shader/hlsl: Make sample count optional for SM4.1+.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-06-27 22:34:03 +02:00
Conor McCarthy
3aa83e877d
vkd3d: Append CopyTileMappings() commands to the command queue op array.
2023-06-27 22:33:58 +02:00
Conor McCarthy
3935e8647f
vkd3d: Append UpdateTileMappings() commands to the command queue op array.
2023-06-27 22:33:58 +02:00
Conor McCarthy
e98e6c9b53
vkd3d: Add missing const attributes to ID3D12CommandQueue::UpdateTileMappings() parameters.
2023-06-27 22:33:58 +02:00
Conor McCarthy
5ccadd07f1
vkd3d: Validate plane count for tiled textures.
2023-06-27 22:33:58 +02:00
Conor McCarthy
0b67481496
vkd3d: Validate tiled resources tier for 3D textures.
2023-06-27 22:33:58 +02:00
Conor McCarthy
1a0d85b8d6
vkd3d: Validate tiled resources support during reserved resource creation.
...
Check directly for Vulkan support because the D3D12 tiled resources
tier may in future be modified by a config option.
2023-06-27 22:33:57 +02:00
Conor McCarthy
e93f2e7746
vkd3d: Always pass null heap properties to vkd3d_create_image() for sparse images.
2023-06-27 22:33:57 +02:00
Conor McCarthy
9532ac5f84
vkd3d: Check sparse image format is supported.
...
Based on code by Jan Sikorski.
2023-06-27 22:33:55 +02:00
Nikolay Sivov
861078d63a
vkd3d-shader/hlsl: Handle 'texkill' discard type for sm4+.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-06-27 22:33:50 +02:00
Nikolay Sivov
8d84e206ab
vkd3d-shader/hlsl: Parse clip() function.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-06-27 22:33:48 +02:00
Nikolay Sivov
b40179da3a
vkd3d-shader/hlsl: Add a parameter for jump nodes and use it for 'discard'.
2023-06-27 22:33:47 +02:00
Zebediah Figura
7e1fcdca89
vkd3d-shader: Synthesize signatures for d3dbc shaders.
2023-06-27 22:33:41 +02:00
Zebediah Figura
20190a1388
vkd3d-shader: Introduce an API to retrieve all signatures from DXBC shaders.
2023-06-27 22:33:41 +02:00
Stefan Dösinger
5e88ab22aa
vkd3d-shader/hlsl: Make sure variants is initialized in declare_predefined_types().
...
MSVC is too stupid to see it is unused when n_variants=0.
2023-06-27 22:33:31 +02:00
Henri Verbeet
771e442af1
Release 1.8.
2023-06-22 22:00:20 +02:00
Nikolay Sivov
c8ffe8e1a8
vkd3d-shader/hlsl: Don't report a register type mismatch for unused reserved variables.
2023-06-22 22:00:19 +02:00
Zebediah Figura
d6ac823dd6
vkd3d-shader/hlsl: Don't set "allocated" for unused reserved variables.
2023-06-22 22:00:17 +02:00
Zebediah Figura
1c1f1094a5
vkd3d-shader/hlsl: Handle reserved vars specially in get_allocated_object().
2023-06-22 22:00:16 +02:00
Francisco Casas
c1ca0dafe8
vkd3d-shader/d3dbc: Avoid hlsl_type_get_regset() in d3dbc.c.
...
In SM1 we can expect all variables to always belong to a single regset.
structs in particular, should always be allocated to HLSL_REGSET_NUM,
since they are only allowed if all their components are numeric.
We are not covering the structs case because of the use of
hlsl_type_get_regset(), which is currently not defined for structs.
So the current shader
struct
{
float4 a;
float4 b;
} apple;
float4 main() : sv_target
{
return apple.a + apple.b;
}
fails with
vkd3d/libs/vkd3d-shader/hlsl.c:224: Aborting, reached unreachable code.
The solution is to iterate over all regsets to find the one where the
variable is allocated (if any), and ignore all others.
2023-06-22 22:00:14 +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
Nikolay Sivov
d856be0519
vkd3d-shader/hlsl: Handle static constants in array size expressions.
2023-06-12 22:50:12 +02:00
Nikolay Sivov
99314b6340
vkd3d-shader/hlsl: Store static initialization instructions in a block.
2023-06-12 22:50:11 +02:00
Francisco Casas
5dee6561c2
vkd3d-shader/hlsl: Fold redundant casts again after lower narrowing casts.
...
lower_narrowing_casts() currently creates a new cast calling
hlsl_new_cast(). This cast may be redundant, but it is not folded, which
is making SM1 emit an unnecessary fixme in some shaders:
Aborting due to not yet implemented feature: SM1 "cast" expression.
Other passes that call hlsl_new_cast() are lower_int_division() and
lower_int_modulus(), so the new fold_redundant_casts() pass is called
after these as well.
2023-06-08 23:21:40 +02:00
Zebediah Figura
f34b107faf
vkd3d-shader/hlsl: Return an hlsl_ir_node pointer from hlsl_new_constant().
2023-06-08 18:50:35 +02:00
Zebediah Figura
740b0ad807
vkd3d-shader/hlsl: Pass a hlsl_constant_value pointer to hlsl_new_constant().
2023-06-08 18:50:34 +02:00
Zebediah Figura
79f443d131
vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_bit_or().
2023-06-08 18:50:32 +02:00
Zebediah Figura
1049f489bb
vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_bit_and().
2023-06-08 18:50:31 +02:00
Zebediah Figura
a7a09ac5ef
vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_bit_xor().
2023-06-08 18:50:30 +02:00
Zebediah Figura
974528cbe3
vkd3d-shader/hlsl: Only read used coordinates in encode_texel_offset_as_aoffimmi().
...
The V and W offsets may be uninitialized, which may spuriously trigger "out of range" errors.
2023-06-08 18:50:28 +02:00
Zebediah Figura
7b476573ff
vkd3d-shader/hlsl: Use the writemask to map the coords swizzle for load instructions.
...
Instead of modifying the swizzle after calling sm4_src_from_node().
This fixes the case where sm4_src_from_node() returns an immediate constant.
Fixes: a471c5567a
2023-06-08 18:50:26 +02:00
Francisco Casas
ebf7573571
vkd3d-shader/hlsl: Support non-constant vector indexing.
...
Non-constant vector indexing is not solved with relative addressing
in the register indexes because this indexation cannot be at the level
of register-components.
Mathematical operations must be used instead.
2023-06-07 20:48:59 +02:00
Francisco Casas
6cfa8cf859
vkd3d-shader/hlsl: Lower dot for non-float types.
2023-06-07 20:48:58 +02:00
Francisco Casas
441902bb85
vkd3d-shader/hlsl: Introduce transform_derefs().
2023-06-07 20:48:57 +02:00
Nikolay Sivov
82ddc6b417
vkd3d-shader/hlsl: Fix sampler type used for samplerCUBE.
2023-06-05 22:27:36 +02:00
Nikolay Sivov
ccad49d486
vkd3d-shader/d3d-asm: Fix 3D sampler declaration instruction name.
2023-06-05 22:27:33 +02:00
Giovanni Mascellani
7c360330d7
vkd3d-shader/tpf: Do not emit HLSL_IR_CONSTANT instructions.
...
Since constants are now inlined.
2023-05-29 20:21:29 +02:00
Giovanni Mascellani
a471c5567a
vkd3d-shader/tpf: Emit constant values inline.
2023-05-29 20:21:27 +02:00
Giovanni Mascellani
a7de09d418
vkd3d-shader/tpf: Move sm4_src_from_constant_value() above.
...
So that it can be used by sm4_src_from_node() in later commits.
2023-05-29 20:21:25 +02:00
Giovanni Mascellani
4ecd3af2af
vkd3d-shader/tpf: Use a semicolon to separate statements.
2023-05-29 20:21:23 +02:00