mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
202 lines
8.1 KiB
Diff
202 lines
8.1 KiB
Diff
From e0214af03df8d0b0212f99c79a961003ffc63ff6 Mon Sep 17 00:00:00 2001
|
|
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
|
Date: Fri, 24 May 2024 07:56:01 +1000
|
|
Subject: [PATCH] Updated vkd3d to f090d1e80d8b6617b71f25dd422665b44759f3d0.
|
|
|
|
---
|
|
libs/vkd3d/libs/vkd3d-shader/d3dbc.c | 11 ++++++-----
|
|
libs/vkd3d/libs/vkd3d-shader/dxbc.c | 10 ++++++++--
|
|
libs/vkd3d/libs/vkd3d-shader/dxil.c | 17 ++++++++++++++++-
|
|
libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c | 2 +-
|
|
libs/vkd3d/libs/vkd3d-shader/preproc.l | 2 +-
|
|
.../libs/vkd3d-shader/vkd3d_shader_main.c | 18 +++++++++++++++++-
|
|
6 files changed, 49 insertions(+), 11 deletions(-)
|
|
|
|
diff --git a/libs/vkd3d/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
|
index 58f830dd887..bfd5b52b436 100644
|
|
--- a/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
|
+++ b/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
|
@@ -559,7 +559,8 @@ static bool add_signature_element(struct vkd3d_shader_sm1_parser *sm1, bool outp
|
|
element = &signature->elements[signature->element_count++];
|
|
|
|
memset(element, 0, sizeof(*element));
|
|
- element->semantic_name = name;
|
|
+ if (!(element->semantic_name = vkd3d_strdup(name)))
|
|
+ return false;
|
|
element->semantic_index = index;
|
|
element->sysval_semantic = sysval;
|
|
element->component_type = VKD3D_SHADER_COMPONENT_FLOAT;
|
|
@@ -2050,7 +2051,7 @@ static void write_sm1_cast(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *b
|
|
case HLSL_TYPE_BOOL:
|
|
/* Casts to bool should have already been lowered. */
|
|
default:
|
|
- hlsl_fixme(ctx, &expr->node.loc, "SM1 cast from %s to %s.\n",
|
|
+ hlsl_fixme(ctx, &expr->node.loc, "SM1 cast from %s to %s.",
|
|
debug_hlsl_type(ctx, src_type), debug_hlsl_type(ctx, dst_type));
|
|
break;
|
|
}
|
|
@@ -2458,7 +2459,7 @@ static void write_sm1_jump(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *b
|
|
}
|
|
|
|
default:
|
|
- hlsl_fixme(ctx, &jump->node.loc, "Jump type %s.\n", hlsl_jump_type_to_string(jump->type));
|
|
+ hlsl_fixme(ctx, &jump->node.loc, "Jump type %s.", hlsl_jump_type_to_string(jump->type));
|
|
}
|
|
}
|
|
|
|
@@ -2546,7 +2547,7 @@ static void write_sm1_resource_load(struct hlsl_ctx *ctx, struct vkd3d_bytecode_
|
|
break;
|
|
|
|
default:
|
|
- hlsl_fixme(ctx, &instr->loc, "Resource load type %u\n", load->load_type);
|
|
+ hlsl_fixme(ctx, &instr->loc, "Resource load type %u.", load->load_type);
|
|
return;
|
|
}
|
|
|
|
@@ -2578,7 +2579,7 @@ static void write_sm1_store(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *
|
|
|
|
if (store->lhs.var->data_type->class == HLSL_CLASS_MATRIX)
|
|
{
|
|
- hlsl_fixme(ctx, &instr->loc, "Lower matrix writemasks.\n");
|
|
+ hlsl_fixme(ctx, &instr->loc, "Lower matrix writemasks.");
|
|
return;
|
|
}
|
|
|
|
diff --git a/libs/vkd3d/libs/vkd3d-shader/dxbc.c b/libs/vkd3d/libs/vkd3d-shader/dxbc.c
|
|
index 8a1012d909b..4b9f67235aa 100644
|
|
--- a/libs/vkd3d/libs/vkd3d-shader/dxbc.c
|
|
+++ b/libs/vkd3d/libs/vkd3d-shader/dxbc.c
|
|
@@ -360,7 +360,7 @@ static int shader_parse_signature(const struct vkd3d_shader_dxbc_section_desc *s
|
|
uint32_t count, header_size;
|
|
struct signature_element *e;
|
|
const char *ptr = data;
|
|
- unsigned int i;
|
|
+ unsigned int i, j;
|
|
|
|
if (!require_space(0, 2, sizeof(uint32_t), section->data.size))
|
|
{
|
|
@@ -403,6 +403,7 @@ static int shader_parse_signature(const struct vkd3d_shader_dxbc_section_desc *s
|
|
for (i = 0; i < count; ++i)
|
|
{
|
|
size_t name_offset;
|
|
+ const char *name;
|
|
uint32_t mask;
|
|
|
|
e[i].sort_index = i;
|
|
@@ -413,9 +414,14 @@ static int shader_parse_signature(const struct vkd3d_shader_dxbc_section_desc *s
|
|
e[i].stream_index = 0;
|
|
|
|
name_offset = read_u32(&ptr);
|
|
- if (!(e[i].semantic_name = shader_get_string(data, section->data.size, name_offset)))
|
|
+ if (!(name = shader_get_string(data, section->data.size, name_offset))
|
|
+ || !(e[i].semantic_name = vkd3d_strdup(name)))
|
|
{
|
|
WARN("Invalid name offset %#zx (data size %#zx).\n", name_offset, section->data.size);
|
|
+ for (j = 0; j < i; ++j)
|
|
+ {
|
|
+ vkd3d_free((void *)e[j].semantic_name);
|
|
+ }
|
|
vkd3d_free(e);
|
|
return VKD3D_ERROR_INVALID_ARGUMENT;
|
|
}
|
|
diff --git a/libs/vkd3d/libs/vkd3d-shader/dxil.c b/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
|
index 4943a586680..73a8d8687c5 100644
|
|
--- a/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
|
+++ b/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
|
@@ -9445,7 +9445,22 @@ static enum vkd3d_result sm6_parser_read_signature(struct sm6_parser *sm6, const
|
|
}
|
|
}
|
|
|
|
- vkd3d_free(s->elements);
|
|
+ for (i = 0; i < operand_count; ++i)
|
|
+ {
|
|
+ if ((elements[i].semantic_name = vkd3d_strdup(elements[i].semantic_name)))
|
|
+ continue;
|
|
+
|
|
+ vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_OUT_OF_MEMORY,
|
|
+ "Failed to allocate signature element semantic name.");
|
|
+ for (j = 0; j < i; ++j)
|
|
+ {
|
|
+ vkd3d_free((void *)elements[j].semantic_name);
|
|
+ }
|
|
+ vkd3d_free(elements);
|
|
+ return VKD3D_ERROR_OUT_OF_MEMORY;
|
|
+ }
|
|
+
|
|
+ shader_signature_cleanup(s);
|
|
s->elements = elements;
|
|
s->element_count = operand_count;
|
|
|
|
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
|
index 27f16af51c5..bdb72a1fab9 100644
|
|
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
|
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
|
@@ -2988,7 +2988,7 @@ static bool lower_ternary(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, stru
|
|
|
|
if (cond->data_type->class > HLSL_CLASS_VECTOR || instr->data_type->class > HLSL_CLASS_VECTOR)
|
|
{
|
|
- hlsl_fixme(ctx, &instr->loc, "Lower ternary of type other than scalar or vector.\n");
|
|
+ hlsl_fixme(ctx, &instr->loc, "Lower ternary of type other than scalar or vector.");
|
|
return false;
|
|
}
|
|
|
|
diff --git a/libs/vkd3d/libs/vkd3d-shader/preproc.l b/libs/vkd3d/libs/vkd3d-shader/preproc.l
|
|
index 6fb61eff6c3..a3cdbe559a7 100644
|
|
--- a/libs/vkd3d/libs/vkd3d-shader/preproc.l
|
|
+++ b/libs/vkd3d/libs/vkd3d-shader/preproc.l
|
|
@@ -66,7 +66,7 @@ static void update_location(struct preproc_ctx *ctx);
|
|
%s LINE
|
|
|
|
NEWLINE \r?\n
|
|
-WS [ \t]
|
|
+WS [ \t\r]
|
|
IDENTIFIER [A-Za-z_][A-Za-z0-9_]*
|
|
INT_SUFFIX [uUlL]{0,2}
|
|
|
|
diff --git a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c
|
|
index b8dd0dba377..46c0da2a2d7 100644
|
|
--- a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c
|
|
+++ b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c
|
|
@@ -657,7 +657,15 @@ static bool vkd3d_shader_signature_from_shader_signature(struct vkd3d_shader_sig
|
|
struct vkd3d_shader_signature_element *d = &signature->elements[i];
|
|
struct signature_element *e = &src->elements[i];
|
|
|
|
- d->semantic_name = e->semantic_name;
|
|
+ if (!(d->semantic_name = vkd3d_strdup(e->semantic_name)))
|
|
+ {
|
|
+ for (unsigned int j = 0; j < i; ++j)
|
|
+ {
|
|
+ vkd3d_free((void *)signature->elements[j].semantic_name);
|
|
+ }
|
|
+ vkd3d_free(signature->elements);
|
|
+ return false;
|
|
+ }
|
|
d->semantic_index = e->semantic_index;
|
|
d->stream_index = e->stream_index;
|
|
d->sysval_semantic = e->sysval_semantic;
|
|
@@ -1763,6 +1771,10 @@ void vkd3d_shader_free_root_signature(struct vkd3d_shader_versioned_root_signatu
|
|
|
|
void shader_signature_cleanup(struct shader_signature *signature)
|
|
{
|
|
+ for (unsigned int i = 0; i < signature->element_count; ++i)
|
|
+ {
|
|
+ vkd3d_free((void *)signature->elements[i].semantic_name);
|
|
+ }
|
|
vkd3d_free(signature->elements);
|
|
signature->elements = NULL;
|
|
}
|
|
@@ -1820,6 +1832,10 @@ void vkd3d_shader_free_shader_signature(struct vkd3d_shader_signature *signature
|
|
{
|
|
TRACE("signature %p.\n", signature);
|
|
|
|
+ for (unsigned int i = 0; i < signature->element_count; ++i)
|
|
+ {
|
|
+ vkd3d_free((void *)signature->elements[i].semantic_name);
|
|
+ }
|
|
vkd3d_free(signature->elements);
|
|
signature->elements = NULL;
|
|
}
|
|
--
|
|
2.43.0
|
|
|