You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-12-15 08:03:15 -08:00
Updated vkd3d-latest patchset
This commit is contained in:
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
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,330 @@
|
||||
From 9f47509c12b50d2d39f192dfc66b8a711ca70b27 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Wed, 15 Oct 2025 07:43:18 +1100
|
||||
Subject: [PATCH] Updated vkd3d to 40bdaa43af3414d25e43b477bf813b81827633b3.
|
||||
|
||||
---
|
||||
libs/vkd3d/Makefile.in | 4 +-
|
||||
libs/vkd3d/libs/vkd3d-shader/dxil.c | 9 ++---
|
||||
libs/vkd3d/libs/vkd3d-shader/glsl.c | 18 +++++++++
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl.y | 4 --
|
||||
libs/vkd3d/libs/vkd3d-shader/ir.c | 40 ++++++++++++++++++-
|
||||
libs/vkd3d/libs/vkd3d-shader/msl.c | 11 +++++
|
||||
libs/vkd3d/libs/vkd3d-shader/spirv.c | 16 ++++++++
|
||||
.../libs/vkd3d-shader/vkd3d_shader_private.h | 7 ++--
|
||||
libs/vkd3d/libs/vkd3d/state.c | 2 +-
|
||||
9 files changed, 95 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/libs/vkd3d/Makefile.in b/libs/vkd3d/Makefile.in
|
||||
index 9ad9ed850b6..868f4582380 100644
|
||||
--- a/libs/vkd3d/Makefile.in
|
||||
+++ b/libs/vkd3d/Makefile.in
|
||||
@@ -7,7 +7,6 @@ EXTRADEFS = \
|
||||
-DLIBVKD3D_UTILS_SOURCE
|
||||
|
||||
SOURCES = \
|
||||
- config.h \
|
||||
libs/vkd3d-common/blob.c \
|
||||
libs/vkd3d-common/debug.c \
|
||||
libs/vkd3d-common/error.c \
|
||||
@@ -40,4 +39,5 @@ SOURCES = \
|
||||
libs/vkd3d/resource.c \
|
||||
libs/vkd3d/state.c \
|
||||
libs/vkd3d/utils.c \
|
||||
- libs/vkd3d/vkd3d_main.c
|
||||
+ libs/vkd3d/vkd3d_main.c \
|
||||
+ config.h
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/dxil.c b/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
||||
index c7af58118df..7861efc16d2 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
||||
@@ -4674,13 +4674,13 @@ static void sm6_parser_emit_binop(struct sm6_parser *sm6, const struct dxil_reco
|
||||
case VSIR_OP_ISHL:
|
||||
silence_warning = !(flags & ~(OB_NO_UNSIGNED_WRAP | OB_NO_SIGNED_WRAP));
|
||||
break;
|
||||
+ case VSIR_OP_IDIV:
|
||||
+ case VSIR_OP_IREM:
|
||||
case VSIR_OP_ISHR:
|
||||
type_flags |= DXIL_TYPE_SIGNED;
|
||||
/* fall through */
|
||||
case VSIR_OP_USHR:
|
||||
- case VSIR_OP_IDIV:
|
||||
case VSIR_OP_UDIV_SIMPLE:
|
||||
- case VSIR_OP_IREM:
|
||||
case VSIR_OP_UREM:
|
||||
silence_warning = !(flags & ~PEB_EXACT);
|
||||
break;
|
||||
@@ -6252,13 +6252,12 @@ static void sm6_parser_emit_dx_saturate(struct sm6_parser *sm6, enum dx_intrinsi
|
||||
struct vkd3d_shader_instruction *ins = state->ins;
|
||||
struct vkd3d_shader_src_param *src_param;
|
||||
|
||||
- vsir_instruction_init(ins, &sm6->p.location, VSIR_OP_MOV);
|
||||
+ vsir_instruction_init(ins, &sm6->p.location, VSIR_OP_SATURATE);
|
||||
if (!(src_param = instruction_src_params_alloc(ins, 1, sm6)))
|
||||
return;
|
||||
src_param_init_from_value(src_param, operands[0], 0, sm6);
|
||||
|
||||
- if (instruction_dst_param_init_ssa_scalar(ins, 0, sm6))
|
||||
- ins->dst->modifiers = VKD3DSPDM_SATURATE;
|
||||
+ instruction_dst_param_init_ssa_scalar(ins, 0, sm6);
|
||||
}
|
||||
|
||||
static void sm6_parser_emit_dx_split_double(struct sm6_parser *sm6, enum dx_intrinsic_opcode op,
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/glsl.c b/libs/vkd3d/libs/vkd3d-shader/glsl.c
|
||||
index 88c87ae33ee..91a96a5547e 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/glsl.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/glsl.c
|
||||
@@ -605,6 +605,21 @@ static void shader_glsl_dot(struct vkd3d_glsl_generator *gen,
|
||||
glsl_dst_cleanup(&dst, &gen->string_buffers);
|
||||
}
|
||||
|
||||
+static void shader_glsl_saturate(struct vkd3d_glsl_generator *gen, const struct vkd3d_shader_instruction *ins)
|
||||
+{
|
||||
+ struct glsl_src src;
|
||||
+ struct glsl_dst dst;
|
||||
+ uint32_t mask;
|
||||
+
|
||||
+ mask = glsl_dst_init(&dst, gen, ins, &ins->dst[0]);
|
||||
+ glsl_src_init(&src, gen, &ins->src[0], mask);
|
||||
+
|
||||
+ shader_glsl_print_assignment(gen, &dst, "clamp(%s, 0.0, 1.0)", src.str->buffer);
|
||||
+
|
||||
+ glsl_src_cleanup(&src, &gen->string_buffers);
|
||||
+ glsl_dst_cleanup(&dst, &gen->string_buffers);
|
||||
+}
|
||||
+
|
||||
static void shader_glsl_intrinsic(struct vkd3d_glsl_generator *gen,
|
||||
const struct vkd3d_shader_instruction *ins, const char *op)
|
||||
{
|
||||
@@ -1654,6 +1669,9 @@ static void vkd3d_glsl_handle_instruction(struct vkd3d_glsl_generator *gen,
|
||||
case VSIR_OP_RSQ:
|
||||
shader_glsl_intrinsic(gen, ins, "inversesqrt");
|
||||
break;
|
||||
+ case VSIR_OP_SATURATE:
|
||||
+ shader_glsl_saturate(gen, ins);
|
||||
+ break;
|
||||
case VSIR_OP_SIN:
|
||||
shader_glsl_intrinsic(gen, ins, "sin");
|
||||
break;
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.y b/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
index 27afac71320..759dadf8a58 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
@@ -614,10 +614,6 @@ static struct hlsl_default_value evaluate_static_expression(struct hlsl_ctx *ctx
|
||||
if (!(ret.string = vkd3d_strdup(string->string)))
|
||||
return ret;
|
||||
}
|
||||
- else if (node->type == HLSL_IR_STRING_CONSTANT)
|
||||
- {
|
||||
- hlsl_fixme(ctx, &node->loc, "Evaluate string constants as static expressions.");
|
||||
- }
|
||||
else
|
||||
{
|
||||
hlsl_error(ctx, &node->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_SYNTAX,
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/ir.c b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
index 13ea8a433a6..c013c9e61bd 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
@@ -338,6 +338,7 @@ const char *vsir_opcode_get_name(enum vkd3d_shader_opcode op, const char *error)
|
||||
[VSIR_OP_SAMPLE_LOD ] = "sample_l",
|
||||
[VSIR_OP_SAMPLE_LOD_S ] = "sample_l_s",
|
||||
[VSIR_OP_SAMPLE_POS ] = "sample_pos",
|
||||
+ [VSIR_OP_SATURATE ] = "saturate",
|
||||
[VSIR_OP_SETP ] = "setp",
|
||||
[VSIR_OP_SGE ] = "sge",
|
||||
[VSIR_OP_SGN ] = "sgn",
|
||||
@@ -2235,6 +2236,39 @@ static enum vkd3d_result vsir_program_lower_modifiers(struct vsir_program *progr
|
||||
++program->ssa_count;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ for (i = 0; i < ins->dst_count; ++i)
|
||||
+ {
|
||||
+ struct vkd3d_shader_dst_param *dst = &ins->dst[i];
|
||||
+
|
||||
+ if (dst->modifiers & VKD3DSPDM_SATURATE)
|
||||
+ {
|
||||
+ if (!vsir_program_iterator_insert_after(&it, 1))
|
||||
+ return VKD3D_ERROR_OUT_OF_MEMORY;
|
||||
+ ins = vsir_program_iterator_current(&it);
|
||||
+ new_ins = vsir_program_iterator_next(&it);
|
||||
+
|
||||
+ if (!vsir_instruction_init_with_params(program, new_ins, &ins->location, VSIR_OP_SATURATE, 1, 1))
|
||||
+ {
|
||||
+ vkd3d_shader_instruction_make_nop(new_ins);
|
||||
+ return VKD3D_ERROR_OUT_OF_MEMORY;
|
||||
+ }
|
||||
+
|
||||
+ new_ins->dst[0] = *dst;
|
||||
+ new_ins->dst[0].modifiers &= ~VKD3DSPDM_NONE;
|
||||
+
|
||||
+ dst_param_init_ssa(dst, program->ssa_count, dst->reg.data_type, dst->reg.dimension);
|
||||
+ src_param_init_ssa(&new_ins->src[0], program->ssa_count, dst->reg.data_type, dst->reg.dimension);
|
||||
+
|
||||
+ if (data_type_is_64_bit(dst->reg.data_type))
|
||||
+ {
|
||||
+ dst->write_mask = vsir_write_mask_64_from_32(dst->write_mask);
|
||||
+ new_ins->src[0].swizzle = vsir_swizzle_64_from_32(new_ins->src[0].swizzle);
|
||||
+ }
|
||||
+
|
||||
+ ++program->ssa_count;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
return VKD3D_OK;
|
||||
@@ -8795,6 +8829,7 @@ static bool vsir_src_is_masked(enum vkd3d_shader_opcode opcode, unsigned int src
|
||||
case VSIR_OP_ROUND_PI:
|
||||
case VSIR_OP_ROUND_Z:
|
||||
case VSIR_OP_RSQ:
|
||||
+ case VSIR_OP_SATURATE:
|
||||
case VSIR_OP_SETP:
|
||||
case VSIR_OP_SGE:
|
||||
case VSIR_OP_SGN:
|
||||
@@ -12833,6 +12868,7 @@ static const struct vsir_validator_instruction_desc vsir_validator_instructions[
|
||||
[VSIR_OP_HS_JOIN_PHASE] = {0, 0, vsir_validate_hull_shader_phase},
|
||||
[VSIR_OP_HTAN] = {1, 1, vsir_validate_float_elementwise_operation},
|
||||
[VSIR_OP_IADD] = {1, 2, vsir_validate_integer_elementwise_operation},
|
||||
+ [VSIR_OP_IDIV] = {1, 2, vsir_validate_signed_integer_elementwise_operation},
|
||||
[VSIR_OP_IEQ] = {1, 2, vsir_validate_integer_comparison_operation},
|
||||
[VSIR_OP_IF] = {0, 1, vsir_validate_if},
|
||||
[VSIR_OP_IFC] = {0, 2, vsir_validate_ifc},
|
||||
@@ -12843,7 +12879,7 @@ static const struct vsir_validator_instruction_desc vsir_validator_instructions[
|
||||
[VSIR_OP_IMIN] = {1, 2, vsir_validate_signed_integer_elementwise_operation},
|
||||
[VSIR_OP_INE] = {1, 2, vsir_validate_integer_comparison_operation},
|
||||
[VSIR_OP_INEG] = {1, 1, vsir_validate_integer_elementwise_operation},
|
||||
- [VSIR_OP_IREM] = {1, 2, vsir_validate_integer_elementwise_operation},
|
||||
+ [VSIR_OP_IREM] = {1, 2, vsir_validate_signed_integer_elementwise_operation},
|
||||
[VSIR_OP_ISFINITE] = {1, 1, vsir_validate_float_comparison_operation},
|
||||
[VSIR_OP_ISHL] = {1, 2, vsir_validate_ishl},
|
||||
[VSIR_OP_ISHR] = {1, 2, vsir_validate_ishr},
|
||||
@@ -12875,6 +12911,7 @@ static const struct vsir_validator_instruction_desc vsir_validator_instructions[
|
||||
[VSIR_OP_ROUND_NE] = {1, 1, vsir_validate_float_elementwise_operation},
|
||||
[VSIR_OP_ROUND_NI] = {1, 1, vsir_validate_float_elementwise_operation},
|
||||
[VSIR_OP_SAMPLE_INFO] = {1, 1, vsir_validate_sample_info},
|
||||
+ [VSIR_OP_SATURATE] = {1, 1, vsir_validate_float_or_double_elementwise_operation},
|
||||
[VSIR_OP_SWITCH] = {0, 1, vsir_validate_switch},
|
||||
[VSIR_OP_SWITCH_MONOLITHIC] = {0, ~0u, vsir_validate_switch_monolithic},
|
||||
[VSIR_OP_USHR] = {1, 2, vsir_validate_ushr},
|
||||
@@ -13315,6 +13352,7 @@ static bool vsir_instruction_has_side_effects(const struct vkd3d_shader_instruct
|
||||
case VSIR_OP_SAMPLE_LOD:
|
||||
case VSIR_OP_SAMPLE_LOD_S:
|
||||
case VSIR_OP_SAMPLE_POS:
|
||||
+ case VSIR_OP_SATURATE:
|
||||
case VSIR_OP_SETP:
|
||||
case VSIR_OP_SGE:
|
||||
case VSIR_OP_SGN:
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/msl.c b/libs/vkd3d/libs/vkd3d-shader/msl.c
|
||||
index fc136e3ac98..f2d28acbe38 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/msl.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/msl.c
|
||||
@@ -1578,9 +1578,17 @@ static void msl_handle_instruction(struct msl_generator *gen, const struct vkd3d
|
||||
case VSIR_OP_HTAN:
|
||||
msl_intrinsic(gen, ins, "tanh");
|
||||
break;
|
||||
+ case VSIR_OP_IDIV:
|
||||
+ case VSIR_OP_UDIV_SIMPLE:
|
||||
+ msl_binop(gen, ins, "/");
|
||||
+ break;
|
||||
case VSIR_OP_IF:
|
||||
msl_if(gen, ins);
|
||||
break;
|
||||
+ case VSIR_OP_IREM:
|
||||
+ case VSIR_OP_UREM:
|
||||
+ msl_binop(gen, ins, "%");
|
||||
+ break;
|
||||
case VSIR_OP_ISHL:
|
||||
msl_binop(gen, ins, "<<");
|
||||
break;
|
||||
@@ -1663,6 +1671,9 @@ static void msl_handle_instruction(struct msl_generator *gen, const struct vkd3d
|
||||
case VSIR_OP_RSQ:
|
||||
msl_intrinsic(gen, ins, "rsqrt");
|
||||
break;
|
||||
+ case VSIR_OP_SATURATE:
|
||||
+ msl_intrinsic(gen, ins, "saturate");
|
||||
+ break;
|
||||
case VSIR_OP_SIN:
|
||||
msl_intrinsic(gen, ins, "sin");
|
||||
break;
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/spirv.c b/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
index 31271660e4f..8ff46759fb6 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
@@ -2524,6 +2524,7 @@ static uint32_t spirv_get_type_id(struct vkd3d_spirv_builder *builder,
|
||||
|
||||
case VSIR_DATA_I32:
|
||||
case VSIR_DATA_U32:
|
||||
+ case VSIR_DATA_MIXED:
|
||||
type_id = vkd3d_spirv_get_op_type_int(builder, 32, data_type == VSIR_DATA_I32);
|
||||
break;
|
||||
|
||||
@@ -7627,6 +7628,18 @@ static enum vkd3d_result spirv_compiler_emit_alu_instruction(struct spirv_compil
|
||||
return VKD3D_OK;
|
||||
}
|
||||
|
||||
+static void spirv_compiler_emit_saturate(struct spirv_compiler *compiler,
|
||||
+ const struct vkd3d_shader_instruction *instruction)
|
||||
+{
|
||||
+ const struct vkd3d_shader_dst_param *dst = instruction->dst;
|
||||
+ const struct vkd3d_shader_src_param *src = instruction->src;
|
||||
+ uint32_t val_id;
|
||||
+
|
||||
+ val_id = spirv_compiler_emit_load_src(compiler, src, dst->write_mask);
|
||||
+ val_id = spirv_compiler_emit_sat(compiler, &dst->reg, dst->write_mask, val_id);
|
||||
+ spirv_compiler_emit_store_dst(compiler, dst, val_id);
|
||||
+}
|
||||
+
|
||||
static void spirv_compiler_emit_isfinite(struct spirv_compiler *compiler,
|
||||
const struct vkd3d_shader_instruction *instruction)
|
||||
{
|
||||
@@ -10520,6 +10533,9 @@ static int spirv_compiler_handle_instruction(struct spirv_compiler *compiler,
|
||||
case VSIR_OP_ISFINITE:
|
||||
spirv_compiler_emit_isfinite(compiler, instruction);
|
||||
break;
|
||||
+ case VSIR_OP_SATURATE:
|
||||
+ spirv_compiler_emit_saturate(compiler, instruction);
|
||||
+ break;
|
||||
case VSIR_OP_ABS:
|
||||
case VSIR_OP_ACOS:
|
||||
case VSIR_OP_ASIN:
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
||||
index c70096f1f75..346c74ff698 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
||||
@@ -542,6 +542,7 @@ enum vkd3d_shader_opcode
|
||||
VSIR_OP_SAMPLE_LOD,
|
||||
VSIR_OP_SAMPLE_LOD_S,
|
||||
VSIR_OP_SAMPLE_POS,
|
||||
+ VSIR_OP_SATURATE,
|
||||
VSIR_OP_SETP,
|
||||
VSIR_OP_SGE,
|
||||
VSIR_OP_SGN,
|
||||
@@ -1502,9 +1503,9 @@ static inline bool vsir_program_iterator_insert_after(struct vsir_program_iterat
|
||||
}
|
||||
|
||||
/* When insertion takes place, argument `it' is updated to point to the same
|
||||
- * instruction as before the insertion, and the optional argument `ins_it' is
|
||||
- * initialized to point to the first inserted instruction.
|
||||
- * A pointer to the first inserted instruction is returned. */
|
||||
+ * instruction as before the insertion, and argument `ins_it' is initialized
|
||||
+ * to point to the first inserted instruction. A pointer to the first inserted
|
||||
+ * instruction is returned. */
|
||||
static inline struct vkd3d_shader_instruction *vsir_program_iterator_insert_before(
|
||||
struct vsir_program_iterator *it, struct vsir_program_iterator *ins_it, size_t count)
|
||||
{
|
||||
diff --git a/libs/vkd3d/libs/vkd3d/state.c b/libs/vkd3d/libs/vkd3d/state.c
|
||||
index b6055a50a99..4bd97fd599f 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d/state.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d/state.c
|
||||
@@ -843,7 +843,7 @@ static struct vk_binding_array *d3d12_root_signature_vk_binding_array_for_type(
|
||||
{
|
||||
if (!context->static_samplers_descriptor_set)
|
||||
{
|
||||
- if (!context->push_descriptor && context->root_descriptor_set)
|
||||
+ if (!root_signature->device->vk_info.KHR_push_descriptor && context->root_descriptor_set)
|
||||
context->static_samplers_descriptor_set = context->root_descriptor_set;
|
||||
else
|
||||
/* The descriptor type is irrelevant here, it will never be used. */
|
||||
--
|
||||
2.51.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
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user