vkd3d-shader/spirv: Pass a vkd3d_shader_descriptor_info1 structure to spirv_compiler_emit_cbv_declaration().

This commit is contained in:
Anna (navi) Figueiredo Gomes 2024-08-29 20:58:45 +02:00 committed by Henri Verbeet
parent 2a52ccf2c6
commit 22aad955ec
Notes: Henri Verbeet 2024-09-04 11:47:00 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1024

View File

@ -6194,11 +6194,12 @@ static uint32_t spirv_compiler_build_descriptor_variable(struct spirv_compiler *
} }
static void spirv_compiler_emit_cbv_declaration(struct spirv_compiler *compiler, static void spirv_compiler_emit_cbv_declaration(struct spirv_compiler *compiler,
const struct vkd3d_shader_register_range *range, unsigned int register_id, unsigned int size_in_bytes) const struct vkd3d_shader_register_range *range, const struct vkd3d_shader_descriptor_info1 *descriptor)
{ {
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
uint32_t vec4_id, array_type_id, length_id, struct_id, var_id; uint32_t vec4_id, array_type_id, length_id, struct_id, var_id;
const SpvStorageClass storage_class = SpvStorageClassUniform; const SpvStorageClass storage_class = SpvStorageClassUniform;
unsigned int size_in_bytes = descriptor->buffer_size;
struct vkd3d_push_constant_buffer_binding *push_cb; struct vkd3d_push_constant_buffer_binding *push_cb;
struct vkd3d_descriptor_variable_info var_info; struct vkd3d_descriptor_variable_info var_info;
struct vkd3d_shader_register reg; struct vkd3d_shader_register reg;
@ -6206,7 +6207,7 @@ static void spirv_compiler_emit_cbv_declaration(struct spirv_compiler *compiler,
unsigned int size; unsigned int size;
vsir_register_init(&reg, VKD3DSPR_CONSTBUFFER, VKD3D_DATA_FLOAT, 3); vsir_register_init(&reg, VKD3DSPR_CONSTBUFFER, VKD3D_DATA_FLOAT, 3);
reg.idx[0].offset = register_id; reg.idx[0].offset = descriptor->register_id;
reg.idx[1].offset = range->first; reg.idx[1].offset = range->first;
reg.idx[2].offset = range->last; reg.idx[2].offset = range->last;
@ -10567,7 +10568,7 @@ static void spirv_compiler_emit_descriptor_declarations(struct spirv_compiler *c
break; break;
case VKD3D_SHADER_DESCRIPTOR_TYPE_CBV: case VKD3D_SHADER_DESCRIPTOR_TYPE_CBV:
spirv_compiler_emit_cbv_declaration(compiler, &range, descriptor->register_id, descriptor->buffer_size); spirv_compiler_emit_cbv_declaration(compiler, &range, descriptor);
break; break;
case VKD3D_SHADER_DESCRIPTOR_TYPE_SRV: case VKD3D_SHADER_DESCRIPTOR_TYPE_SRV: