Commit Graph

606 Commits

Author SHA1 Message Date
9c817e5e6d vkd3d-shader/hlsl: Forbid recursive calls. 2023-01-19 19:16:27 +01:00
17d6a4411e vkd3d-shader/hlsl: Validate that non-uniform objects are not referenced.
Note that in the future we should call
validate_static_object_references() after DCE and pruning branches,
because shaders such as these compile (at least in more modern versions
of the native compiler):

Branch pruning:
```
static RWTexture2D<float> tex;

float4 main() : sv_target
{
    if (0)
    {
        tex[int2(0, 0)] = 2;
    }
    return 0;
}
```

DCE:
```
static Texture2D tex;
uniform uint i;

float4 main() : sv_target
{
    float4 unused = tex.Load(int3(0, 1, 2));

    return 0;
}
```

These are "todo" tests in hlsl-static-initializer.shader_test
that depend on this.
2023-01-19 12:29:39 +01:00
b29d3489de vkd3d-shader/hlsl: Generate IR for user-defined function calls. 2023-01-13 17:32:42 +01:00
30550c0831 vkd3d-shader/hlsl: Avoid assuming that expressions have at least one argument. 2023-01-13 17:32:40 +01:00
cc811dc3c2 vkd3d-shader/hlsl: Rename hlsl_struct_field.modifiers to "storage_modifiers". 2023-01-11 16:03:47 +01:00
4dbbb8beb4 vkd3d-shader/hlsl: Rename hlsl_ir_var.modifiers to "storage_modifiers". 2023-01-11 16:03:45 +01:00
f100f5b726 vkd3d-shader/hlsl: Check for non-static object references on resource stores. 2022-11-18 22:29:04 +01:00
f21693b284 vkd3d-shader/hlsl: Use reg_size as component count when allocating a single register.
Otherwise, for instance, the added test results in:

debug_hlsl_writemask: Assertion `!(writemask & ~VKD3DSP_WRITEMASK_ALL)' failed.

Which happens in allocate_variable_temp_register() when the variable's
type reg_size is <= 4 but its component count is larger, which may
happen if it contains objects.
2022-11-10 22:48:26 +01:00
3153ce3145 vkd3d-shader/hlsl: Don't allocate object types as constant registers. 2022-11-10 22:48:16 +01:00
718c79b823 vkd3d-shader/hlsl: Parse the numthreads attribute. 2022-11-08 20:53:04 +01:00
d6799bd5d3 vkd3d-shader/hlsl: Parse function attributes. 2022-11-08 20:53:03 +01:00
c416627e64 vkd3d-shader/hlsl: Propagate copies for resource store instructions. 2022-10-31 22:07:47 +01:00
03f9d16047 vkd3d-shader/hlsl: Parse UAV stores. 2022-10-31 22:07:44 +01:00
2ec67e0f10 vkd3d-shader/hlsl: Allocate UAVs. 2022-10-31 22:07:40 +01:00
0a07ac6f88 vkd3d-shader/hlsl: Lower float modulus.
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
2022-10-19 21:59:17 +02:00
eb119878f7 vkd3d-shader/hlsl: Lower int modulus.
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
2022-10-19 21:59:15 +02:00
eb7b594002 vkd3d-shader/hlsl: Lower int division. 2022-10-17 17:58:17 +02:00
4c13ae5764 vkd3d-shader/hlsl: Lower int absolute value. 2022-10-17 17:58:14 +02:00
d5fd309ef8 vkd3d: Add a macro to mark unreachable code.
This should silence warnings about some branches non returning any value
without requiring additional "return 0" statement or similar.

Also, in theory this might enable to compiler to optimize the program
a little bit more, though that's unlikely to have any measurable effect.
2022-09-27 20:14:27 +02:00
d6f45b730f vkd3d-shader/hlsl: Parse the SampleLevel method. 2022-08-23 15:57:54 -05:00
6989266e76 vkd3d-shader/hlsl: Check for non-static object references.
It is responsibility of the shader's programmer to ensure that
object references can be solved statically.

Resource arrays for ps_5_1 and vs_5_1 are an exception which is not
properly handled yet. They probably deserve a different object type.

Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
2022-08-23 15:57:54 -05:00
1bba18aa75 vkd3d-shader/hlsl: Invalidate components more precisely in copy propagation.
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
2022-08-23 15:57:54 -05:00
b5b08bd8a0 vkd3d-shader/hlsl: Replace register offsets with index paths in copy propagation.
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
2022-08-23 15:57:54 -05:00
f843a7babb vkd3d-shader/hlsl: Rename 'inner_type' to 'element_type' in function name.
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
2022-08-23 15:57:54 -05:00
577014c017 vkd3d-shader/hlsl: Replace register offsets with index paths in split copies.
hlsl_new_store() and hlsl_new_load() are deleted, so now there are no more
direct ways to create derefs with offsets in hlsl.c and hlsl.h.

Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
2022-08-10 21:34:19 +02:00