From: Henri Verbeet Subject: Re: [PATCH vkd3d 2/9] vkd3d-shader: Add double data type. Message-Id: Date: Tue, 15 Jun 2021 23:52:41 +0200 In-Reply-To: <20210614032643.14994-2-cmccarthy@codeweavers.com> References: <20210614032643.14994-1-cmccarthy@codeweavers.com> <20210614032643.14994-2-cmccarthy@codeweavers.com> On Mon, 14 Jun 2021 at 05:27, Conor McCarthy wrote: > diff --git a/libs/vkd3d-shader/dxbc.c b/libs/vkd3d-shader/dxbc.c > index d2cf87e3..cd90354a 100644 > --- a/libs/vkd3d-shader/dxbc.c > +++ b/libs/vkd3d-shader/dxbc.c > @@ -1001,6 +1001,7 @@ static void shader_sm5_read_sync(struct vkd3d_shader_instruction *ins, > * R -> VKD3D_DATA_RESOURCE > * S -> VKD3D_DATA_SAMPLER > * U -> VKD3D_DATA_UAV > + * d -> VKD3D_DATA_DOUBLE > */ > static const struct vkd3d_sm4_opcode_info opcode_table[] = > { > @@ -1335,6 +1336,8 @@ static enum vkd3d_data_type map_data_type(char t) > return VKD3D_DATA_SAMPLER; > case 'U': > return VKD3D_DATA_UAV; > + case 'd': > + return VKD3D_DATA_DOUBLE; > default: > ERR("Invalid data type '%c'.\n", t); > return VKD3D_DATA_FLOAT; This is unused in this patch. > +static inline unsigned int vkd3d_write_mask_component_count_typed(DWORD write_mask, > + enum vkd3d_data_type data_type) > +{ > + unsigned int component_count = vkd3d_write_mask_component_count(write_mask); > + if (data_type == VKD3D_DATA_DOUBLE) > + component_count /= 2u; > + assert(component_count != 0); > + return component_count; > +} > + Having both vkd3d_write_mask_component_count() and vkd3d_write_mask_component_count_typed() isn't very nice. If we're going to handle this in the backend, it would seem best to consistently pass type information to vkd3d_write_mask_component_count(). Alternatively, how hard would it be to fix things up in the frontend so that we would never have to deal with this here?