You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-09-12 18:50:20 -07:00
Updated vkd3d-latest patchset
Squash and Update.
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
@@ -1,213 +0,0 @@
|
||||
From 77a6a8c574a94f8fb1a0bfbda96313e660b607c8 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Thu, 10 Apr 2025 07:44:42 +1000
|
||||
Subject: [PATCH] Updated vkd3d to cbce3a8631116ec10895e6c9c4a00b89b051f6b0.
|
||||
|
||||
---
|
||||
libs/vkd3d/libs/vkd3d-shader/fx.c | 44 ++++++++++++++++-----
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c | 10 ++++-
|
||||
libs/vkd3d/libs/vkd3d-shader/msl.c | 2 +-
|
||||
libs/vkd3d/libs/vkd3d-shader/tpf.c | 20 +++++++---
|
||||
4 files changed, 58 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/fx.c b/libs/vkd3d/libs/vkd3d-shader/fx.c
|
||||
index debcb261811..c93f01039ef 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/fx.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/fx.c
|
||||
@@ -2420,6 +2420,23 @@ static inline enum hlsl_base_type hlsl_type_from_fx_type(enum state_property_com
|
||||
}
|
||||
}
|
||||
|
||||
+static inline bool hlsl_type_state_compatible(struct hlsl_type *lhs, enum hlsl_base_type rhs)
|
||||
+{
|
||||
+ if (!hlsl_is_numeric_type(lhs))
|
||||
+ return false;
|
||||
+ switch (lhs->e.numeric.type)
|
||||
+ {
|
||||
+ case HLSL_TYPE_INT:
|
||||
+ case HLSL_TYPE_UINT:
|
||||
+ return rhs == HLSL_TYPE_INT || rhs == HLSL_TYPE_UINT;
|
||||
+
|
||||
+ default:
|
||||
+ return lhs->e.numeric.type == rhs;
|
||||
+ }
|
||||
+
|
||||
+ vkd3d_unreachable();
|
||||
+}
|
||||
+
|
||||
static const struct rhs_named_value filter_values[] =
|
||||
{
|
||||
{ "MIN_MAG_MIP_POINT", 0x00 },
|
||||
@@ -2664,9 +2681,9 @@ static void resolve_fx_4_state_block_values(struct hlsl_ir_var *var, struct hlsl
|
||||
struct replace_state_context replace_context;
|
||||
const struct fx_4_state *state = NULL;
|
||||
struct hlsl_type *state_type = NULL;
|
||||
- struct hlsl_ir_node *node, *cast;
|
||||
struct hlsl_ctx *ctx = fx->ctx;
|
||||
enum hlsl_base_type base_type;
|
||||
+ struct hlsl_ir_node *node;
|
||||
unsigned int i;
|
||||
|
||||
if (type->class == HLSL_CLASS_BLEND_STATE && ctx->profile->major_version == 5)
|
||||
@@ -2803,9 +2820,15 @@ static void resolve_fx_4_state_block_values(struct hlsl_ir_var *var, struct hlsl
|
||||
if (state_type)
|
||||
{
|
||||
node = entry->args->node;
|
||||
- if (!(cast = hlsl_new_cast(ctx, node, state_type, &var->loc)))
|
||||
- return;
|
||||
- list_add_after(&node->entry, &cast->entry);
|
||||
+ if (state->type == FX_UINT8 || !hlsl_type_state_compatible(node->data_type, base_type))
|
||||
+ {
|
||||
+ struct hlsl_ir_node *cast;
|
||||
+
|
||||
+ if (!(cast = hlsl_new_cast(ctx, node, state_type, &var->loc)))
|
||||
+ return;
|
||||
+ list_add_after(&node->entry, &cast->entry);
|
||||
+ node = cast;
|
||||
+ }
|
||||
|
||||
/* FX_UINT8 values are using 32-bits in the binary. Mask higher 24 bits for those. */
|
||||
if (state->type == FX_UINT8)
|
||||
@@ -2814,15 +2837,18 @@ static void resolve_fx_4_state_block_values(struct hlsl_ir_var *var, struct hlsl
|
||||
|
||||
if (!(mask = hlsl_new_uint_constant(ctx, 0xff, &var->loc)))
|
||||
return;
|
||||
- list_add_after(&cast->entry, &mask->entry);
|
||||
+ list_add_after(&node->entry, &mask->entry);
|
||||
|
||||
- if (!(cast = hlsl_new_binary_expr(ctx, HLSL_OP2_BIT_AND, cast, mask)))
|
||||
+ if (!(node = hlsl_new_binary_expr(ctx, HLSL_OP2_BIT_AND, node, mask)))
|
||||
return;
|
||||
- list_add_after(&mask->entry, &cast->entry);
|
||||
+ list_add_after(&mask->entry, &node->entry);
|
||||
}
|
||||
|
||||
- hlsl_src_remove(entry->args);
|
||||
- hlsl_src_from_node(entry->args, cast);
|
||||
+ if (node != entry->args->node)
|
||||
+ {
|
||||
+ hlsl_src_remove(entry->args);
|
||||
+ hlsl_src_from_node(entry->args, node);
|
||||
+ }
|
||||
|
||||
hlsl_run_const_passes(ctx, entry->instrs);
|
||||
}
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
||||
index ba56ba90403..dc7607a1393 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
||||
@@ -6407,7 +6407,9 @@ static void allocate_semantic_register(struct hlsl_ctx *ctx, struct hlsl_ir_var
|
||||
|| semantic == VKD3D_SHADER_SV_PRIMITIVE_ID)
|
||||
vip_allocation = true;
|
||||
|
||||
- if (semantic == VKD3D_SHADER_SV_IS_FRONT_FACE || semantic == VKD3D_SHADER_SV_SAMPLE_INDEX)
|
||||
+ if (semantic == VKD3D_SHADER_SV_IS_FRONT_FACE || semantic == VKD3D_SHADER_SV_SAMPLE_INDEX
|
||||
+ || (version.type == VKD3D_SHADER_TYPE_DOMAIN && !output && !is_primitive)
|
||||
+ || (ctx->is_patch_constant_func && output))
|
||||
special_interpolation = true;
|
||||
}
|
||||
|
||||
@@ -6443,6 +6445,8 @@ static void allocate_semantic_registers(struct hlsl_ctx *ctx, struct hlsl_ir_fun
|
||||
bool is_pixel_shader = ctx->profile->type == VKD3D_SHADER_TYPE_PIXEL;
|
||||
struct hlsl_ir_var *var;
|
||||
|
||||
+ in_prim_allocator.prioritize_smaller_writemasks = true;
|
||||
+ patch_constant_out_patch_allocator.prioritize_smaller_writemasks = true;
|
||||
input_allocator.prioritize_smaller_writemasks = true;
|
||||
output_allocator.prioritize_smaller_writemasks = true;
|
||||
|
||||
@@ -6470,6 +6474,8 @@ static void allocate_semantic_registers(struct hlsl_ctx *ctx, struct hlsl_ir_fun
|
||||
allocate_semantic_register(ctx, var, &output_allocator, true, !is_pixel_shader);
|
||||
}
|
||||
|
||||
+ vkd3d_free(in_prim_allocator.allocations);
|
||||
+ vkd3d_free(patch_constant_out_patch_allocator.allocations);
|
||||
vkd3d_free(input_allocator.allocations);
|
||||
vkd3d_free(output_allocator.allocations);
|
||||
}
|
||||
@@ -9770,7 +9776,7 @@ static void sm4_generate_vsir_instr_dcl_semantic(struct hlsl_ctx *ctx, struct vs
|
||||
else
|
||||
{
|
||||
if (semantic == VKD3D_SHADER_SV_NONE || version->type == VKD3D_SHADER_TYPE_PIXEL
|
||||
- || version->type == VKD3D_SHADER_TYPE_HULL)
|
||||
+ || (version->type == VKD3D_SHADER_TYPE_HULL && !ctx->is_patch_constant_func))
|
||||
opcode = VKD3DSIH_DCL_OUTPUT;
|
||||
else
|
||||
opcode = VKD3DSIH_DCL_OUTPUT_SIV;
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/msl.c b/libs/vkd3d/libs/vkd3d-shader/msl.c
|
||||
index a5d952cd525..d477bfa1c1b 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/msl.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/msl.c
|
||||
@@ -1292,7 +1292,7 @@ static int msl_generator_init(struct msl_generator *gen, struct vsir_program *pr
|
||||
{
|
||||
msl_compiler_error(gen, VKD3D_SHADER_ERROR_MSL_INTERNAL,
|
||||
"Internal compiler error: Unhandled shader type %#x.", type);
|
||||
- return VKD3D_ERROR_INVALID_SHADER;
|
||||
+ gen->prefix = "unknown";
|
||||
}
|
||||
gen->interface_info = vkd3d_find_struct(compile_info->next, INTERFACE_INFO);
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/tpf.c b/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
||||
index 23dab35a288..3be1d743acf 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
||||
@@ -3116,8 +3116,12 @@ bool sm4_sysval_semantic_from_semantic_name(enum vkd3d_shader_sysval_semantic *s
|
||||
{"sv_domainlocation", false, VKD3D_SHADER_TYPE_DOMAIN, ~0u},
|
||||
{"sv_position", false, VKD3D_SHADER_TYPE_DOMAIN, VKD3D_SHADER_SV_NONE},
|
||||
{"sv_primitiveid", false, VKD3D_SHADER_TYPE_DOMAIN, ~0u},
|
||||
+ {"sv_rendertargetarrayindex", false, VKD3D_SHADER_TYPE_DOMAIN, VKD3D_SHADER_SV_NONE},
|
||||
+ {"sv_viewportarrayindex", false, VKD3D_SHADER_TYPE_DOMAIN, VKD3D_SHADER_SV_NONE},
|
||||
|
||||
{"sv_position", true, VKD3D_SHADER_TYPE_DOMAIN, VKD3D_SHADER_SV_POSITION},
|
||||
+ {"sv_rendertargetarrayindex", true, VKD3D_SHADER_TYPE_DOMAIN, VKD3D_SHADER_SV_RENDER_TARGET_ARRAY_INDEX},
|
||||
+ {"sv_viewportarrayindex", true, VKD3D_SHADER_TYPE_DOMAIN, VKD3D_SHADER_SV_VIEWPORT_ARRAY_INDEX},
|
||||
|
||||
{"sv_primitiveid", false, VKD3D_SHADER_TYPE_GEOMETRY, VKD3D_SHADER_SV_PRIMITIVE_ID},
|
||||
{"sv_gsinstanceid", false, VKD3D_SHADER_TYPE_GEOMETRY, ~0u},
|
||||
@@ -3131,6 +3135,8 @@ bool sm4_sysval_semantic_from_semantic_name(enum vkd3d_shader_sysval_semantic *s
|
||||
{"sv_primitiveid", false, VKD3D_SHADER_TYPE_HULL, ~0u},
|
||||
|
||||
{"sv_position", true, VKD3D_SHADER_TYPE_HULL, VKD3D_SHADER_SV_POSITION},
|
||||
+ {"sv_rendertargetarrayindex", true, VKD3D_SHADER_TYPE_HULL, VKD3D_SHADER_SV_RENDER_TARGET_ARRAY_INDEX},
|
||||
+ {"sv_viewportarrayindex", true, VKD3D_SHADER_TYPE_HULL, VKD3D_SHADER_SV_VIEWPORT_ARRAY_INDEX},
|
||||
|
||||
{"position", false, VKD3D_SHADER_TYPE_PIXEL, VKD3D_SHADER_SV_POSITION},
|
||||
{"sv_position", false, VKD3D_SHADER_TYPE_PIXEL, VKD3D_SHADER_SV_POSITION},
|
||||
@@ -3164,6 +3170,10 @@ bool sm4_sysval_semantic_from_semantic_name(enum vkd3d_shader_sysval_semantic *s
|
||||
if (!ascii_strcasecmp(semantic_name, "sv_position")
|
||||
|| (semantic_compat_mapping && !ascii_strcasecmp(semantic_name, "position")))
|
||||
*sysval_semantic = VKD3D_SHADER_SV_POSITION;
|
||||
+ else if (!ascii_strcasecmp(semantic_name, "sv_rendertargetarrayindex"))
|
||||
+ *sysval_semantic = VKD3D_SHADER_SV_RENDER_TARGET_ARRAY_INDEX;
|
||||
+ else if (!ascii_strcasecmp(semantic_name, "sv_viewportarrayindex"))
|
||||
+ *sysval_semantic = VKD3D_SHADER_SV_VIEWPORT_ARRAY_INDEX;
|
||||
else if (has_sv_prefix)
|
||||
return false;
|
||||
else
|
||||
@@ -3179,11 +3189,6 @@ bool sm4_sysval_semantic_from_semantic_name(enum vkd3d_shader_sysval_semantic *s
|
||||
return get_tessfactor_sysval_semantic(sysval_semantic, domain, semantic_idx);
|
||||
if (!ascii_strcasecmp(semantic_name, "sv_insidetessfactor"))
|
||||
return get_insidetessfactor_sysval_semantic(sysval_semantic, domain, semantic_idx);
|
||||
- if (!ascii_strcasecmp(semantic_name, "sv_position"))
|
||||
- {
|
||||
- *sysval_semantic = VKD3D_SHADER_SV_NONE;
|
||||
- return true;
|
||||
- }
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3214,7 +3219,10 @@ bool sm4_sysval_semantic_from_semantic_name(enum vkd3d_shader_sysval_semantic *s
|
||||
&& (semantic_compat_mapping || has_sv_prefix)
|
||||
&& version->type == semantics[i].shader_type)
|
||||
{
|
||||
- *sysval_semantic = semantics[i].semantic;
|
||||
+ if (is_patch_constant_func && output && semantics[i].semantic != ~0u)
|
||||
+ *sysval_semantic = VKD3D_SHADER_SV_NONE;
|
||||
+ else
|
||||
+ *sysval_semantic = semantics[i].semantic;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
--
|
||||
2.47.2
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,304 +0,0 @@
|
||||
From ee67ac02b1545b81f14e77720b3cca0309fbf64c Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Thu, 17 Apr 2025 08:02:13 +1000
|
||||
Subject: [PATCH] Updated vkd3d to c764f71cf58e3a8327b44c588ad3696b422cf8a3.
|
||||
|
||||
---
|
||||
libs/vkd3d/include/vkd3d_shader.h | 5 ++
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl.y | 44 ++++++++++++------
|
||||
libs/vkd3d/libs/vkd3d-shader/ir.c | 46 ++++++++++++++++++-
|
||||
.../libs/vkd3d-shader/vkd3d_shader_main.c | 10 +++-
|
||||
.../libs/vkd3d-shader/vkd3d_shader_private.h | 5 ++
|
||||
5 files changed, 92 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/libs/vkd3d/include/vkd3d_shader.h b/libs/vkd3d/include/vkd3d_shader.h
|
||||
index 2e1f37f12e6..6b2805e8759 100644
|
||||
--- a/libs/vkd3d/include/vkd3d_shader.h
|
||||
+++ b/libs/vkd3d/include/vkd3d_shader.h
|
||||
@@ -2076,6 +2076,11 @@ enum vkd3d_shader_resource_type
|
||||
*/
|
||||
enum vkd3d_shader_resource_data_type
|
||||
{
|
||||
+ /**
|
||||
+ * The descriptor has no relevant data type. This value is returned for
|
||||
+ * samplers. \since 1.16
|
||||
+ */
|
||||
+ VKD3D_SHADER_RESOURCE_DATA_NONE = 0x0,
|
||||
/** Unsigned normalized integer. */
|
||||
VKD3D_SHADER_RESOURCE_DATA_UNORM = 0x1,
|
||||
/** Signed normalized integer. */
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.y b/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
index 6086d018fdc..40fd142f58d 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
@@ -997,10 +997,24 @@ static void free_parse_variable_def(struct parse_variable_def *v)
|
||||
vkd3d_free(v->arrays.sizes);
|
||||
vkd3d_free(v->name);
|
||||
hlsl_cleanup_semantic(&v->semantic);
|
||||
- VKD3D_ASSERT(!v->state_blocks);
|
||||
+ if (v->state_block_count)
|
||||
+ {
|
||||
+ for (unsigned int i = 0; i < v->state_block_count; ++i)
|
||||
+ hlsl_free_state_block(v->state_blocks[i]);
|
||||
+ vkd3d_free(v->state_blocks);
|
||||
+ }
|
||||
vkd3d_free(v);
|
||||
}
|
||||
|
||||
+static void destroy_parse_variable_defs(struct list *defs)
|
||||
+{
|
||||
+ struct parse_variable_def *v, *v_next;
|
||||
+
|
||||
+ LIST_FOR_EACH_ENTRY_SAFE(v, v_next, defs, struct parse_variable_def, entry)
|
||||
+ free_parse_variable_def(v);
|
||||
+ vkd3d_free(defs);
|
||||
+}
|
||||
+
|
||||
static bool gen_struct_fields(struct hlsl_ctx *ctx, struct parse_fields *fields,
|
||||
struct hlsl_type *type, uint32_t modifiers, struct list *defs)
|
||||
{
|
||||
@@ -2618,11 +2632,7 @@ static struct hlsl_block *initialize_vars(struct hlsl_ctx *ctx, struct list *var
|
||||
|
||||
if (!(initializers = make_empty_block(ctx)))
|
||||
{
|
||||
- LIST_FOR_EACH_ENTRY_SAFE(v, v_next, var_list, struct parse_variable_def, entry)
|
||||
- {
|
||||
- free_parse_variable_def(v);
|
||||
- }
|
||||
- vkd3d_free(var_list);
|
||||
+ destroy_parse_variable_defs(var_list);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -6551,7 +6561,6 @@ static void validate_uav_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim,
|
||||
bool boolval;
|
||||
char *name;
|
||||
uint32_t modifiers;
|
||||
- struct hlsl_ir_node *instr;
|
||||
struct hlsl_block *block;
|
||||
struct list *list;
|
||||
struct parse_fields fields;
|
||||
@@ -6723,6 +6732,8 @@ static void validate_uav_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim,
|
||||
%type <list> variables_def
|
||||
%type <list> variables_def_typed
|
||||
%type <list> switch_cases
|
||||
+%destructor { destroy_parse_variable_defs($$); } type_specs variables_def variables_def_typed;
|
||||
+%destructor { destroy_switch_cases($$); } switch_cases;
|
||||
|
||||
%token <name> VAR_IDENTIFIER
|
||||
%token <name> NEW_IDENTIFIER
|
||||
@@ -6766,9 +6777,9 @@ static void validate_uav_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim,
|
||||
%type <block> selection_statement
|
||||
%type <block> statement
|
||||
%type <block> statement_list
|
||||
-%type <block> struct_declaration_without_vars
|
||||
%type <block> switch_statement
|
||||
%type <block> unary_expr
|
||||
+%destructor { destroy_block($$); } <block>
|
||||
|
||||
%type <boolval> boolean
|
||||
|
||||
@@ -6819,6 +6830,7 @@ static void validate_uav_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim,
|
||||
%type <state_block_index> state_block_index_opt
|
||||
|
||||
%type <switch_case> switch_case
|
||||
+%destructor { hlsl_free_ir_switch_case($$); } <switch_case>
|
||||
|
||||
%type <type> base_optional
|
||||
%type <type> field_type
|
||||
@@ -6835,6 +6847,7 @@ static void validate_uav_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim,
|
||||
%type <variable_def> variable_decl
|
||||
%type <variable_def> variable_def
|
||||
%type <variable_def> variable_def_typed
|
||||
+%destructor { free_parse_variable_def($$); } <variable_def>
|
||||
|
||||
%%
|
||||
|
||||
@@ -6988,6 +7001,9 @@ buffer_type:
|
||||
declaration_statement_list:
|
||||
%empty
|
||||
| declaration_statement_list declaration_statement
|
||||
+ {
|
||||
+ destroy_block($2);
|
||||
+ }
|
||||
|
||||
preproc_directive:
|
||||
PRE_LINE STRING
|
||||
@@ -7021,9 +7037,6 @@ struct_declaration_without_vars:
|
||||
if ($1)
|
||||
hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_INVALID_MODIFIER,
|
||||
"Modifiers are not allowed on struct type declarations.");
|
||||
-
|
||||
- if (!($$ = make_empty_block(ctx)))
|
||||
- YYABORT;
|
||||
}
|
||||
|
||||
struct_spec:
|
||||
@@ -8144,6 +8157,10 @@ type:
|
||||
declaration_statement:
|
||||
declaration
|
||||
| struct_declaration_without_vars
|
||||
+ {
|
||||
+ if (!($$ = make_empty_block(ctx)))
|
||||
+ YYABORT;
|
||||
+ }
|
||||
| typedef
|
||||
{
|
||||
if (!($$ = make_empty_block(ctx)))
|
||||
@@ -8157,15 +8174,12 @@ typedef_type:
|
||||
typedef:
|
||||
KW_TYPEDEF var_modifiers typedef_type type_specs ';'
|
||||
{
|
||||
- struct parse_variable_def *v, *v_next;
|
||||
uint32_t modifiers = $2;
|
||||
struct hlsl_type *type;
|
||||
|
||||
if (!(type = apply_type_modifiers(ctx, $3, &modifiers, false, &@2)))
|
||||
{
|
||||
- LIST_FOR_EACH_ENTRY_SAFE(v, v_next, $4, struct parse_variable_def, entry)
|
||||
- free_parse_variable_def(v);
|
||||
- vkd3d_free($4);
|
||||
+ destroy_parse_variable_defs($4);
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/ir.c b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
index d25485ab004..95093102552 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
@@ -8357,8 +8357,11 @@ static void vsir_validate_src_param(struct validation_context *ctx,
|
||||
break;
|
||||
|
||||
case VKD3DSPR_NULL:
|
||||
+ case VKD3DSPR_DEPTHOUT:
|
||||
+ case VKD3DSPR_DEPTHOUTGE:
|
||||
+ case VKD3DSPR_DEPTHOUTLE:
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_REGISTER_TYPE,
|
||||
- "Invalid NULL register used as source parameter.");
|
||||
+ "Invalid register of type %#x used as source parameter.", src->reg.type);
|
||||
break;
|
||||
|
||||
case VKD3DSPR_INPUT:
|
||||
@@ -8857,6 +8860,45 @@ static void vsir_validate_signature(struct validation_context *ctx, const struct
|
||||
}
|
||||
}
|
||||
|
||||
+static void vsir_validate_descriptors(struct validation_context *ctx)
|
||||
+{
|
||||
+ const struct vkd3d_shader_scan_descriptor_info1 *descriptors = &ctx->program->descriptors;
|
||||
+ unsigned int i;
|
||||
+
|
||||
+ for (i = 0; i < descriptors->descriptor_count; ++i)
|
||||
+ {
|
||||
+ const struct vkd3d_shader_descriptor_info1 *descriptor = &descriptors->descriptors[i];
|
||||
+
|
||||
+ if (descriptor->type >= VKD3D_SHADER_DESCRIPTOR_TYPE_COUNT)
|
||||
+ validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DESCRIPTOR_TYPE,
|
||||
+ "Descriptor %u has invalid type %#x.", i, descriptor->type);
|
||||
+
|
||||
+ if (descriptor->resource_type >= VKD3D_SHADER_RESOURCE_TYPE_COUNT)
|
||||
+ validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_RESOURCE_TYPE,
|
||||
+ "Descriptor %u has invalid resource type %#x.", i, descriptor->resource_type);
|
||||
+ else if ((descriptor->resource_type == VKD3D_SHADER_RESOURCE_NONE)
|
||||
+ != (descriptor->type == VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER))
|
||||
+ validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_RESOURCE_TYPE,
|
||||
+ "Descriptor %u has invalid resource type %#x for descriptor type %#x.",
|
||||
+ i, descriptor->resource_type, descriptor->type);
|
||||
+
|
||||
+ if (descriptor->resource_data_type >= VKD3D_DATA_COUNT)
|
||||
+ validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DATA_TYPE,
|
||||
+ "Descriptor %u has invalid resource data type %#x.", i, descriptor->resource_data_type);
|
||||
+ else if ((descriptor->resource_data_type == VKD3D_DATA_UNUSED)
|
||||
+ != (descriptor->type == VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER))
|
||||
+ validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DATA_TYPE,
|
||||
+ "Descriptor %u has invalid resource data type %#x for descriptor type %#x.",
|
||||
+ i, descriptor->resource_data_type, descriptor->type);
|
||||
+
|
||||
+ if (!descriptor->count || (descriptor->count > UINT_MAX - descriptor->register_index
|
||||
+ && descriptor->count != UINT_MAX))
|
||||
+ validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DESCRIPTOR_COUNT,
|
||||
+ "Descriptor %u has invalid descriptor count %u starting at index %u.",
|
||||
+ i, descriptor->count, descriptor->register_index);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static const char *name_from_cf_type(enum vsir_control_flow_type type)
|
||||
{
|
||||
switch (type)
|
||||
@@ -9823,6 +9865,8 @@ enum vkd3d_result vsir_program_validate(struct vsir_program *program, uint64_t c
|
||||
}
|
||||
}
|
||||
|
||||
+ vsir_validate_descriptors(&ctx);
|
||||
+
|
||||
if (!(ctx.temps = vkd3d_calloc(ctx.program->temp_count, sizeof(*ctx.temps))))
|
||||
goto fail;
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c
|
||||
index a0c24eaf18a..4103cdc1ef9 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c
|
||||
@@ -1111,7 +1111,7 @@ static void vkd3d_shader_scan_sampler_declaration(struct vkd3d_shader_scan_conte
|
||||
struct vkd3d_shader_descriptor_info1 *d;
|
||||
|
||||
if (!(d = vkd3d_shader_scan_add_descriptor(context, VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER,
|
||||
- &sampler->src.reg, &sampler->range, VKD3D_SHADER_RESOURCE_NONE, VKD3D_DATA_UINT)))
|
||||
+ &sampler->src.reg, &sampler->range, VKD3D_SHADER_RESOURCE_NONE, VKD3D_DATA_UNUSED)))
|
||||
return;
|
||||
|
||||
if (instruction->flags & VKD3DSI_SAMPLER_COMPARISON_MODE)
|
||||
@@ -1122,7 +1122,7 @@ static void vkd3d_shader_scan_combined_sampler_declaration(
|
||||
struct vkd3d_shader_scan_context *context, const struct vkd3d_shader_semantic *semantic)
|
||||
{
|
||||
vkd3d_shader_scan_add_descriptor(context, VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER, &semantic->resource.reg.reg,
|
||||
- &semantic->resource.range, VKD3D_SHADER_RESOURCE_NONE, VKD3D_DATA_UINT);
|
||||
+ &semantic->resource.range, VKD3D_SHADER_RESOURCE_NONE, VKD3D_DATA_UNUSED);
|
||||
vkd3d_shader_scan_add_descriptor(context, VKD3D_SHADER_DESCRIPTOR_TYPE_SRV, &semantic->resource.reg.reg,
|
||||
&semantic->resource.range, semantic->resource_type, VKD3D_DATA_FLOAT);
|
||||
}
|
||||
@@ -1520,6 +1520,8 @@ static enum vkd3d_shader_resource_data_type vkd3d_resource_data_type_from_data_t
|
||||
return VKD3D_SHADER_RESOURCE_DATA_DOUBLE;
|
||||
case VKD3D_DATA_CONTINUED:
|
||||
return VKD3D_SHADER_RESOURCE_DATA_CONTINUED;
|
||||
+ case VKD3D_DATA_UNUSED:
|
||||
+ return VKD3D_SHADER_RESOURCE_DATA_NONE;
|
||||
default:
|
||||
ERR("Invalid resource data type %#x.\n", data_type);
|
||||
return VKD3D_SHADER_RESOURCE_DATA_FLOAT;
|
||||
@@ -1547,6 +1549,10 @@ static enum vkd3d_result convert_descriptor_info(struct vkd3d_shader_scan_contex
|
||||
dst->flags = src->flags;
|
||||
dst->count = src->count;
|
||||
|
||||
+ if (context->api_version <= VKD3D_SHADER_API_VERSION_1_15
|
||||
+ && dst->type == VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER)
|
||||
+ dst->resource_data_type = VKD3D_SHADER_RESOURCE_DATA_UINT;
|
||||
+
|
||||
if (context->api_version < VKD3D_SHADER_API_VERSION_1_3
|
||||
&& dst->resource_data_type >= VKD3D_SHADER_RESOURCE_DATA_MIXED)
|
||||
{
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
||||
index 05ef8beeb9c..3b4fb626fcc 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
||||
@@ -61,6 +61,8 @@
|
||||
|
||||
#define VKD3D_SHADER_COMPONENT_TYPE_COUNT (VKD3D_SHADER_COMPONENT_INT16 + 1)
|
||||
#define VKD3D_SHADER_MINIMUM_PRECISION_COUNT (VKD3D_SHADER_MINIMUM_PRECISION_UINT_16 + 1)
|
||||
+#define VKD3D_SHADER_DESCRIPTOR_TYPE_COUNT (VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER + 1)
|
||||
+#define VKD3D_SHADER_RESOURCE_TYPE_COUNT (VKD3D_SHADER_RESOURCE_TEXTURE_CUBEARRAY + 1)
|
||||
|
||||
#define VKD3D_MAX_STREAM_COUNT 4
|
||||
|
||||
@@ -257,6 +259,9 @@ enum vkd3d_shader_error
|
||||
VKD3D_SHADER_ERROR_VSIR_MISSING_SEMANTIC = 9021,
|
||||
VKD3D_SHADER_ERROR_VSIR_INVALID_SIGNATURE = 9022,
|
||||
VKD3D_SHADER_ERROR_VSIR_INVALID_RANGE = 9023,
|
||||
+ VKD3D_SHADER_ERROR_VSIR_INVALID_DESCRIPTOR_TYPE = 9024,
|
||||
+ VKD3D_SHADER_ERROR_VSIR_INVALID_RESOURCE_TYPE = 9025,
|
||||
+ VKD3D_SHADER_ERROR_VSIR_INVALID_DESCRIPTOR_COUNT = 9026,
|
||||
|
||||
VKD3D_SHADER_WARNING_VSIR_DYNAMIC_DESCRIPTOR_ARRAY = 9300,
|
||||
|
||||
--
|
||||
2.47.2
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,39 +0,0 @@
|
||||
From 004790ffcc95151f41ae68b2eefe425bdbfe8123 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Tue, 29 Apr 2025 07:48:48 +1000
|
||||
Subject: [PATCH] Updated vkd3d to 8882d324a6e91654b4ea2908506e400986aed840.
|
||||
|
||||
---
|
||||
libs/vkd3d/libs/vkd3d-shader/dxil.c | 2 +-
|
||||
libs/vkd3d/libs/vkd3d-shader/ir.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/dxil.c b/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
||||
index a3813c39bf0..d5f9626ec9d 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
||||
@@ -9689,7 +9689,7 @@ static enum vkd3d_result sm6_parser_signatures_init(struct sm6_parser *sm6, cons
|
||||
if ((ret = sm6_parser_init_input_signature(sm6, &program->input_signature)) < 0)
|
||||
return ret;
|
||||
|
||||
- if ((ret = sm6_parser_init_output_signature(sm6, &program->output_signature) < 0))
|
||||
+ if ((ret = sm6_parser_init_output_signature(sm6, &program->output_signature)) < 0)
|
||||
return ret;
|
||||
|
||||
if ((ret = sm6_parser_init_patch_constant_signature(sm6, &program->patch_constant_signature)) < 0)
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/ir.c b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
index 95093102552..b8f83946294 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
@@ -2064,7 +2064,7 @@ static enum vkd3d_result shader_signature_map_patch_constant_index_ranges(struct
|
||||
continue;
|
||||
|
||||
if ((ret = range_map_set_register_range(normaliser, range_map,
|
||||
- e->register_index, register_count, e->mask, e->used_mask, false) < 0))
|
||||
+ e->register_index, register_count, e->mask, e->used_mask, false)) < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
--
|
||||
2.47.2
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user