vkd3d: Make nameless unions really nameless

This makes it consistent across tests and vkd3d.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
This commit is contained in:
Joshua Ashton 2020-06-11 19:46:27 +01:00 committed by Hans-Kristian Arntzen
parent cbdf6f88d2
commit b9909854fe
16 changed files with 484 additions and 492 deletions

View File

@ -117,7 +117,7 @@ struct vkd3d_shader_parameter_immediate_constant
union
{
uint32_t u32;
} u;
};
};
struct vkd3d_shader_parameter_specialization_constant
@ -134,7 +134,7 @@ struct vkd3d_shader_parameter
{
struct vkd3d_shader_parameter_immediate_constant immediate_constant;
struct vkd3d_shader_parameter_specialization_constant specialization_constant;
} u;
};
};
#define VKD3D_SHADER_DESCRIPTOR_RANGE_UNBOUNDED (~0u)
@ -426,7 +426,7 @@ struct vkd3d_root_parameter
struct vkd3d_root_descriptor_table descriptor_table;
struct vkd3d_root_constants constants;
struct vkd3d_root_descriptor descriptor;
} u;
};
enum vkd3d_shader_visibility shader_visibility;
};
@ -502,7 +502,7 @@ struct vkd3d_root_parameter1
struct vkd3d_root_descriptor_table1 descriptor_table;
struct vkd3d_root_constants constants;
struct vkd3d_root_descriptor1 descriptor;
} u;
};
enum vkd3d_shader_visibility shader_visibility;
};
@ -530,7 +530,7 @@ struct vkd3d_versioned_root_signature_desc
{
struct vkd3d_root_signature_desc v_1_0;
struct vkd3d_root_signature_desc1 v_1_1;
} u;
};
};
/* FIXME: Add support for 64 UAV bind slots. */

View File

@ -22,13 +22,8 @@
/* Nameless unions */
#ifndef __C89_NAMELESS
# ifdef NONAMELESSUNION
# define __C89_NAMELESS
# define __C89_NAMELESSUNIONNAME u
# else
# define __C89_NAMELESS
# define __C89_NAMELESSUNIONNAME
# endif /* NONAMELESSUNION */
#endif /* __C89_NAMELESS */
#if !defined(_WIN32) || defined(__WIDL__)

View File

@ -804,7 +804,7 @@ static void shader_sm5_read_fcall(struct vkd3d_shader_instruction *ins,
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct vkd3d_sm4_data *priv)
{
priv->src_param[0].reg.u.fp_body_idx = *tokens++;
priv->src_param[0].reg.fp_body_idx = *tokens++;
shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], VKD3D_DATA_OPAQUE, &priv->src_param[0]);
}
@ -1624,7 +1624,7 @@ static bool shader_sm4_read_param(struct vkd3d_sm4_data *priv, const DWORD **ptr
WARN("Invalid ptr %p, end %p.\n", *ptr, end);
return false;
}
memcpy(param->u.immconst_uint, *ptr, 1 * sizeof(DWORD));
memcpy(param->immconst_uint, *ptr, 1 * sizeof(DWORD));
*ptr += 1;
break;
@ -1635,7 +1635,7 @@ static bool shader_sm4_read_param(struct vkd3d_sm4_data *priv, const DWORD **ptr
WARN("Invalid ptr %p, end %p.\n", *ptr, end);
return false;
}
memcpy(param->u.immconst_uint, *ptr, VKD3D_VEC4_SIZE * sizeof(DWORD));
memcpy(param->immconst_uint, *ptr, VKD3D_VEC4_SIZE * sizeof(DWORD));
*ptr += 4;
break;
@ -2515,15 +2515,15 @@ static int shader_parse_root_parameters(struct root_signature_parser_context *co
switch (parameters[i].parameter_type)
{
case VKD3D_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE:
ret = shader_parse_descriptor_table(context, offset, &parameters[i].u.descriptor_table);
ret = shader_parse_descriptor_table(context, offset, &parameters[i].descriptor_table);
break;
case VKD3D_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS:
ret = shader_parse_root_constants(context, offset, &parameters[i].u.constants);
ret = shader_parse_root_constants(context, offset, &parameters[i].constants);
break;
case VKD3D_ROOT_PARAMETER_TYPE_CBV:
case VKD3D_ROOT_PARAMETER_TYPE_SRV:
case VKD3D_ROOT_PARAMETER_TYPE_UAV:
ret = shader_parse_root_descriptor(context, offset, &parameters[i].u.descriptor);
ret = shader_parse_root_descriptor(context, offset, &parameters[i].descriptor);
break;
default:
FIXME("Unrecognized type %#x.\n", parameters[i].parameter_type);
@ -2563,15 +2563,15 @@ static int shader_parse_root_parameters1(struct root_signature_parser_context *c
switch (parameters[i].parameter_type)
{
case VKD3D_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE:
ret = shader_parse_descriptor_table1(context, offset, &parameters[i].u.descriptor_table);
ret = shader_parse_descriptor_table1(context, offset, &parameters[i].descriptor_table);
break;
case VKD3D_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS:
ret = shader_parse_root_constants(context, offset, &parameters[i].u.constants);
ret = shader_parse_root_constants(context, offset, &parameters[i].constants);
break;
case VKD3D_ROOT_PARAMETER_TYPE_CBV:
case VKD3D_ROOT_PARAMETER_TYPE_SRV:
case VKD3D_ROOT_PARAMETER_TYPE_UAV:
ret = shader_parse_root_descriptor1(context, offset, &parameters[i].u.descriptor);
ret = shader_parse_root_descriptor1(context, offset, &parameters[i].descriptor);
break;
default:
FIXME("Unrecognized type %#x.\n", parameters[i].parameter_type);
@ -2621,7 +2621,7 @@ static int shader_parse_static_samplers(struct root_signature_parser_context *co
static int shader_parse_root_signature(const char *data, unsigned int data_size,
struct vkd3d_versioned_root_signature_desc *desc)
{
struct vkd3d_root_signature_desc *v_1_0 = &desc->u.v_1_0;
struct vkd3d_root_signature_desc *v_1_0 = &desc->v_1_0;
struct root_signature_parser_context context;
unsigned int count, offset, version;
const char *ptr = data;
@ -2664,7 +2664,7 @@ static int shader_parse_root_signature(const char *data, unsigned int data_size,
}
else
{
struct vkd3d_root_signature_desc1 *v_1_1 = &desc->u.v_1_1;
struct vkd3d_root_signature_desc1 *v_1_1 = &desc->v_1_1;
assert(version == VKD3D_ROOT_SIGNATURE_VERSION_1_1);
@ -2731,61 +2731,61 @@ int vkd3d_shader_parse_root_signature(const struct vkd3d_shader_code *dxbc,
static unsigned int versioned_root_signature_get_parameter_count(const struct vkd3d_versioned_root_signature_desc *desc)
{
if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_0)
return desc->u.v_1_0.parameter_count;
return desc->v_1_0.parameter_count;
else
return desc->u.v_1_1.parameter_count;
return desc->v_1_1.parameter_count;
}
static enum vkd3d_root_parameter_type versioned_root_signature_get_parameter_type(
const struct vkd3d_versioned_root_signature_desc *desc, unsigned int i)
{
if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_0)
return desc->u.v_1_0.parameters[i].parameter_type;
return desc->v_1_0.parameters[i].parameter_type;
else
return desc->u.v_1_1.parameters[i].parameter_type;
return desc->v_1_1.parameters[i].parameter_type;
}
static enum vkd3d_shader_visibility versioned_root_signature_get_parameter_shader_visibility(
const struct vkd3d_versioned_root_signature_desc *desc, unsigned int i)
{
if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_0)
return desc->u.v_1_0.parameters[i].shader_visibility;
return desc->v_1_0.parameters[i].shader_visibility;
else
return desc->u.v_1_1.parameters[i].shader_visibility;
return desc->v_1_1.parameters[i].shader_visibility;
}
static const struct vkd3d_root_constants *versioned_root_signature_get_root_constants(
const struct vkd3d_versioned_root_signature_desc *desc, unsigned int i)
{
if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_0)
return &desc->u.v_1_0.parameters[i].u.constants;
return &desc->v_1_0.parameters[i].constants;
else
return &desc->u.v_1_1.parameters[i].u.constants;
return &desc->v_1_1.parameters[i].constants;
}
static unsigned int versioned_root_signature_get_static_sampler_count(const struct vkd3d_versioned_root_signature_desc *desc)
{
if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_0)
return desc->u.v_1_0.static_sampler_count;
return desc->v_1_0.static_sampler_count;
else
return desc->u.v_1_1.static_sampler_count;
return desc->v_1_1.static_sampler_count;
}
static const struct vkd3d_static_sampler_desc *versioned_root_signature_get_static_samplers(
const struct vkd3d_versioned_root_signature_desc *desc)
{
if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_0)
return desc->u.v_1_0.static_samplers;
return desc->v_1_0.static_samplers;
else
return desc->u.v_1_1.static_samplers;
return desc->v_1_1.static_samplers;
}
static unsigned int versioned_root_signature_get_flags(const struct vkd3d_versioned_root_signature_desc *desc)
{
if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_0)
return desc->u.v_1_0.flags;
return desc->v_1_0.flags;
else
return desc->u.v_1_1.flags;
return desc->v_1_1.flags;
}
struct root_signature_writer_context
@ -2998,9 +2998,9 @@ static int shader_write_root_parameters(struct root_signature_writer_context *co
{
case VKD3D_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE:
if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_0)
ret = shader_write_descriptor_table(context, &desc->u.v_1_0.parameters[i].u.descriptor_table);
ret = shader_write_descriptor_table(context, &desc->v_1_0.parameters[i].descriptor_table);
else
ret = shader_write_descriptor_table1(context, &desc->u.v_1_1.parameters[i].u.descriptor_table);
ret = shader_write_descriptor_table1(context, &desc->v_1_1.parameters[i].descriptor_table);
break;
case VKD3D_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS:
ret = shader_write_root_constants(context, versioned_root_signature_get_root_constants(desc, i));
@ -3009,9 +3009,9 @@ static int shader_write_root_parameters(struct root_signature_writer_context *co
case VKD3D_ROOT_PARAMETER_TYPE_SRV:
case VKD3D_ROOT_PARAMETER_TYPE_UAV:
if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_0)
ret = shader_write_root_descriptor(context, &desc->u.v_1_0.parameters[i].u.descriptor);
ret = shader_write_root_descriptor(context, &desc->v_1_0.parameters[i].descriptor);
else
ret = shader_write_root_descriptor1(context, &desc->u.v_1_1.parameters[i].u.descriptor);
ret = shader_write_root_descriptor1(context, &desc->v_1_1.parameters[i].descriptor);
break;
default:
FIXME("Unrecognized type %#x.\n", versioned_root_signature_get_parameter_type(desc, i));
@ -3179,9 +3179,9 @@ static int validate_root_signature_desc(const struct vkd3d_versioned_root_signat
if (type == VKD3D_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE)
{
if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_0)
ret = validate_descriptor_table_v_1_0(&desc->u.v_1_0.parameters[i].u.descriptor_table);
ret = validate_descriptor_table_v_1_0(&desc->v_1_0.parameters[i].descriptor_table);
else
ret = validate_descriptor_table_v_1_1(&desc->u.v_1_1.parameters[i].u.descriptor_table);
ret = validate_descriptor_table_v_1_1(&desc->v_1_1.parameters[i].descriptor_table);
}
if (ret < 0)
@ -3251,7 +3251,7 @@ static void free_descriptor_ranges(const struct vkd3d_root_parameter *parameters
const struct vkd3d_root_parameter *p = &parameters[i];
if (p->parameter_type == VKD3D_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE)
vkd3d_free((void *)p->u.descriptor_table.descriptor_ranges);
vkd3d_free((void *)p->descriptor_table.descriptor_ranges);
}
}
@ -3273,17 +3273,17 @@ static int convert_root_parameters_to_v_1_0(struct vkd3d_root_parameter *dst,
{
case VKD3D_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE:
ranges = NULL;
if ((p->u.descriptor_table.descriptor_range_count = p1->u.descriptor_table.descriptor_range_count))
if ((p->descriptor_table.descriptor_range_count = p1->descriptor_table.descriptor_range_count))
{
if (!(ranges = vkd3d_calloc(p->u.descriptor_table.descriptor_range_count, sizeof(*ranges))))
if (!(ranges = vkd3d_calloc(p->descriptor_table.descriptor_range_count, sizeof(*ranges))))
{
ret = VKD3D_ERROR_OUT_OF_MEMORY;
goto fail;
}
}
p->u.descriptor_table.descriptor_ranges = ranges;
ranges1 = p1->u.descriptor_table.descriptor_ranges;
for (j = 0; j < p->u.descriptor_table.descriptor_range_count; ++j)
p->descriptor_table.descriptor_ranges = ranges;
ranges1 = p1->descriptor_table.descriptor_ranges;
for (j = 0; j < p->descriptor_table.descriptor_range_count; ++j)
{
ranges[j].range_type = ranges1[j].range_type;
ranges[j].descriptor_count = ranges1[j].descriptor_count;
@ -3293,13 +3293,13 @@ static int convert_root_parameters_to_v_1_0(struct vkd3d_root_parameter *dst,
}
break;
case VKD3D_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS:
p->u.constants = p1->u.constants;
p->constants = p1->constants;
break;
case VKD3D_ROOT_PARAMETER_TYPE_CBV:
case VKD3D_ROOT_PARAMETER_TYPE_SRV:
case VKD3D_ROOT_PARAMETER_TYPE_UAV:
p->u.descriptor.shader_register = p1->u.descriptor.shader_register;
p->u.descriptor.register_space = p1->u.descriptor.register_space;
p->descriptor.shader_register = p1->descriptor.shader_register;
p->descriptor.register_space = p1->descriptor.register_space;
break;
default:
WARN("Invalid root parameter type %#x.\n", p->parameter_type);
@ -3320,8 +3320,8 @@ fail:
static int convert_root_signature_to_v1_0(struct vkd3d_versioned_root_signature_desc *dst,
const struct vkd3d_versioned_root_signature_desc *src)
{
const struct vkd3d_root_signature_desc1 *src_desc = &src->u.v_1_1;
struct vkd3d_root_signature_desc *dst_desc = &dst->u.v_1_0;
const struct vkd3d_root_signature_desc1 *src_desc = &src->v_1_1;
struct vkd3d_root_signature_desc *dst_desc = &dst->v_1_0;
struct vkd3d_static_sampler_desc *samplers = NULL;
struct vkd3d_root_parameter *parameters = NULL;
int ret;
@ -3370,7 +3370,7 @@ static void free_descriptor_ranges1(const struct vkd3d_root_parameter1 *paramete
const struct vkd3d_root_parameter1 *p = &parameters[i];
if (p->parameter_type == VKD3D_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE)
vkd3d_free((void *)p->u.descriptor_table.descriptor_ranges);
vkd3d_free((void *)p->descriptor_table.descriptor_ranges);
}
}
@ -3392,17 +3392,17 @@ static int convert_root_parameters_to_v_1_1(struct vkd3d_root_parameter1 *dst,
{
case VKD3D_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE:
ranges1 = NULL;
if ((p1->u.descriptor_table.descriptor_range_count = p->u.descriptor_table.descriptor_range_count))
if ((p1->descriptor_table.descriptor_range_count = p->descriptor_table.descriptor_range_count))
{
if (!(ranges1 = vkd3d_calloc(p1->u.descriptor_table.descriptor_range_count, sizeof(*ranges1))))
if (!(ranges1 = vkd3d_calloc(p1->descriptor_table.descriptor_range_count, sizeof(*ranges1))))
{
ret = VKD3D_ERROR_OUT_OF_MEMORY;
goto fail;
}
}
p1->u.descriptor_table.descriptor_ranges = ranges1;
ranges = p->u.descriptor_table.descriptor_ranges;
for (j = 0; j < p1->u.descriptor_table.descriptor_range_count; ++j)
p1->descriptor_table.descriptor_ranges = ranges1;
ranges = p->descriptor_table.descriptor_ranges;
for (j = 0; j < p1->descriptor_table.descriptor_range_count; ++j)
{
ranges1[j].range_type = ranges[j].range_type;
ranges1[j].descriptor_count = ranges[j].descriptor_count;
@ -3413,14 +3413,14 @@ static int convert_root_parameters_to_v_1_1(struct vkd3d_root_parameter1 *dst,
}
break;
case VKD3D_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS:
p1->u.constants = p->u.constants;
p1->constants = p->constants;
break;
case VKD3D_ROOT_PARAMETER_TYPE_CBV:
case VKD3D_ROOT_PARAMETER_TYPE_SRV:
case VKD3D_ROOT_PARAMETER_TYPE_UAV:
p1->u.descriptor.shader_register = p->u.descriptor.shader_register;
p1->u.descriptor.register_space = p->u.descriptor.register_space;
p1->u.descriptor.flags = VKD3D_ROOT_SIGNATURE_1_0_ROOT_DESCRIPTOR_FLAGS;
p1->descriptor.shader_register = p->descriptor.shader_register;
p1->descriptor.register_space = p->descriptor.register_space;
p1->descriptor.flags = VKD3D_ROOT_SIGNATURE_1_0_ROOT_DESCRIPTOR_FLAGS;
break;
default:
WARN("Invalid root parameter type %#x.\n", p1->parameter_type);
@ -3441,8 +3441,8 @@ fail:
static int convert_root_signature_to_v1_1(struct vkd3d_versioned_root_signature_desc *dst,
const struct vkd3d_versioned_root_signature_desc *src)
{
const struct vkd3d_root_signature_desc *src_desc = &src->u.v_1_0;
struct vkd3d_root_signature_desc1 *dst_desc = &dst->u.v_1_1;
const struct vkd3d_root_signature_desc *src_desc = &src->v_1_0;
struct vkd3d_root_signature_desc1 *dst_desc = &dst->v_1_1;
struct vkd3d_static_sampler_desc *samplers = NULL;
struct vkd3d_root_parameter1 *parameters = NULL;
int ret;

View File

@ -501,7 +501,7 @@ int vkd3d_shader_compile_dxil(const struct vkd3d_shader_code *dxbc,
bool spec_constant = argument->type == VKD3D_SHADER_PARAMETER_TYPE_SPECIALIZATION_CONSTANT;
const dxil_spv_option_rasterizer_sample_count helper =
{ { DXIL_SPV_OPTION_RASTERIZER_SAMPLE_COUNT },
spec_constant ? argument->u.specialization_constant.id : argument->u.immediate_constant.u.u32,
spec_constant ? argument->specialization_constant.id : argument->immediate_constant.u32,
spec_constant ? DXIL_SPV_TRUE : DXIL_SPV_FALSE };
if (dxil_spv_converter_add_option(converter, &helper.base) != DXIL_SPV_SUCCESS)
{

View File

@ -2131,7 +2131,7 @@ struct vkd3d_control_flow_info
struct vkd3d_if_cf_info if_;
struct vkd3d_loop_cf_info loop;
struct vkd3d_switch_cf_info switch_;
} u;
};
enum
{
@ -2813,7 +2813,7 @@ static uint32_t vkd3d_dxbc_compiler_alloc_spec_constant_id(struct vkd3d_dxbc_com
const struct vkd3d_shader_parameter *current = &compile_args->parameters[i];
if (current->type == VKD3D_SHADER_PARAMETER_TYPE_SPECIALIZATION_CONSTANT)
id = max(current->u.specialization_constant.id + 1, id);
id = max(current->specialization_constant.id + 1, id);
}
compiler->current_spec_constant_id = id;
@ -2876,9 +2876,9 @@ static uint32_t vkd3d_dxbc_compiler_emit_uint_shader_parameter(struct vkd3d_dxbc
}
if (parameter->type == VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT)
return vkd3d_dxbc_compiler_get_constant_uint(compiler, parameter->u.immediate_constant.u.u32);
return vkd3d_dxbc_compiler_get_constant_uint(compiler, parameter->immediate_constant.u32);
if (parameter->type == VKD3D_SHADER_PARAMETER_TYPE_SPECIALIZATION_CONSTANT)
return vkd3d_dxbc_compiler_get_spec_constant(compiler, name, parameter->u.specialization_constant.id);
return vkd3d_dxbc_compiler_get_spec_constant(compiler, name, parameter->specialization_constant.id);
FIXME("Unhandled parameter type %#x.\n", parameter->type);
@ -3182,14 +3182,14 @@ static uint32_t vkd3d_dxbc_compiler_emit_load_constant(struct vkd3d_dxbc_compile
if (reg->immconst_type == VKD3D_IMMCONST_SCALAR)
{
for (i = 0; i < component_count; ++i)
values[i] = *reg->u.immconst_uint;
values[i] = *reg->immconst_uint;
}
else
{
for (i = 0, j = 0; i < VKD3D_VEC4_SIZE; ++i)
{
if (write_mask & (VKD3DSP_WRITEMASK_0 << i))
values[j++] = reg->u.immconst_uint[vkd3d_swizzle_get_component(swizzle, i)];
values[j++] = reg->immconst_uint[vkd3d_swizzle_get_component(swizzle, i)];
}
}
@ -7328,14 +7328,14 @@ static int vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_c
true_label = vkd3d_spirv_alloc_id(builder);
merge_block_id = vkd3d_spirv_alloc_id(builder);
vkd3d_spirv_build_op_selection_merge(builder, merge_block_id, SpvSelectionControlMaskNone);
cf_info->u.if_.stream_location = vkd3d_spirv_stream_current_location(&builder->function_stream);
cf_info->if_.stream_location = vkd3d_spirv_stream_current_location(&builder->function_stream);
vkd3d_spirv_build_op_branch_conditional(builder, condition_id, true_label, merge_block_id);
vkd3d_spirv_build_op_label(builder, true_label);
cf_info->u.if_.id = compiler->branch_id;
cf_info->u.if_.merge_block_id = merge_block_id;
cf_info->u.if_.else_block_id = 0;
cf_info->if_.id = compiler->branch_id;
cf_info->if_.merge_block_id = merge_block_id;
cf_info->if_.else_block_id = 0;
cf_info->inside_block = true;
cf_info->current_block = VKD3D_BLOCK_IF;
@ -7349,14 +7349,14 @@ static int vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_c
assert(cf_info->current_block == VKD3D_BLOCK_IF);
if (cf_info->inside_block)
vkd3d_spirv_build_op_branch(builder, cf_info->u.if_.merge_block_id);
vkd3d_spirv_build_op_branch(builder, cf_info->if_.merge_block_id);
cf_info->u.if_.else_block_id = vkd3d_spirv_alloc_id(builder);
cf_info->if_.else_block_id = vkd3d_spirv_alloc_id(builder);
vkd3d_spirv_as_op_branch_conditional(&builder->function_stream,
cf_info->u.if_.stream_location)->false_label = cf_info->u.if_.else_block_id;
cf_info->if_.stream_location)->false_label = cf_info->if_.else_block_id;
vkd3d_spirv_build_op_name(builder,
cf_info->u.if_.else_block_id, "branch%u_false", cf_info->u.if_.id);
vkd3d_spirv_build_op_label(builder, cf_info->u.if_.else_block_id);
cf_info->if_.else_block_id, "branch%u_false", cf_info->if_.id);
vkd3d_spirv_build_op_label(builder, cf_info->if_.else_block_id);
cf_info->inside_block = true;
break;
@ -7365,9 +7365,9 @@ static int vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_c
assert(cf_info->current_block == VKD3D_BLOCK_IF);
if (cf_info->inside_block)
vkd3d_spirv_build_op_branch(builder, cf_info->u.if_.merge_block_id);
vkd3d_spirv_build_op_branch(builder, cf_info->if_.merge_block_id);
vkd3d_spirv_build_op_label(builder, cf_info->u.if_.merge_block_id);
vkd3d_spirv_build_op_label(builder, cf_info->if_.merge_block_id);
vkd3d_dxbc_compiler_pop_control_flow_level(compiler);
break;
@ -7388,9 +7388,9 @@ static int vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_c
vkd3d_spirv_build_op_label(builder, loop_body_block_id);
cf_info->u.loop.header_block_id = loop_header_block_id;
cf_info->u.loop.continue_block_id = continue_block_id;
cf_info->u.loop.merge_block_id = merge_block_id;
cf_info->loop.header_block_id = loop_header_block_id;
cf_info->loop.continue_block_id = continue_block_id;
cf_info->loop.merge_block_id = merge_block_id;
cf_info->current_block = VKD3D_BLOCK_LOOP;
vkd3d_spirv_build_op_name(builder, loop_header_block_id, "loop%u_header", compiler->loop_id);
@ -7404,11 +7404,11 @@ static int vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_c
assert(compiler->control_flow_depth);
assert(cf_info->current_block == VKD3D_BLOCK_LOOP);
vkd3d_spirv_build_op_branch(builder, cf_info->u.loop.continue_block_id);
vkd3d_spirv_build_op_branch(builder, cf_info->loop.continue_block_id);
vkd3d_spirv_build_op_label(builder, cf_info->u.loop.continue_block_id);
vkd3d_spirv_build_op_branch(builder, cf_info->u.loop.header_block_id);
vkd3d_spirv_build_op_label(builder, cf_info->u.loop.merge_block_id);
vkd3d_spirv_build_op_label(builder, cf_info->loop.continue_block_id);
vkd3d_spirv_build_op_branch(builder, cf_info->loop.header_block_id);
vkd3d_spirv_build_op_label(builder, cf_info->loop.merge_block_id);
vkd3d_dxbc_compiler_pop_control_flow_level(compiler);
break;
@ -7424,14 +7424,14 @@ static int vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_c
vkd3d_spirv_build_op_selection_merge(builder, merge_block_id, SpvSelectionControlMaskNone);
cf_info->u.switch_.id = compiler->switch_id;
cf_info->u.switch_.merge_block_id = merge_block_id;
cf_info->u.switch_.stream_location = vkd3d_spirv_stream_current_location(&builder->function_stream);
cf_info->u.switch_.selector_id = val_id;
cf_info->u.switch_.case_blocks = NULL;
cf_info->u.switch_.case_blocks_size = 0;
cf_info->u.switch_.case_block_count = 0;
cf_info->u.switch_.default_block_id = 0;
cf_info->switch_.id = compiler->switch_id;
cf_info->switch_.merge_block_id = merge_block_id;
cf_info->switch_.stream_location = vkd3d_spirv_stream_current_location(&builder->function_stream);
cf_info->switch_.selector_id = val_id;
cf_info->switch_.case_blocks = NULL;
cf_info->switch_.case_blocks_size = 0;
cf_info->switch_.case_block_count = 0;
cf_info->switch_.default_block_id = 0;
cf_info->inside_block = false;
cf_info->current_block = VKD3D_BLOCK_SWITCH;
@ -7439,8 +7439,8 @@ static int vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_c
++compiler->switch_id;
if (!vkd3d_array_reserve((void **)&cf_info->u.switch_.case_blocks, &cf_info->u.switch_.case_blocks_size,
10, sizeof(*cf_info->u.switch_.case_blocks)))
if (!vkd3d_array_reserve((void **)&cf_info->switch_.case_blocks, &cf_info->switch_.case_blocks_size,
10, sizeof(*cf_info->switch_.case_blocks)))
return VKD3D_ERROR_OUT_OF_MEMORY;
break;
@ -7450,21 +7450,21 @@ static int vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_c
assert(cf_info->current_block == VKD3D_BLOCK_SWITCH);
assert(!cf_info->inside_block);
if (!cf_info->u.switch_.default_block_id)
cf_info->u.switch_.default_block_id = cf_info->u.switch_.merge_block_id;
if (!cf_info->switch_.default_block_id)
cf_info->switch_.default_block_id = cf_info->switch_.merge_block_id;
vkd3d_spirv_build_op_label(builder, cf_info->u.switch_.merge_block_id);
vkd3d_spirv_build_op_label(builder, cf_info->switch_.merge_block_id);
/* The OpSwitch instruction is inserted when the endswitch
* instruction is processed because we do not know the number
* of case statments in advance.*/
vkd3d_spirv_begin_function_stream_insertion(builder, cf_info->u.switch_.stream_location);
vkd3d_spirv_build_op_switch(builder, cf_info->u.switch_.selector_id,
cf_info->u.switch_.default_block_id, cf_info->u.switch_.case_blocks,
cf_info->u.switch_.case_block_count);
vkd3d_spirv_begin_function_stream_insertion(builder, cf_info->switch_.stream_location);
vkd3d_spirv_build_op_switch(builder, cf_info->switch_.selector_id,
cf_info->switch_.default_block_id, cf_info->switch_.case_blocks,
cf_info->switch_.case_block_count);
vkd3d_spirv_end_function_stream_insertion(builder);
vkd3d_free(cf_info->u.switch_.case_blocks);
vkd3d_free(cf_info->switch_.case_blocks);
vkd3d_dxbc_compiler_pop_control_flow_level(compiler);
break;
@ -7476,38 +7476,38 @@ static int vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_c
assert(cf_info->current_block == VKD3D_BLOCK_SWITCH);
assert(src->swizzle == VKD3D_NO_SWIZZLE && src->reg.type == VKD3DSPR_IMMCONST);
value = *src->reg.u.immconst_uint;
value = *src->reg.immconst_uint;
if (!vkd3d_array_reserve((void **)&cf_info->u.switch_.case_blocks, &cf_info->u.switch_.case_blocks_size,
2 * (cf_info->u.switch_.case_block_count + 1), sizeof(*cf_info->u.switch_.case_blocks)))
if (!vkd3d_array_reserve((void **)&cf_info->switch_.case_blocks, &cf_info->switch_.case_blocks_size,
2 * (cf_info->switch_.case_block_count + 1), sizeof(*cf_info->switch_.case_blocks)))
return VKD3D_ERROR_OUT_OF_MEMORY;
label_id = vkd3d_spirv_alloc_id(builder);
if (cf_info->inside_block) /* fall-through */
vkd3d_spirv_build_op_branch(builder, label_id);
cf_info->u.switch_.case_blocks[2 * cf_info->u.switch_.case_block_count + 0] = value;
cf_info->u.switch_.case_blocks[2 * cf_info->u.switch_.case_block_count + 1] = label_id;
++cf_info->u.switch_.case_block_count;
cf_info->switch_.case_blocks[2 * cf_info->switch_.case_block_count + 0] = value;
cf_info->switch_.case_blocks[2 * cf_info->switch_.case_block_count + 1] = label_id;
++cf_info->switch_.case_block_count;
vkd3d_spirv_build_op_label(builder, label_id);
cf_info->inside_block = true;
vkd3d_spirv_build_op_name(builder, label_id, "switch%u_case%u", cf_info->u.switch_.id, value);
vkd3d_spirv_build_op_name(builder, label_id, "switch%u_case%u", cf_info->switch_.id, value);
break;
}
case VKD3DSIH_DEFAULT:
assert(compiler->control_flow_depth);
assert(cf_info->current_block == VKD3D_BLOCK_SWITCH);
assert(!cf_info->u.switch_.default_block_id);
assert(!cf_info->switch_.default_block_id);
cf_info->u.switch_.default_block_id = vkd3d_spirv_alloc_id(builder);
cf_info->switch_.default_block_id = vkd3d_spirv_alloc_id(builder);
if (cf_info->inside_block) /* fall-through */
vkd3d_spirv_build_op_branch(builder, cf_info->u.switch_.default_block_id);
vkd3d_spirv_build_op_branch(builder, cf_info->switch_.default_block_id);
vkd3d_spirv_build_op_label(builder, cf_info->u.switch_.default_block_id);
vkd3d_spirv_build_op_name(builder, cf_info->u.switch_.default_block_id,
"switch%u_default", cf_info->u.switch_.id);
vkd3d_spirv_build_op_label(builder, cf_info->switch_.default_block_id);
vkd3d_spirv_build_op_name(builder, cf_info->switch_.default_block_id,
"switch%u_default", cf_info->switch_.id);
cf_info->inside_block = true;
break;
@ -7525,12 +7525,12 @@ static int vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_c
if (breakable_cf_info->current_block == VKD3D_BLOCK_LOOP)
{
vkd3d_spirv_build_op_branch(builder, breakable_cf_info->u.loop.merge_block_id);
vkd3d_spirv_build_op_branch(builder, breakable_cf_info->loop.merge_block_id);
}
else if (breakable_cf_info->current_block == VKD3D_BLOCK_SWITCH)
{
assert(breakable_cf_info->inside_block);
vkd3d_spirv_build_op_branch(builder, breakable_cf_info->u.switch_.merge_block_id);
vkd3d_spirv_build_op_branch(builder, breakable_cf_info->switch_.merge_block_id);
}
cf_info->inside_block = false;
@ -7550,7 +7550,7 @@ static int vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_c
}
merge_block_id = vkd3d_dxbc_compiler_emit_conditional_branch(compiler,
instruction, loop_cf_info->u.loop.merge_block_id);
instruction, loop_cf_info->loop.merge_block_id);
vkd3d_spirv_build_op_label(builder, merge_block_id);
break;
}
@ -7567,7 +7567,7 @@ static int vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_c
return VKD3D_ERROR_INVALID_SHADER;
}
vkd3d_spirv_build_op_branch(builder, loop_cf_info->u.loop.continue_block_id);
vkd3d_spirv_build_op_branch(builder, loop_cf_info->loop.continue_block_id);
cf_info->inside_block = false;
break;
@ -7584,7 +7584,7 @@ static int vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_c
}
merge_block_id = vkd3d_dxbc_compiler_emit_conditional_branch(compiler,
instruction, loop_cf_info->u.loop.continue_block_id);
instruction, loop_cf_info->loop.continue_block_id);
vkd3d_spirv_build_op_label(builder, merge_block_id);
break;
}

View File

@ -970,15 +970,15 @@ static void shader_dump_register(struct vkd3d_string_buffer *buffer,
switch (reg->data_type)
{
case VKD3D_DATA_FLOAT:
shader_addline(buffer, "%.8e", reg->u.immconst_float[0]);
shader_addline(buffer, "%.8e", reg->immconst_float[0]);
break;
case VKD3D_DATA_INT:
shader_addline(buffer, "%d", reg->u.immconst_uint[0]);
shader_addline(buffer, "%d", reg->immconst_uint[0]);
break;
case VKD3D_DATA_RESOURCE:
case VKD3D_DATA_SAMPLER:
case VKD3D_DATA_UINT:
shader_addline(buffer, "%u", reg->u.immconst_uint[0]);
shader_addline(buffer, "%u", reg->immconst_uint[0]);
break;
default:
shader_addline(buffer, "<unhandled data type %#x>", reg->data_type);
@ -991,20 +991,20 @@ static void shader_dump_register(struct vkd3d_string_buffer *buffer,
{
case VKD3D_DATA_FLOAT:
shader_addline(buffer, "%.8e, %.8e, %.8e, %.8e",
reg->u.immconst_float[0], reg->u.immconst_float[1],
reg->u.immconst_float[2], reg->u.immconst_float[3]);
reg->immconst_float[0], reg->immconst_float[1],
reg->immconst_float[2], reg->immconst_float[3]);
break;
case VKD3D_DATA_INT:
shader_addline(buffer, "%d, %d, %d, %d",
reg->u.immconst_uint[0], reg->u.immconst_uint[1],
reg->u.immconst_uint[2], reg->u.immconst_uint[3]);
reg->immconst_uint[0], reg->immconst_uint[1],
reg->immconst_uint[2], reg->immconst_uint[3]);
break;
case VKD3D_DATA_RESOURCE:
case VKD3D_DATA_SAMPLER:
case VKD3D_DATA_UINT:
shader_addline(buffer, "%u, %u, %u, %u",
reg->u.immconst_uint[0], reg->u.immconst_uint[1],
reg->u.immconst_uint[2], reg->u.immconst_uint[3]);
reg->immconst_uint[0], reg->immconst_uint[1],
reg->immconst_uint[2], reg->immconst_uint[3]);
break;
default:
shader_addline(buffer, "<unhandled data type %#x>", reg->data_type);
@ -1056,7 +1056,7 @@ static void shader_dump_register(struct vkd3d_string_buffer *buffer,
}
if (reg->type == VKD3DSPR_FUNCTIONPOINTER)
shader_addline(buffer, "[%u]", reg->u.fp_body_idx);
shader_addline(buffer, "[%u]", reg->fp_body_idx);
}
}
@ -1553,19 +1553,19 @@ static void shader_dump_instruction(struct vkd3d_string_buffer *buffer,
case VKD3DSIH_DEF:
shader_addline(buffer, "def c%u = %.8e, %.8e, %.8e, %.8e",
shader_get_float_offset(ins->dst[0].reg.type, ins->dst[0].reg.idx[0].offset),
ins->src[0].reg.u.immconst_float[0], ins->src[0].reg.u.immconst_float[1],
ins->src[0].reg.u.immconst_float[2], ins->src[0].reg.u.immconst_float[3]);
ins->src[0].reg.immconst_float[0], ins->src[0].reg.immconst_float[1],
ins->src[0].reg.immconst_float[2], ins->src[0].reg.immconst_float[3]);
break;
case VKD3DSIH_DEFI:
shader_addline(buffer, "defi i%u = %d, %d, %d, %d", ins->dst[0].reg.idx[0].offset,
ins->src[0].reg.u.immconst_uint[0], ins->src[0].reg.u.immconst_uint[1],
ins->src[0].reg.u.immconst_uint[2], ins->src[0].reg.u.immconst_uint[3]);
ins->src[0].reg.immconst_uint[0], ins->src[0].reg.immconst_uint[1],
ins->src[0].reg.immconst_uint[2], ins->src[0].reg.immconst_uint[3]);
break;
case VKD3DSIH_DEFB:
shader_addline(buffer, "defb b%u = %s",
ins->dst[0].reg.idx[0].offset, ins->src[0].reg.u.immconst_uint[0] ? "true" : "false");
ins->dst[0].reg.idx[0].offset, ins->src[0].reg.immconst_uint[0] ? "true" : "false");
break;
default:

View File

@ -372,7 +372,7 @@ static void vkd3d_shader_free_root_signature_v_1_0(struct vkd3d_root_signature_d
const struct vkd3d_root_parameter *parameter = &root_signature->parameters[i];
if (parameter->parameter_type == VKD3D_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE)
vkd3d_free((void *)parameter->u.descriptor_table.descriptor_ranges);
vkd3d_free((void *)parameter->descriptor_table.descriptor_ranges);
}
vkd3d_free((void *)root_signature->parameters);
vkd3d_free((void *)root_signature->static_samplers);
@ -389,7 +389,7 @@ static void vkd3d_shader_free_root_signature_v_1_1(struct vkd3d_root_signature_d
const struct vkd3d_root_parameter1 *parameter = &root_signature->parameters[i];
if (parameter->parameter_type == VKD3D_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE)
vkd3d_free((void *)parameter->u.descriptor_table.descriptor_ranges);
vkd3d_free((void *)parameter->descriptor_table.descriptor_ranges);
}
vkd3d_free((void *)root_signature->parameters);
vkd3d_free((void *)root_signature->static_samplers);
@ -401,11 +401,11 @@ void vkd3d_shader_free_root_signature(struct vkd3d_versioned_root_signature_desc
{
if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_0)
{
vkd3d_shader_free_root_signature_v_1_0(&desc->u.v_1_0);
vkd3d_shader_free_root_signature_v_1_0(&desc->v_1_0);
}
else if (desc->version == VKD3D_ROOT_SIGNATURE_VERSION_1_1)
{
vkd3d_shader_free_root_signature_v_1_1(&desc->u.v_1_1);
vkd3d_shader_free_root_signature_v_1_1(&desc->v_1_1);
}
else if (desc->version)
{

View File

@ -45,7 +45,6 @@
#ifndef __VKD3D_SHADER_PRIVATE_H
#define __VKD3D_SHADER_PRIVATE_H
#define NONAMELESSUNION
#include "vkd3d_common.h"
#include "vkd3d_memory.h"
#include "vkd3d_shader.h"
@ -589,7 +588,7 @@ struct vkd3d_shader_register
DWORD immconst_uint[VKD3D_VEC4_SIZE];
float immconst_float[VKD3D_VEC4_SIZE];
unsigned fp_body_idx;
} u;
};
};
struct vkd3d_shader_dst_param

View File

@ -20,7 +20,6 @@
#define __VKD3D_UTILS_PRIVATE_H
#define COBJMACROS
#define NONAMELESSUNION
#define VK_NO_PROTOTYPES
#include "vkd3d_threads.h"

View File

@ -458,7 +458,7 @@ static const struct d3d12_root_descriptor_table *root_signature_get_descriptor_t
{
const struct d3d12_root_parameter *p = root_signature_get_parameter(root_signature, index);
assert(p->parameter_type == D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE);
return &p->u.descriptor_table;
return &p->descriptor_table;
}
static const struct d3d12_root_constant *root_signature_get_32bit_constants(
@ -466,7 +466,7 @@ static const struct d3d12_root_constant *root_signature_get_32bit_constants(
{
const struct d3d12_root_parameter *p = root_signature_get_parameter(root_signature, index);
assert(p->parameter_type == D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS);
return &p->u.constant;
return &p->constant;
}
static const struct d3d12_root_parameter *root_signature_get_root_descriptor(
@ -1935,7 +1935,7 @@ static void d3d12_command_list_clear_attachment_pass(struct d3d12_command_list *
extent.height = d3d12_resource_desc_get_height(&resource->desc, view->info.texture.miplevel_idx);
extent.depth = view->info.texture.layer_count;
if (!d3d12_command_list_create_framebuffer(list, vk_render_pass, 1, &view->u.vk_image_view, extent, &vk_framebuffer))
if (!d3d12_command_list_create_framebuffer(list, vk_render_pass, 1, &view->vk_image_view, extent, &vk_framebuffer))
{
ERR("Failed to create framebuffer.\n");
return;
@ -1992,7 +1992,7 @@ static bool d3d12_command_list_has_render_pass_rtv_clear(struct d3d12_command_li
if (!d3d12_pipeline_state_is_graphics(list->state))
return false;
graphics = &list->state->u.graphics;
graphics = &list->state->graphics;
return attachment_idx < graphics->rt_count &&
!(graphics->null_attachment_mask & (1 << attachment_idx)) &&
@ -2146,7 +2146,7 @@ static VkPipelineStageFlags vk_render_pass_barrier_from_view(const struct vkd3d_
vk_barrier->srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
vk_barrier->dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
vk_barrier->image = resource->u.vk_image;
vk_barrier->image = resource->vk_image;
vk_barrier->subresourceRange = vk_subresource_range_from_view(view);
return stages;
}
@ -2419,7 +2419,7 @@ static void d3d12_command_list_transition_resource_to_initial_state(struct d3d12
barrier.newLayout = resource->common_layout;
barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
barrier.image = resource->u.vk_image;
barrier.image = resource->vk_image;
barrier.subresourceRange.aspectMask = format->vk_aspect_mask;
barrier.subresourceRange.baseMipLevel = 0;
barrier.subresourceRange.levelCount = VK_REMAINING_MIP_LEVELS;
@ -2712,7 +2712,7 @@ static bool d3d12_command_list_has_depth_stencil_view(struct d3d12_command_list
struct d3d12_graphics_pipeline_state *graphics;
assert(d3d12_pipeline_state_is_graphics(list->state));
graphics = &list->state->u.graphics;
graphics = &list->state->graphics;
return graphics->dsv_format || (d3d12_pipeline_state_has_unknown_dsv_format(list->state) && list->dsv.format);
}
@ -2720,7 +2720,7 @@ static bool d3d12_command_list_has_depth_stencil_view(struct d3d12_command_list
static void d3d12_command_list_get_fb_extent(struct d3d12_command_list *list,
uint32_t *width, uint32_t *height, uint32_t *layer_count)
{
struct d3d12_graphics_pipeline_state *graphics = &list->state->u.graphics;
struct d3d12_graphics_pipeline_state *graphics = &list->state->graphics;
struct d3d12_device *device = list->device;
if (graphics->rt_count || d3d12_command_list_has_depth_stencil_view(list))
@ -2785,7 +2785,7 @@ static bool d3d12_command_list_update_current_framebuffer(struct d3d12_command_l
if (list->current_framebuffer != VK_NULL_HANDLE)
return true;
graphics = &list->state->u.graphics;
graphics = &list->state->graphics;
for (i = 0, view_count = 0; i < graphics->rt_count; ++i)
{
@ -2802,7 +2802,7 @@ static bool d3d12_command_list_update_current_framebuffer(struct d3d12_command_l
return false;
}
views[view_count++] = list->rtvs[i].view->u.vk_image_view;
views[view_count++] = list->rtvs[i].view->vk_image_view;
}
if (d3d12_command_list_has_depth_stencil_view(list))
@ -2813,7 +2813,7 @@ static bool d3d12_command_list_update_current_framebuffer(struct d3d12_command_l
return false;
}
views[view_count++] = list->dsv.view->u.vk_image_view;
views[view_count++] = list->dsv.view->vk_image_view;
}
d3d12_command_list_get_fb_extent(list, &extent.width, &extent.height, &extent.depth);
@ -2842,8 +2842,8 @@ static bool d3d12_command_list_update_compute_pipeline(struct d3d12_command_list
return false;
}
VK_CALL(vkCmdBindPipeline(list->vk_command_buffer, list->state->vk_bind_point, list->state->u.compute.vk_pipeline));
list->current_pipeline = list->state->u.compute.vk_pipeline;
VK_CALL(vkCmdBindPipeline(list->vk_command_buffer, list->state->vk_bind_point, list->state->compute.vk_pipeline));
list->current_pipeline = list->state->compute.vk_pipeline;
return true;
}
@ -2881,7 +2881,7 @@ static bool d3d12_command_list_update_graphics_pipeline(struct d3d12_command_lis
if (list->current_render_pass || list->render_pass_suspended)
d3d12_command_list_invalidate_current_render_pass(list);
/* Only override this after ending the render pass. */
list->dsv_layout = list->state->u.graphics.dsv_layout;
list->dsv_layout = list->state->graphics.dsv_layout;
}
VK_CALL(vkCmdBindPipeline(list->vk_command_buffer, list->state->vk_bind_point, vk_pipeline));
@ -2900,7 +2900,7 @@ static bool vkd3d_descriptor_info_from_d3d12_desc(struct d3d12_device *device,
if (desc->magic != VKD3D_DESCRIPTOR_MAGIC_CBV)
return false;
vk_descriptor->buffer = desc->u.vk_cbv_info;
vk_descriptor->buffer = desc->info.vk_cbv_info;
return true;
case VKD3D_SHADER_DESCRIPTOR_TYPE_SRV:
@ -2908,17 +2908,17 @@ static bool vkd3d_descriptor_info_from_d3d12_desc(struct d3d12_device *device,
return false;
if ((binding->flags & VKD3D_SHADER_BINDING_FLAG_IMAGE)
&& (desc->u.view->type == VKD3D_VIEW_TYPE_IMAGE))
&& (desc->info.view->type == VKD3D_VIEW_TYPE_IMAGE))
{
vk_descriptor->image.imageView = desc->u.view->u.vk_image_view;
vk_descriptor->image.imageView = desc->info.view->vk_image_view;
vk_descriptor->image.sampler = VK_NULL_HANDLE;
vk_descriptor->image.imageLayout = desc->u.view->info.texture.vk_layout;
vk_descriptor->image.imageLayout = desc->info.view->info.texture.vk_layout;
return true;
}
else if ((binding->flags & VKD3D_SHADER_BINDING_FLAG_BUFFER)
&& (desc->u.view->type == VKD3D_VIEW_TYPE_BUFFER))
&& (desc->info.view->type == VKD3D_VIEW_TYPE_BUFFER))
{
vk_descriptor->buffer_view = desc->u.view->u.vk_buffer_view;
vk_descriptor->buffer_view = desc->info.view->vk_buffer_view;
return true;
}
break;
@ -2928,23 +2928,23 @@ static bool vkd3d_descriptor_info_from_d3d12_desc(struct d3d12_device *device,
return false;
if ((binding->flags & VKD3D_SHADER_BINDING_FLAG_IMAGE)
&& (desc->u.view->type == VKD3D_VIEW_TYPE_IMAGE))
&& (desc->info.view->type == VKD3D_VIEW_TYPE_IMAGE))
{
vk_descriptor->image.imageView = desc->u.view->u.vk_image_view;
vk_descriptor->image.imageView = desc->info.view->vk_image_view;
vk_descriptor->image.sampler = VK_NULL_HANDLE;
vk_descriptor->image.imageLayout = desc->u.view->info.texture.vk_layout;
vk_descriptor->image.imageLayout = desc->info.view->info.texture.vk_layout;
return true;
}
else if ((binding->flags & VKD3D_SHADER_BINDING_FLAG_BUFFER)
&& (desc->u.view->type == VKD3D_VIEW_TYPE_BUFFER))
&& (desc->info.view->type == VKD3D_VIEW_TYPE_BUFFER))
{
vk_descriptor->buffer_view = desc->u.view->u.vk_buffer_view;
vk_descriptor->buffer_view = desc->info.view->vk_buffer_view;
return true;
}
else if ((binding->flags & VKD3D_SHADER_BINDING_FLAG_COUNTER)
&& desc->u.view->vk_counter_view)
&& desc->info.view->vk_counter_view)
{
vk_descriptor->buffer_view = desc->u.view->vk_counter_view;
vk_descriptor->buffer_view = desc->info.view->vk_counter_view;
return true;
}
break;
@ -2953,7 +2953,7 @@ static bool vkd3d_descriptor_info_from_d3d12_desc(struct d3d12_device *device,
if (desc->magic != VKD3D_DESCRIPTOR_MAGIC_SAMPLER)
return false;
vk_descriptor->image.sampler = desc->u.view->u.vk_sampler;
vk_descriptor->image.sampler = desc->info.view->vk_sampler;
vk_descriptor->image.imageView = VK_NULL_HANDLE;
vk_descriptor->image.imageLayout = VK_IMAGE_LAYOUT_UNDEFINED;
return true;
@ -3178,7 +3178,7 @@ static bool vk_write_descriptor_set_from_root_descriptor(VkWriteDescriptorSet *v
{
const union vkd3d_descriptor_info *descriptor;
descriptor = &descriptors[root_parameter->u.descriptor.packed_descriptor];
descriptor = &descriptors[root_parameter->descriptor.packed_descriptor];
switch (root_parameter->parameter_type)
{
@ -3208,7 +3208,7 @@ static bool vk_write_descriptor_set_from_root_descriptor(VkWriteDescriptorSet *v
vk_descriptor_write->sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
vk_descriptor_write->pNext = NULL;
vk_descriptor_write->dstSet = vk_descriptor_set;
vk_descriptor_write->dstBinding = root_parameter->u.descriptor.binding->binding.binding;
vk_descriptor_write->dstBinding = root_parameter->descriptor.binding->binding.binding;
vk_descriptor_write->dstArrayElement = 0;
vk_descriptor_write->descriptorCount = 1;
vk_descriptor_write->pImageInfo = NULL;
@ -3499,7 +3499,7 @@ static void d3d12_command_list_update_dynamic_state(struct d3d12_command_list *l
struct vkd3d_dynamic_state *dyn_state = &list->dynamic_state;
/* Make sure we only update states that are dynamic in the pipeline */
dyn_state->dirty_flags &= list->state->u.graphics.dynamic_state_flags;
dyn_state->dirty_flags &= list->state->graphics.dynamic_state_flags;
if (dyn_state->dirty_flags & VKD3D_DYNAMIC_STATE_VIEWPORT)
{
@ -3582,7 +3582,7 @@ static bool d3d12_command_list_begin_render_pass(struct d3d12_command_list *list
/* Emit deferred clears with vkCmdClearAttachment */
d3d12_command_list_emit_render_pass_clears(list, false);
graphics = &list->state->u.graphics;
graphics = &list->state->graphics;
if (graphics->xfb_enabled)
{
VK_CALL(vkCmdBeginTransformFeedbackEXT(list->vk_command_buffer, 0, ARRAY_SIZE(list->so_counter_buffers),
@ -3596,7 +3596,7 @@ static bool d3d12_command_list_begin_render_pass(struct d3d12_command_list *list
static void d3d12_command_list_check_index_buffer_strip_cut_value(struct d3d12_command_list *list)
{
struct d3d12_graphics_pipeline_state *graphics = &list->state->u.graphics;
struct d3d12_graphics_pipeline_state *graphics = &list->state->graphics;
if (TRACE_ON())
{
/* In Vulkan, the strip cut value is derived from the index buffer format. */
@ -3722,7 +3722,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_CopyBufferRegion(d3d12_command_
buffer_copy.size = byte_count;
VK_CALL(vkCmdCopyBuffer(list->vk_command_buffer,
src_resource->u.vk_buffer, dst_resource->u.vk_buffer, 1, &buffer_copy));
src_resource->vk_buffer, dst_resource->vk_buffer, 1, &buffer_copy));
}
static void vk_image_subresource_layers_from_d3d12(VkImageSubresourceLayers *subresource,
@ -3913,14 +3913,14 @@ static void d3d12_command_list_copy_image(struct d3d12_command_list *list,
vk_image_barriers[0].dstAccessMask = dst_access;
vk_image_barriers[0].oldLayout = dst_resource->common_layout;
vk_image_barriers[0].newLayout = dst_layout;
vk_image_barriers[0].image = dst_resource->u.vk_image;
vk_image_barriers[0].image = dst_resource->vk_image;
vk_image_barriers[0].subresourceRange = vk_subresource_range_from_layers(&region->dstSubresource);
vk_image_barriers[1].srcAccessMask = 0;
vk_image_barriers[1].dstAccessMask = src_access;
vk_image_barriers[1].oldLayout = src_resource->common_layout;
vk_image_barriers[1].newLayout = src_layout;
vk_image_barriers[1].image = src_resource->u.vk_image;
vk_image_barriers[1].image = src_resource->vk_image;
vk_image_barriers[1].subresourceRange = vk_subresource_range_from_layers(&region->srcSubresource);
VK_CALL(vkCmdPipelineBarrier(list->vk_command_buffer,
@ -3931,8 +3931,8 @@ static void d3d12_command_list_copy_image(struct d3d12_command_list *list,
if (use_copy)
{
VK_CALL(vkCmdCopyImage(list->vk_command_buffer,
src_resource->u.vk_image, src_layout,
dst_resource->u.vk_image, dst_layout,
src_resource->vk_image, src_layout,
dst_resource->vk_image, dst_layout,
1, region));
}
else
@ -3979,8 +3979,8 @@ static void d3d12_command_list_copy_image(struct d3d12_command_list *list,
src_view_desc.layer_count = region->srcSubresource.layerCount;
src_view_desc.allowed_swizzle = false;
if (!vkd3d_create_texture_view(list->device, dst_resource->u.vk_image, &dst_view_desc, &dst_view) ||
!vkd3d_create_texture_view(list->device, src_resource->u.vk_image, &src_view_desc, &src_view))
if (!vkd3d_create_texture_view(list->device, dst_resource->vk_image, &dst_view_desc, &dst_view) ||
!vkd3d_create_texture_view(list->device, src_resource->vk_image, &src_view_desc, &src_view))
{
ERR("Failed to create image views.\n");
goto cleanup;
@ -3997,7 +3997,7 @@ static void d3d12_command_list_copy_image(struct d3d12_command_list *list,
extent.height = d3d12_resource_desc_get_height(&dst_resource->desc, dst_view_desc.miplevel_idx);
extent.depth = dst_view_desc.layer_count;
if (!d3d12_command_list_create_framebuffer(list, pipeline_info.vk_render_pass, 1, &dst_view->u.vk_image_view, extent, &vk_framebuffer))
if (!d3d12_command_list_create_framebuffer(list, pipeline_info.vk_render_pass, 1, &dst_view->vk_image_view, extent, &vk_framebuffer))
{
ERR("Failed to create framebuffer.\n");
goto cleanup;
@ -4040,7 +4040,7 @@ static void d3d12_command_list_copy_image(struct d3d12_command_list *list,
}
vk_image_info.sampler = VK_NULL_HANDLE;
vk_image_info.imageView = src_view->u.vk_image_view;
vk_image_info.imageView = src_view->vk_image_view;
vk_image_info.imageLayout = src_view_desc.layout;
vk_descriptor_write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
@ -4159,9 +4159,9 @@ static void STDMETHODCALLTYPE d3d12_command_list_CopyTextureRegion(d3d12_command
assert(d3d12_resource_is_texture(src_resource));
if (!(dst_format = vkd3d_format_from_d3d12_resource_desc(list->device,
&src_resource->desc, dst->u.PlacedFootprint.Footprint.Format)))
&src_resource->desc, dst->PlacedFootprint.Footprint.Format)))
{
WARN("Invalid format %#x.\n", dst->u.PlacedFootprint.Footprint.Format);
WARN("Invalid format %#x.\n", dst->PlacedFootprint.Footprint.Format);
return;
}
@ -4175,22 +4175,22 @@ static void STDMETHODCALLTYPE d3d12_command_list_CopyTextureRegion(d3d12_command
&& (dst_format->vk_aspect_mask & VK_IMAGE_ASPECT_STENCIL_BIT))
FIXME("Depth-stencil format %#x not fully supported yet.\n", dst_format->dxgi_format);
vk_image_buffer_copy_from_d3d12(&buffer_image_copy, &dst->u.PlacedFootprint,
src->u.SubresourceIndex, &src_resource->desc, dst_format, src_box, dst_x, dst_y, dst_z);
vk_image_buffer_copy_from_d3d12(&buffer_image_copy, &dst->PlacedFootprint,
src->SubresourceIndex, &src_resource->desc, dst_format, src_box, dst_x, dst_y, dst_z);
buffer_image_copy.bufferOffset += dst_resource->heap_offset;
vk_layout = d3d12_resource_pick_layout(src_resource, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
d3d12_command_list_transition_image_layout(list, src_resource->u.vk_image,
d3d12_command_list_transition_image_layout(list, src_resource->vk_image,
&buffer_image_copy.imageSubresource, VK_PIPELINE_STAGE_TRANSFER_BIT,
0, src_resource->common_layout, VK_PIPELINE_STAGE_TRANSFER_BIT,
VK_ACCESS_TRANSFER_READ_BIT, vk_layout);
VK_CALL(vkCmdCopyImageToBuffer(list->vk_command_buffer,
src_resource->u.vk_image, vk_layout,
dst_resource->u.vk_buffer, 1, &buffer_image_copy));
src_resource->vk_image, vk_layout,
dst_resource->vk_buffer, 1, &buffer_image_copy));
d3d12_command_list_transition_image_layout(list, src_resource->u.vk_image,
d3d12_command_list_transition_image_layout(list, src_resource->vk_image,
&buffer_image_copy.imageSubresource, VK_PIPELINE_STAGE_TRANSFER_BIT, 0,
vk_layout, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, src_resource->common_layout);
}
@ -4201,9 +4201,9 @@ static void STDMETHODCALLTYPE d3d12_command_list_CopyTextureRegion(d3d12_command
assert(d3d12_resource_is_buffer(src_resource));
if (!(src_format = vkd3d_format_from_d3d12_resource_desc(list->device,
&dst_resource->desc, src->u.PlacedFootprint.Footprint.Format)))
&dst_resource->desc, src->PlacedFootprint.Footprint.Format)))
{
WARN("Invalid format %#x.\n", src->u.PlacedFootprint.Footprint.Format);
WARN("Invalid format %#x.\n", src->PlacedFootprint.Footprint.Format);
return;
}
@ -4217,22 +4217,22 @@ static void STDMETHODCALLTYPE d3d12_command_list_CopyTextureRegion(d3d12_command
&& (src_format->vk_aspect_mask & VK_IMAGE_ASPECT_STENCIL_BIT))
FIXME("Depth-stencil format %#x not fully supported yet.\n", src_format->dxgi_format);
vk_buffer_image_copy_from_d3d12(&buffer_image_copy, &src->u.PlacedFootprint,
dst->u.SubresourceIndex, &dst_resource->desc, src_format, src_box, dst_x, dst_y, dst_z);
vk_buffer_image_copy_from_d3d12(&buffer_image_copy, &src->PlacedFootprint,
dst->SubresourceIndex, &dst_resource->desc, src_format, src_box, dst_x, dst_y, dst_z);
buffer_image_copy.bufferOffset += src_resource->heap_offset;
vk_layout = d3d12_resource_pick_layout(dst_resource, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
d3d12_command_list_transition_image_layout(list, dst_resource->u.vk_image,
d3d12_command_list_transition_image_layout(list, dst_resource->vk_image,
&buffer_image_copy.imageSubresource, VK_PIPELINE_STAGE_TRANSFER_BIT,
0, dst_resource->common_layout, VK_PIPELINE_STAGE_TRANSFER_BIT,
VK_ACCESS_TRANSFER_WRITE_BIT, vk_layout);
VK_CALL(vkCmdCopyBufferToImage(list->vk_command_buffer,
src_resource->u.vk_buffer, dst_resource->u.vk_image,
src_resource->vk_buffer, dst_resource->vk_image,
vk_layout, 1, &buffer_image_copy));
d3d12_command_list_transition_image_layout(list, dst_resource->u.vk_image,
d3d12_command_list_transition_image_layout(list, dst_resource->vk_image,
&buffer_image_copy.imageSubresource, VK_PIPELINE_STAGE_TRANSFER_BIT,
VK_ACCESS_TRANSFER_WRITE_BIT, vk_layout, VK_PIPELINE_STAGE_TRANSFER_BIT,
0, dst_resource->common_layout);
@ -4263,7 +4263,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_CopyTextureRegion(d3d12_command
&& (src_format->vk_aspect_mask & VK_IMAGE_ASPECT_STENCIL_BIT))
FIXME("Depth-stencil format %#x not fully supported yet.\n", src_format->dxgi_format);
vk_image_copy_from_d3d12(&image_copy, src->u.SubresourceIndex, dst->u.SubresourceIndex,
vk_image_copy_from_d3d12(&image_copy, src->SubresourceIndex, dst->SubresourceIndex,
&src_resource->desc, &dst_resource->desc, src_format, dst_format,
src_box, dst_x, dst_y, dst_z);
@ -4309,7 +4309,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_CopyResource(d3d12_command_list
vk_buffer_copy.dstOffset = dst_resource->heap_offset;
vk_buffer_copy.size = dst_resource->desc.Width;
VK_CALL(vkCmdCopyBuffer(list->vk_command_buffer,
src_resource->u.vk_buffer, dst_resource->u.vk_buffer, 1, &vk_buffer_copy));
src_resource->vk_buffer, dst_resource->vk_buffer, 1, &vk_buffer_copy));
}
else
{
@ -4406,7 +4406,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_CopyTiles(d3d12_command_list_if
vk_image_barrier.dstAccessMask = copy_to_buffer ? VK_ACCESS_TRANSFER_READ_BIT : VK_ACCESS_TRANSFER_WRITE_BIT;
vk_image_barrier.oldLayout = tiled_res->common_layout;
vk_image_barrier.newLayout = vk_image_layout;
vk_image_barrier.image = tiled_res->u.vk_image;
vk_image_barrier.image = tiled_res->vk_image;
/* The entire resource must be in the appropriate copy state */
vk_image_barrier.subresourceRange.aspectMask = format->vk_aspect_mask;
@ -4425,7 +4425,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_CopyTiles(d3d12_command_list_if
for (i = 0; i < region_size->NumTiles; i++)
{
unsigned int tile_index = vkd3d_get_tile_index_from_region(&tiled_res->sparse, region_coord, region_size, i);
const struct d3d12_sparse_image_region *region = &tiled_res->sparse.tiles[tile_index].u.image;
const struct d3d12_sparse_image_region *region = &tiled_res->sparse.tiles[tile_index].image;
buffer_image_copy.bufferOffset = buffer_offset + VKD3D_TILE_SIZE * i;
buffer_image_copy.imageSubresource = vk_subresource_layers_from_subresource(&region->subresource);
@ -4435,13 +4435,13 @@ static void STDMETHODCALLTYPE d3d12_command_list_CopyTiles(d3d12_command_list_if
if (copy_to_buffer)
{
VK_CALL(vkCmdCopyImageToBuffer(list->vk_command_buffer,
tiled_res->u.vk_image, vk_image_layout, linear_res->u.vk_buffer,
tiled_res->vk_image, vk_image_layout, linear_res->vk_buffer,
1, &buffer_image_copy));
}
else
{
VK_CALL(vkCmdCopyBufferToImage(list->vk_command_buffer,
linear_res->u.vk_buffer, tiled_res->u.vk_image, vk_image_layout,
linear_res->vk_buffer, tiled_res->vk_image, vk_image_layout,
1, &buffer_image_copy));
}
}
@ -4471,8 +4471,8 @@ static void STDMETHODCALLTYPE d3d12_command_list_CopyTiles(d3d12_command_list_if
}
VK_CALL(vkCmdCopyBuffer(list->vk_command_buffer,
copy_to_buffer ? tiled_res->u.vk_buffer : linear_res->u.vk_buffer,
copy_to_buffer ? linear_res->u.vk_buffer : tiled_res->u.vk_buffer,
copy_to_buffer ? tiled_res->vk_buffer : linear_res->vk_buffer,
copy_to_buffer ? linear_res->vk_buffer : tiled_res->vk_buffer,
1, &buffer_copy));
}
}
@ -4565,22 +4565,22 @@ static void STDMETHODCALLTYPE d3d12_command_list_ResolveSubresource(d3d12_comman
vk_image_barriers[0].dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
vk_image_barriers[0].oldLayout = dst_resource->common_layout;
vk_image_barriers[0].newLayout = dst_layout;
vk_image_barriers[0].image = dst_resource->u.vk_image;
vk_image_barriers[0].image = dst_resource->vk_image;
vk_image_barriers[0].subresourceRange = vk_subresource_range_from_layers(&vk_image_resolve.dstSubresource);
vk_image_barriers[1].srcAccessMask = 0;
vk_image_barriers[1].dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT;
vk_image_barriers[1].oldLayout = src_resource->common_layout;
vk_image_barriers[1].newLayout = src_layout;
vk_image_barriers[1].image = src_resource->u.vk_image;
vk_image_barriers[1].image = src_resource->vk_image;
vk_image_barriers[1].subresourceRange = vk_subresource_range_from_layers(&vk_image_resolve.srcSubresource);
VK_CALL(vkCmdPipelineBarrier(list->vk_command_buffer,
VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
0, 0, NULL, 0, NULL, ARRAY_SIZE(vk_image_barriers), vk_image_barriers));
VK_CALL(vkCmdResolveImage(list->vk_command_buffer, src_resource->u.vk_image,
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, dst_resource->u.vk_image,
VK_CALL(vkCmdResolveImage(list->vk_command_buffer, src_resource->vk_image,
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, dst_resource->vk_image,
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &vk_image_resolve));
vk_image_barriers[0].srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
@ -4734,11 +4734,11 @@ static void STDMETHODCALLTYPE d3d12_command_list_SetPipelineState(d3d12_command_
if (d3d12_pipeline_state_is_graphics(state))
{
uint32_t old_dynamic_state_flags = d3d12_pipeline_state_is_graphics(list->state)
? list->state->u.graphics.dynamic_state_flags
? list->state->graphics.dynamic_state_flags
: 0u;
/* Reapply all dynamic states that were not dynamic in previously bound pipeline */
list->dynamic_state.dirty_flags |= state->u.graphics.dynamic_state_flags & ~old_dynamic_state_flags;
list->dynamic_state.dirty_flags |= state->graphics.dynamic_state_flags & ~old_dynamic_state_flags;
}
list->state = state;
@ -4778,7 +4778,7 @@ static bool vk_image_memory_barrier_from_d3d12_transition(const struct d3d12_dev
vk_barrier->newLayout = vk_image_layout_from_d3d12_resource_state(resource, transition->StateAfter);
vk_barrier->srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
vk_barrier->dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
vk_barrier->image = resource->u.vk_image;
vk_barrier->image = resource->vk_image;
vk_barrier->subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
if (transition->Subresource == D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES)
@ -4843,7 +4843,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_ResourceBarrier(d3d12_command_l
{
case D3D12_RESOURCE_BARRIER_TYPE_TRANSITION:
{
const D3D12_RESOURCE_TRANSITION_BARRIER *transition = &current->u.Transition;
const D3D12_RESOURCE_TRANSITION_BARRIER *transition = &current->Transition;
VkPipelineStageFlags src_image_stage_mask = 0, dst_image_stage_mask = 0;
if (!is_valid_resource_state(transition->StateBefore))
@ -4890,7 +4890,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_ResourceBarrier(d3d12_command_l
case D3D12_RESOURCE_BARRIER_TYPE_UAV:
{
const D3D12_RESOURCE_UAV_BARRIER *uav = &current->u.UAV;
const D3D12_RESOURCE_UAV_BARRIER *uav = &current->UAV;
resource = unsafe_impl_from_ID3D12Resource(uav->pResource);
vk_access_and_stage_flags_from_d3d12_resource_state(list->device, resource,
@ -5146,14 +5146,14 @@ static void d3d12_command_list_set_root_descriptor(struct d3d12_command_list *li
VkBufferView vk_buffer_view;
root_parameter = root_signature_get_root_descriptor(root_signature, index);
descriptor = &bindings->root_descriptors[root_parameter->u.descriptor.packed_descriptor];
descriptor = &bindings->root_descriptors[root_parameter->descriptor.packed_descriptor];
if (root_parameter->parameter_type == D3D12_ROOT_PARAMETER_TYPE_CBV)
{
if (gpu_address)
{
resource = vkd3d_gpu_va_allocator_dereference(&list->device->gpu_va_allocator, gpu_address);
descriptor->buffer.buffer = resource->u.vk_buffer;
descriptor->buffer.buffer = resource->vk_buffer;
descriptor->buffer.offset = gpu_address - resource->gpu_address;
descriptor->buffer.range = min(resource->desc.Width - descriptor->buffer.offset,
vk_info->device_limits.maxUniformBufferRange);
@ -5302,7 +5302,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_IASetIndexBuffer(d3d12_command_
list->index_buffer_format = view->Format;
resource = vkd3d_gpu_va_allocator_dereference(&list->device->gpu_va_allocator, view->BufferLocation);
VK_CALL(vkCmdBindIndexBuffer(list->vk_command_buffer, resource->u.vk_buffer,
VK_CALL(vkCmdBindIndexBuffer(list->vk_command_buffer, resource->vk_buffer,
view->BufferLocation - resource->gpu_address, index_type));
}
@ -5338,7 +5338,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_IASetVertexBuffers(d3d12_comman
if (views[i].BufferLocation)
{
resource = vkd3d_gpu_va_allocator_dereference(gpu_va_allocator, views[i].BufferLocation);
buffers[i] = resource->u.vk_buffer;
buffers[i] = resource->vk_buffer;
offsets[i] = views[i].BufferLocation - resource->gpu_address;
stride = views[i].StrideInBytes;
}
@ -5398,12 +5398,12 @@ static void STDMETHODCALLTYPE d3d12_command_list_SOSetTargets(d3d12_command_list
if (views[i].BufferLocation && views[i].SizeInBytes)
{
resource = vkd3d_gpu_va_allocator_dereference(gpu_va_allocator, views[i].BufferLocation);
buffers[count] = resource->u.vk_buffer;
buffers[count] = resource->vk_buffer;
offsets[count] = views[i].BufferLocation - resource->gpu_address;
sizes[count] = views[i].SizeInBytes;
resource = vkd3d_gpu_va_allocator_dereference(gpu_va_allocator, views[i].BufferFilledSizeLocation);
list->so_counter_buffers[start_slot + i] = resource->u.vk_buffer;
list->so_counter_buffers[start_slot + i] = resource->vk_buffer;
list->so_counter_buffer_offsets[start_slot + i] = views[i].BufferFilledSizeLocation - resource->gpu_address;
++count;
}
@ -5673,7 +5673,7 @@ static void d3d12_command_list_clear_uav(struct d3d12_command_list *list,
if (d3d12_resource_is_texture(resource))
{
image_info.sampler = VK_NULL_HANDLE;
image_info.imageView = view->u.vk_image_view;
image_info.imageView = view->vk_image_view;
image_info.imageLayout = view->info.texture.vk_layout;
write_set.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
@ -5695,7 +5695,7 @@ static void d3d12_command_list_clear_uav(struct d3d12_command_list *list,
write_set.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER;
write_set.pImageInfo = NULL;
write_set.pBufferInfo = NULL;
write_set.pTexelBufferView = &view->u.vk_buffer_view;
write_set.pTexelBufferView = &view->vk_buffer_view;
miplevel_idx = 0;
layer_count = 1;
@ -5792,7 +5792,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewUint(d3
resource_impl = unsafe_impl_from_ID3D12Resource(resource);
base_view = d3d12_desc_from_cpu_handle(cpu_handle)->u.view;
base_view = d3d12_desc_from_cpu_handle(cpu_handle)->info.view;
uint_view = NULL;
if (base_view->format->type != VKD3D_FORMAT_TYPE_UINT)
@ -5818,7 +5818,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewUint(d3
view_desc.layer_count = base_view->info.texture.layer_count;
view_desc.allowed_swizzle = false;
if (!vkd3d_create_texture_view(list->device, resource_impl->u.vk_image, &view_desc, &uint_view))
if (!vkd3d_create_texture_view(list->device, resource_impl->vk_image, &view_desc, &uint_view))
{
ERR("Failed to create image view.\n");
return;
@ -5826,7 +5826,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewUint(d3
}
else
{
if (!vkd3d_create_buffer_view(list->device, resource_impl->u.vk_buffer, uint_format,
if (!vkd3d_create_buffer_view(list->device, resource_impl->vk_buffer, uint_format,
base_view->info.buffer.offset, base_view->info.buffer.size, &uint_view))
{
ERR("Failed to create buffer view.\n");
@ -5857,7 +5857,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewFloat(d
memcpy(color.float32, values, sizeof(color.float32));
resource_impl = unsafe_impl_from_ID3D12Resource(resource);
view = d3d12_desc_from_cpu_handle(cpu_handle)->u.view;
view = d3d12_desc_from_cpu_handle(cpu_handle)->info.view;
d3d12_command_list_clear_uav(list, resource_impl, view, &color, rect_count, rects);
}
@ -5995,7 +5995,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_ResolveQueryData(d3d12_command_
if (count)
{
VK_CALL(vkCmdCopyQueryPoolResults(list->vk_command_buffer,
query_heap->vk_query_pool, first, count, buffer->u.vk_buffer,
query_heap->vk_query_pool, first, count, buffer->vk_buffer,
buffer->heap_offset + offset, stride, VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT));
}
count = 0;
@ -6009,7 +6009,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_ResolveQueryData(d3d12_command_
* a VK_ERROR_DEVICE_LOST error may occur."
*/
VK_CALL(vkCmdFillBuffer(list->vk_command_buffer,
buffer->u.vk_buffer, buffer->heap_offset + offset, stride, 0x00000000));
buffer->vk_buffer, buffer->heap_offset + offset, stride, 0x00000000));
++first;
offset += stride;
@ -6019,7 +6019,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_ResolveQueryData(d3d12_command_
if (count)
{
VK_CALL(vkCmdCopyQueryPoolResults(list->vk_command_buffer,
query_heap->vk_query_pool, first, count, buffer->u.vk_buffer,
query_heap->vk_query_pool, first, count, buffer->vk_buffer,
buffer->heap_offset + offset, stride, VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT));
}
}
@ -6066,7 +6066,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_SetPredication(d3d12_command_li
cond_info.sType = VK_STRUCTURE_TYPE_CONDITIONAL_RENDERING_BEGIN_INFO_EXT;
cond_info.pNext = NULL;
cond_info.buffer = resource->u.vk_buffer;
cond_info.buffer = resource->vk_buffer;
cond_info.offset = aligned_buffer_offset;
switch (operation)
{
@ -6249,14 +6249,14 @@ static void STDMETHODCALLTYPE d3d12_command_list_ExecuteIndirect(d3d12_command_l
if (count_buffer)
{
VK_CALL(vkCmdDrawIndirectCountKHR(list->vk_command_buffer, arg_impl->u.vk_buffer,
arg_buffer_offset + arg_impl->heap_offset, count_impl->u.vk_buffer,
VK_CALL(vkCmdDrawIndirectCountKHR(list->vk_command_buffer, arg_impl->vk_buffer,
arg_buffer_offset + arg_impl->heap_offset, count_impl->vk_buffer,
count_buffer_offset + count_impl->heap_offset,
max_command_count, signature_desc->ByteStride));
}
else
{
VK_CALL(vkCmdDrawIndirect(list->vk_command_buffer, arg_impl->u.vk_buffer,
VK_CALL(vkCmdDrawIndirect(list->vk_command_buffer, arg_impl->vk_buffer,
arg_buffer_offset + arg_impl->heap_offset, max_command_count, signature_desc->ByteStride));
}
break;
@ -6272,14 +6272,14 @@ static void STDMETHODCALLTYPE d3d12_command_list_ExecuteIndirect(d3d12_command_l
if (count_buffer)
{
VK_CALL(vkCmdDrawIndexedIndirectCountKHR(list->vk_command_buffer, arg_impl->u.vk_buffer,
arg_buffer_offset + arg_impl->heap_offset, count_impl->u.vk_buffer,
VK_CALL(vkCmdDrawIndexedIndirectCountKHR(list->vk_command_buffer, arg_impl->vk_buffer,
arg_buffer_offset + arg_impl->heap_offset, count_impl->vk_buffer,
count_buffer_offset + count_impl->heap_offset,
max_command_count, signature_desc->ByteStride));
}
else
{
VK_CALL(vkCmdDrawIndexedIndirect(list->vk_command_buffer, arg_impl->u.vk_buffer,
VK_CALL(vkCmdDrawIndexedIndirect(list->vk_command_buffer, arg_impl->vk_buffer,
arg_buffer_offset + arg_impl->heap_offset, max_command_count, signature_desc->ByteStride));
}
break;
@ -6301,7 +6301,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_ExecuteIndirect(d3d12_command_l
}
VK_CALL(vkCmdDispatchIndirect(list->vk_command_buffer,
arg_impl->u.vk_buffer, arg_buffer_offset + arg_impl->heap_offset));
arg_impl->vk_buffer, arg_buffer_offset + arg_impl->heap_offset));
break;
default:
@ -6821,11 +6821,11 @@ static void STDMETHODCALLTYPE d3d12_command_queue_UpdateTileMappings(ID3D12Comma
return;
sub.type = VKD3D_SUBMISSION_BIND_SPARSE;
sub.u.bind_sparse.mode = VKD3D_SPARSE_MEMORY_BIND_MODE_UPDATE;
sub.u.bind_sparse.bind_count = 0;
sub.u.bind_sparse.bind_infos = NULL;
sub.u.bind_sparse.dst_resource = res;
sub.u.bind_sparse.src_resource = NULL;
sub.bind_sparse.mode = VKD3D_SPARSE_MEMORY_BIND_MODE_UPDATE;
sub.bind_sparse.bind_count = 0;
sub.bind_sparse.bind_infos = NULL;
sub.bind_sparse.dst_resource = res;
sub.bind_sparse.src_resource = NULL;
if (region_coords)
region_coord = region_coords[0];
@ -6866,14 +6866,14 @@ static void STDMETHODCALLTYPE d3d12_command_queue_UpdateTileMappings(ID3D12Comma
if (!(bind = bound_tiles[tile_index]))
{
if (!vkd3d_array_reserve((void **)&sub.u.bind_sparse.bind_infos, &bind_infos_size,
sub.u.bind_sparse.bind_count + 1, sizeof(*sub.u.bind_sparse.bind_infos)))
if (!vkd3d_array_reserve((void **)&sub.bind_sparse.bind_infos, &bind_infos_size,
sub.bind_sparse.bind_count + 1, sizeof(*sub.bind_sparse.bind_infos)))
{
ERR("Failed to allocate bind info array.\n");
goto fail;
}
bind = &sub.u.bind_sparse.bind_infos[sub.u.bind_sparse.bind_count++];
bind = &sub.bind_sparse.bind_infos[sub.bind_sparse.bind_count++];
bound_tiles[tile_index] = bind;
}
@ -6926,7 +6926,7 @@ static void STDMETHODCALLTYPE d3d12_command_queue_UpdateTileMappings(ID3D12Comma
fail:
vkd3d_free(bound_tiles);
vkd3d_free(sub.u.bind_sparse.bind_infos);
vkd3d_free(sub.bind_sparse.bind_infos);
}
static void STDMETHODCALLTYPE d3d12_command_queue_CopyTileMappings(ID3D12CommandQueue *iface,
@ -6947,13 +6947,13 @@ static void STDMETHODCALLTYPE d3d12_command_queue_CopyTileMappings(ID3D12Command
src_region_start_coordinate, region_size, flags);
sub.type = VKD3D_SUBMISSION_BIND_SPARSE;
sub.u.bind_sparse.mode = VKD3D_SPARSE_MEMORY_BIND_MODE_COPY;
sub.u.bind_sparse.bind_count = region_size->NumTiles;
sub.u.bind_sparse.bind_infos = vkd3d_malloc(region_size->NumTiles * sizeof(*sub.u.bind_sparse.bind_infos));
sub.u.bind_sparse.dst_resource = dst_res;
sub.u.bind_sparse.src_resource = src_res;
sub.bind_sparse.mode = VKD3D_SPARSE_MEMORY_BIND_MODE_COPY;
sub.bind_sparse.bind_count = region_size->NumTiles;
sub.bind_sparse.bind_infos = vkd3d_malloc(region_size->NumTiles * sizeof(*sub.bind_sparse.bind_infos));
sub.bind_sparse.dst_resource = dst_res;
sub.bind_sparse.src_resource = src_res;
if (!sub.u.bind_sparse.bind_infos)
if (!sub.bind_sparse.bind_infos)
{
ERR("Failed to allocate bind info array.\n");
return;
@ -6961,7 +6961,7 @@ static void STDMETHODCALLTYPE d3d12_command_queue_CopyTileMappings(ID3D12Command
for (i = 0; i < region_size->NumTiles; i++)
{
bind = &sub.u.bind_sparse.bind_infos[i];
bind = &sub.bind_sparse.bind_infos[i];
bind->dst_tile = vkd3d_get_tile_index_from_region(&dst_res->sparse, dst_region_start_coordinate, region_size, i);
bind->src_tile = vkd3d_get_tile_index_from_region(&src_res->sparse, src_region_start_coordinate, region_size, i);
bind->vk_memory = VK_NULL_HANDLE;
@ -7017,9 +7017,9 @@ static void STDMETHODCALLTYPE d3d12_command_queue_ExecuteCommandLists(ID3D12Comm
}
sub.type = VKD3D_SUBMISSION_EXECUTE;
sub.u.execute.cmd = buffers;
sub.u.execute.count = command_list_count;
sub.u.execute.outstanding_submissions_count = outstanding;
sub.execute.cmd = buffers;
sub.execute.count = command_list_count;
sub.execute.outstanding_submissions_count = outstanding;
d3d12_command_queue_add_submission(command_queue, &sub);
}
@ -7054,8 +7054,8 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_queue_Signal(ID3D12CommandQueue *
fence = unsafe_impl_from_ID3D12Fence(fence_iface);
sub.type = VKD3D_SUBMISSION_SIGNAL;
sub.u.signal.fence = fence;
sub.u.signal.value = value;
sub.signal.fence = fence;
sub.signal.value = value;
d3d12_command_queue_add_submission(command_queue, &sub);
return S_OK;
}
@ -7072,8 +7072,8 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_queue_Wait(ID3D12CommandQueue *if
fence = unsafe_impl_from_ID3D12Fence(fence_iface);
sub.type = VKD3D_SUBMISSION_WAIT;
sub.u.wait.fence = fence;
sub.u.wait.value = value;
sub.wait.fence = fence;
sub.wait.value = value;
d3d12_command_queue_add_submission(command_queue, &sub);
return S_OK;
}
@ -7423,7 +7423,7 @@ static void d3d12_command_queue_bind_sparse(struct d3d12_command_queue *command_
goto cleanup;
}
buffer_info.buffer = dst_resource->u.vk_buffer;
buffer_info.buffer = dst_resource->vk_buffer;
buffer_info.bindCount = count;
buffer_info.pBinds = memory_binds;
@ -7456,7 +7456,7 @@ static void d3d12_command_queue_bind_sparse(struct d3d12_command_queue *command_
goto cleanup;
}
opaque_info.image = dst_resource->u.vk_image;
opaque_info.image = dst_resource->vk_image;
opaque_info.bindCount = opaque_bind_count;
opaque_info.pBinds = memory_binds;
@ -7472,7 +7472,7 @@ static void d3d12_command_queue_bind_sparse(struct d3d12_command_queue *command_
goto cleanup;
}
image_info.image = dst_resource->u.vk_image;
image_info.image = dst_resource->vk_image;
image_info.bindCount = image_bind_count;
image_info.pBinds = image_binds;
@ -7501,9 +7501,9 @@ static void d3d12_command_queue_bind_sparse(struct d3d12_command_queue *command_
if (d3d12_resource_is_texture(dst_resource) && bind->dst_tile < first_packed_tile)
{
VkSparseImageMemoryBind *vk_bind = &image_binds[j++];
vk_bind->subresource = tile->u.image.subresource;
vk_bind->offset = tile->u.image.offset;
vk_bind->extent = tile->u.image.extent;
vk_bind->subresource = tile->image.subresource;
vk_bind->offset = tile->image.offset;
vk_bind->extent = tile->image.extent;
vk_bind->memory = vk_memory;
vk_bind->memoryOffset = vk_offset;
vk_bind->flags = 0;
@ -7511,8 +7511,8 @@ static void d3d12_command_queue_bind_sparse(struct d3d12_command_queue *command_
else
{
VkSparseMemoryBind *vk_bind = &memory_binds[k++];
vk_bind->resourceOffset = tile->u.buffer.offset;
vk_bind->size = tile->u.buffer.length;
vk_bind->resourceOffset = tile->buffer.offset;
vk_bind->size = tile->buffer.length;
vk_bind->memory = vk_memory;
vk_bind->memoryOffset = vk_offset;
vk_bind->flags = 0;
@ -7617,27 +7617,27 @@ static void *d3d12_command_queue_submission_worker_main(void *userdata)
return NULL;
case VKD3D_SUBMISSION_WAIT:
d3d12_command_queue_wait(queue, submission.u.wait.fence, submission.u.wait.value);
d3d12_command_queue_wait(queue, submission.wait.fence, submission.wait.value);
break;
case VKD3D_SUBMISSION_SIGNAL:
d3d12_command_queue_signal(queue, submission.u.signal.fence, submission.u.signal.value);
d3d12_command_queue_signal(queue, submission.signal.fence, submission.signal.value);
break;
case VKD3D_SUBMISSION_EXECUTE:
d3d12_command_queue_execute(queue, submission.u.execute.cmd, submission.u.execute.count);
vkd3d_free(submission.u.execute.cmd);
d3d12_command_queue_execute(queue, submission.execute.cmd, submission.execute.count);
vkd3d_free(submission.execute.cmd);
/* TODO: The correct place to do this would be in a fence handler, but this is good enough for now. */
for (i = 0; i < submission.u.execute.count; i++)
InterlockedDecrement(submission.u.execute.outstanding_submissions_count[i]);
vkd3d_free(submission.u.execute.outstanding_submissions_count);
for (i = 0; i < submission.execute.count; i++)
InterlockedDecrement(submission.execute.outstanding_submissions_count[i]);
vkd3d_free(submission.execute.outstanding_submissions_count);
break;
case VKD3D_SUBMISSION_BIND_SPARSE:
d3d12_command_queue_bind_sparse(queue, submission.u.bind_sparse.mode,
submission.u.bind_sparse.dst_resource, submission.u.bind_sparse.src_resource,
submission.u.bind_sparse.bind_count, submission.u.bind_sparse.bind_infos);
vkd3d_free(submission.u.bind_sparse.bind_infos);
d3d12_command_queue_bind_sparse(queue, submission.bind_sparse.mode,
submission.bind_sparse.dst_resource, submission.bind_sparse.src_resource,
submission.bind_sparse.bind_count, submission.bind_sparse.bind_infos);
vkd3d_free(submission.bind_sparse.bind_infos);
break;
case VKD3D_SUBMISSION_DRAIN:

View File

@ -650,13 +650,13 @@ static HRESULT d3d12_heap_init(struct d3d12_heap *heap,
{
if (d3d12_resource_is_buffer(resource))
{
hr = vkd3d_allocate_buffer_memory(device, resource->u.vk_buffer,
hr = vkd3d_allocate_buffer_memory(device, resource->vk_buffer,
&heap->desc.Properties, heap->desc.Flags | D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS,
&heap->vk_memory, &heap->vk_memory_type, &vk_memory_size);
}
else
{
hr = vkd3d_allocate_image_memory(device, resource->u.vk_image,
hr = vkd3d_allocate_image_memory(device, resource->vk_image,
&heap->desc.Properties, heap->desc.Flags,
&heap->vk_memory, &heap->vk_memory_type, &vk_memory_size);
}
@ -665,7 +665,7 @@ static HRESULT d3d12_heap_init(struct d3d12_heap *heap,
}
else if (heap->buffer_resource)
{
hr = vkd3d_allocate_buffer_memory(device, heap->buffer_resource->u.vk_buffer,
hr = vkd3d_allocate_buffer_memory(device, heap->buffer_resource->vk_buffer,
&heap->desc.Properties, heap->desc.Flags,
&heap->vk_memory, &heap->vk_memory_type, &vk_memory_size);
}
@ -1246,7 +1246,7 @@ static void d3d12_resource_get_tiling(struct d3d12_device *device, struct d3d12_
else
{
VK_CALL(vkGetImageSparseMemoryRequirements(device->vk_device,
resource->u.vk_image, &memory_requirement_count, NULL));
resource->vk_image, &memory_requirement_count, NULL));
if (!memory_requirement_count)
{
@ -1257,7 +1257,7 @@ static void d3d12_resource_get_tiling(struct d3d12_device *device, struct d3d12_
memory_requirements = vkd3d_malloc(memory_requirement_count * sizeof(*memory_requirements));
VK_CALL(vkGetImageSparseMemoryRequirements(device->vk_device,
resource->u.vk_image, &memory_requirement_count, memory_requirements));
resource->vk_image, &memory_requirement_count, memory_requirements));
for (i = 0; i < memory_requirement_count; i++)
{
@ -1353,9 +1353,9 @@ static void d3d12_resource_destroy(struct d3d12_resource *resource, struct d3d12
vkd3d_gpu_va_allocator_free(&device->gpu_va_allocator, resource->gpu_address);
if (d3d12_resource_is_buffer(resource))
VK_CALL(vkDestroyBuffer(device->vk_device, resource->u.vk_buffer, NULL));
VK_CALL(vkDestroyBuffer(device->vk_device, resource->vk_buffer, NULL));
else
VK_CALL(vkDestroyImage(device->vk_device, resource->u.vk_image, NULL));
VK_CALL(vkDestroyImage(device->vk_device, resource->vk_image, NULL));
}
if (resource->flags & VKD3D_RESOURCE_DEDICATED_HEAP)
@ -1540,10 +1540,10 @@ static HRESULT STDMETHODCALLTYPE d3d12_resource_SetName(d3d12_resource_iface *if
}
if (d3d12_resource_is_buffer(resource))
return vkd3d_set_vk_object_name(resource->device, (uint64_t)resource->u.vk_buffer,
return vkd3d_set_vk_object_name(resource->device, (uint64_t)resource->vk_buffer,
VK_OBJECT_TYPE_BUFFER, name);
else
return vkd3d_set_vk_object_name(resource->device, (uint64_t)resource->u.vk_image,
return vkd3d_set_vk_object_name(resource->device, (uint64_t)resource->vk_image,
VK_OBJECT_TYPE_IMAGE, name);
}
@ -1775,7 +1775,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_resource_WriteToSubresource(d3d12_resourc
return E_NOTIMPL;
}
VK_CALL(vkGetImageSubresourceLayout(device->vk_device, resource->u.vk_image, &vk_sub_resource, &vk_layout));
VK_CALL(vkGetImageSubresourceLayout(device->vk_device, resource->vk_image, &vk_sub_resource, &vk_layout));
TRACE("Offset %#"PRIx64", size %#"PRIx64", row pitch %#"PRIx64", depth pitch %#"PRIx64".\n",
vk_layout.offset, vk_layout.size, vk_layout.rowPitch, vk_layout.depthPitch);
@ -1860,7 +1860,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_resource_ReadFromSubresource(d3d12_resour
return E_NOTIMPL;
}
VK_CALL(vkGetImageSubresourceLayout(device->vk_device, resource->u.vk_image, &vk_sub_resource, &vk_layout));
VK_CALL(vkGetImageSubresourceLayout(device->vk_device, resource->vk_image, &vk_sub_resource, &vk_layout));
TRACE("Offset %#"PRIx64", size %#"PRIx64", row pitch %#"PRIx64", depth pitch %#"PRIx64".\n",
vk_layout.offset, vk_layout.size, vk_layout.rowPitch, vk_layout.depthPitch);
@ -2143,7 +2143,7 @@ static HRESULT d3d12_resource_bind_sparse_metadata(struct d3d12_resource *resour
* drivers, so most of the time we'll just return early. The implementation
* is therefore aimed at simplicity, and not very well tested in practice. */
VK_CALL(vkGetImageSparseMemoryRequirements(device->vk_device,
resource->u.vk_image, &sparse_requirement_count, NULL));
resource->vk_image, &sparse_requirement_count, NULL));
if (!(sparse_requirements = vkd3d_malloc(sparse_requirement_count * sizeof(*sparse_requirements))))
{
@ -2153,7 +2153,7 @@ static HRESULT d3d12_resource_bind_sparse_metadata(struct d3d12_resource *resour
}
VK_CALL(vkGetImageSparseMemoryRequirements(device->vk_device,
resource->u.vk_image, &sparse_requirement_count, sparse_requirements));
resource->vk_image, &sparse_requirement_count, sparse_requirements));
/* Find out how much memory and how many bind infos we need */
metadata_size = 0;
@ -2181,7 +2181,7 @@ static HRESULT d3d12_resource_bind_sparse_metadata(struct d3d12_resource *resour
/* Allocate memory for metadata mip tail */
TRACE("Allocating sparse metadata for resource %p.\n", resource);
VK_CALL(vkGetImageMemoryRequirements(device->vk_device, resource->u.vk_image, &memory_requirements));
VK_CALL(vkGetImageMemoryRequirements(device->vk_device, resource->vk_image, &memory_requirements));
if ((vr = vkd3d_allocate_memory(device, metadata_size, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
memory_requirements.memoryTypeBits, NULL, &sparse->vk_metadata_memory, NULL)))
@ -2227,7 +2227,7 @@ static HRESULT d3d12_resource_bind_sparse_metadata(struct d3d12_resource *resour
}
/* Bind metadata memory to the image */
opaque_bind.image = resource->u.vk_image;
opaque_bind.image = resource->vk_image;
opaque_bind.bindCount = bind_count;
opaque_bind.pBinds = memory_binds;
@ -2318,18 +2318,18 @@ static HRESULT d3d12_resource_init_sparse_info(struct d3d12_resource *resource,
if (d3d12_resource_is_buffer(resource))
{
VkDeviceSize offset = VKD3D_TILE_SIZE * i;
sparse->tiles[i].u.buffer.offset = offset;
sparse->tiles[i].u.buffer.length = min(VKD3D_TILE_SIZE, resource->desc.Width - offset);
sparse->tiles[i].buffer.offset = offset;
sparse->tiles[i].buffer.length = min(VKD3D_TILE_SIZE, resource->desc.Width - offset);
}
else if (sparse->packed_mips.NumPackedMips && i >= sparse->packed_mips.StartTileIndexInOverallResource)
{
VkDeviceSize offset = VKD3D_TILE_SIZE * (i - sparse->packed_mips.StartTileIndexInOverallResource);
sparse->tiles[i].u.buffer.offset = vk_memory_requirements.imageMipTailOffset + offset;
sparse->tiles[i].u.buffer.length = min(VKD3D_TILE_SIZE, vk_memory_requirements.imageMipTailSize - offset);
sparse->tiles[i].buffer.offset = vk_memory_requirements.imageMipTailOffset + offset;
sparse->tiles[i].buffer.length = min(VKD3D_TILE_SIZE, vk_memory_requirements.imageMipTailSize - offset);
}
else
{
struct d3d12_sparse_image_region *region = &sparse->tiles[i].u.image;
struct d3d12_sparse_image_region *region = &sparse->tiles[i].image;
VkExtent3D block_extent = vk_memory_requirements.formatProperties.imageGranularity;
VkExtent3D mip_extent;
@ -2430,12 +2430,12 @@ static HRESULT d3d12_resource_init(struct d3d12_resource *resource, struct d3d12
/* We'll inherit a VkBuffer reference from the heap with an implied offset. */
if (placed)
{
resource->u.vk_buffer = VK_NULL_HANDLE;
resource->vk_buffer = VK_NULL_HANDLE;
break;
}
if (FAILED(hr = vkd3d_create_buffer(device, heap_properties, heap_flags,
&resource->desc, &resource->u.vk_buffer)))
&resource->desc, &resource->vk_buffer)))
return hr;
if (!(resource->gpu_address = vkd3d_gpu_va_allocator_allocate(&device->gpu_va_allocator,
desc->Alignment ? desc->Alignment : D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT,
@ -2454,7 +2454,7 @@ static HRESULT d3d12_resource_init(struct d3d12_resource *resource, struct d3d12
resource->desc.MipLevels = max_miplevel_count(desc);
resource->flags |= VKD3D_RESOURCE_INITIAL_STATE_TRANSITION;
if (FAILED(hr = vkd3d_create_image(device, heap_properties, heap_flags,
&resource->desc, resource, &resource->u.vk_image)))
&resource->desc, resource, &resource->vk_image)))
return hr;
break;
@ -2566,7 +2566,7 @@ static HRESULT vkd3d_bind_heap_memory(struct d3d12_device *device,
if (resource->flags & VKD3D_RESOURCE_PLACED_BUFFER)
{
/* Just inherit the buffer from the heap. */
resource->u.vk_buffer = heap->buffer_resource->u.vk_buffer;
resource->vk_buffer = heap->buffer_resource->vk_buffer;
resource->heap = heap;
resource->heap_offset = heap_offset;
resource->gpu_address = heap->buffer_resource->gpu_address + heap_offset;
@ -2574,9 +2574,9 @@ static HRESULT vkd3d_bind_heap_memory(struct d3d12_device *device,
}
if (d3d12_resource_is_buffer(resource))
VK_CALL(vkGetBufferMemoryRequirements(vk_device, resource->u.vk_buffer, &requirements));
VK_CALL(vkGetBufferMemoryRequirements(vk_device, resource->vk_buffer, &requirements));
else
VK_CALL(vkGetImageMemoryRequirements(vk_device, resource->u.vk_image, &requirements));
VK_CALL(vkGetImageMemoryRequirements(vk_device, resource->vk_image, &requirements));
if (heap_offset % requirements.alignment)
{
@ -2593,9 +2593,9 @@ static HRESULT vkd3d_bind_heap_memory(struct d3d12_device *device,
}
if (d3d12_resource_is_buffer(resource))
vr = VK_CALL(vkBindBufferMemory(vk_device, resource->u.vk_buffer, heap->vk_memory, heap_offset));
vr = VK_CALL(vkBindBufferMemory(vk_device, resource->vk_buffer, heap->vk_memory, heap_offset));
else
vr = VK_CALL(vkBindImageMemory(vk_device, resource->u.vk_image, heap->vk_memory, heap_offset));
vr = VK_CALL(vkBindImageMemory(vk_device, resource->vk_image, heap->vk_memory, heap_offset));
if (vr == VK_SUCCESS)
{
@ -2687,7 +2687,7 @@ HRESULT vkd3d_create_image_resource(ID3D12Device *device,
object->refcount = 1;
object->internal_refcount = 1;
object->desc = create_info->desc;
object->u.vk_image = create_info->vk_image;
object->vk_image = create_info->vk_image;
object->flags = VKD3D_RESOURCE_EXTERNAL;
object->flags |= create_info->flags & VKD3D_RESOURCE_PUBLIC_FLAGS;
object->initial_state = D3D12_RESOURCE_STATE_COMMON;
@ -2760,13 +2760,13 @@ static void vkd3d_view_destroy(struct vkd3d_view *view, struct d3d12_device *dev
switch (view->type)
{
case VKD3D_VIEW_TYPE_BUFFER:
VK_CALL(vkDestroyBufferView(device->vk_device, view->u.vk_buffer_view, NULL));
VK_CALL(vkDestroyBufferView(device->vk_device, view->vk_buffer_view, NULL));
break;
case VKD3D_VIEW_TYPE_IMAGE:
VK_CALL(vkDestroyImageView(device->vk_device, view->u.vk_image_view, NULL));
VK_CALL(vkDestroyImageView(device->vk_device, view->vk_image_view, NULL));
break;
case VKD3D_VIEW_TYPE_SAMPLER:
VK_CALL(vkDestroySampler(device->vk_device, view->u.vk_sampler, NULL));
VK_CALL(vkDestroySampler(device->vk_device, view->vk_sampler, NULL));
break;
default:
WARN("Unhandled view type %d.\n", view->type);
@ -2800,12 +2800,12 @@ static void d3d12_desc_update_bindless_descriptor(struct d3d12_desc *dst)
{
dst->heap->uav_counters.data[descriptor_index] =
(dst->magic & VKD3D_DESCRIPTOR_MAGIC_HAS_VIEW)
? dst->u.view->vk_counter_address : 0;
? dst->info.view->vk_counter_address : 0;
}
/* update the actual descriptor */
is_buffer = dst->magic == VKD3D_DESCRIPTOR_MAGIC_CBV ||
dst->u.view->type == VKD3D_VIEW_TYPE_BUFFER;
dst->info.view->type == VKD3D_VIEW_TYPE_BUFFER;
set_index = d3d12_descriptor_heap_set_index_from_magic(dst->magic, is_buffer);
@ -2814,17 +2814,17 @@ static void d3d12_desc_update_bindless_descriptor(struct d3d12_desc *dst)
if (dst->magic == VKD3D_DESCRIPTOR_MAGIC_CBV)
{
descriptor_info.buffer = dst->u.vk_cbv_info;
descriptor_info.buffer = dst->info.vk_cbv_info;
}
else if (is_buffer)
{
descriptor_info.buffer_view = dst->u.view->u.vk_buffer_view;
descriptor_info.buffer_view = dst->info.view->vk_buffer_view;
}
else
{
descriptor_info.image.sampler = dst->u.view->u.vk_sampler;
descriptor_info.image.imageView = dst->u.view->u.vk_image_view;
descriptor_info.image.imageLayout = dst->u.view->info.texture.vk_layout;
descriptor_info.image.sampler = dst->info.view->vk_sampler;
descriptor_info.image.imageView = dst->info.view->vk_image_view;
descriptor_info.image.imageLayout = dst->info.view->info.texture.vk_layout;
}
vk_write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
@ -2846,12 +2846,12 @@ static inline void d3d12_desc_write(struct d3d12_desc *dst, const struct d3d12_d
{
/* Nothing to do for VKD3D_DESCRIPTOR_MAGIC_CBV. */
if ((dst->magic & VKD3D_DESCRIPTOR_MAGIC_HAS_VIEW)
&& !InterlockedDecrement(&dst->u.view->refcount))
*destroy_view = dst->u.view;
&& !InterlockedDecrement(&dst->info.view->refcount))
*destroy_view = dst->info.view;
dst->magic = src->magic;
dst->vk_descriptor_type = src->vk_descriptor_type;
dst->u = src->u;
dst->info = src->info;
if (dst->magic != VKD3D_DESCRIPTOR_MAGIC_FREE)
d3d12_desc_update_bindless_descriptor(dst);
@ -2897,13 +2897,13 @@ void d3d12_desc_copy(struct d3d12_desc *dst, struct d3d12_desc *src,
{
if (dst->magic & VKD3D_DESCRIPTOR_MAGIC_HAS_VIEW)
{
needs_update = dst->u.view != src->u.view;
needs_update = dst->info.view != src->info.view;
}
else if (dst->magic != VKD3D_DESCRIPTOR_MAGIC_FREE)
{
needs_update = dst->u.vk_cbv_info.buffer != src->u.vk_cbv_info.buffer ||
dst->u.vk_cbv_info.offset != src->u.vk_cbv_info.offset ||
dst->u.vk_cbv_info.range != src->u.vk_cbv_info.range;
needs_update = dst->info.vk_cbv_info.buffer != src->info.vk_cbv_info.buffer ||
dst->info.vk_cbv_info.offset != src->info.vk_cbv_info.offset ||
dst->info.vk_cbv_info.range != src->info.vk_cbv_info.range;
}
}
@ -2911,7 +2911,7 @@ void d3d12_desc_copy(struct d3d12_desc *dst, struct d3d12_desc *src,
{
/* Perform the actual descriptor update */
if (src->magic & VKD3D_DESCRIPTOR_MAGIC_HAS_VIEW)
InterlockedIncrement(&src->u.view->refcount);
InterlockedIncrement(&src->info.view->refcount);
d3d12_desc_write(dst, src, &destroy_view);
}
@ -3030,7 +3030,7 @@ bool vkd3d_create_buffer_view(struct d3d12_device *device, VkBuffer vk_buffer, c
return false;
}
object->u.vk_buffer_view = vk_view;
object->vk_buffer_view = vk_view;
object->format = format;
object->info.buffer.offset = offset;
object->info.buffer.size = size;
@ -3070,7 +3070,7 @@ static bool vkd3d_create_buffer_view_for_resource(struct d3d12_device *device,
assert(d3d12_resource_is_buffer(resource));
return vkd3d_create_buffer_view(device, resource->u.vk_buffer,
return vkd3d_create_buffer_view(device, resource->vk_buffer,
format, resource->heap_offset + offset * element_size, size * element_size, view);
}
@ -3297,7 +3297,7 @@ bool vkd3d_create_texture_view(struct d3d12_device *device, VkImage vk_image,
return false;
}
object->u.vk_image_view = vk_view;
object->vk_image_view = vk_view;
object->format = format;
object->info.texture.vk_view_type = desc->view_type;
object->info.texture.vk_layout = desc->layout;
@ -3326,11 +3326,11 @@ void d3d12_desc_create_cbv(struct d3d12_desc *descriptor,
return;
}
buffer_info = &descriptor->u.vk_cbv_info;
buffer_info = &descriptor->info.vk_cbv_info;
if (desc->BufferLocation)
{
resource = vkd3d_gpu_va_allocator_dereference(&device->gpu_va_allocator, desc->BufferLocation);
buffer_info->buffer = resource->u.vk_buffer;
buffer_info->buffer = resource->vk_buffer;
buffer_info->offset = desc->BufferLocation - resource->gpu_address;
buffer_info->range = min(desc->SizeInBytes, resource->desc.Width - buffer_info->offset);
}
@ -3380,7 +3380,7 @@ static void vkd3d_create_null_srv(struct d3d12_desc *descriptor,
{
descriptor->magic = VKD3D_DESCRIPTOR_MAGIC_SRV;
descriptor->vk_descriptor_type = VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER;
descriptor->u.view = view;
descriptor->info.view = view;
}
return;
@ -3417,7 +3417,7 @@ static void vkd3d_create_null_srv(struct d3d12_desc *descriptor,
descriptor->magic = VKD3D_DESCRIPTOR_MAGIC_SRV;
descriptor->vk_descriptor_type = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE;
descriptor->u.view = view;
descriptor->info.view = view;
}
static void vkd3d_create_buffer_srv(struct d3d12_desc *descriptor,
@ -3439,15 +3439,15 @@ static void vkd3d_create_buffer_srv(struct d3d12_desc *descriptor,
return;
}
flags = vkd3d_view_flags_from_d3d12_buffer_srv_flags(desc->u.Buffer.Flags);
flags = vkd3d_view_flags_from_d3d12_buffer_srv_flags(desc->Buffer.Flags);
if (!vkd3d_create_buffer_view_for_resource(device, resource, desc->Format,
desc->u.Buffer.FirstElement, desc->u.Buffer.NumElements,
desc->u.Buffer.StructureByteStride, flags, &view))
desc->Buffer.FirstElement, desc->Buffer.NumElements,
desc->Buffer.StructureByteStride, flags, &view))
return;
descriptor->magic = VKD3D_DESCRIPTOR_MAGIC_SRV;
descriptor->vk_descriptor_type = VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER;
descriptor->u.view = view;
descriptor->info.view = view;
}
void d3d12_desc_create_srv(struct d3d12_desc *descriptor,
@ -3489,37 +3489,37 @@ void d3d12_desc_create_srv(struct d3d12_desc *descriptor,
{
case D3D12_SRV_DIMENSION_TEXTURE1D:
vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_1D;
vkd3d_desc.miplevel_idx = desc->u.Texture1D.MostDetailedMip;
vkd3d_desc.miplevel_count = desc->u.Texture1D.MipLevels;
vkd3d_desc.miplevel_idx = desc->Texture1D.MostDetailedMip;
vkd3d_desc.miplevel_count = desc->Texture1D.MipLevels;
vkd3d_desc.layer_count = 1;
break;
case D3D12_SRV_DIMENSION_TEXTURE1DARRAY:
vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_1D_ARRAY;
vkd3d_desc.miplevel_idx = desc->u.Texture1DArray.MostDetailedMip;
vkd3d_desc.miplevel_count = desc->u.Texture1DArray.MipLevels;
vkd3d_desc.layer_idx = desc->u.Texture1DArray.FirstArraySlice;
vkd3d_desc.layer_count = desc->u.Texture1DArray.ArraySize;
vkd3d_desc.miplevel_idx = desc->Texture1DArray.MostDetailedMip;
vkd3d_desc.miplevel_count = desc->Texture1DArray.MipLevels;
vkd3d_desc.layer_idx = desc->Texture1DArray.FirstArraySlice;
vkd3d_desc.layer_count = desc->Texture1DArray.ArraySize;
break;
case D3D12_SRV_DIMENSION_TEXTURE2D:
vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_2D;
vkd3d_desc.miplevel_idx = desc->u.Texture2D.MostDetailedMip;
vkd3d_desc.miplevel_count = desc->u.Texture2D.MipLevels;
vkd3d_desc.miplevel_idx = desc->Texture2D.MostDetailedMip;
vkd3d_desc.miplevel_count = desc->Texture2D.MipLevels;
vkd3d_desc.layer_count = 1;
if (desc->u.Texture2D.PlaneSlice)
FIXME("Ignoring plane slice %u.\n", desc->u.Texture2D.PlaneSlice);
if (desc->u.Texture2D.ResourceMinLODClamp)
FIXME("Unhandled min LOD clamp %.8e.\n", desc->u.Texture2D.ResourceMinLODClamp);
if (desc->Texture2D.PlaneSlice)
FIXME("Ignoring plane slice %u.\n", desc->Texture2D.PlaneSlice);
if (desc->Texture2D.ResourceMinLODClamp)
FIXME("Unhandled min LOD clamp %.8e.\n", desc->Texture2D.ResourceMinLODClamp);
break;
case D3D12_SRV_DIMENSION_TEXTURE2DARRAY:
vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
vkd3d_desc.miplevel_idx = desc->u.Texture2DArray.MostDetailedMip;
vkd3d_desc.miplevel_count = desc->u.Texture2DArray.MipLevels;
vkd3d_desc.layer_idx = desc->u.Texture2DArray.FirstArraySlice;
vkd3d_desc.layer_count = desc->u.Texture2DArray.ArraySize;
if (desc->u.Texture2DArray.PlaneSlice)
FIXME("Ignoring plane slice %u.\n", desc->u.Texture2DArray.PlaneSlice);
if (desc->u.Texture2DArray.ResourceMinLODClamp)
FIXME("Unhandled min LOD clamp %.8e.\n", desc->u.Texture2DArray.ResourceMinLODClamp);
vkd3d_desc.miplevel_idx = desc->Texture2DArray.MostDetailedMip;
vkd3d_desc.miplevel_count = desc->Texture2DArray.MipLevels;
vkd3d_desc.layer_idx = desc->Texture2DArray.FirstArraySlice;
vkd3d_desc.layer_count = desc->Texture2DArray.ArraySize;
if (desc->Texture2DArray.PlaneSlice)
FIXME("Ignoring plane slice %u.\n", desc->Texture2DArray.PlaneSlice);
if (desc->Texture2DArray.ResourceMinLODClamp)
FIXME("Unhandled min LOD clamp %.8e.\n", desc->Texture2DArray.ResourceMinLODClamp);
break;
case D3D12_SRV_DIMENSION_TEXTURE2DMS:
vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_2D;
@ -3527,46 +3527,46 @@ void d3d12_desc_create_srv(struct d3d12_desc *descriptor,
break;
case D3D12_SRV_DIMENSION_TEXTURE2DMSARRAY:
vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
vkd3d_desc.layer_idx = desc->u.Texture2DMSArray.FirstArraySlice;
vkd3d_desc.layer_count = desc->u.Texture2DMSArray.ArraySize;
vkd3d_desc.layer_idx = desc->Texture2DMSArray.FirstArraySlice;
vkd3d_desc.layer_count = desc->Texture2DMSArray.ArraySize;
break;
case D3D12_SRV_DIMENSION_TEXTURE3D:
vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_3D;
vkd3d_desc.miplevel_idx = desc->u.Texture3D.MostDetailedMip;
vkd3d_desc.miplevel_count = desc->u.Texture3D.MipLevels;
if (desc->u.Texture3D.ResourceMinLODClamp)
FIXME("Unhandled min LOD clamp %.8e.\n", desc->u.Texture2D.ResourceMinLODClamp);
vkd3d_desc.miplevel_idx = desc->Texture3D.MostDetailedMip;
vkd3d_desc.miplevel_count = desc->Texture3D.MipLevels;
if (desc->Texture3D.ResourceMinLODClamp)
FIXME("Unhandled min LOD clamp %.8e.\n", desc->Texture2D.ResourceMinLODClamp);
break;
case D3D12_SRV_DIMENSION_TEXTURECUBE:
vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_CUBE;
vkd3d_desc.miplevel_idx = desc->u.TextureCube.MostDetailedMip;
vkd3d_desc.miplevel_count = desc->u.TextureCube.MipLevels;
vkd3d_desc.miplevel_idx = desc->TextureCube.MostDetailedMip;
vkd3d_desc.miplevel_count = desc->TextureCube.MipLevels;
vkd3d_desc.layer_count = 6;
if (desc->u.TextureCube.ResourceMinLODClamp)
FIXME("Unhandled min LOD clamp %.8e.\n", desc->u.TextureCube.ResourceMinLODClamp);
if (desc->TextureCube.ResourceMinLODClamp)
FIXME("Unhandled min LOD clamp %.8e.\n", desc->TextureCube.ResourceMinLODClamp);
break;
case D3D12_SRV_DIMENSION_TEXTURECUBEARRAY:
vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_CUBE_ARRAY;
vkd3d_desc.miplevel_idx = desc->u.TextureCubeArray.MostDetailedMip;
vkd3d_desc.miplevel_count = desc->u.TextureCubeArray.MipLevels;
vkd3d_desc.layer_idx = desc->u.TextureCubeArray.First2DArrayFace;
vkd3d_desc.layer_count = desc->u.TextureCubeArray.NumCubes;
vkd3d_desc.miplevel_idx = desc->TextureCubeArray.MostDetailedMip;
vkd3d_desc.miplevel_count = desc->TextureCubeArray.MipLevels;
vkd3d_desc.layer_idx = desc->TextureCubeArray.First2DArrayFace;
vkd3d_desc.layer_count = desc->TextureCubeArray.NumCubes;
if (vkd3d_desc.layer_count != VK_REMAINING_ARRAY_LAYERS)
vkd3d_desc.layer_count *= 6;
if (desc->u.TextureCubeArray.ResourceMinLODClamp)
FIXME("Unhandled min LOD clamp %.8e.\n", desc->u.TextureCubeArray.ResourceMinLODClamp);
if (desc->TextureCubeArray.ResourceMinLODClamp)
FIXME("Unhandled min LOD clamp %.8e.\n", desc->TextureCubeArray.ResourceMinLODClamp);
break;
default:
FIXME("Unhandled view dimension %#x.\n", desc->ViewDimension);
}
}
if (!vkd3d_create_texture_view(device, resource->u.vk_image, &vkd3d_desc, &view))
if (!vkd3d_create_texture_view(device, resource->vk_image, &vkd3d_desc, &view))
return;
descriptor->magic = VKD3D_DESCRIPTOR_MAGIC_SRV;
descriptor->vk_descriptor_type = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE;
descriptor->u.view = view;
descriptor->info.view = view;
}
static unsigned int vkd3d_view_flags_from_d3d12_buffer_uav_flags(D3D12_BUFFER_UAV_FLAGS flags)
@ -3603,7 +3603,7 @@ static void vkd3d_create_null_uav(struct d3d12_desc *descriptor,
{
descriptor->magic = VKD3D_DESCRIPTOR_MAGIC_UAV;
descriptor->vk_descriptor_type = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER;
descriptor->u.view = view;
descriptor->info.view = view;
}
return;
@ -3640,7 +3640,7 @@ static void vkd3d_create_null_uav(struct d3d12_desc *descriptor,
descriptor->magic = VKD3D_DESCRIPTOR_MAGIC_UAV;
descriptor->vk_descriptor_type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
descriptor->u.view = view;
descriptor->info.view = view;
}
static VkDeviceAddress vkd3d_get_buffer_device_address(struct d3d12_device *device, VkBuffer vk_buffer)
@ -3674,37 +3674,37 @@ static void vkd3d_create_buffer_uav(struct d3d12_desc *descriptor, struct d3d12_
return;
}
if (desc->u.Buffer.CounterOffsetInBytes)
FIXME("Ignoring counter offset %"PRIu64".\n", desc->u.Buffer.CounterOffsetInBytes);
if (desc->Buffer.CounterOffsetInBytes)
FIXME("Ignoring counter offset %"PRIu64".\n", desc->Buffer.CounterOffsetInBytes);
flags = vkd3d_view_flags_from_d3d12_buffer_uav_flags(desc->u.Buffer.Flags);
flags = vkd3d_view_flags_from_d3d12_buffer_uav_flags(desc->Buffer.Flags);
if (!vkd3d_create_buffer_view_for_resource(device, resource, desc->Format,
desc->u.Buffer.FirstElement, desc->u.Buffer.NumElements,
desc->u.Buffer.StructureByteStride, flags, &view))
desc->Buffer.FirstElement, desc->Buffer.NumElements,
desc->Buffer.StructureByteStride, flags, &view))
return;
descriptor->magic = VKD3D_DESCRIPTOR_MAGIC_UAV;
descriptor->vk_descriptor_type = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER;
descriptor->u.view = view;
descriptor->info.view = view;
if (counter_resource)
{
assert(d3d12_resource_is_buffer(counter_resource));
assert(desc->u.Buffer.StructureByteStride);
assert(desc->Buffer.StructureByteStride);
if (device->bindless_state.flags & VKD3D_BINDLESS_UAV_COUNTER)
{
VkDeviceAddress address = vkd3d_get_buffer_device_address(device, counter_resource->u.vk_buffer);
VkDeviceAddress address = vkd3d_get_buffer_device_address(device, counter_resource->vk_buffer);
view->vk_counter_view = VK_NULL_HANDLE;
view->vk_counter_address = address + counter_resource->heap_offset + desc->u.Buffer.CounterOffsetInBytes;
view->vk_counter_address = address + counter_resource->heap_offset + desc->Buffer.CounterOffsetInBytes;
}
else
{
const struct vkd3d_format *format = vkd3d_get_format(device, DXGI_FORMAT_R32_UINT, false);
if (!vkd3d_create_vk_buffer_view(device, counter_resource->u.vk_buffer, format,
desc->u.Buffer.CounterOffsetInBytes + resource->heap_offset, sizeof(uint32_t), &view->vk_counter_view))
if (!vkd3d_create_vk_buffer_view(device, counter_resource->vk_buffer, format,
desc->Buffer.CounterOffsetInBytes + resource->heap_offset, sizeof(uint32_t), &view->vk_counter_view))
{
WARN("Failed to create counter buffer view.\n");
view->vk_counter_view = VK_NULL_HANDLE;
@ -3736,38 +3736,38 @@ static void vkd3d_create_texture_uav(struct d3d12_desc *descriptor,
{
case D3D12_UAV_DIMENSION_TEXTURE1D:
vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_1D;
vkd3d_desc.miplevel_idx = desc->u.Texture1D.MipSlice;
vkd3d_desc.miplevel_idx = desc->Texture1D.MipSlice;
vkd3d_desc.layer_count = 1;
break;
case D3D12_UAV_DIMENSION_TEXTURE1DARRAY:
vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_1D_ARRAY;
vkd3d_desc.miplevel_idx = desc->u.Texture1DArray.MipSlice;
vkd3d_desc.layer_idx = desc->u.Texture1DArray.FirstArraySlice;
vkd3d_desc.layer_count = desc->u.Texture1DArray.ArraySize;
vkd3d_desc.miplevel_idx = desc->Texture1DArray.MipSlice;
vkd3d_desc.layer_idx = desc->Texture1DArray.FirstArraySlice;
vkd3d_desc.layer_count = desc->Texture1DArray.ArraySize;
break;
case D3D12_UAV_DIMENSION_TEXTURE2D:
vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_2D;
vkd3d_desc.miplevel_idx = desc->u.Texture2D.MipSlice;
vkd3d_desc.miplevel_idx = desc->Texture2D.MipSlice;
vkd3d_desc.layer_count = 1;
if (desc->u.Texture2D.PlaneSlice)
FIXME("Ignoring plane slice %u.\n", desc->u.Texture2D.PlaneSlice);
if (desc->Texture2D.PlaneSlice)
FIXME("Ignoring plane slice %u.\n", desc->Texture2D.PlaneSlice);
break;
case D3D12_UAV_DIMENSION_TEXTURE2DARRAY:
vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
vkd3d_desc.miplevel_idx = desc->u.Texture2DArray.MipSlice;
vkd3d_desc.layer_idx = desc->u.Texture2DArray.FirstArraySlice;
vkd3d_desc.layer_count = desc->u.Texture2DArray.ArraySize;
if (desc->u.Texture2DArray.PlaneSlice)
FIXME("Ignoring plane slice %u.\n", desc->u.Texture2DArray.PlaneSlice);
vkd3d_desc.miplevel_idx = desc->Texture2DArray.MipSlice;
vkd3d_desc.layer_idx = desc->Texture2DArray.FirstArraySlice;
vkd3d_desc.layer_count = desc->Texture2DArray.ArraySize;
if (desc->Texture2DArray.PlaneSlice)
FIXME("Ignoring plane slice %u.\n", desc->Texture2DArray.PlaneSlice);
break;
case D3D12_UAV_DIMENSION_TEXTURE3D:
vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_3D;
vkd3d_desc.miplevel_idx = desc->u.Texture3D.MipSlice;
if (desc->u.Texture3D.FirstWSlice ||
((desc->u.Texture3D.WSize != resource->desc.DepthOrArraySize) && (desc->u.Texture3D.WSize != UINT_MAX)))
vkd3d_desc.miplevel_idx = desc->Texture3D.MipSlice;
if (desc->Texture3D.FirstWSlice ||
((desc->Texture3D.WSize != resource->desc.DepthOrArraySize) && (desc->Texture3D.WSize != UINT_MAX)))
{
FIXME("Unhandled depth view %u-%u.\n",
desc->u.Texture3D.FirstWSlice, desc->u.Texture3D.WSize);
desc->Texture3D.FirstWSlice, desc->Texture3D.WSize);
}
break;
default:
@ -3775,12 +3775,12 @@ static void vkd3d_create_texture_uav(struct d3d12_desc *descriptor,
}
}
if (!vkd3d_create_texture_view(device, resource->u.vk_image, &vkd3d_desc, &view))
if (!vkd3d_create_texture_view(device, resource->vk_image, &vkd3d_desc, &view))
return;
descriptor->magic = VKD3D_DESCRIPTOR_MAGIC_UAV;
descriptor->vk_descriptor_type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
descriptor->u.view = view;
descriptor->info.view = view;
}
void d3d12_desc_create_uav(struct d3d12_desc *descriptor, struct d3d12_device *device,
@ -3822,7 +3822,7 @@ bool vkd3d_create_raw_buffer_view(struct d3d12_device *device,
offset = gpu_address - resource->gpu_address;
range = min(resource->desc.Width - offset, device->vk_info.device_limits.maxStorageBufferRange);
return vkd3d_create_vk_buffer_view(device, resource->u.vk_buffer, format,
return vkd3d_create_vk_buffer_view(device, resource->vk_buffer, format,
offset, range, vk_buffer_view);
}
@ -4056,7 +4056,7 @@ void d3d12_desc_create_sampler(struct d3d12_desc *sampler,
if (!(view = vkd3d_view_create(VKD3D_VIEW_TYPE_SAMPLER)))
return;
if (FAILED(d3d12_create_sampler(device, desc, &view->u.vk_sampler)))
if (FAILED(d3d12_create_sampler(device, desc, &view->vk_sampler)))
{
vkd3d_free(view);
return;
@ -4064,7 +4064,7 @@ void d3d12_desc_create_sampler(struct d3d12_desc *sampler,
sampler->magic = VKD3D_DESCRIPTOR_MAGIC_SAMPLER;
sampler->vk_descriptor_type = VK_DESCRIPTOR_TYPE_SAMPLER;
sampler->u.view = view;
sampler->info.view = view;
}
/* RTVs */
@ -4108,29 +4108,29 @@ void d3d12_rtv_desc_create_rtv(struct d3d12_rtv_desc *rtv_desc, struct d3d12_dev
{
case D3D12_RTV_DIMENSION_TEXTURE1D:
vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_1D;
vkd3d_desc.miplevel_idx = desc->u.Texture1D.MipSlice;
vkd3d_desc.miplevel_idx = desc->Texture1D.MipSlice;
vkd3d_desc.layer_count = 1;
break;
case D3D12_RTV_DIMENSION_TEXTURE1DARRAY:
vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_1D_ARRAY;
vkd3d_desc.miplevel_idx = desc->u.Texture1DArray.MipSlice;
vkd3d_desc.layer_idx = desc->u.Texture1DArray.FirstArraySlice;
vkd3d_desc.layer_count = desc->u.Texture1DArray.ArraySize;
vkd3d_desc.miplevel_idx = desc->Texture1DArray.MipSlice;
vkd3d_desc.layer_idx = desc->Texture1DArray.FirstArraySlice;
vkd3d_desc.layer_count = desc->Texture1DArray.ArraySize;
break;
case D3D12_RTV_DIMENSION_TEXTURE2D:
vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_2D;
vkd3d_desc.miplevel_idx = desc->u.Texture2D.MipSlice;
vkd3d_desc.miplevel_idx = desc->Texture2D.MipSlice;
vkd3d_desc.layer_count = 1;
if (desc->u.Texture2D.PlaneSlice)
FIXME("Ignoring plane slice %u.\n", desc->u.Texture2D.PlaneSlice);
if (desc->Texture2D.PlaneSlice)
FIXME("Ignoring plane slice %u.\n", desc->Texture2D.PlaneSlice);
break;
case D3D12_RTV_DIMENSION_TEXTURE2DARRAY:
vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
vkd3d_desc.miplevel_idx = desc->u.Texture2DArray.MipSlice;
vkd3d_desc.layer_idx = desc->u.Texture2DArray.FirstArraySlice;
vkd3d_desc.layer_count = desc->u.Texture2DArray.ArraySize;
if (desc->u.Texture2DArray.PlaneSlice)
FIXME("Ignoring plane slice %u.\n", desc->u.Texture2DArray.PlaneSlice);
vkd3d_desc.miplevel_idx = desc->Texture2DArray.MipSlice;
vkd3d_desc.layer_idx = desc->Texture2DArray.FirstArraySlice;
vkd3d_desc.layer_count = desc->Texture2DArray.ArraySize;
if (desc->Texture2DArray.PlaneSlice)
FIXME("Ignoring plane slice %u.\n", desc->Texture2DArray.PlaneSlice);
break;
case D3D12_RTV_DIMENSION_TEXTURE2DMS:
vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_2D;
@ -4138,14 +4138,14 @@ void d3d12_rtv_desc_create_rtv(struct d3d12_rtv_desc *rtv_desc, struct d3d12_dev
break;
case D3D12_RTV_DIMENSION_TEXTURE2DMSARRAY:
vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
vkd3d_desc.layer_idx = desc->u.Texture2DMSArray.FirstArraySlice;
vkd3d_desc.layer_count = desc->u.Texture2DMSArray.ArraySize;
vkd3d_desc.layer_idx = desc->Texture2DMSArray.FirstArraySlice;
vkd3d_desc.layer_count = desc->Texture2DMSArray.ArraySize;
break;
case D3D12_RTV_DIMENSION_TEXTURE3D:
vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
vkd3d_desc.miplevel_idx = desc->u.Texture3D.MipSlice;
vkd3d_desc.layer_idx = desc->u.Texture3D.FirstWSlice;
vkd3d_desc.layer_count = desc->u.Texture3D.WSize;
vkd3d_desc.miplevel_idx = desc->Texture3D.MipSlice;
vkd3d_desc.layer_idx = desc->Texture3D.FirstWSlice;
vkd3d_desc.layer_count = desc->Texture3D.WSize;
break;
default:
FIXME("Unhandled view dimension %#x.\n", desc->ViewDimension);
@ -4163,7 +4163,7 @@ void d3d12_rtv_desc_create_rtv(struct d3d12_rtv_desc *rtv_desc, struct d3d12_dev
assert(d3d12_resource_is_texture(resource));
if (!vkd3d_create_texture_view(device, resource->u.vk_image, &vkd3d_desc, &view))
if (!vkd3d_create_texture_view(device, resource->vk_image, &vkd3d_desc, &view))
return;
rtv_desc->magic = VKD3D_DESCRIPTOR_MAGIC_RTV;
@ -4240,24 +4240,24 @@ void d3d12_dsv_desc_create_dsv(struct d3d12_dsv_desc *dsv_desc, struct d3d12_dev
switch (desc->ViewDimension)
{
case D3D12_DSV_DIMENSION_TEXTURE1D:
vkd3d_desc.miplevel_idx = desc->u.Texture1D.MipSlice;
vkd3d_desc.miplevel_idx = desc->Texture1D.MipSlice;
vkd3d_desc.layer_count = 1;
break;
case D3D12_DSV_DIMENSION_TEXTURE1DARRAY:
vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_1D_ARRAY;
vkd3d_desc.miplevel_idx = desc->u.Texture1DArray.MipSlice;
vkd3d_desc.layer_idx = desc->u.Texture1DArray.FirstArraySlice;
vkd3d_desc.layer_count = desc->u.Texture1DArray.ArraySize;
vkd3d_desc.miplevel_idx = desc->Texture1DArray.MipSlice;
vkd3d_desc.layer_idx = desc->Texture1DArray.FirstArraySlice;
vkd3d_desc.layer_count = desc->Texture1DArray.ArraySize;
break;
case D3D12_DSV_DIMENSION_TEXTURE2D:
vkd3d_desc.miplevel_idx = desc->u.Texture2D.MipSlice;
vkd3d_desc.miplevel_idx = desc->Texture2D.MipSlice;
vkd3d_desc.layer_count = 1;
break;
case D3D12_DSV_DIMENSION_TEXTURE2DARRAY:
vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
vkd3d_desc.miplevel_idx = desc->u.Texture2DArray.MipSlice;
vkd3d_desc.layer_idx = desc->u.Texture2DArray.FirstArraySlice;
vkd3d_desc.layer_count = desc->u.Texture2DArray.ArraySize;
vkd3d_desc.miplevel_idx = desc->Texture2DArray.MipSlice;
vkd3d_desc.layer_idx = desc->Texture2DArray.FirstArraySlice;
vkd3d_desc.layer_count = desc->Texture2DArray.ArraySize;
break;
case D3D12_DSV_DIMENSION_TEXTURE2DMS:
vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_2D;
@ -4265,8 +4265,8 @@ void d3d12_dsv_desc_create_dsv(struct d3d12_dsv_desc *dsv_desc, struct d3d12_dev
break;
case D3D12_DSV_DIMENSION_TEXTURE2DMSARRAY:
vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
vkd3d_desc.layer_idx = desc->u.Texture2DMSArray.FirstArraySlice;
vkd3d_desc.layer_count = desc->u.Texture2DMSArray.ArraySize;
vkd3d_desc.layer_idx = desc->Texture2DMSArray.FirstArraySlice;
vkd3d_desc.layer_count = desc->Texture2DMSArray.ArraySize;
break;
default:
FIXME("Unhandled view dimension %#x.\n", desc->ViewDimension);
@ -4280,7 +4280,7 @@ void d3d12_dsv_desc_create_dsv(struct d3d12_dsv_desc *dsv_desc, struct d3d12_dev
assert(d3d12_resource_is_texture(resource));
if (!vkd3d_create_texture_view(device, resource->u.vk_image, &vkd3d_desc, &view))
if (!vkd3d_create_texture_view(device, resource->vk_image, &vkd3d_desc, &view))
return;
dsv_desc->magic = VKD3D_DESCRIPTOR_MAGIC_DSV;

View File

@ -489,9 +489,9 @@ static HRESULT d3d12_root_signature_info_from_desc(struct d3d12_root_signature_i
switch (p->ParameterType)
{
case D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE:
for (j = 0; j < p->u.DescriptorTable.NumDescriptorRanges; ++j)
for (j = 0; j < p->DescriptorTable.NumDescriptorRanges; ++j)
if (FAILED(hr = d3d12_root_signature_info_count_descriptors(info,
device, &p->u.DescriptorTable.pDescriptorRanges[j])))
device, &p->DescriptorTable.pDescriptorRanges[j])))
return hr;
info->cost += 1;
break;
@ -506,7 +506,7 @@ static HRESULT d3d12_root_signature_info_from_desc(struct d3d12_root_signature_i
case D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS:
info->root_constant_count += 1;
info->cost += p->u.Constants.Num32BitValues;
info->cost += p->Constants.Num32BitValues;
break;
default:
@ -544,16 +544,16 @@ static HRESULT d3d12_root_signature_init_push_constants(struct d3d12_root_signat
root_signature->root_constant_mask |= 1ull << i;
root_signature->parameters[i].parameter_type = p->ParameterType;
root_signature->parameters[i].u.constant.constant_index = push_constant_range->size / sizeof(uint32_t);
root_signature->parameters[i].u.constant.constant_count = p->u.Constants.Num32BitValues;
root_signature->parameters[i].constant.constant_index = push_constant_range->size / sizeof(uint32_t);
root_signature->parameters[i].constant.constant_count = p->Constants.Num32BitValues;
root_signature->root_constants[j].register_space = p->u.Constants.RegisterSpace;
root_signature->root_constants[j].register_index = p->u.Constants.ShaderRegister;
root_signature->root_constants[j].register_space = p->Constants.RegisterSpace;
root_signature->root_constants[j].register_index = p->Constants.ShaderRegister;
root_signature->root_constants[j].shader_visibility = vkd3d_shader_visibility_from_d3d12(p->ShaderVisibility);
root_signature->root_constants[j].offset = push_constant_range->size;
root_signature->root_constants[j].size = p->u.Constants.Num32BitValues * sizeof(uint32_t);
root_signature->root_constants[j].size = p->Constants.Num32BitValues * sizeof(uint32_t);
push_constant_range->size += p->u.Constants.Num32BitValues * sizeof(uint32_t);
push_constant_range->size += p->Constants.Num32BitValues * sizeof(uint32_t);
++j;
}
@ -609,8 +609,8 @@ static HRESULT d3d12_root_signature_init_root_descriptor_tables(struct d3d12_roo
root_signature->descriptor_table_mask |= 1ull << i;
table = &root_signature->parameters[i].u.descriptor_table;
range_count = p->u.DescriptorTable.NumDescriptorRanges;
table = &root_signature->parameters[i].descriptor_table;
range_count = p->DescriptorTable.NumDescriptorRanges;
range_descriptor_offset = 0;
root_signature->parameters[i].parameter_type = p->ParameterType;
@ -623,7 +623,7 @@ static HRESULT d3d12_root_signature_init_root_descriptor_tables(struct d3d12_roo
for (j = 0; j < range_count; ++j)
{
const D3D12_DESCRIPTOR_RANGE *range = &p->u.DescriptorTable.pDescriptorRanges[j];
const D3D12_DESCRIPTOR_RANGE *range = &p->DescriptorTable.pDescriptorRanges[j];
bool is_srv = range->RangeType == D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
bool is_uav = range->RangeType == D3D12_DESCRIPTOR_RANGE_TYPE_UAV;
@ -795,8 +795,8 @@ static HRESULT d3d12_root_signature_init_root_descriptors(struct d3d12_root_sign
binding = &root_signature->bindings[context->binding_index];
binding->type = vkd3d_descriptor_type_from_d3d12_root_parameter_type(p->ParameterType);
binding->register_space = p->u.Descriptor.RegisterSpace;
binding->register_index = p->u.Descriptor.ShaderRegister;
binding->register_space = p->Descriptor.RegisterSpace;
binding->register_index = p->Descriptor.ShaderRegister;
binding->register_count = 1;
binding->descriptor_table = 0; /* ignored */
binding->descriptor_offset = 0; /* ignored */
@ -807,8 +807,8 @@ static HRESULT d3d12_root_signature_init_root_descriptors(struct d3d12_root_sign
param = &root_signature->parameters[i];
param->parameter_type = p->ParameterType;
param->u.descriptor.binding = binding;
param->u.descriptor.packed_descriptor = context->packed_descriptor_index;
param->descriptor.binding = binding;
param->descriptor.packed_descriptor = context->packed_descriptor_index;
context->packed_descriptor_index += 1;
context->binding_index += 1;
@ -1076,7 +1076,7 @@ HRESULT d3d12_root_signature_create(struct d3d12_device *device,
return E_OUTOFMEMORY;
}
hr = d3d12_root_signature_init(object, device, &root_signature_desc.d3d12.u.Desc_1_0);
hr = d3d12_root_signature_init(object, device, &root_signature_desc.d3d12.Desc_1_0);
vkd3d_shader_free_root_signature(&root_signature_desc.vkd3d);
if (FAILED(hr))
{
@ -1377,7 +1377,7 @@ static ULONG STDMETHODCALLTYPE d3d12_pipeline_state_AddRef(ID3D12PipelineState *
static void d3d12_pipeline_state_destroy_graphics(struct d3d12_pipeline_state *state,
struct d3d12_device *device)
{
struct d3d12_graphics_pipeline_state *graphics = &state->u.graphics;
struct d3d12_graphics_pipeline_state *graphics = &state->graphics;
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
struct vkd3d_compiled_pipeline *current, *e;
unsigned int i;
@ -1411,7 +1411,7 @@ static ULONG STDMETHODCALLTYPE d3d12_pipeline_state_Release(ID3D12PipelineState
if (d3d12_pipeline_state_is_graphics(state))
d3d12_pipeline_state_destroy_graphics(state, device);
else if (d3d12_pipeline_state_is_compute(state))
VK_CALL(vkDestroyPipeline(device->vk_device, state->u.compute.vk_pipeline, NULL));
VK_CALL(vkDestroyPipeline(device->vk_device, state->compute.vk_pipeline, NULL));
vkd3d_free(state);
@ -1459,7 +1459,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_pipeline_state_SetName(ID3D12PipelineStat
if (d3d12_pipeline_state_is_compute(state))
{
return vkd3d_set_vk_object_name(state->device, (uint64_t)state->u.compute.vk_pipeline,
return vkd3d_set_vk_object_name(state->device, (uint64_t)state->compute.vk_pipeline,
VK_OBJECT_TYPE_PIPELINE, name);
}
@ -1621,7 +1621,7 @@ static HRESULT d3d12_pipeline_state_init_compute(struct d3d12_pipeline_state *st
shader_interface.push_constant_ubo_binding = &root_signature->push_constant_ubo_binding;
if (FAILED(hr = vkd3d_create_compute_pipeline(device, &desc->cs, &shader_interface,
root_signature->vk_pipeline_layout, &state->u.compute.vk_pipeline)))
root_signature->vk_pipeline_layout, &state->compute.vk_pipeline)))
{
WARN("Failed to create Vulkan compute pipeline, hr %#x.\n", hr);
return hr;
@ -1629,7 +1629,7 @@ static HRESULT d3d12_pipeline_state_init_compute(struct d3d12_pipeline_state *st
if (FAILED(hr = vkd3d_private_store_init(&state->private_store)))
{
VK_CALL(vkDestroyPipeline(device->vk_device, state->u.compute.vk_pipeline, NULL));
VK_CALL(vkDestroyPipeline(device->vk_device, state->compute.vk_pipeline, NULL));
return hr;
}
@ -2161,7 +2161,7 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
{
const VkPhysicalDeviceFeatures *features = &device->device_info.features2.features;
unsigned int ps_output_swizzle[D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT];
struct d3d12_graphics_pipeline_state *graphics = &state->u.graphics;
struct d3d12_graphics_pipeline_state *graphics = &state->graphics;
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
const D3D12_STREAM_OUTPUT_DESC *so_desc = &desc->stream_output;
VkVertexInputBindingDivisorDescriptionEXT *binding_divisor;
@ -2332,7 +2332,7 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
ps_shader_parameters[0].name = VKD3D_SHADER_PARAMETER_NAME_RASTERIZER_SAMPLE_COUNT;
ps_shader_parameters[0].type = VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT;
ps_shader_parameters[0].data_type = VKD3D_SHADER_PARAMETER_DATA_TYPE_UINT32;
ps_shader_parameters[0].u.immediate_constant.u.u32 = sample_count;
ps_shader_parameters[0].immediate_constant.u32 = sample_count;
ps_compile_args.type = VKD3D_SHADER_STRUCTURE_TYPE_COMPILE_ARGUMENTS;
ps_compile_args.next = NULL;
@ -2638,7 +2638,7 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
fail:
for (i = 0; i < graphics->stage_count; ++i)
{
VK_CALL(vkDestroyShaderModule(device->vk_device, state->u.graphics.stages[i].module, NULL));
VK_CALL(vkDestroyShaderModule(device->vk_device, state->graphics.stages[i].module, NULL));
}
vkd3d_shader_free_shader_signature(&input_signature);
@ -2754,7 +2754,7 @@ static enum VkPrimitiveTopology vk_topology_from_d3d12_topology(D3D12_PRIMITIVE_
static VkPipeline d3d12_pipeline_state_find_compiled_pipeline(const struct d3d12_pipeline_state *state,
const struct vkd3d_pipeline_key *key, VkRenderPass *vk_render_pass)
{
const struct d3d12_graphics_pipeline_state *graphics = &state->u.graphics;
const struct d3d12_graphics_pipeline_state *graphics = &state->graphics;
struct d3d12_device *device = state->device;
VkPipeline vk_pipeline = VK_NULL_HANDLE;
struct vkd3d_compiled_pipeline *current;
@ -2786,7 +2786,7 @@ static VkPipeline d3d12_pipeline_state_find_compiled_pipeline(const struct d3d12
static bool d3d12_pipeline_state_put_pipeline_to_cache(struct d3d12_pipeline_state *state,
const struct vkd3d_pipeline_key *key, VkPipeline vk_pipeline, VkRenderPass vk_render_pass)
{
struct d3d12_graphics_pipeline_state *graphics = &state->u.graphics;
struct d3d12_graphics_pipeline_state *graphics = &state->graphics;
struct vkd3d_compiled_pipeline *compiled_pipeline, *current;
struct d3d12_device *device = state->device;
int rc;
@ -2827,7 +2827,7 @@ VkPipeline d3d12_pipeline_state_get_or_create_pipeline(struct d3d12_pipeline_sta
{
VkVertexInputBindingDescription bindings[D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
const struct vkd3d_vk_device_procs *vk_procs = &state->device->vk_procs;
struct d3d12_graphics_pipeline_state *graphics = &state->u.graphics;
struct d3d12_graphics_pipeline_state *graphics = &state->graphics;
VkPipelineVertexInputDivisorStateCreateInfoEXT input_divisor_info;
VkPipelineTessellationStateCreateInfo tessellation_info;
VkPipelineVertexInputStateCreateInfo input_desc;

View File

@ -950,15 +950,15 @@ static HRESULT vkd3d_private_store_set_private_data(struct vkd3d_private_store *
ptr = &data;
}
if (!(d = vkd3d_malloc(offsetof(struct vkd3d_private_data, u.data[data_size]))))
if (!(d = vkd3d_malloc(offsetof(struct vkd3d_private_data, data[data_size]))))
return E_OUTOFMEMORY;
d->tag = *tag;
d->size = data_size;
d->is_object = is_object;
memcpy(d->u.data, ptr, data_size);
memcpy(d->data, ptr, data_size);
if (is_object)
IUnknown_AddRef(d->u.object);
IUnknown_AddRef(d->object);
if ((old_data = vkd3d_private_store_get_private_data(store, tag)))
vkd3d_private_data_destroy(old_data);
@ -1003,8 +1003,8 @@ HRESULT vkd3d_get_private_data(struct vkd3d_private_store *store,
}
if (data->is_object)
IUnknown_AddRef(data->u.object);
memcpy(out, data->u.data, data->size);
IUnknown_AddRef(data->object);
memcpy(out, data->data, data->size);
done:
pthread_mutex_unlock(&store->mutex);

View File

@ -155,7 +155,7 @@ static const D3D12_ROOT_SIGNATURE_DESC * STDMETHODCALLTYPE d3d12_root_signature_
TRACE("iface %p.\n", iface);
assert(deserializer->desc.d3d12.Version == D3D_ROOT_SIGNATURE_VERSION_1_0);
return &deserializer->desc.d3d12.u.Desc_1_0;
return &deserializer->desc.d3d12.Desc_1_0;
}
static const struct ID3D12RootSignatureDeserializerVtbl d3d12_root_signature_deserializer_vtbl =
@ -449,7 +449,7 @@ HRESULT vkd3d_serialize_root_signature(const D3D12_ROOT_SIGNATURE_DESC *desc,
*error_blob = NULL;
vkd3d_desc.version = VKD3D_ROOT_SIGNATURE_VERSION_1_0;
vkd3d_desc.u.v_1_0 = *(const struct vkd3d_root_signature_desc *)desc;
vkd3d_desc.v_1_0 = *(const struct vkd3d_root_signature_desc *)desc;
if ((ret = vkd3d_shader_serialize_root_signature(&vkd3d_desc, &dxbc)) < 0)
{
WARN("Failed to serialize root signature, vkd3d result %d.\n", ret);

View File

@ -20,7 +20,6 @@
#define __VKD3D_PRIVATE_H
#define COBJMACROS
#define NONAMELESSUNION
#define VK_NO_PROTOTYPES
#include "vkd3d_common.h"
@ -309,13 +308,13 @@ struct vkd3d_private_data
{
BYTE data[1];
IUnknown *object;
} u;
};
};
static inline void vkd3d_private_data_destroy(struct vkd3d_private_data *data)
{
if (data->is_object)
IUnknown_Release(data->u.object);
IUnknown_Release(data->object);
list_remove(&data->entry);
vkd3d_free(data);
}
@ -438,7 +437,7 @@ struct d3d12_sparse_tile
{
struct d3d12_sparse_image_region image;
struct d3d12_sparse_buffer_region buffer;
} u;
};
VkDeviceMemory vk_memory;
VkDeviceSize vk_offset;
};
@ -470,7 +469,7 @@ struct d3d12_resource
{
VkBuffer vk_buffer;
VkImage vk_image;
} u;
};
unsigned int flags;
struct d3d12_heap *heap;
@ -542,7 +541,7 @@ struct vkd3d_view
VkBufferView vk_buffer_view;
VkImageView vk_image_view;
VkSampler vk_sampler;
} u;
};
VkBufferView vk_counter_view;
VkDeviceAddress vk_counter_address;
const struct vkd3d_format *format;
@ -596,7 +595,7 @@ struct d3d12_desc
{
VkDescriptorBufferInfo vk_cbv_info;
struct vkd3d_view *view;
} u;
} info;
};
static inline struct d3d12_desc *d3d12_desc_from_cpu_handle(D3D12_CPU_DESCRIPTOR_HANDLE cpu_handle)
@ -807,7 +806,7 @@ struct d3d12_root_parameter
struct d3d12_root_constant constant;
struct d3d12_root_descriptor descriptor;
struct d3d12_root_descriptor_table descriptor_table;
} u;
};
};
/* ID3D12RootSignature */
@ -938,7 +937,7 @@ struct d3d12_pipeline_state
{
struct d3d12_graphics_pipeline_state graphics;
struct d3d12_compute_pipeline_state compute;
} u;
};
VkPipelineBindPoint vk_bind_point;
struct d3d12_device *device;
@ -960,7 +959,7 @@ static inline bool d3d12_pipeline_state_has_unknown_dsv_format(struct d3d12_pipe
{
if (d3d12_pipeline_state_is_graphics(state))
{
struct d3d12_graphics_pipeline_state *graphics = &state->u.graphics;
struct d3d12_graphics_pipeline_state *graphics = &state->graphics;
return graphics->null_attachment_mask & dsv_attachment_mask(graphics);
}
@ -1311,7 +1310,7 @@ struct d3d12_command_queue_submission
struct d3d12_command_queue_submission_signal signal;
struct d3d12_command_queue_submission_execute execute;
struct d3d12_command_queue_submission_bind_sparse bind_sparse;
} u;
};
};
struct vkd3d_timeline_semaphore

View File

@ -9974,7 +9974,7 @@ static void test_shader_instructions(void)
struct uvec4 src0;
struct uvec4 src1;
struct uvec4 src2;
} u;
};
struct
{
struct ivec4 src0;