Francisco Casas
eef2163375
vkd3d-shader/tpf: Declare indexable temps.
...
If var->indexable, then the variable is given a unique register number,
regardless of its lifetime.
2023-10-31 21:59:22 +01:00
Nikolay Sivov
bc2a4ee66a
vkd3d-shader/tpf: Write out 'switch' statements.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-31 21:59:05 +01:00
Conor McCarthy
1e5f91b371
vkd3d-shader: Emit IR CBV declaration sizes in bytes.
...
DXIL declares CBV sizes in bytes and they are not aligned to 16 bytes.
2023-10-19 23:07:43 +02:00
Nikolay Sivov
e242b46922
vkd3d-shader/tpf: Convert some of the semantic names to system values names when in compatibility mode.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-19 23:03:23 +02:00
Conor McCarthy
06f8a88466
vkd3d-shader: Define more global flags.
2023-10-17 22:18:23 +02:00
Francisco Casas
432fa8fa8f
vkd3d-shader/tpf: Avoid translations to D3DDECLUSAGE and back (clangd).
2023-10-12 23:27:19 +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
Nikolay Sivov
3af629cf8c
vkd3d-shader/tpf: Output interpolation modifiers for input declarations.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-09 21:58:31 +02:00
Nikolay Sivov
c5414fa92f
vkd3d-shader/tpf: Write 'continue' instruction.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-09 21:58:17 +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
014960b64b
vkd3d-shader/tpf: Use lookup table for opcode_info_from_sm4().
...
Makes get_opcode_info() and thus, tpf reading a little faster.
2023-10-05 16:16:27 +02:00
Francisco Casas
88b644a11d
vkd3d-shader/tpf: Don't store sm4 instruction extra bits in the opcode.
...
Adding extra bits to instr->opcode doesn't seem correct, given that it
is an enum.
For instance, get_opcode_info() would return NULL if additional bits are
added to instr->opcode. This is not a problem now because that function
is called when reading and not writing.
2023-10-05 16:16:24 +02:00
Francisco Casas
0a5fa80f02
vkd3d-shader/tpf: Apply mask to swizzle when swizzle type is scalar.
...
In native's output, for scalar swizzles only the first component of the
swizzle is written, the others are left as zero.
2023-10-05 16:16:21 +02:00
Francisco Casas
f06169afc5
vkd3d-shader/tpf: Don't calculate instruction size in advance.
...
Co-authored-by: Henri Verbeet <hverbeet@codeweavers.com>
2023-10-05 16:16:19 +02:00
Francisco Casas
4ab6572be7
vkd3d-shader/hlsl: Replace hlsl_type_get_regset() uses with hlsl_deref_get_regset().
2023-10-05 16:15:37 +02:00
Francisco Casas
cd0e3786c3
vkd3d-shader/hlsl: Avoid hlsl_type_get_regset() in sm4_get_extern_resources().
2023-10-05 16:15:28 +02:00
Francisco Casas
dfce1e7f4a
vkd3d-shader/hlsl: Make regset an output argument in hlsl_type_get_component_offset().
...
Components only span across a single regset, so instead of expecting the
regset as input for the offset, hlsl_type_get_component_offset() can
actually retrieve it.
2023-10-05 16:15:26 +02:00
Alistair Leslie-Hughes
71715cc434
vkd3d-shader: Fix compiler warning.
...
vkd3d-shader/tpf.c:3810:39: warning: passing argument 2 of ‘sm4_register_from_node’ from incompatible pointer type [-Wincompatible-pointer-types]
vkd3d-shader/tpf.c:4750:59: warning: passing argument 3 of ‘sm4_register_from_deref’ from incompatible pointer type [-Wincompatible-pointer-types]
Change to use uint32_t as requested.
2023-10-05 16:14:44 +02:00
Francisco Casas
c92772657f
vkd3d-shader/tpf: Replace sm4_src_register with vkd3d_shader_src_param.
2023-10-03 21:27:48 +02:00
Francisco Casas
13f62e60e1
vkd3d-shader/tpf: Remove sm4_src_register.swizzle_type.
2023-10-03 21:27:47 +02:00
Francisco Casas
32f03468fc
vkd3d-shader/tpf: Make sm4_src_register.mod a vkd3d_shader_src_modifier enum.
2023-10-03 21:27:45 +02:00
Francisco Casas
f50d0ae2cb
vkd3d-shader/tpf: Store vkd3d-shader swizzles in sm4_src_register.swizzle.
2023-09-28 23:13:16 +02:00
Francisco Casas
ef9ec28eb0
vkd3d-shader/tpf: Replace sm4_dst_register with vkd3d_shader_dst_param.
2023-09-28 23:13:14 +02:00
Francisco Casas
d41d8f8771
vkd3d-shader/tpf: Rename sm4_dst_register.writemask to write_mask.
2023-09-28 23:13:12 +02:00
Francisco Casas
8e0fe29bfc
vkd3d-shader/tpf: Replace sm4_register with vkd3d_shader_register.
2023-09-27 22:34:31 +02:00
Francisco Casas
10bbc7eda5
vkd3d-shader/tpf: Move sm4_register.mod to sm4_src_register.
2023-09-27 22:34:30 +02:00
Francisco Casas
8124ba3a54
vkd3d-shader/tpf: Put sm4_register.immconst_uint inside a union.
2023-09-27 22:34:28 +02:00
Francisco Casas
0c8b74cb39
vkd3d-shader/tpf: Turn sm4_register.dim into an enum vkd3d_shader_dimension.
2023-09-27 22:34:26 +02:00
Francisco Casas
33f47c5ae9
vkd3d-shader/tpf: Parse register dimension for all register types.
2023-09-26 22:07:04 +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
c1d9e776e2
vkd3d-shader/tpf: Use vsir_register_init() in shader_sm4_read_param().
2023-09-26 22:07:01 +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
78220ed07e
vkd3d-shader/tpf: Destroy the SM4 parser on parsing errors.
2023-09-22 11:06:10 +02:00
Giovanni Mascellani
05af25eecb
vkd3d-shader: Rename shader_instruction_init().
2023-09-22 11:06:05 +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
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
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
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
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