Okay, now the text is correctly written. Please disregard the previous MR I sent by mistake, I already closed it.
*ehem*
I don't expect this MR to be approved (because it is quite big) but I think it would be good if you review it so I start sending it in partitions, and to avoid working on conflicting patches.
But, most importantly, because the patches in the middle of this series contain design decisions pertaining the handling of resource components and register spaces that, I think, are justified by their capability of supporting the many features in the second half of the patch series. Also, in case a different approach is deemed more convenient, it would be good to consider how it would manage the features in these patches.
Most of these design decisions are implemented in the following patches of the series:
```
vkd3d-shader/hlsl: Span variables across multiple register spaces.
vkd3d-shader/hlsl: Support variables that have multiple-registers in object reg. spaces.
```
I converged to these implementations by using Zeb's advice and by hitting myself against the wall while trying to implement these features with other approaches.
In short, this patch series includes:
* For SM1, the tex2D and tex3D intrinsics, inferring generic samplers dimension from usage, writing sampler declarations, and writing sample instructions.
* Support for arrays of resources for both SM1 and SM4 (not to be confused with the resource-arrays of SM 5.1, which can have non-constant indexes).
* Support for declaring resources within structs.
* Support for synthetic combined samplers for SM1 and synthetic separated samplers for SM4, considering that they can be arrays or members of structs.
* All of this while imitating the way the native compiler assigns the register indexes of the resources on allocation, which proved to be the most difficult thing, and the main reason behind the design decisions, because the rules are many, and all the previous things have combined effects in the assignment order.
* (There are also many small fixes to corner cases I have stumbled upon, and validations for cases that should not be supported. Most of them are in short patches and in the first half of the MR).
In order to test that the allocated register indexes (in both the sampler and texture spaces) were the same as the native compiler, I did manual tests using ps_4_0, ps_5_0 and ps_3_0 and compared the CTAB/RDEF sections while trying to deduct the assignment rules. Sadly, I cannot be sure that I am covering 100% of the possible scenarios.
I had to do tests manually since it is difficult to test this with the shader_runner which is also limited to SM4, and I haven't learned how to implement C tests that check the reflection data yet (like the ones in wine that Zeb mentioned test_constant_table() in dlls/d3dcompiler_43/tests/hlsl_d3d9.c). Doing these tests automatically is still missing in this MR.
Nevertheless, I could implement some tests for lowering combined samplers for SM4 that also double down as tests to check for the register assignment order in:
```
tests: Add lowering combined samplers tests.
```
For reference, these are some of the tests I have been running manually both for SM1 and SM4 (with the -GeC flag):
[sm1-separated-samplers.hlsl](/uploads/56019f468f60bd942385c4267dd82754/sm1-separated-samplers.hlsl)
[sm1-separated-samplers-array.hlsl](/uploads/a0d08ae30075db7290f63a91d79eb73c/sm1-separated-samplers-array.hlsl)
[sm1-reserves-and-arrays.hlsl](/uploads/8bcec18556a3981a98b7a206ef2883cf/sm1-reserves-and-arrays.hlsl)
[sm1-reserves-and-dims.hlsl](/uploads/ccbf1b6fe3907354164b8301d179ce5d/sm1-reserves-and-dims.hlsl)
[sm1-separated-samplers-2.hlsl](/uploads/81929a9401bec2050f401a53ec6597e5/sm1-separated-samplers-2.hlsl)
[sm1-separated-and-combined-samplers.hlsl](/uploads/5eb72698df741498bdea262298f88257/sm1-separated-and-combined-samplers.hlsl)
[sm1-combined-order.hlsl](/uploads/6e3e7ee5bacd183ea8d3535ddcb2821c/sm1-combined-order.hlsl)
--
This merge request has too many patches to be relayed via email.
Please visit the URL below to see the contents of the merge request.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/27
This video codec is used by games such as Richman 4, and Zwei: The Arges Adventure.
The decoder logic is based on code from the FFmpeg project.
--
v6: loader/wine.inf: Enable ir50_32 video codec.
ir50_32: Implement decompression to 24-bit and 15-bit RGB.
https://gitlab.winehq.org/wine/wine/-/merge_requests/1301
We are currently not initializing static values to zero by default.
Consider the following shader:
```hlsl
static float4 va;
float4 main() : sv_target
{
return va;
}
```
we get the following output:
```
ps_5_0
dcl_output o0.xyzw
dcl_temps 2
mov r0.xyzw, r1.xyzw
mov o0.xyzw, r0.xyzw
ret
```
where r1.xyzw is not initialized.
This patch solves this by assigning the static variable the value of an
uint 0, and thus, relying on complex broadcasts.
This seems to be the behaviour of the the native compiler, since it retrieves
the following error on a shader that lacks an initializer on a data type with
object components:
```
error X3017: cannot convert from 'uint' to 'struct <unnamed>'
```
--
v6: vkd3d-shader/hlsl: Allow uninitialized static objects.
vkd3d-shader/hlsl: Validate that non-uniform objects are not referenced.
tests: Add additional object references tests.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/54