[PATCH vkd3d 4/5] vkd3d-shader: Allocate constant registers for anonymous constants.
Matteo Bruni
matteo.mystral at gmail.com
Fri Apr 2 15:05:20 CDT 2021
On Wed, Mar 31, 2021 at 12:04 AM Zebediah Figura
<zfigura at codeweavers.com> wrote:
>
> Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
> ---
> libs/vkd3d-shader/hlsl_codegen.c | 51 ++++++++++++++++++++++++++++++++
> 1 file changed, 51 insertions(+)
>
> diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c
> index 42e8f86a..505a77e7 100644
> --- a/libs/vkd3d-shader/hlsl_codegen.c
> +++ b/libs/vkd3d-shader/hlsl_codegen.c
> @@ -797,6 +797,55 @@ static void allocate_temp_registers_recurse(struct list *instrs, struct liveness
> }
> }
>
> +static void allocate_const_registers_recurse(struct list *instrs, struct liveness *liveness)
> +{
> + struct hlsl_ir_node *instr;
> +
> + LIST_FOR_EACH_ENTRY(instr, instrs, struct hlsl_ir_node, entry)
> + {
> + switch (instr->type)
> + {
> + case HLSL_IR_CONSTANT:
> + {
> + struct hlsl_ir_constant *constant = hlsl_ir_constant(instr);
> +
> + if (instr->data_type->reg_size > 1)
> + constant->reg = allocate_range(liveness, 1, INT_MAX, instr->data_type->reg_size);
> + else
> + constant->reg = allocate_register(liveness, 1, INT_MAX, instr->data_type->dimx);
Not that it makes a difference in practice, but shouldn't this be
UINT_MAX in theory?
More information about the wine-devel
mailing list