[2/5] WineD3D: Keep track of used float constants

Henri Verbeet hverbeet at gmail.com
Wed May 6 03:09:38 CDT 2009


> +    reg_maps->constf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
> +                                 sizeof(*reg_maps->constf) * (constf_size / (sizeof(*reg_maps->constf) * 8) + 1));
This is flawed, it will allocate too much memory. You essentially want
"(bit_count + 31) / 32" to calculate the number of DWORDs.

>  static void shader_record_register_usage(IWineD3DBaseShaderImpl *This, struct shader_reg_maps *reg_maps,
> -        DWORD register_type, UINT register_idx, BOOL has_rel_addr, BOOL pshader)
> +        DWORD register_type, UINT register_idx, BOOL has_rel_addr, BOOL pshader, unsigned char size)
I don't think this is very nice, it's better to just call
shader_record_register_usage() multiple times for the appropriate
instructions. I.e., handle this the same way all the other opcodes are
handled.



More information about the wine-devel mailing list