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
Squash and rebase.
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
@@ -1,330 +0,0 @@
|
||||
From 5866455f54b6310fdc5e7e3c8f3503aa55118657 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
@@ -1,370 +0,0 @@
|
||||
From f6ccbf9518ca22514548ca078947750430f8ada7 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Sat, 18 Oct 2025 15:15:36 +1100
|
||||
Subject: [PATCH] Updated vkd3d to 86b8f2de3546603c67e1f2828a68b1cd0aa049df.
|
||||
|
||||
---
|
||||
libs/vkd3d/libs/vkd3d-shader/glsl.c | 31 ++------------------
|
||||
libs/vkd3d/libs/vkd3d-shader/ir.c | 44 ++++++++++++++++++++++++----
|
||||
libs/vkd3d/libs/vkd3d-shader/msl.c | 34 ++-------------------
|
||||
libs/vkd3d/libs/vkd3d-shader/spirv.c | 27 +++--------------
|
||||
4 files changed, 49 insertions(+), 87 deletions(-)
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/glsl.c b/libs/vkd3d/libs/vkd3d-shader/glsl.c
|
||||
index ab45c4d1e73..073282db129 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/glsl.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/glsl.c
|
||||
@@ -392,7 +392,7 @@ static void shader_glsl_print_src(struct vkd3d_string_buffer *buffer, struct vkd
|
||||
const struct vkd3d_shader_src_param *vsir_src, uint32_t mask, enum vsir_data_type data_type)
|
||||
{
|
||||
const struct vkd3d_shader_register *reg = &vsir_src->reg;
|
||||
- struct vkd3d_string_buffer *register_name, *str;
|
||||
+ struct vkd3d_string_buffer *register_name;
|
||||
enum vsir_data_type src_data_type;
|
||||
unsigned int size;
|
||||
|
||||
@@ -409,25 +409,11 @@ static void shader_glsl_print_src(struct vkd3d_string_buffer *buffer, struct vkd
|
||||
|
||||
shader_glsl_print_register_name(register_name, gen, reg);
|
||||
|
||||
- if (!vsir_src->modifiers)
|
||||
- str = buffer;
|
||||
- else
|
||||
- str = vkd3d_string_buffer_get(&gen->string_buffers);
|
||||
-
|
||||
size = reg->dimension == VSIR_DIMENSION_VEC4 ? 4 : 1;
|
||||
- shader_glsl_print_bitcast(str, gen, register_name->buffer, data_type, src_data_type, size);
|
||||
+ shader_glsl_print_bitcast(buffer, gen, register_name->buffer, data_type, src_data_type, size);
|
||||
if (reg->dimension == VSIR_DIMENSION_VEC4)
|
||||
- shader_glsl_print_swizzle(str, vsir_src->swizzle, mask);
|
||||
+ shader_glsl_print_swizzle(buffer, vsir_src->swizzle, mask);
|
||||
|
||||
- if (vsir_src->modifiers)
|
||||
- {
|
||||
- vkd3d_string_buffer_printf(buffer, "<unhandled modifier %#x>(%s)", vsir_src->modifiers, str->buffer);
|
||||
- vkd3d_glsl_compiler_error(gen, VKD3D_SHADER_ERROR_GLSL_INTERNAL,
|
||||
- "Internal compiler error: Unhandled source modifier(s) %#x.", vsir_src->modifiers);
|
||||
- }
|
||||
-
|
||||
- if (str != buffer)
|
||||
- vkd3d_string_buffer_release(&gen->string_buffers, str);
|
||||
vkd3d_string_buffer_release(&gen->string_buffers, register_name);
|
||||
}
|
||||
|
||||
@@ -489,23 +475,14 @@ static void VKD3D_PRINTF_FUNC(4, 0) shader_glsl_vprint_assignment(struct vkd3d_g
|
||||
struct glsl_dst *dst, enum vsir_data_type data_type, const char *format, va_list args)
|
||||
{
|
||||
struct vkd3d_string_buffer *buffer = gen->buffer;
|
||||
- uint32_t modifiers = dst->vsir->modifiers;
|
||||
bool close = true;
|
||||
|
||||
- /* It is always legitimate to ignore _pp. */
|
||||
- modifiers &= ~VKD3DSPDM_PARTIALPRECISION;
|
||||
-
|
||||
if (dst->vsir->shift)
|
||||
vkd3d_glsl_compiler_error(gen, VKD3D_SHADER_ERROR_GLSL_INTERNAL,
|
||||
"Internal compiler error: Unhandled destination shift %#x.", dst->vsir->shift);
|
||||
- if (modifiers & ~VKD3DSPDM_SATURATE)
|
||||
- vkd3d_glsl_compiler_error(gen, VKD3D_SHADER_ERROR_GLSL_INTERNAL,
|
||||
- "Internal compiler error: Unhandled destination modifier(s) %#x.", modifiers);
|
||||
|
||||
shader_glsl_print_indent(buffer, gen->indent);
|
||||
vkd3d_string_buffer_printf(buffer, "%s%s = ", dst->register_name->buffer, dst->mask->buffer);
|
||||
- if (modifiers & VKD3DSPDM_SATURATE)
|
||||
- vkd3d_string_buffer_printf(buffer, "clamp(");
|
||||
|
||||
switch (data_type)
|
||||
{
|
||||
@@ -530,8 +507,6 @@ static void VKD3D_PRINTF_FUNC(4, 0) shader_glsl_vprint_assignment(struct vkd3d_g
|
||||
|
||||
if (close)
|
||||
vkd3d_string_buffer_printf(buffer, ")");
|
||||
- if (modifiers & VKD3DSPDM_SATURATE)
|
||||
- vkd3d_string_buffer_printf(buffer, ", 0.0, 1.0)");
|
||||
vkd3d_string_buffer_printf(buffer, ";\n");
|
||||
}
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/ir.c b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
index 82901c6fb34..000c78aeed3 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
@@ -2173,6 +2173,7 @@ static enum vkd3d_result vsir_program_lower_modifiers(struct vsir_program *progr
|
||||
{
|
||||
struct vsir_program_iterator it = vsir_program_iterator(&program->instructions), new_it;
|
||||
struct vkd3d_shader_instruction *ins, *new_ins;
|
||||
+ enum vkd3d_result ret = VKD3D_OK;
|
||||
unsigned int i, j;
|
||||
|
||||
for (ins = vsir_program_iterator_head(&it); ins; ins = vsir_program_iterator_next(&it))
|
||||
@@ -2182,9 +2183,11 @@ static enum vkd3d_result vsir_program_lower_modifiers(struct vsir_program *progr
|
||||
enum vkd3d_shader_opcode new_opcodes[2] = {VSIR_OP_NOP, VSIR_OP_NOP};
|
||||
struct vkd3d_shader_src_param *src = &ins->src[i];
|
||||
|
||||
- /* TODO: support other modifiers, including destination modifiers. */
|
||||
switch (src->modifiers)
|
||||
{
|
||||
+ case VKD3DSPSM_NONE:
|
||||
+ continue;
|
||||
+
|
||||
case VKD3DSPSM_ABS:
|
||||
new_opcodes[0] = VSIR_OP_ABS;
|
||||
break;
|
||||
@@ -2199,6 +2202,9 @@ static enum vkd3d_result vsir_program_lower_modifiers(struct vsir_program *progr
|
||||
break;
|
||||
|
||||
default:
|
||||
+ vkd3d_shader_error(ctx->message_context, &ins->location, VKD3D_SHADER_ERROR_VSIR_NOT_IMPLEMENTED,
|
||||
+ "Aborting due to unimplemented feature: Source modifier %#x.", src->modifiers);
|
||||
+ ret = VKD3D_ERROR_NOT_IMPLEMENTED;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2234,12 +2240,23 @@ static enum vkd3d_result vsir_program_lower_modifiers(struct vsir_program *progr
|
||||
{
|
||||
struct vkd3d_shader_dst_param *dst = &ins->dst[i];
|
||||
|
||||
+ /* It is always legitimate to ignore _pp. */
|
||||
+ dst->modifiers &= ~VKD3DSPDM_PARTIALPRECISION;
|
||||
+
|
||||
+ if (dst->modifiers & ~VKD3DSPDM_SATURATE)
|
||||
+ {
|
||||
+ vkd3d_shader_error(ctx->message_context, &ins->location, VKD3D_SHADER_ERROR_VSIR_NOT_IMPLEMENTED,
|
||||
+ "Aborting due to unimplemented feature: Destination modifier %#x.", dst->modifiers);
|
||||
+ ret = VKD3D_ERROR_NOT_IMPLEMENTED;
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
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);
|
||||
+ ins = vsir_program_iterator_prev(&it);
|
||||
|
||||
if (!vsir_instruction_init_with_params(program, new_ins, &ins->location, VSIR_OP_SATURATE, 1, 1))
|
||||
{
|
||||
@@ -2248,7 +2265,7 @@ static enum vkd3d_result vsir_program_lower_modifiers(struct vsir_program *progr
|
||||
}
|
||||
|
||||
new_ins->dst[0] = *dst;
|
||||
- new_ins->dst[0].modifiers &= ~VKD3DSPDM_NONE;
|
||||
+ new_ins->dst[0].modifiers &= ~VKD3DSPDM_SATURATE;
|
||||
|
||||
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);
|
||||
@@ -2264,7 +2281,7 @@ static enum vkd3d_result vsir_program_lower_modifiers(struct vsir_program *progr
|
||||
}
|
||||
}
|
||||
|
||||
- return VKD3D_OK;
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
static enum vkd3d_result vsir_program_lower_instructions(struct vsir_program *program,
|
||||
@@ -5064,6 +5081,7 @@ static enum vkd3d_result vsir_program_materialise_phi_ssas_to_temps_in_function(
|
||||
for (ins = vsir_program_iterator_current(it); ins; ins = vsir_program_iterator_next(it))
|
||||
{
|
||||
struct vkd3d_shader_instruction *mov_ins;
|
||||
+ struct vkd3d_shader_location loc;
|
||||
bool finish = false;
|
||||
size_t j;
|
||||
|
||||
@@ -5083,6 +5101,7 @@ static enum vkd3d_result vsir_program_materialise_phi_ssas_to_temps_in_function(
|
||||
case VSIR_OP_SWITCH_MONOLITHIC:
|
||||
info = &block_info[current_label - 1];
|
||||
|
||||
+ loc = ins->location;
|
||||
if (!(mov_ins = vsir_program_iterator_insert_before_and_move(it, info->incoming_count)))
|
||||
goto fail;
|
||||
VKD3D_ASSERT(mov_ins);
|
||||
@@ -5091,7 +5110,7 @@ static enum vkd3d_result vsir_program_materialise_phi_ssas_to_temps_in_function(
|
||||
{
|
||||
struct phi_incoming_to_temp *incoming = &info->incomings[j];
|
||||
|
||||
- if (!vsir_instruction_init_with_params(program, mov_ins, &ins->location, VSIR_OP_MOV, 1, 0))
|
||||
+ if (!vsir_instruction_init_with_params(program, mov_ins, &loc, VSIR_OP_MOV, 1, 0))
|
||||
{
|
||||
vkd3d_shader_instruction_make_nop(mov_ins);
|
||||
goto fail;
|
||||
@@ -9311,6 +9330,7 @@ struct temp_allocator
|
||||
enum vkd3d_shader_register_type type;
|
||||
unsigned int idx;
|
||||
bool force_first;
|
||||
+ bool fixed_mask;
|
||||
} *ssa_regs, *temp_regs;
|
||||
size_t ssa_count, temp_count;
|
||||
unsigned int new_temp_count;
|
||||
@@ -9339,6 +9359,9 @@ static void temp_allocator_set_src(struct temp_allocator *allocator, struct vkd3
|
||||
src->reg.type = VKD3DSPR_TEMP;
|
||||
src->reg.dimension = VSIR_DIMENSION_VEC4;
|
||||
src->reg.idx[0].offset = reg->temp_id;
|
||||
+
|
||||
+ if (reg->fixed_mask)
|
||||
+ return;
|
||||
src->swizzle = vsir_combine_swizzles(vsir_swizzle_from_writemask(reg->allocated_mask), src->swizzle);
|
||||
}
|
||||
|
||||
@@ -9430,7 +9453,16 @@ static void temp_allocator_set_dst(struct temp_allocator *allocator,
|
||||
dst->reg.type = VKD3DSPR_TEMP;
|
||||
dst->reg.dimension = VSIR_DIMENSION_VEC4;
|
||||
dst->reg.idx[0].offset = reg->temp_id;
|
||||
+
|
||||
+ if (reg->fixed_mask)
|
||||
+ {
|
||||
+ VKD3D_ASSERT((reg->allocated_mask & dst->write_mask) == dst->write_mask);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
remapped_mask = vsir_combine_write_masks(reg->allocated_mask, dst->write_mask);
|
||||
+ VKD3D_ASSERT(vkd3d_popcount(remapped_mask) == vkd3d_popcount(dst->write_mask));
|
||||
+
|
||||
if (dst->write_mask != remapped_mask)
|
||||
{
|
||||
dst->write_mask = remapped_mask;
|
||||
@@ -9508,6 +9540,7 @@ static void temp_allocator_open_register(struct temp_allocator *allocator, struc
|
||||
{
|
||||
reg->temp_id = i;
|
||||
reg->allocated_mask = liveness_reg->mask;
|
||||
+ reg->fixed_mask = true;
|
||||
current_allocation[i] |= reg->allocated_mask;
|
||||
allocator->new_temp_count = max(allocator->new_temp_count, i + 1);
|
||||
TRACE("Allocated r%u%s for %s (liveness %u-%u).\n",
|
||||
@@ -9534,6 +9567,7 @@ static void temp_allocator_open_register(struct temp_allocator *allocator, struc
|
||||
|
||||
reg->temp_id = i;
|
||||
reg->allocated_mask = vsir_combine_write_masks(available_mask, mask);
|
||||
+ reg->fixed_mask = false;
|
||||
current_allocation[i] |= reg->allocated_mask;
|
||||
allocator->new_temp_count = max(allocator->new_temp_count, i + 1);
|
||||
TRACE("Allocated r%u%s for %s (liveness %u-%u).\n",
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/msl.c b/libs/vkd3d/libs/vkd3d-shader/msl.c
|
||||
index f2d28acbe38..3e7bf831e48 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/msl.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/msl.c
|
||||
@@ -583,7 +583,7 @@ static void msl_print_src_with_type(struct vkd3d_string_buffer *buffer, struct m
|
||||
const struct vkd3d_shader_src_param *vsir_src, uint32_t mask, enum vsir_data_type data_type)
|
||||
{
|
||||
const struct vkd3d_shader_register *reg = &vsir_src->reg;
|
||||
- struct vkd3d_string_buffer *register_name, *str;
|
||||
+ struct vkd3d_string_buffer *register_name;
|
||||
enum msl_data_type src_data_type;
|
||||
|
||||
register_name = vkd3d_string_buffer_get(&gen->string_buffers);
|
||||
@@ -592,25 +592,10 @@ static void msl_print_src_with_type(struct vkd3d_string_buffer *buffer, struct m
|
||||
msl_compiler_error(gen, VKD3D_SHADER_ERROR_MSL_INTERNAL,
|
||||
"Internal compiler error: Unhandled 'non-uniform' modifier.");
|
||||
|
||||
- if (!vsir_src->modifiers)
|
||||
- str = buffer;
|
||||
- else
|
||||
- str = vkd3d_string_buffer_get(&gen->string_buffers);
|
||||
-
|
||||
src_data_type = msl_print_register_name(register_name, gen, reg);
|
||||
- msl_print_bitcast(str, gen, register_name->buffer, data_type, src_data_type, reg->dimension);
|
||||
+ msl_print_bitcast(buffer, gen, register_name->buffer, data_type, src_data_type, reg->dimension);
|
||||
if (reg->dimension == VSIR_DIMENSION_VEC4)
|
||||
- msl_print_swizzle(str, vsir_src->swizzle, mask);
|
||||
-
|
||||
- if (vsir_src->modifiers)
|
||||
- {
|
||||
- vkd3d_string_buffer_printf(buffer, "<unhandled modifier %#x>(%s)", vsir_src->modifiers, str->buffer);
|
||||
- msl_compiler_error(gen, VKD3D_SHADER_ERROR_MSL_INTERNAL,
|
||||
- "Internal compiler error: Unhandled source modifier(s) %#x.", vsir_src->modifiers);
|
||||
- }
|
||||
-
|
||||
- if (str != buffer)
|
||||
- vkd3d_string_buffer_release(&gen->string_buffers, str);
|
||||
+ msl_print_swizzle(buffer, vsir_src->swizzle, mask);
|
||||
}
|
||||
|
||||
static void msl_src_init(struct msl_src *msl_src, struct msl_generator *gen,
|
||||
@@ -674,32 +659,19 @@ static void msl_print_subscript(struct vkd3d_string_buffer *buffer, struct msl_g
|
||||
static void VKD3D_PRINTF_FUNC(3, 4) msl_print_assignment(
|
||||
struct msl_generator *gen, struct msl_dst *dst, const char *format, ...)
|
||||
{
|
||||
- uint32_t modifiers = dst->vsir->modifiers;
|
||||
va_list args;
|
||||
|
||||
- /* It is always legitimate to ignore _pp. */
|
||||
- modifiers &= ~VKD3DSPDM_PARTIALPRECISION;
|
||||
-
|
||||
if (dst->vsir->shift)
|
||||
msl_compiler_error(gen, VKD3D_SHADER_ERROR_MSL_INTERNAL,
|
||||
"Internal compiler error: Unhandled destination shift %#x.", dst->vsir->shift);
|
||||
- if (modifiers & ~VKD3DSPDM_SATURATE)
|
||||
- msl_compiler_error(gen, VKD3D_SHADER_ERROR_MSL_INTERNAL,
|
||||
- "Internal compiler error: Unhandled destination modifier(s) %#x.", modifiers);
|
||||
|
||||
msl_print_indent(gen->buffer, gen->indent);
|
||||
vkd3d_string_buffer_printf(gen->buffer, "%s%s = ", dst->register_name->buffer, dst->mask->buffer);
|
||||
|
||||
- if (modifiers & VKD3DSPDM_SATURATE)
|
||||
- vkd3d_string_buffer_printf(gen->buffer, "saturate(");
|
||||
-
|
||||
va_start(args, format);
|
||||
vkd3d_string_buffer_vprintf(gen->buffer, format, args);
|
||||
va_end(args);
|
||||
|
||||
- if (modifiers & VKD3DSPDM_SATURATE)
|
||||
- vkd3d_string_buffer_printf(gen->buffer, ")");
|
||||
-
|
||||
vkd3d_string_buffer_printf(gen->buffer, ";\n");
|
||||
}
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/spirv.c b/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
index a1572f69438..0f5df228121 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
@@ -4823,10 +4823,6 @@ static void spirv_compiler_emit_execution_mode1(struct spirv_compiler *compiler,
|
||||
static uint32_t spirv_compiler_emit_load_src(struct spirv_compiler *compiler,
|
||||
const struct vkd3d_shader_src_param *src, uint32_t write_mask)
|
||||
{
|
||||
- if (src->modifiers)
|
||||
- spirv_compiler_error(compiler, VKD3D_SHADER_ERROR_SPV_NOT_IMPLEMENTED,
|
||||
- "Unhandled source modifier(s) %#x.", src->modifiers);
|
||||
-
|
||||
return spirv_compiler_emit_load_reg(compiler, &src->reg, src->swizzle, write_mask);
|
||||
}
|
||||
|
||||
@@ -4981,25 +4977,6 @@ static uint32_t spirv_compiler_emit_sat(struct spirv_compiler *compiler,
|
||||
static void spirv_compiler_emit_store_dst(struct spirv_compiler *compiler,
|
||||
const struct vkd3d_shader_dst_param *dst, uint32_t val_id)
|
||||
{
|
||||
- uint32_t modifiers = dst->modifiers;
|
||||
-
|
||||
- /* It is always legitimate to ignore _pp. */
|
||||
- modifiers &= ~VKD3DSPDM_PARTIALPRECISION;
|
||||
-
|
||||
- if (modifiers & VKD3DSPDM_SATURATE)
|
||||
- {
|
||||
- val_id = spirv_compiler_emit_sat(compiler, &dst->reg, dst->write_mask, val_id);
|
||||
- modifiers &= ~VKD3DSPDM_SATURATE;
|
||||
- }
|
||||
-
|
||||
- if (dst->modifiers & VKD3DSPDM_MSAMPCENTROID)
|
||||
- {
|
||||
- FIXME("Ignoring _centroid modifier.\n");
|
||||
- modifiers &= ~VKD3DSPDM_MSAMPCENTROID;
|
||||
- }
|
||||
-
|
||||
- VKD3D_ASSERT(!modifiers);
|
||||
-
|
||||
spirv_compiler_emit_store_reg(compiler, &dst->reg, dst->write_mask, val_id);
|
||||
}
|
||||
|
||||
@@ -11052,7 +11029,11 @@ static int spirv_compiler_generate_spirv(struct spirv_compiler *compiler,
|
||||
}
|
||||
|
||||
if (compiler->failed)
|
||||
+ {
|
||||
+ vkd3d_shader_free_shader_code(spirv);
|
||||
+
|
||||
return VKD3D_ERROR_INVALID_SHADER;
|
||||
+ }
|
||||
|
||||
if (compile_info->target_type == VKD3D_SHADER_TARGET_SPIRV_TEXT)
|
||||
{
|
||||
--
|
||||
2.51.0
|
||||
|
||||
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