mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/dxil: Support null constant arrays.
This commit is contained in:
parent
69c3946c85
commit
ffae57eb8d
Notes:
Alexandre Julliard
2023-12-07 22:47:09 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/477
@ -2412,7 +2412,7 @@ static enum vkd3d_result value_allocate_constant_array(struct sm6_value *dst, co
|
||||
return VKD3D_ERROR_INVALID_SHADER;
|
||||
}
|
||||
size = max(size, sizeof(icb->data[0]));
|
||||
count = type->u.array.count * size / sizeof(icb->data[0]);
|
||||
count = operands ? type->u.array.count * size / sizeof(icb->data[0]) : 0;
|
||||
|
||||
if (!(icb = vkd3d_malloc(offsetof(struct vkd3d_shader_immediate_constant_buffer, data[count]))))
|
||||
{
|
||||
@ -2436,6 +2436,10 @@ static enum vkd3d_result value_allocate_constant_array(struct sm6_value *dst, co
|
||||
icb->data_type = vkd3d_data_type_from_sm6_type(elem_type);
|
||||
icb->element_count = type->u.array.count;
|
||||
icb->component_count = 1;
|
||||
icb->is_null = !operands;
|
||||
|
||||
if (!operands)
|
||||
return VKD3D_OK;
|
||||
|
||||
count = type->u.array.count;
|
||||
if (size > sizeof(icb->data[0]))
|
||||
@ -2510,12 +2514,10 @@ static enum vkd3d_result sm6_parser_constants_init(struct sm6_parser *sm6, const
|
||||
switch (record->code)
|
||||
{
|
||||
case CST_CODE_NULL:
|
||||
if (sm6_type_is_array(type))
|
||||
if (sm6_type_is_array(type)
|
||||
&& (ret = value_allocate_constant_array(dst, type, NULL, sm6)) < 0)
|
||||
{
|
||||
FIXME("Constant null arrays are not supported.\n");
|
||||
vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_INVALID_OPERAND,
|
||||
"Constant null arrays are not supported.");
|
||||
return VKD3D_ERROR_INVALID_SHADER;
|
||||
return ret;
|
||||
}
|
||||
/* For non-aggregates, register constant data is already zero-filled. */
|
||||
break;
|
||||
|
@ -795,6 +795,7 @@ static void shader_sm4_read_shader_data(struct vkd3d_shader_instruction *ins, ui
|
||||
icb->data_type = VKD3D_DATA_FLOAT;
|
||||
icb->component_count = VKD3D_VEC4_SIZE;
|
||||
icb->element_count = icb_size / VKD3D_VEC4_SIZE;
|
||||
icb->is_null = false;
|
||||
memcpy(icb->data, tokens, sizeof(*tokens) * icb_size);
|
||||
shader_instruction_array_add_icb(&priv->p.instructions, icb);
|
||||
ins->declaration.icb = icb;
|
||||
|
@ -797,6 +797,7 @@ struct vkd3d_shader_immediate_constant_buffer
|
||||
/* total count is element_count * component_count */
|
||||
unsigned int element_count;
|
||||
unsigned int component_count;
|
||||
bool is_null;
|
||||
uint32_t data[];
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user