[PATCH vkd3d 4/5] vkd3d-shader: Allocate constant registers for anonymous constants.

Zebediah Figura (she/her) zfigura at codeweavers.com
Fri Apr 2 17:08:36 CDT 2021


On 4/2/21 3:05 PM, Matteo Bruni wrote:
> 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?
> 

Yep, that's probably just an error...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20210402/52fc4b05/attachment.sig>


More information about the wine-devel mailing list