Zebediah Figura
7b9eb8d189
vkd3d-shader: Introduce documented semantics for the target type and other data passed to vkd3d_shader_scan().
...
Passing VKD3D_SHADER_TARGET_NONE was actually already allowed.
2023-06-27 22:33:39 +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
Henri Verbeet
e17ee34b92
build: List tests/object-parameters.shader_test before tests/object-references.shader_test.
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
Nikolay Sivov
883ab880e3
tests: Add more tests for unused registers with a reservation.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
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
38c89442ac
tests: Add a test for array size expressions using static constants.
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
Francisco Casas
f24598c9a0
tests: Test indexing temps.
2023-06-07 20:48:57 +02:00
Francisco Casas
8d7cc8c84e
tests: Test non-constant vector indexing.
2023-06-07 20:48:55 +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
Nikolay Sivov
a2e85a8a76
vkd3d-shader/hlsl: Parse SampleCmpLevelZero() method.
2023-05-29 20:21:17 +02:00
Nikolay Sivov
c33219c97b
vkd3d-shader/tpf: Write out comparison mode sampler declarations and corresponding sampling instruction.
2023-05-29 20:21:16 +02:00
Nikolay Sivov
2fd3550ba6
vkd3d-shader/hlsl: Parse SampleCmp() method.
2023-05-29 20:21:14 +02:00
Nikolay Sivov
7c94705c54
vkd3d-shader/hlsl: Parse SamplerComparisonState objects.
2023-05-29 20:21:11 +02:00
Nikolay Sivov
efe107d231
vkd3d-shader/hlsl: Use a function table for object methods handlers.
2023-05-29 20:21:10 +02:00
Nikolay Sivov
87cd3f872b
vkd3d-shader/hlsl: Move object type checks to methods handlers.
2023-05-29 20:21:07 +02:00
Ethan Lee
aa17d139be
tests: Add a test for arrays with an expression as the index.
...
Currently, the compiler requires that dereferences be HLSL_IR_CONSTANT, so that
it can compute the offset at compile time. However, scenarios such as this test
will produce a dereference with HLSL_IR_EXPR, which will generate an error.
Passing this test in particular will require adding support for SM4 relative
addressing, as well as support for non-constant indexing in general.
Signed-off-by: Ethan Lee <flibitijibibo@gmail.com>
2023-05-29 20:21:01 +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
Zebediah Figura
b453a0acd6
vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_abs().
2023-05-26 19:11:46 +02:00
Zebediah Figura
c805eb1191
vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_min().
2023-05-26 19:11:44 +02:00
Zebediah Figura
aa82f61ef3
vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_max().
2023-05-26 19:11:42 +02:00
Zebediah Figura
ad0ab664d2
vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_mod().
2023-05-26 19:11:39 +02:00
Zebediah Figura
c8b7dbebe4
vkd3d-shader/hlsl: Pass hlsl_constant_value and hlsl_type pointers to fold_div().
2023-05-26 19:11:36 +02:00
Henri Verbeet
133421a38c
vkd3d: Avoid redundantly initialising "descriptors" in d3d12_desc_flush_vk_heap_updates_locked().
...
As pointed out by Andrey Gusev.
2023-05-26 19:11:26 +02:00
Conor McCarthy
f4778b727d
vkd3d-shader/spirv: Use the register index count in shader_register_clone_relative_addresses().
2023-05-26 19:11:15 +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