vkd3d-shader: Use vkd3d_bytecode_buffer helpers directly in shader_write_descriptor_table().

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-07-27 16:06:48 -05:00 committed by Alexandre Julliard
parent 6f8be6c208
commit d1671829d9

View File

@ -3019,23 +3019,15 @@ static void shader_write_descriptor_ranges1(struct vkd3d_bytecode_buffer *buffer
} }
} }
static int shader_write_descriptor_table(struct root_signature_writer_context *context, static void shader_write_descriptor_table(struct root_signature_writer_context *context,
const struct vkd3d_shader_root_descriptor_table *table) const struct vkd3d_shader_root_descriptor_table *table)
{ {
struct vkd3d_bytecode_buffer *buffer = &context->buffer; struct vkd3d_bytecode_buffer *buffer = &context->buffer;
if (!write_dword(context, table->descriptor_range_count)) put_u32(buffer, table->descriptor_range_count);
goto fail; put_u32(buffer, get_chunk_offset(context) + sizeof(uint32_t)); /* offset */
if (!write_dword(context, get_chunk_offset(context) + sizeof(DWORD))) /* offset */
goto fail;
shader_write_descriptor_ranges(buffer, table); shader_write_descriptor_ranges(buffer, table);
return VKD3D_OK;
fail:
vkd3d_shader_error(&context->message_context, NULL, VKD3D_SHADER_ERROR_RS_OUT_OF_MEMORY,
"Out of memory while writing root signature root descriptor table.");
return VKD3D_ERROR_OUT_OF_MEMORY;
} }
static int shader_write_descriptor_table1(struct root_signature_writer_context *context, static int shader_write_descriptor_table1(struct root_signature_writer_context *context,
@ -3131,13 +3123,15 @@ static int shader_write_root_parameters(struct root_signature_writer_context *co
for (i = 0; i < parameter_count; ++i) for (i = 0; i < parameter_count; ++i)
{ {
ret = VKD3D_OK;
set_u32(buffer, parameters_position + ((3 * i + 2) * sizeof(uint32_t)), get_chunk_offset(context)); set_u32(buffer, parameters_position + ((3 * i + 2) * sizeof(uint32_t)), get_chunk_offset(context));
switch (versioned_root_signature_get_parameter_type(desc, i)) switch (versioned_root_signature_get_parameter_type(desc, i))
{ {
case VKD3D_SHADER_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE: case VKD3D_SHADER_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE:
if (desc->version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0) if (desc->version == VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0)
ret = shader_write_descriptor_table(context, &desc->u.v_1_0.parameters[i].u.descriptor_table); shader_write_descriptor_table(context, &desc->u.v_1_0.parameters[i].u.descriptor_table);
else else
ret = shader_write_descriptor_table1(context, &desc->u.v_1_1.parameters[i].u.descriptor_table); ret = shader_write_descriptor_table1(context, &desc->u.v_1_1.parameters[i].u.descriptor_table);
break; break;