On 4/8/21 2:29 PM, Matteo Bruni wrote:
On Mon, Apr 5, 2021 at 6:32 AM Zebediah Figura zfigura@codeweavers.com wrote:
Signed-off-by: Zebediah Figura zfigura@codeweavers.com
Sorry for the wait...
libs/vkd3d-shader/hlsl.c | 4 +- libs/vkd3d-shader/hlsl.h | 9 ++ libs/vkd3d-shader/hlsl_codegen.c | 185 +++++++++++++++++++++++++++++++ 3 files changed, 196 insertions(+), 2 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index c82cd4f5..e642fee1 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -137,6 +137,13 @@ struct hlsl_struct_field unsigned int reg_offset; };
+struct hlsl_reg +{
- uint32_t id;
- unsigned char writemask;
- bool allocated;
+};
Is that unsigned char intentional?
Probably some overzealous attempt at structure packing.
diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 0641aa0f..a7007886 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c
+static struct hlsl_reg allocate_range(struct liveness *liveness,
unsigned int first_write, unsigned int last_read, unsigned int reg_count)
+{
- const unsigned int component_count = reg_count * 4;
- struct hlsl_reg ret = {.allocated = true};
- unsigned int i, component_idx;
- for (component_idx = 0; component_idx < liveness->size; component_idx += 4)
- {
if (is_range_available(liveness, first_write, component_idx,
min(component_count, liveness->size - component_idx)))
break;
- }
- if (!resize_liveness(liveness, component_idx + component_count))
return ret;
This is going to return ret.allocated = true, which seems problematic.
There's another similar case above.