From 832865d5a83555798a3343e5829e406929ac7fd5 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Thu, 15 Feb 2024 11:01:11 +1100 Subject: [PATCH] Updated vkd3d to 628acb6b96eaae24861402dfa2be641c44ce2480. --- libs/vkd3d/libs/vkd3d-shader/dxil.c | 221 ++++++++++++++++-- libs/vkd3d/libs/vkd3d-shader/hlsl.y | 18 +- .../libs/vkd3d-shader/vkd3d_shader_main.c | 7 +- libs/vkd3d/libs/vkd3d/device.c | 85 ++++++- 4 files changed, 304 insertions(+), 27 deletions(-) diff --git a/libs/vkd3d/libs/vkd3d-shader/dxil.c b/libs/vkd3d/libs/vkd3d-shader/dxil.c index a001f6f0642..33d30aef08e 100644 --- a/libs/vkd3d/libs/vkd3d-shader/dxil.c +++ b/libs/vkd3d/libs/vkd3d-shader/dxil.c @@ -33,7 +33,7 @@ static const uint64_t ALLOCA_FLAG_IN_ALLOCA = 0x20; static const uint64_t ALLOCA_FLAG_EXPLICIT_TYPE = 0x40; static const uint64_t ALLOCA_ALIGNMENT_MASK = ALLOCA_FLAG_IN_ALLOCA - 1; static const unsigned int SHADER_DESCRIPTOR_TYPE_COUNT = 4; -static const size_t MAX_IR_INSTRUCTIONS_PER_DXIL_INSTRUCTION = 5; +static const size_t MAX_IR_INSTRUCTIONS_PER_DXIL_INSTRUCTION = 11; static const unsigned int dx_max_thread_group_size[3] = {1024, 1024, 64}; @@ -228,6 +228,13 @@ enum dxil_component_type COMPONENT_TYPE_PACKEDU8X32 = 18, }; +enum dxil_sampler_kind +{ + SAMPLER_KIND_DEFAULT = 0, + SAMPLER_KIND_COMPARISON = 1, + SAMPLER_KIND_MONO = 2, +}; + enum dxil_semantic_kind { SEMANTIC_KIND_ARBITRARY = 0, @@ -369,6 +376,8 @@ enum dx_intrinsic_opcode DX_UBFE = 52, DX_CREATE_HANDLE = 57, DX_CBUFFER_LOAD_LEGACY = 59, + DX_SAMPLE = 60, + DX_SAMPLE_GRAD = 63, DX_TEXTURE_LOAD = 66, DX_TEXTURE_STORE = 67, DX_BUFFER_LOAD = 68, @@ -2421,6 +2430,26 @@ static bool sm6_value_validate_is_texture_handle(const struct sm6_value *value, return true; } +static bool sm6_value_validate_is_sampler_handle(const struct sm6_value *value, enum dx_intrinsic_opcode op, + struct sm6_parser *sm6) +{ + enum dxil_resource_kind kind; + + if (!sm6_value_validate_is_handle(value, sm6)) + return false; + + kind = value->u.handle.d->kind; + if (kind != RESOURCE_KIND_SAMPLER) + { + WARN("Resource kind %u for op %u is not a sampler.\n", kind, op); + vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_INVALID_RESOURCE_HANDLE, + "Resource kind %u for sample operation %u is not a sampler.", kind, op); + return false; + } + + return true; +} + static bool sm6_value_validate_is_pointer(const struct sm6_value *value, struct sm6_parser *sm6) { if (!sm6_type_is_pointer(value->type)) @@ -3500,7 +3529,8 @@ static void sm6_parser_emit_binop(struct sm6_parser *sm6, const struct dxil_reco "Ignoring flags %#"PRIx64" for a binary operation.", flags); } - src_params = instruction_src_params_alloc(ins, 2, sm6); + if (!(src_params = instruction_src_params_alloc(ins, 2, sm6))) + return; src_param_init_from_value(&src_params[0], a); src_param_init_from_value(&src_params[1], b); if (code == BINOP_SUB) @@ -3654,11 +3684,10 @@ static bool sm6_parser_emit_composite_construct(struct sm6_parser *sm6, const st } static bool sm6_parser_emit_coordinate_construct(struct sm6_parser *sm6, const struct sm6_value **operands, - const struct sm6_value *z_operand, struct function_emission_state *state, + unsigned int max_operands, const struct sm6_value *z_operand, struct function_emission_state *state, struct vkd3d_shader_register *reg) { const struct vkd3d_shader_register *operand_regs[VKD3D_VEC4_SIZE]; - const unsigned int max_operands = 3; unsigned int component_count; for (component_count = 0; component_count < max_operands; ++component_count) @@ -3751,7 +3780,8 @@ static void sm6_parser_emit_dx_unary(struct sm6_parser *sm6, enum dx_intrinsic_o struct vkd3d_shader_src_param *src_param; vsir_instruction_init(ins, &sm6->p.location, map_dx_unary_op(op)); - src_param = instruction_src_params_alloc(ins, 1, sm6); + if (!(src_param = instruction_src_params_alloc(ins, 1, sm6))) + return; src_param_init_from_value(src_param, operands[0]); instruction_dst_param_init_ssa_scalar(ins, sm6); @@ -3785,7 +3815,8 @@ static void sm6_parser_emit_dx_binary(struct sm6_parser *sm6, enum dx_intrinsic_ struct vkd3d_shader_src_param *src_params; vsir_instruction_init(ins, &sm6->p.location, map_dx_binary_op(op, operands[0]->type)); - src_params = instruction_src_params_alloc(ins, 2, sm6); + if (!(src_params = instruction_src_params_alloc(ins, 2, sm6))) + return; src_param_init_from_value(&src_params[0], operands[0]); src_param_init_from_value(&src_params[1], operands[1]); @@ -3807,7 +3838,8 @@ static void sm6_parser_emit_dx_cbuffer_load(struct sm6_parser *sm6, enum dx_intr vsir_instruction_init(ins, &sm6->p.location, VKD3DSIH_MOV); - src_param = instruction_src_params_alloc(ins, 1, sm6); + if (!(src_param = instruction_src_params_alloc(ins, 1, sm6))) + return; src_param_init_vector_from_reg(src_param, &buffer->u.handle.reg); register_index_address_init(&src_param->reg.idx[2], operands[1], sm6); assert(src_param->reg.idx_count == 3); @@ -3903,7 +3935,8 @@ static void sm6_parser_emit_dx_tertiary(struct sm6_parser *sm6, enum dx_intrinsi unsigned int i; vsir_instruction_init(ins, &sm6->p.location, sm6_dx_map_tertiary_op(op)); - src_params = instruction_src_params_alloc(ins, 3, sm6); + if (!(src_params = instruction_src_params_alloc(ins, 3, sm6))) + return; for (i = 0; i < 3; ++i) src_param_init_from_value(&src_params[i], operands[i]); @@ -3934,7 +3967,8 @@ static void sm6_parser_emit_dx_load_input(struct sm6_parser *sm6, enum dx_intrin } e = &signature->elements[row_index]; - src_param = instruction_src_params_alloc(ins, 1, sm6); + if (!(src_param = instruction_src_params_alloc(ins, 1, sm6))) + return; src_param->reg = sm6->input_params[row_index].reg; src_param_init_scalar(src_param, column_index); if (e->register_count > 1) @@ -4013,7 +4047,8 @@ static void sm6_parser_emit_dx_buffer_load(struct sm6_parser *sm6, enum dx_intri instruction_init_with_resource(ins, (resource->u.handle.d->type == VKD3D_SHADER_DESCRIPTOR_TYPE_UAV) ? VKD3DSIH_LD_UAV_TYPED : VKD3DSIH_LD, resource, sm6); - src_params = instruction_src_params_alloc(ins, 2, sm6); + if (!(src_params = instruction_src_params_alloc(ins, 2, sm6))) + return; src_param_init_from_value(&src_params[0], operands[1]); if (!sm6_value_is_undef(operands[2])) { @@ -4040,6 +4075,71 @@ static void instruction_set_texel_offset(struct vkd3d_shader_instruction *ins, ins->texel_offset.w = sm6_value_get_texel_offset(operands[2]); } +static void sm6_parser_emit_dx_sample(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, + const struct sm6_value **operands, struct function_emission_state *state) +{ + struct vkd3d_shader_register coord, ddx, ddy; + const struct sm6_value *resource, *sampler; + struct vkd3d_shader_src_param *src_params; + struct vkd3d_shader_instruction *ins; + unsigned int clamp_idx; + + resource = operands[0]; + sampler = operands[1]; + if (!sm6_value_validate_is_texture_handle(resource, op, sm6) + || !sm6_value_validate_is_sampler_handle(sampler, op, sm6)) + { + return; + } + + if (!sm6_parser_emit_coordinate_construct(sm6, &operands[2], VKD3D_VEC4_SIZE, NULL, state, &coord)) + return; + + if (op == DX_SAMPLE_GRAD) + { + if (!sm6_parser_emit_coordinate_construct(sm6, &operands[9], 3, NULL, state, &ddx)) + return; + if (!sm6_parser_emit_coordinate_construct(sm6, &operands[12], 3, NULL, state, &ddy)) + return; + } + + ins = state->ins; + switch (op) + { + case DX_SAMPLE: + instruction_init_with_resource(ins, VKD3DSIH_SAMPLE, resource, sm6); + src_params = instruction_src_params_alloc(ins, 3, sm6); + clamp_idx = 9; + break; + case DX_SAMPLE_GRAD: + instruction_init_with_resource(ins, VKD3DSIH_SAMPLE_GRAD, resource, sm6); + src_params = instruction_src_params_alloc(ins, 5, sm6); + src_param_init_vector_from_reg(&src_params[3], &ddx); + src_param_init_vector_from_reg(&src_params[4], &ddy); + clamp_idx = 15; + break; + default: + vkd3d_unreachable(); + } + + if (!src_params) + return; + + if (!sm6_value_is_undef(operands[clamp_idx])) + { + FIXME("Ignoring LOD clamp value.\n"); + vkd3d_shader_parser_warning(&sm6->p, VKD3D_SHADER_WARNING_DXIL_IGNORING_OPERANDS, + "Ignoring LOD clamp value for a sample operation."); + } + + src_param_init_vector_from_reg(&src_params[0], &coord); + src_param_init_vector_from_reg(&src_params[1], &resource->u.handle.reg); + src_param_init_vector_from_reg(&src_params[2], &sampler->u.handle.reg); + instruction_set_texel_offset(ins, &operands[6], sm6); + + instruction_dst_param_init_ssa_vector(ins, VKD3D_VEC4_SIZE, sm6); +} + static void sm6_parser_emit_dx_sincos(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state) { @@ -4050,7 +4150,8 @@ static void sm6_parser_emit_dx_sincos(struct sm6_parser *sm6, enum dx_intrinsic_ unsigned int index; vsir_instruction_init(ins, &sm6->p.location, VKD3DSIH_SINCOS); - src_param = instruction_src_params_alloc(ins, 1, sm6); + if (!(src_param = instruction_src_params_alloc(ins, 1, sm6))) + return; src_param_init_from_value(src_param, operands[0]); index = op == DX_COS; @@ -4069,7 +4170,8 @@ static void sm6_parser_emit_dx_split_double(struct sm6_parser *sm6, enum dx_intr struct vkd3d_shader_src_param *src_param; vsir_instruction_init(ins, &sm6->p.location, VKD3DSIH_MOV); - src_param = instruction_src_params_alloc(ins, 1, sm6); + if (!(src_param = instruction_src_params_alloc(ins, 1, sm6))) + return; src_param_init_from_value(src_param, operands[0]); instruction_dst_param_init_ssa_vector(ins, 2, sm6); @@ -4150,7 +4252,7 @@ static void sm6_parser_emit_dx_texture_load(struct sm6_parser *sm6, enum dx_intr is_uav = resource->u.handle.d->type == VKD3D_SHADER_DESCRIPTOR_TYPE_UAV; mip_level_or_sample_count = (resource_type != VKD3D_SHADER_RESOURCE_BUFFER) ? operands[1] : NULL; - if (!sm6_parser_emit_coordinate_construct(sm6, &operands[2], + if (!sm6_parser_emit_coordinate_construct(sm6, &operands[2], 3, is_multisample ? NULL : mip_level_or_sample_count, state, &coord)) { return; @@ -4164,7 +4266,8 @@ static void sm6_parser_emit_dx_texture_load(struct sm6_parser *sm6, enum dx_intr for (i = 0; i < VKD3D_VEC4_SIZE; ++i) ins->resource_data_type[i] = resource->u.handle.d->resource_data_type; - src_params = instruction_src_params_alloc(ins, 2 + is_multisample, sm6); + if (!(src_params = instruction_src_params_alloc(ins, 2 + is_multisample, sm6))) + return; src_param_init_vector_from_reg(&src_params[0], &coord); src_param_init_vector_from_reg(&src_params[1], &resource->u.handle.reg); if (is_multisample) @@ -4187,7 +4290,7 @@ static void sm6_parser_emit_dx_texture_store(struct sm6_parser *sm6, enum dx_int if (!sm6_value_validate_is_texture_handle(resource, op, sm6)) return; - if (!sm6_parser_emit_coordinate_construct(sm6, &operands[1], NULL, state, &coord)) + if (!sm6_parser_emit_coordinate_construct(sm6, &operands[1], 3, NULL, state, &coord)) return; write_mask = sm6_value_get_constant_uint(operands[8]); @@ -4290,6 +4393,8 @@ static const struct sm6_dx_opcode_info sm6_dx_op_table[] = [DX_ROUND_PI ] = {"g", "R", sm6_parser_emit_dx_unary}, [DX_ROUND_Z ] = {"g", "R", sm6_parser_emit_dx_unary}, [DX_RSQRT ] = {"g", "R", sm6_parser_emit_dx_unary}, + [DX_SAMPLE ] = {"o", "HHffffiiif", sm6_parser_emit_dx_sample}, + [DX_SAMPLE_GRAD ] = {"o", "HHffffiiifffffff", sm6_parser_emit_dx_sample}, [DX_SIN ] = {"g", "R", sm6_parser_emit_dx_sincos}, [DX_SPLIT_DOUBLE ] = {"S", "d", sm6_parser_emit_dx_split_double}, [DX_SQRT ] = {"g", "R", sm6_parser_emit_dx_unary}, @@ -4661,7 +4766,8 @@ static void sm6_parser_emit_cast(struct sm6_parser *sm6, const struct dxil_recor return; } - src_param = instruction_src_params_alloc(ins, 1, sm6); + if (!(src_param = instruction_src_params_alloc(ins, 1, sm6))) + return; src_param_init_from_value(src_param, value); instruction_dst_param_init_ssa_scalar(ins, sm6); @@ -4797,7 +4903,8 @@ static void sm6_parser_emit_cmp2(struct sm6_parser *sm6, const struct dxil_recor "Ignoring flags %#"PRIx64" for a comparison operation.", flags); } - src_params = instruction_src_params_alloc(ins, 2, sm6); + if (!(src_params = instruction_src_params_alloc(ins, 2, sm6))) + return; src_param_init_from_value(&src_params[0 ^ cmp->src_swap], a); src_param_init_from_value(&src_params[1 ^ cmp->src_swap], b); @@ -4855,7 +4962,8 @@ static void sm6_parser_emit_extractval(struct sm6_parser *sm6, const struct dxil vsir_instruction_init(ins, &sm6->p.location, VKD3DSIH_MOV); - src_param = instruction_src_params_alloc(ins, 1, sm6); + if (!(src_param = instruction_src_params_alloc(ins, 1, sm6))) + return; src_param->reg = src->u.reg; src_param_init_scalar(src_param, elem_idx); @@ -5006,7 +5114,8 @@ static void sm6_parser_emit_load(struct sm6_parser *sm6, const struct dxil_recor vsir_instruction_init(ins, &sm6->p.location, VKD3DSIH_MOV); - src_param = instruction_src_params_alloc(ins, 1, sm6); + if (!(src_param = instruction_src_params_alloc(ins, 1, sm6))) + return; src_param_init_from_value(&src_param[0], ptr); src_param->reg.alignment = alignment; @@ -5165,7 +5274,8 @@ static void sm6_parser_emit_store(struct sm6_parser *sm6, const struct dxil_reco vsir_instruction_init(ins, &sm6->p.location, VKD3DSIH_MOV); - src_param = instruction_src_params_alloc(ins, 1, sm6); + if (!(src_param = instruction_src_params_alloc(ins, 1, sm6))) + return; src_param_init_from_value(&src_param[0], src); dst_param = instruction_dst_params_alloc(ins, 1, sm6); @@ -5285,7 +5395,8 @@ static void sm6_parser_emit_vselect(struct sm6_parser *sm6, const struct dxil_re vsir_instruction_init(ins, &sm6->p.location, VKD3DSIH_MOVC); - src_params = instruction_src_params_alloc(ins, 3, sm6); + if (!(src_params = instruction_src_params_alloc(ins, 3, sm6))) + return; for (i = 0; i < 3; ++i) src_param_init_from_value(&src_params[i], src[i]); @@ -6755,6 +6866,70 @@ static enum vkd3d_result sm6_parser_resources_load_cbv(struct sm6_parser *sm6, return VKD3D_OK; } +static enum vkd3d_result sm6_parser_resources_load_sampler(struct sm6_parser *sm6, + const struct sm6_metadata_node *node, struct sm6_descriptor_info *d, struct vkd3d_shader_instruction *ins) +{ + struct vkd3d_shader_register *reg; + unsigned int kind; + + if (node->operand_count < 7) + { + WARN("Invalid operand count %u.\n", node->operand_count); + vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_INVALID_OPERAND_COUNT, + "Invalid operand count %u for a sampler descriptor.", node->operand_count); + return VKD3D_ERROR_INVALID_SHADER; + } + if (node->operand_count > 7 && node->operands[7]) + { + WARN("Ignoring %u extra operands.\n", node->operand_count - 7); + vkd3d_shader_parser_warning(&sm6->p, VKD3D_SHADER_WARNING_DXIL_IGNORING_OPERANDS, + "Ignoring %u extra operands for a sampler descriptor.", node->operand_count - 7); + } + + vsir_instruction_init(ins, &sm6->p.location, VKD3DSIH_DCL_SAMPLER); + ins->resource_type = VKD3D_SHADER_RESOURCE_NONE; + + if (!sm6_metadata_get_uint_value(sm6, node->operands[6], &kind)) + { + WARN("Failed to load sampler mode.\n"); + vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_INVALID_RESOURCES, + "Sampler mode metadata value is not an integer."); + return VKD3D_ERROR_INVALID_SHADER; + } + switch (kind) + { + case SAMPLER_KIND_DEFAULT: + break; + case SAMPLER_KIND_COMPARISON: + ins->flags = VKD3DSI_SAMPLER_COMPARISON_MODE; + break; + default: + FIXME("Ignoring sampler kind %u.\n", kind); + vkd3d_shader_parser_warning(&sm6->p, VKD3D_SHADER_WARNING_DXIL_IGNORING_OPERANDS, + "Ignoring sampler kind %u.", kind); + break; + } + + ins->declaration.sampler.src.swizzle = VKD3D_SHADER_NO_SWIZZLE; + ins->declaration.sampler.src.modifiers = VKD3DSPSM_NONE; + + reg = &ins->declaration.sampler.src.reg; + vsir_register_init(reg, VKD3DSPR_SAMPLER, VKD3D_DATA_UNUSED, 3); + reg->idx[0].offset = d->id; + reg->idx[1].offset = d->range.first; + reg->idx[2].offset = d->range.last; + + ins->declaration.sampler.range = d->range; + + d->resource_type = ins->resource_type; + d->kind = RESOURCE_KIND_SAMPLER; + d->reg_type = VKD3DSPR_SAMPLER; + d->reg_data_type = VKD3D_DATA_UNUSED; + d->resource_data_type = VKD3D_DATA_UNUSED; + + return VKD3D_OK; +} + static enum vkd3d_result sm6_parser_descriptor_type_init(struct sm6_parser *sm6, enum vkd3d_shader_descriptor_type type, const struct sm6_metadata_node *descriptor_node) { @@ -6831,6 +7006,10 @@ static enum vkd3d_result sm6_parser_descriptor_type_init(struct sm6_parser *sm6, if ((ret = sm6_parser_resources_load_uav(sm6, node, d, ins)) < 0) return ret; break; + case VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER: + if ((ret = sm6_parser_resources_load_sampler(sm6, node, d, ins)) < 0) + return ret; + break; default: FIXME("Unsupported descriptor type %u.\n", type); vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_INVALID_RESOURCES, diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.y b/libs/vkd3d/libs/vkd3d-shader/hlsl.y index 8dc353e11c0..5f6334a4d19 100644 --- a/libs/vkd3d/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.y @@ -5572,11 +5572,11 @@ attribute: $$->name = $2; hlsl_block_init(&$$->instrs); hlsl_block_add_block(&$$->instrs, $4.instrs); - vkd3d_free($4.instrs); $$->loc = @$; $$->args_count = $4.args_count; for (i = 0; i < $4.args_count; ++i) hlsl_src_from_node(&$$->args[i], $4.args[i]); + free_parse_initializer(&$4); } attribute_list: @@ -5807,7 +5807,11 @@ func_prototype: } else { - free($1.attrs); + unsigned int i; + + for (i = 0; i < $1.count; ++i) + hlsl_free_attribute((void *)$1.attrs[i]); + vkd3d_free($1.attrs); } $$ = $2; } @@ -6992,8 +6996,10 @@ primary_expr: if (!(var = hlsl_get_var(ctx->cur_scope, $1))) { hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_NOT_DEFINED, "Variable \"%s\" is not defined.", $1); + vkd3d_free($1); YYABORT; } + vkd3d_free($1); if (!(load = hlsl_new_var_load(ctx, var, &@1))) YYABORT; if (!($$ = make_block(ctx, &load->node))) @@ -7067,12 +7073,17 @@ postfix_expr: if (!(field = get_struct_field(type->e.record.fields, type->e.record.field_count, $3))) { hlsl_error(ctx, &@3, VKD3D_SHADER_ERROR_HLSL_NOT_DEFINED, "Field \"%s\" is not defined.", $3); + vkd3d_free($3); YYABORT; } field_idx = field - type->e.record.fields; if (!add_record_access(ctx, $1, node, field_idx, &@2)) + { + vkd3d_free($3); YYABORT; + } + vkd3d_free($3); $$ = $1; } else if (hlsl_is_numeric_type(node->data_type)) @@ -7082,14 +7093,17 @@ postfix_expr: if (!(swizzle = get_swizzle(ctx, node, $3, &@3))) { hlsl_error(ctx, &@3, VKD3D_SHADER_ERROR_HLSL_INVALID_SYNTAX, "Invalid swizzle \"%s\".", $3); + vkd3d_free($3); YYABORT; } hlsl_block_add_instr($1, swizzle); + vkd3d_free($3); $$ = $1; } else { hlsl_error(ctx, &@3, VKD3D_SHADER_ERROR_HLSL_INVALID_SYNTAX, "Invalid subscript \"%s\".", $3); + vkd3d_free($3); YYABORT; } } diff --git a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c index d0fd6b047b1..1557fb3ea7f 100644 --- a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c +++ b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c @@ -2048,9 +2048,12 @@ void *shader_param_allocator_get(struct vkd3d_shader_param_allocator *allocator, if (count > allocator->count - allocator->index) { - struct vkd3d_shader_param_node *next = shader_param_allocator_node_create(allocator); + struct vkd3d_shader_param_node *next; - if (!next) + /* Monolithic switch has no definite parameter count limit. */ + allocator->count = max(allocator->count, count); + + if (!(next = shader_param_allocator_node_create(allocator))) return NULL; if (allocator->current) allocator->current->next = next; diff --git a/libs/vkd3d/libs/vkd3d/device.c b/libs/vkd3d/libs/vkd3d/device.c index 90272818b3d..f5a57ad31b7 100644 --- a/libs/vkd3d/libs/vkd3d/device.c +++ b/libs/vkd3d/libs/vkd3d/device.c @@ -3433,6 +3433,87 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CheckFeatureSupport(ID3D12Device7 return S_OK; } + case D3D12_FEATURE_D3D12_OPTIONS10: + { + D3D12_FEATURE_DATA_D3D12_OPTIONS10 *data = feature_data; + + if (feature_data_size != sizeof(*data)) + { + WARN("Invalid size %u.\n", feature_data_size); + return E_INVALIDARG; + } + + data->VariableRateShadingSumCombinerSupported = FALSE; + data->MeshShaderPerPrimitiveShadingRateSupported = FALSE; + + TRACE("Variable rate shading sum combiner %#x.\n", data->VariableRateShadingSumCombinerSupported); + TRACE("Mesh shader per primitive shading rate %#x.\n", data->MeshShaderPerPrimitiveShadingRateSupported); + return S_OK; + } + + case D3D12_FEATURE_D3D12_OPTIONS11: + { + D3D12_FEATURE_DATA_D3D12_OPTIONS11 *data = feature_data; + + if (feature_data_size != sizeof(*data)) + { + WARN("Invalid size %u.\n", feature_data_size); + return E_INVALIDARG; + } + + data->AtomicInt64OnDescriptorHeapResourceSupported = FALSE; + + TRACE("Atomic int64 on descriptor heap resource %#x.\n", data->AtomicInt64OnDescriptorHeapResourceSupported); + return S_OK; + } + + case D3D12_FEATURE_D3D12_OPTIONS12: + { + D3D12_FEATURE_DATA_D3D12_OPTIONS12 *data = feature_data; + + if (feature_data_size != sizeof(*data)) + { + WARN("Invalid size %u.\n", feature_data_size); + return E_INVALIDARG; + } + + data->MSPrimitivesPipelineStatisticIncludesCulledPrimitives = D3D12_TRI_STATE_UNKNOWN; + data->EnhancedBarriersSupported = FALSE; + data->RelaxedFormatCastingSupported = FALSE; + + TRACE("Mesh shader primitives pipeline stats include cull primitives %#x.\n", + data->MSPrimitivesPipelineStatisticIncludesCulledPrimitives); + TRACE("Enhanced barriers %#x.\n", data->EnhancedBarriersSupported); + TRACE("Relaxed format casting %#x.\n", data->RelaxedFormatCastingSupported); + return S_OK; + } + + case D3D12_FEATURE_D3D12_OPTIONS13: + { + D3D12_FEATURE_DATA_D3D12_OPTIONS13 *data = feature_data; + + if (feature_data_size != sizeof(*data)) + { + WARN("Invalid size %u.\n", feature_data_size); + return E_INVALIDARG; + } + + data->UnrestrictedBufferTextureCopyPitchSupported = FALSE; + data->UnrestrictedVertexElementAlignmentSupported = FALSE; + data->InvertedViewportHeightFlipsYSupported = FALSE; + data->InvertedViewportDepthFlipsZSupported = FALSE; + data->TextureCopyBetweenDimensionsSupported = FALSE; + data->AlphaBlendFactorSupported = FALSE; + + TRACE("Unrestricted buffer-texture copy pitch %#x.\n", data->UnrestrictedBufferTextureCopyPitchSupported); + TRACE("Unrestricted vertex element alignment %#x.\n", data->UnrestrictedVertexElementAlignmentSupported); + TRACE("Inverted viewport height flips Y %#x.\n", data->InvertedViewportHeightFlipsYSupported); + TRACE("Inverted viewport depth flips Z %#x.\n", data->InvertedViewportDepthFlipsZSupported); + TRACE("Texture copy between dimensions %#x.\n", data->TextureCopyBetweenDimensionsSupported); + TRACE("Alpha blend factor support %#x.\n", data->AlphaBlendFactorSupported); + return S_OK; + } + default: FIXME("Unhandled feature %#x.\n", feature); return E_NOTIMPL; @@ -3888,7 +3969,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateSharedHandle(ID3D12Device7 * struct d3d12_device *device = impl_from_ID3D12Device7(iface); FIXME("iface %p, object %p, attributes %p, access %#x, name %s, handle %p stub!\n", - iface, object, attributes, access, debugstr_w(name, device->wchar_size), handle); + iface, object, attributes, (uint32_t)access, debugstr_w(name, device->wchar_size), handle); return E_NOTIMPL; } @@ -3908,7 +3989,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_OpenSharedHandleByName(ID3D12Devic struct d3d12_device *device = impl_from_ID3D12Device7(iface); FIXME("iface %p, name %s, access %#x, handle %p stub!\n", - iface, debugstr_w(name, device->wchar_size), access, handle); + iface, debugstr_w(name, device->wchar_size), (uint32_t)access, handle); return E_NOTIMPL; } -- 2.43.0