vkd3d-shader: Add constant buffer size to struct vkd3d_shader_descriptor_info1.

This commit is contained in:
Zebediah Figura 2023-07-31 19:34:23 -05:00 committed by Alexandre Julliard
parent 8c465c81cf
commit 88f85ffb50
Notes: Alexandre Julliard 2023-08-23 22:51:23 +02:00
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/304
2 changed files with 13 additions and 4 deletions

View File

@ -788,12 +788,15 @@ static void vkd3d_shader_scan_constant_buffer_declaration(struct vkd3d_shader_sc
const struct vkd3d_shader_instruction *instruction) const struct vkd3d_shader_instruction *instruction)
{ {
const struct vkd3d_shader_constant_buffer *cb = &instruction->declaration.cb; const struct vkd3d_shader_constant_buffer *cb = &instruction->declaration.cb;
struct vkd3d_shader_descriptor_info1 *d;
if (!context->scan_descriptor_info) if (!context->scan_descriptor_info)
return; return;
vkd3d_shader_scan_add_descriptor(context, VKD3D_SHADER_DESCRIPTOR_TYPE_CBV, &cb->src.reg, &cb->range, if (!(d = vkd3d_shader_scan_add_descriptor(context, VKD3D_SHADER_DESCRIPTOR_TYPE_CBV,
VKD3D_SHADER_RESOURCE_BUFFER, VKD3D_SHADER_RESOURCE_DATA_UINT); &cb->src.reg, &cb->range, VKD3D_SHADER_RESOURCE_BUFFER, VKD3D_SHADER_RESOURCE_DATA_UINT)))
return;
d->buffer_size = cb->size * 16;
} }
static void vkd3d_shader_scan_sampler_declaration(struct vkd3d_shader_scan_context *context, static void vkd3d_shader_scan_sampler_declaration(struct vkd3d_shader_scan_context *context,
@ -1153,12 +1156,17 @@ static int scan_with_parser(const struct vkd3d_shader_compile_info *compile_info
for (i = 0; i < ARRAY_SIZE(parser->shader_desc.flat_constant_count); ++i) for (i = 0; i < ARRAY_SIZE(parser->shader_desc.flat_constant_count); ++i)
{ {
unsigned int size = parser->shader_desc.flat_constant_count[i].external;
struct vkd3d_shader_register_range range = {.space = 0, .first = i, .last = i}; struct vkd3d_shader_register_range range = {.space = 0, .first = i, .last = i};
struct vkd3d_shader_register reg = {.idx[0].offset = i, .idx_count = 1}; struct vkd3d_shader_register reg = {.idx[0].offset = i, .idx_count = 1};
struct vkd3d_shader_descriptor_info1 *d;
if (parser->shader_desc.flat_constant_count[i].external) if (parser->shader_desc.flat_constant_count[i].external)
vkd3d_shader_scan_add_descriptor(&context, VKD3D_SHADER_DESCRIPTOR_TYPE_CBV, &reg, {
&range, VKD3D_SHADER_RESOURCE_BUFFER, VKD3D_SHADER_RESOURCE_DATA_UINT); if ((d = vkd3d_shader_scan_add_descriptor(&context, VKD3D_SHADER_DESCRIPTOR_TYPE_CBV, &reg,
&range, VKD3D_SHADER_RESOURCE_BUFFER, VKD3D_SHADER_RESOURCE_DATA_UINT)))
d->buffer_size = size * 16;
}
} }
if (!ret && signature_info) if (!ret && signature_info)

View File

@ -1123,6 +1123,7 @@ struct vkd3d_shader_descriptor_info1
enum vkd3d_shader_resource_data_type resource_data_type; enum vkd3d_shader_resource_data_type resource_data_type;
unsigned int flags; unsigned int flags;
unsigned int sample_count; unsigned int sample_count;
unsigned int buffer_size;
unsigned int count; unsigned int count;
}; };