mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
Updated vkd3d-latest patchset
Squashed patchset. Updated to vkd3d-1.11.
This commit is contained in:
parent
d999a6d250
commit
0b083c6f73
File diff suppressed because it is too large
Load Diff
@ -1,638 +0,0 @@
|
||||
From 18cc9a5fae9ba51354b6febe00f5a52587255d02 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
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
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,371 +0,0 @@
|
||||
From ee7b37e4b9c357e15f9f92fd7252e1a8c95a8e88 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Tue, 5 Mar 2024 13:33:16 +1100
|
||||
Subject: [PATCH] Updated vkd3d to 9177df883ecf1bc66b39e28d8f6bb616572a75fe.
|
||||
|
||||
---
|
||||
libs/vkd3d/include/private/vkd3d_common.h | 1 +
|
||||
libs/vkd3d/include/vkd3d.h | 2 +-
|
||||
libs/vkd3d/include/vkd3d_shader.h | 6 ++
|
||||
libs/vkd3d/libs/vkd3d-shader/dxil.c | 116 ++++++++++++++++++++--
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl.c | 2 +-
|
||||
libs/vkd3d/libs/vkd3d-shader/tpf.c | 41 ++++++++
|
||||
libs/vkd3d/libs/vkd3d/device.c | 8 --
|
||||
libs/vkd3d/libs/vkd3d/resource.c | 4 +-
|
||||
libs/vkd3d/libs/vkd3d/vkd3d_private.h | 8 ++
|
||||
9 files changed, 166 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/libs/vkd3d/include/private/vkd3d_common.h b/libs/vkd3d/include/private/vkd3d_common.h
|
||||
index b5a8240d28e..9606e93e8cf 100644
|
||||
--- a/libs/vkd3d/include/private/vkd3d_common.h
|
||||
+++ b/libs/vkd3d/include/private/vkd3d_common.h
|
||||
@@ -64,6 +64,7 @@
|
||||
#define TAG_RDEF VKD3D_MAKE_TAG('R', 'D', 'E', 'F')
|
||||
#define TAG_RTS0 VKD3D_MAKE_TAG('R', 'T', 'S', '0')
|
||||
#define TAG_SDBG VKD3D_MAKE_TAG('S', 'D', 'B', 'G')
|
||||
+#define TAG_SFI0 VKD3D_MAKE_TAG('S', 'F', 'I', '0')
|
||||
#define TAG_SHDR VKD3D_MAKE_TAG('S', 'H', 'D', 'R')
|
||||
#define TAG_SHEX VKD3D_MAKE_TAG('S', 'H', 'E', 'X')
|
||||
#define TAG_STAT VKD3D_MAKE_TAG('S', 'T', 'A', 'T')
|
||||
diff --git a/libs/vkd3d/include/vkd3d.h b/libs/vkd3d/include/vkd3d.h
|
||||
index df361f90177..8a8389f02a4 100644
|
||||
--- a/libs/vkd3d/include/vkd3d.h
|
||||
+++ b/libs/vkd3d/include/vkd3d.h
|
||||
@@ -182,7 +182,7 @@ struct vkd3d_image_resource_create_info
|
||||
const void *next;
|
||||
|
||||
VkImage vk_image;
|
||||
- D3D12_RESOURCE_DESC1 desc;
|
||||
+ D3D12_RESOURCE_DESC desc;
|
||||
unsigned int flags;
|
||||
D3D12_RESOURCE_STATES present_state;
|
||||
};
|
||||
diff --git a/libs/vkd3d/include/vkd3d_shader.h b/libs/vkd3d/include/vkd3d_shader.h
|
||||
index 2f4478a7983..6fa98f3d8fe 100644
|
||||
--- a/libs/vkd3d/include/vkd3d_shader.h
|
||||
+++ b/libs/vkd3d/include/vkd3d_shader.h
|
||||
@@ -199,7 +199,13 @@ enum vkd3d_shader_compile_option_fragment_coordinate_origin
|
||||
/** Advertises feature availability. \since 1.11 */
|
||||
enum vkd3d_shader_compile_option_feature_flags
|
||||
{
|
||||
+ /** The SPIR-V target environment supports 64-bit integer types. This
|
||||
+ * corresponds to the "shaderInt64" feature in the Vulkan API, and the
|
||||
+ * "GL_ARB_gpu_shader_int64" extension in the OpenGL API. */
|
||||
VKD3D_SHADER_COMPILE_OPTION_FEATURE_INT64 = 0x00000001,
|
||||
+ /** The SPIR-V target environment supports 64-bit floating-point types.
|
||||
+ * This corresponds to the "shaderFloat64" feature in the Vulkan API, and
|
||||
+ * the "GL_ARB_gpu_shader_fp64" extension in the OpenGL API. */
|
||||
VKD3D_SHADER_COMPILE_OPTION_FEATURE_FLOAT64 = 0x00000002,
|
||||
|
||||
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_FEATURE_FLAGS),
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/dxil.c b/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
||||
index ac688e85e52..26a8a5c1cc3 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
||||
@@ -388,6 +388,7 @@ enum dx_intrinsic_opcode
|
||||
DX_TEXTURE_STORE = 67,
|
||||
DX_BUFFER_LOAD = 68,
|
||||
DX_BUFFER_STORE = 69,
|
||||
+ DX_GET_DIMENSIONS = 72,
|
||||
DX_ATOMIC_BINOP = 78,
|
||||
DX_ATOMIC_CMP_XCHG = 79,
|
||||
DX_DERIV_COARSEX = 83,
|
||||
@@ -1937,6 +1938,16 @@ static const struct sm6_type *sm6_parser_get_type(struct sm6_parser *sm6, uint64
|
||||
return &sm6->types[type_id];
|
||||
}
|
||||
|
||||
+static bool resource_kind_is_texture(enum dxil_resource_kind kind)
|
||||
+{
|
||||
+ return kind >= RESOURCE_KIND_TEXTURE1D && kind <= RESOURCE_KIND_TEXTURECUBEARRAY;
|
||||
+}
|
||||
+
|
||||
+static bool resource_kind_is_multisampled(enum dxil_resource_kind kind)
|
||||
+{
|
||||
+ return kind == RESOURCE_KIND_TEXTURE2DMS || kind == RESOURCE_KIND_TEXTURE2DMSARRAY;
|
||||
+}
|
||||
+
|
||||
static int global_symbol_compare(const void *a, const void *b)
|
||||
{
|
||||
return vkd3d_u32_compare(((const struct sm6_symbol *)a)->id, ((const struct sm6_symbol *)b)->id);
|
||||
@@ -2346,6 +2357,23 @@ static void instruction_dst_param_init_ssa_vector(struct vkd3d_shader_instructio
|
||||
dst->u.reg = param->reg;
|
||||
}
|
||||
|
||||
+static bool instruction_dst_param_init_temp_vector(struct vkd3d_shader_instruction *ins, struct sm6_parser *sm6)
|
||||
+{
|
||||
+ struct sm6_value *dst = sm6_parser_get_current_value(sm6);
|
||||
+ struct vkd3d_shader_dst_param *param;
|
||||
+
|
||||
+ if (!(param = instruction_dst_params_alloc(ins, 1, sm6)))
|
||||
+ return false;
|
||||
+
|
||||
+ vsir_dst_param_init(param, VKD3DSPR_TEMP, vkd3d_data_type_from_sm6_type(sm6_type_get_scalar_type(dst->type, 0)), 1);
|
||||
+ param->write_mask = VKD3DSP_WRITEMASK_ALL;
|
||||
+ param->reg.idx[0].offset = 0;
|
||||
+ param->reg.dimension = VSIR_DIMENSION_VEC4;
|
||||
+ dst->u.reg = param->reg;
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
/* Recurse through the block tree while maintaining a current value count. The current
|
||||
* count is the sum of the global count plus all declarations within the current function.
|
||||
* Store into value_capacity the highest count seen. */
|
||||
@@ -4037,6 +4065,80 @@ static void sm6_parser_emit_dx_create_handle(struct sm6_parser *sm6, enum dx_int
|
||||
ins->handler_idx = VKD3DSIH_NOP;
|
||||
}
|
||||
|
||||
+static void sm6_parser_emit_dx_get_dimensions(struct sm6_parser *sm6, enum dx_intrinsic_opcode op,
|
||||
+ const struct sm6_value **operands, struct function_emission_state *state)
|
||||
+{
|
||||
+ struct vkd3d_shader_instruction *ins = state->ins;
|
||||
+ struct vkd3d_shader_src_param *src_params;
|
||||
+ unsigned int is_texture, component_count;
|
||||
+ enum dxil_resource_kind resource_kind;
|
||||
+ struct vkd3d_shader_dst_param *dst;
|
||||
+ const struct sm6_value *resource;
|
||||
+
|
||||
+ resource = operands[0];
|
||||
+ if (!sm6_value_validate_is_handle(resource, sm6))
|
||||
+ return;
|
||||
+ is_texture = resource->u.handle.d->resource_type != VKD3D_SHADER_RESOURCE_BUFFER;
|
||||
+ resource_kind = resource->u.handle.d->kind;
|
||||
+
|
||||
+ instruction_init_with_resource(ins, is_texture ? VKD3DSIH_RESINFO : VKD3DSIH_BUFINFO, resource, sm6);
|
||||
+
|
||||
+ if (!(src_params = instruction_src_params_alloc(ins, 1 + is_texture, sm6)))
|
||||
+ return;
|
||||
+ src_param_init_vector_from_reg(&src_params[is_texture], &resource->u.handle.reg);
|
||||
+
|
||||
+ if (is_texture)
|
||||
+ {
|
||||
+ ins->flags = VKD3DSI_RESINFO_UINT;
|
||||
+ src_param_init_from_value(&src_params[0], operands[1]);
|
||||
+ component_count = VKD3D_VEC4_SIZE;
|
||||
+
|
||||
+ if (resource_kind_is_multisampled(resource_kind))
|
||||
+ {
|
||||
+ instruction_dst_param_init_temp_vector(ins++, sm6);
|
||||
+ state->temp_idx = 1;
|
||||
+
|
||||
+ /* DXIL does not have an instrinsic for sample info, and resinfo is expected to return
|
||||
+ * the sample count in .w for MS textures. The result is always a struct of 4 x uint32. */
|
||||
+ vsir_instruction_init(ins, &sm6->p.location, VKD3DSIH_SAMPLE_INFO);
|
||||
+ ins->flags = VKD3DSI_SAMPLE_INFO_UINT;
|
||||
+
|
||||
+ if (!(src_params = instruction_src_params_alloc(ins, 1, sm6)))
|
||||
+ return;
|
||||
+ src_param_init_vector_from_reg(&src_params[0], &resource->u.handle.reg);
|
||||
+ src_params[0].swizzle = VKD3D_SHADER_SWIZZLE(X, X, X, X);
|
||||
+
|
||||
+ if (!instruction_dst_param_init_temp_vector(ins, sm6))
|
||||
+ return;
|
||||
+ dst = ins->dst;
|
||||
+ dst->write_mask = VKD3DSP_WRITEMASK_3;
|
||||
+
|
||||
+ /* Move the result to an SSA in case another instruction overwrites r0 before
|
||||
+ * the components are extracted for use. */
|
||||
+ ++ins;
|
||||
+ vsir_instruction_init(ins, &sm6->p.location, VKD3DSIH_MOV);
|
||||
+ if (!(src_params = instruction_src_params_alloc(ins, 1, sm6)))
|
||||
+ return;
|
||||
+ src_param_init_vector_from_reg(&src_params[0], &dst->reg);
|
||||
+
|
||||
+ state->ins = ins;
|
||||
+ state->code_block->instruction_count += 2;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (!operands[1]->is_undefined)
|
||||
+ {
|
||||
+ WARN("Ignoring unexpected operand.\n");
|
||||
+ vkd3d_shader_parser_warning(&sm6->p, VKD3D_SHADER_WARNING_DXIL_IGNORING_OPERANDS,
|
||||
+ "Ignoring an unexpected defined LOD value for buffer GetDimensions.");
|
||||
+ }
|
||||
+ component_count = 1 + (resource_kind == RESOURCE_KIND_STRUCTUREDBUFFER);
|
||||
+ }
|
||||
+
|
||||
+ instruction_dst_param_init_ssa_vector(ins, component_count, sm6);
|
||||
+}
|
||||
+
|
||||
static enum vkd3d_shader_opcode sm6_dx_map_tertiary_op(enum dx_intrinsic_opcode op)
|
||||
{
|
||||
switch (op)
|
||||
@@ -4626,6 +4728,7 @@ struct sm6_dx_opcode_info
|
||||
e -> half/float
|
||||
g -> half/float/double
|
||||
H -> handle
|
||||
+ D -> Dimensions
|
||||
S -> splitdouble
|
||||
v -> void
|
||||
o -> overloaded
|
||||
@@ -4656,6 +4759,7 @@ static const struct sm6_dx_opcode_info sm6_dx_op_table[] =
|
||||
[DX_FMAX ] = {"g", "RR", sm6_parser_emit_dx_binary},
|
||||
[DX_FMIN ] = {"g", "RR", sm6_parser_emit_dx_binary},
|
||||
[DX_FRC ] = {"g", "R", sm6_parser_emit_dx_unary},
|
||||
+ [DX_GET_DIMENSIONS ] = {"D", "Hi", sm6_parser_emit_dx_get_dimensions},
|
||||
[DX_IBFE ] = {"m", "iiR", sm6_parser_emit_dx_tertiary},
|
||||
[DX_HCOS ] = {"g", "R", sm6_parser_emit_dx_unary},
|
||||
[DX_HSIN ] = {"g", "R", sm6_parser_emit_dx_unary},
|
||||
@@ -4733,6 +4837,8 @@ static bool sm6_parser_validate_operand_type(struct sm6_parser *sm6, const struc
|
||||
return sm6_type_is_floating_point(type);
|
||||
case 'H':
|
||||
return (is_return || sm6_value_is_handle(value)) && type == sm6->handle_type;
|
||||
+ case 'D':
|
||||
+ return sm6_type_is_struct(type) && !strcmp(type->u.struc->name, "dx.types.Dimensions");
|
||||
case 'S':
|
||||
return sm6_type_is_struct(type) && !strcmp(type->u.struc->name, "dx.types.splitdouble");
|
||||
case 'v':
|
||||
@@ -6778,16 +6884,6 @@ static bool sm6_parser_resources_load_register_range(struct sm6_parser *sm6,
|
||||
return true;
|
||||
}
|
||||
|
||||
-static bool resource_kind_is_texture(enum dxil_resource_kind kind)
|
||||
-{
|
||||
- return kind >= RESOURCE_KIND_TEXTURE1D && kind <= RESOURCE_KIND_TEXTURECUBEARRAY;
|
||||
-}
|
||||
-
|
||||
-static bool resource_kind_is_multisampled(enum dxil_resource_kind kind)
|
||||
-{
|
||||
- return kind == RESOURCE_KIND_TEXTURE2DMS || kind == RESOURCE_KIND_TEXTURE2DMSARRAY;
|
||||
-}
|
||||
-
|
||||
static enum vkd3d_shader_resource_type shader_resource_type_from_dxil_resource_kind(enum dxil_resource_kind kind)
|
||||
{
|
||||
if (resource_kind_is_texture(kind))
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.c b/libs/vkd3d/libs/vkd3d-shader/hlsl.c
|
||||
index 0e75edd46f6..538f083df9c 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.c
|
||||
@@ -3017,7 +3017,7 @@ static void free_ir_resource_load(struct hlsl_ir_resource_load *load)
|
||||
|
||||
static void free_ir_resource_store(struct hlsl_ir_resource_store *store)
|
||||
{
|
||||
- hlsl_src_remove(&store->resource.rel_offset);
|
||||
+ hlsl_cleanup_deref(&store->resource);
|
||||
hlsl_src_remove(&store->coords);
|
||||
hlsl_src_remove(&store->value);
|
||||
vkd3d_free(store);
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/tpf.c b/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
||||
index c6cf1c9519c..3be4e40ab0c 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
||||
@@ -164,6 +164,21 @@ STATIC_ASSERT(SM4_MAX_SRC_COUNT <= SPIRV_MAX_SRC_COUNT);
|
||||
/* The shift that corresponds to the D3D_SIF_TEXTURE_COMPONENTS mask. */
|
||||
#define VKD3D_SM4_SIF_TEXTURE_COMPONENTS_SHIFT 2
|
||||
|
||||
+#define VKD3D_SM4_REQUIRES_DOUBLES 0x00000001
|
||||
+#define VKD3D_SM4_REQUIRES_EARLY_DEPTH_STENCIL 0x00000002
|
||||
+#define VKD3D_SM4_REQUIRES_UAVS_AT_EVERY_STAGE 0x00000004
|
||||
+#define VKD3D_SM4_REQUIRES_64_UAVS 0x00000008
|
||||
+#define VKD3D_SM4_REQUIRES_MINIMUM_PRECISION 0x00000010
|
||||
+#define VKD3D_SM4_REQUIRES_11_1_DOUBLE_EXTENSIONS 0x00000020
|
||||
+#define VKD3D_SM4_REQUIRES_11_1_SHADER_EXTENSIONS 0x00000040
|
||||
+#define VKD3D_SM4_REQUIRES_LEVEL_9_COMPARISON_FILTERING 0x00000080
|
||||
+#define VKD3D_SM4_REQUIRES_TILED_RESOURCES 0x00000100
|
||||
+#define VKD3D_SM4_REQUIRES_STENCIL_REF 0x00000200
|
||||
+#define VKD3D_SM4_REQUIRES_INNER_COVERAGE 0x00000400
|
||||
+#define VKD3D_SM4_REQUIRES_TYPED_UAV_LOAD_ADDITIONAL_FORMATS 0x00000800
|
||||
+#define VKD3D_SM4_REQUIRES_ROVS 0x00001000
|
||||
+#define VKD3D_SM4_REQUIRES_VIEWPORT_AND_RT_ARRAY_INDEX_FROM_ANY_SHADER_FEEDING_RASTERIZER 0x00002000
|
||||
+
|
||||
enum vkd3d_sm4_opcode
|
||||
{
|
||||
VKD3D_SM4_OP_ADD = 0x00,
|
||||
@@ -5896,6 +5911,31 @@ static void write_sm4_shdr(struct hlsl_ctx *ctx,
|
||||
sm4_free_extern_resources(extern_resources, extern_resources_count);
|
||||
}
|
||||
|
||||
+static void write_sm4_sfi0(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc)
|
||||
+{
|
||||
+ struct extern_resource *extern_resources;
|
||||
+ unsigned int extern_resources_count;
|
||||
+ uint64_t *flags;
|
||||
+
|
||||
+ flags = vkd3d_calloc(1, sizeof(*flags));
|
||||
+
|
||||
+ extern_resources = sm4_get_extern_resources(ctx, &extern_resources_count);
|
||||
+ for (unsigned int i = 0; i < extern_resources_count; ++i)
|
||||
+ {
|
||||
+ if (extern_resources[i].data_type->e.resource.rasteriser_ordered)
|
||||
+ *flags |= VKD3D_SM4_REQUIRES_ROVS;
|
||||
+ }
|
||||
+ sm4_free_extern_resources(extern_resources, extern_resources_count);
|
||||
+
|
||||
+ /* FIXME: We also emit code that should require UAVS_AT_EVERY_STAGE,
|
||||
+ * STENCIL_REF, and TYPED_UAV_LOAD_ADDITIONAL_FORMATS. */
|
||||
+
|
||||
+ if (flags)
|
||||
+ dxbc_writer_add_section(dxbc, TAG_SFI0, flags, sizeof(*flags));
|
||||
+ else
|
||||
+ vkd3d_free(flags);
|
||||
+}
|
||||
+
|
||||
int hlsl_sm4_write(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_func, struct vkd3d_shader_code *out)
|
||||
{
|
||||
struct dxbc_writer dxbc;
|
||||
@@ -5908,6 +5948,7 @@ int hlsl_sm4_write(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_fun
|
||||
write_sm4_signature(ctx, &dxbc, true);
|
||||
write_sm4_rdef(ctx, &dxbc);
|
||||
write_sm4_shdr(ctx, entry_func, &dxbc);
|
||||
+ write_sm4_sfi0(ctx, &dxbc);
|
||||
|
||||
if (!(ret = ctx->result))
|
||||
ret = dxbc_writer_write(&dxbc, out);
|
||||
diff --git a/libs/vkd3d/libs/vkd3d/device.c b/libs/vkd3d/libs/vkd3d/device.c
|
||||
index 0f45b68fc38..17c7ccb3e31 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d/device.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d/device.c
|
||||
@@ -3733,14 +3733,6 @@ static void STDMETHODCALLTYPE d3d12_device_CopyDescriptorsSimple(ID3D12Device7 *
|
||||
1, &src_descriptor_range_offset, &descriptor_count, descriptor_heap_type);
|
||||
}
|
||||
|
||||
-static void d3d12_resource_desc1_from_desc(D3D12_RESOURCE_DESC1 *desc1, const D3D12_RESOURCE_DESC *desc)
|
||||
-{
|
||||
- memcpy(desc1, desc, sizeof(*desc));
|
||||
- desc1->SamplerFeedbackMipRegion.Width = 0;
|
||||
- desc1->SamplerFeedbackMipRegion.Height = 0;
|
||||
- desc1->SamplerFeedbackMipRegion.Depth = 0;
|
||||
-}
|
||||
-
|
||||
static void d3d12_resource_allocation_info1_from_vkd3d(D3D12_RESOURCE_ALLOCATION_INFO1 *result,
|
||||
const struct vkd3d_resource_allocation_info *info)
|
||||
{
|
||||
diff --git a/libs/vkd3d/libs/vkd3d/resource.c b/libs/vkd3d/libs/vkd3d/resource.c
|
||||
index fc05fce14f3..89764d0901d 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d/resource.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d/resource.c
|
||||
@@ -2277,8 +2277,8 @@ HRESULT vkd3d_create_image_resource(ID3D12Device *device,
|
||||
object->ID3D12Resource2_iface.lpVtbl = &d3d12_resource_vtbl;
|
||||
object->refcount = 1;
|
||||
object->internal_refcount = 1;
|
||||
- object->desc = create_info->desc;
|
||||
- object->format = vkd3d_format_from_d3d12_resource_desc(d3d12_device, &create_info->desc, 0);
|
||||
+ d3d12_resource_desc1_from_desc(&object->desc, &create_info->desc);
|
||||
+ object->format = vkd3d_format_from_d3d12_resource_desc(d3d12_device, &object->desc, 0);
|
||||
object->u.vk_image = create_info->vk_image;
|
||||
object->flags = VKD3D_RESOURCE_EXTERNAL;
|
||||
object->flags |= create_info->flags & VKD3D_RESOURCE_PUBLIC_FLAGS;
|
||||
diff --git a/libs/vkd3d/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/libs/vkd3d/vkd3d_private.h
|
||||
index ed331ccbcc5..b092bb26ded 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d/vkd3d_private.h
|
||||
+++ b/libs/vkd3d/libs/vkd3d/vkd3d_private.h
|
||||
@@ -769,6 +769,14 @@ HRESULT d3d12_reserved_resource_create(struct d3d12_device *device,
|
||||
const D3D12_CLEAR_VALUE *optimized_clear_value, struct d3d12_resource **resource);
|
||||
struct d3d12_resource *unsafe_impl_from_ID3D12Resource(ID3D12Resource *iface);
|
||||
|
||||
+static inline void d3d12_resource_desc1_from_desc(D3D12_RESOURCE_DESC1 *desc1, const D3D12_RESOURCE_DESC *desc)
|
||||
+{
|
||||
+ memcpy(desc1, desc, sizeof(*desc));
|
||||
+ desc1->SamplerFeedbackMipRegion.Width = 0;
|
||||
+ desc1->SamplerFeedbackMipRegion.Height = 0;
|
||||
+ desc1->SamplerFeedbackMipRegion.Depth = 0;
|
||||
+}
|
||||
+
|
||||
HRESULT vkd3d_allocate_buffer_memory(struct d3d12_device *device, VkBuffer vk_buffer,
|
||||
const D3D12_HEAP_PROPERTIES *heap_properties, D3D12_HEAP_FLAGS heap_flags,
|
||||
VkDeviceMemory *vk_memory, uint32_t *vk_memory_type, VkDeviceSize *vk_memory_size);
|
||||
--
|
||||
2.43.0
|
||||
|
Loading…
Reference in New Issue
Block a user