wine-staging/patches/vkd3d-latest/0006-Updated-vkd3d-to-3bafee344d8d50172d8da18512ba070c682.patch
2024-01-13 12:21:42 +11:00

596 lines
31 KiB
Diff

From b039b38e401b3e9e182c2fb20e7ef7cf8648bd2e Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Thu, 4 Jan 2024 12:22:17 +1100
Subject: [PATCH] Updated vkd3d to 3bafee344d8d50172d8da18512ba070c6826b18d.
---
libs/vkd3d/libs/vkd3d-shader/d3d_asm.c | 52 ++++++++---------
libs/vkd3d/libs/vkd3d-shader/d3dbc.c | 2 +-
libs/vkd3d/libs/vkd3d-shader/dxil.c | 58 ++++++++++---------
libs/vkd3d/libs/vkd3d-shader/ir.c | 6 +-
libs/vkd3d/libs/vkd3d-shader/spirv.c | 10 ++--
libs/vkd3d/libs/vkd3d-shader/tpf.c | 30 +++++-----
.../libs/vkd3d-shader/vkd3d_shader_main.c | 10 ++++
.../libs/vkd3d-shader/vkd3d_shader_private.h | 10 ++--
libs/vkd3d/libs/vkd3d/utils.c | 2 +
9 files changed, 99 insertions(+), 81 deletions(-)
diff --git a/libs/vkd3d/libs/vkd3d-shader/d3d_asm.c b/libs/vkd3d/libs/vkd3d-shader/d3d_asm.c
index ac1c41f96e2..0589bc42174 100644
--- a/libs/vkd3d/libs/vkd3d-shader/d3d_asm.c
+++ b/libs/vkd3d/libs/vkd3d-shader/d3d_asm.c
@@ -1109,15 +1109,15 @@ static void shader_dump_register(struct vkd3d_d3d_asm_compiler *compiler, const
switch (reg->data_type)
{
case VKD3D_DATA_FLOAT:
- shader_print_float_literal(compiler, "", reg->u.immconst_float[0], "");
+ shader_print_float_literal(compiler, "", reg->u.immconst_f32[0], "");
break;
case VKD3D_DATA_INT:
- shader_print_int_literal(compiler, "", reg->u.immconst_uint[0], "");
+ shader_print_int_literal(compiler, "", reg->u.immconst_u32[0], "");
break;
case VKD3D_DATA_RESOURCE:
case VKD3D_DATA_SAMPLER:
case VKD3D_DATA_UINT:
- shader_print_uint_literal(compiler, "", reg->u.immconst_uint[0], "");
+ shader_print_uint_literal(compiler, "", reg->u.immconst_u32[0], "");
break;
default:
shader_addline(buffer, "<unhandled data type %#x>", reg->data_type);
@@ -1129,24 +1129,24 @@ static void shader_dump_register(struct vkd3d_d3d_asm_compiler *compiler, const
switch (reg->data_type)
{
case VKD3D_DATA_FLOAT:
- shader_print_float_literal(compiler, "", reg->u.immconst_float[0], "");
- shader_print_float_literal(compiler, ", ", reg->u.immconst_float[1], "");
- shader_print_float_literal(compiler, ", ", reg->u.immconst_float[2], "");
- shader_print_float_literal(compiler, ", ", reg->u.immconst_float[3], "");
+ shader_print_float_literal(compiler, "", reg->u.immconst_f32[0], "");
+ shader_print_float_literal(compiler, ", ", reg->u.immconst_f32[1], "");
+ shader_print_float_literal(compiler, ", ", reg->u.immconst_f32[2], "");
+ shader_print_float_literal(compiler, ", ", reg->u.immconst_f32[3], "");
break;
case VKD3D_DATA_INT:
- shader_print_int_literal(compiler, "", reg->u.immconst_uint[0], "");
- shader_print_int_literal(compiler, ", ", reg->u.immconst_uint[1], "");
- shader_print_int_literal(compiler, ", ", reg->u.immconst_uint[2], "");
- shader_print_int_literal(compiler, ", ", reg->u.immconst_uint[3], "");
+ shader_print_int_literal(compiler, "", reg->u.immconst_u32[0], "");
+ shader_print_int_literal(compiler, ", ", reg->u.immconst_u32[1], "");
+ shader_print_int_literal(compiler, ", ", reg->u.immconst_u32[2], "");
+ shader_print_int_literal(compiler, ", ", reg->u.immconst_u32[3], "");
break;
case VKD3D_DATA_RESOURCE:
case VKD3D_DATA_SAMPLER:
case VKD3D_DATA_UINT:
- shader_print_uint_literal(compiler, "", reg->u.immconst_uint[0], "");
- shader_print_uint_literal(compiler, ", ", reg->u.immconst_uint[1], "");
- shader_print_uint_literal(compiler, ", ", reg->u.immconst_uint[2], "");
- shader_print_uint_literal(compiler, ", ", reg->u.immconst_uint[3], "");
+ shader_print_uint_literal(compiler, "", reg->u.immconst_u32[0], "");
+ shader_print_uint_literal(compiler, ", ", reg->u.immconst_u32[1], "");
+ shader_print_uint_literal(compiler, ", ", reg->u.immconst_u32[2], "");
+ shader_print_uint_literal(compiler, ", ", reg->u.immconst_u32[3], "");
break;
default:
shader_addline(buffer, "<unhandled data type %#x>", reg->data_type);
@@ -1168,9 +1168,9 @@ static void shader_dump_register(struct vkd3d_d3d_asm_compiler *compiler, const
{
if (reg->data_type == VKD3D_DATA_DOUBLE)
{
- shader_print_double_literal(compiler, "", reg->u.immconst_double[0], "");
+ shader_print_double_literal(compiler, "", reg->u.immconst_f64[0], "");
if (reg->dimension == VSIR_DIMENSION_VEC4)
- shader_print_double_literal(compiler, ", ", reg->u.immconst_double[1], "");
+ shader_print_double_literal(compiler, ", ", reg->u.immconst_f64[1], "");
}
else
{
@@ -1882,25 +1882,25 @@ static void shader_dump_instruction(struct vkd3d_d3d_asm_compiler *compiler,
vkd3d_string_buffer_printf(buffer, " %sc%u%s", compiler->colours.reg,
shader_get_float_offset(ins->dst[0].reg.type, ins->dst[0].reg.idx[0].offset),
compiler->colours.reset);
- shader_print_float_literal(compiler, " = ", ins->src[0].reg.u.immconst_float[0], "");
- shader_print_float_literal(compiler, ", ", ins->src[0].reg.u.immconst_float[1], "");
- shader_print_float_literal(compiler, ", ", ins->src[0].reg.u.immconst_float[2], "");
- shader_print_float_literal(compiler, ", ", ins->src[0].reg.u.immconst_float[3], "");
+ shader_print_float_literal(compiler, " = ", ins->src[0].reg.u.immconst_f32[0], "");
+ shader_print_float_literal(compiler, ", ", ins->src[0].reg.u.immconst_f32[1], "");
+ shader_print_float_literal(compiler, ", ", ins->src[0].reg.u.immconst_f32[2], "");
+ shader_print_float_literal(compiler, ", ", ins->src[0].reg.u.immconst_f32[3], "");
break;
case VKD3DSIH_DEFI:
vkd3d_string_buffer_printf(buffer, " %si%u%s", compiler->colours.reg,
ins->dst[0].reg.idx[0].offset, compiler->colours.reset);
- shader_print_int_literal(compiler, " = ", ins->src[0].reg.u.immconst_uint[0], "");
- shader_print_int_literal(compiler, ", ", ins->src[0].reg.u.immconst_uint[1], "");
- shader_print_int_literal(compiler, ", ", ins->src[0].reg.u.immconst_uint[2], "");
- shader_print_int_literal(compiler, ", ", ins->src[0].reg.u.immconst_uint[3], "");
+ shader_print_int_literal(compiler, " = ", ins->src[0].reg.u.immconst_u32[0], "");
+ shader_print_int_literal(compiler, ", ", ins->src[0].reg.u.immconst_u32[1], "");
+ shader_print_int_literal(compiler, ", ", ins->src[0].reg.u.immconst_u32[2], "");
+ shader_print_int_literal(compiler, ", ", ins->src[0].reg.u.immconst_u32[3], "");
break;
case VKD3DSIH_DEFB:
vkd3d_string_buffer_printf(buffer, " %sb%u%s", compiler->colours.reg,
ins->dst[0].reg.idx[0].offset, compiler->colours.reset);
- shader_print_bool_literal(compiler, " = ", ins->src[0].reg.u.immconst_uint[0], "");
+ shader_print_bool_literal(compiler, " = ", ins->src[0].reg.u.immconst_u32[0], "");
break;
default:
diff --git a/libs/vkd3d/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
index d40ea4b5942..ca6e3b72de9 100644
--- a/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
+++ b/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
@@ -987,7 +987,7 @@ static void shader_sm1_read_immconst(struct vkd3d_shader_sm1_parser *sm1, const
src_param->reg.idx[2].rel_addr = NULL;
src_param->reg.idx_count = 0;
src_param->reg.dimension = dimension;
- memcpy(src_param->reg.u.immconst_uint, *ptr, count * sizeof(uint32_t));
+ memcpy(src_param->reg.u.immconst_u32, *ptr, count * sizeof(uint32_t));
src_param->swizzle = VKD3D_SHADER_NO_SWIZZLE;
src_param->modifiers = 0;
diff --git a/libs/vkd3d/libs/vkd3d-shader/dxil.c b/libs/vkd3d/libs/vkd3d-shader/dxil.c
index 602056e25d4..2424b176068 100644
--- a/libs/vkd3d/libs/vkd3d-shader/dxil.c
+++ b/libs/vkd3d/libs/vkd3d-shader/dxil.c
@@ -1237,7 +1237,7 @@ static size_t dxil_block_compute_module_decl_count(const struct dxil_block *bloc
size_t i, count;
for (i = 0, count = 0; i < block->record_count; ++i)
- count += block->records[i]->code == MODULE_CODE_FUNCTION;
+ count += block->records[i]->code == MODULE_CODE_FUNCTION || block->records[i]->code == MODULE_CODE_GLOBALVAR;
return count;
}
@@ -1886,12 +1886,12 @@ static unsigned int register_get_uint_value(const struct vkd3d_shader_register *
if (reg->type == VKD3DSPR_IMMCONST64)
{
- if (reg->u.immconst_uint64[0] > UINT_MAX)
+ if (reg->u.immconst_u64[0] > UINT_MAX)
FIXME("Truncating 64-bit value.\n");
- return reg->u.immconst_uint64[0];
+ return reg->u.immconst_u64[0];
}
- return reg->u.immconst_uint[0];
+ return reg->u.immconst_u32[0];
}
static uint64_t register_get_uint64_value(const struct vkd3d_shader_register *reg)
@@ -1902,7 +1902,7 @@ static uint64_t register_get_uint64_value(const struct vkd3d_shader_register *re
if (reg->dimension == VSIR_DIMENSION_VEC4)
WARN("Returning vec4.x.\n");
- return (reg->type == VKD3DSPR_IMMCONST64) ? reg->u.immconst_uint64[0] : reg->u.immconst_uint[0];
+ return (reg->type == VKD3DSPR_IMMCONST64) ? reg->u.immconst_u64[0] : reg->u.immconst_u32[0];
}
static inline bool sm6_value_is_function_dcl(const struct sm6_value *value)
@@ -2577,9 +2577,9 @@ static enum vkd3d_result sm6_parser_constants_init(struct sm6_parser *sm6, const
value = decode_rotated_signed_value(record->operands[0]);
if (type->u.width <= 32)
- dst->u.reg.u.immconst_uint[0] = value & ((1ull << type->u.width) - 1);
+ dst->u.reg.u.immconst_u32[0] = value & ((1ull << type->u.width) - 1);
else
- dst->u.reg.u.immconst_uint64[0] = value;
+ dst->u.reg.u.immconst_u64[0] = value;
break;
@@ -2596,9 +2596,9 @@ static enum vkd3d_result sm6_parser_constants_init(struct sm6_parser *sm6, const
if (type->u.width == 16)
FIXME("Half float type is not supported yet.\n");
else if (type->u.width == 32)
- dst->u.reg.u.immconst_float[0] = bitcast_uint64_to_float(record->operands[0]);
+ dst->u.reg.u.immconst_f32[0] = bitcast_uint64_to_float(record->operands[0]);
else if (type->u.width == 64)
- dst->u.reg.u.immconst_double[0] = bitcast_uint64_to_double(record->operands[0]);
+ dst->u.reg.u.immconst_f64[0] = bitcast_uint64_to_double(record->operands[0]);
else
vkd3d_unreachable();
@@ -2877,8 +2877,8 @@ static const struct vkd3d_shader_immediate_constant_buffer *resolve_forward_init
static enum vkd3d_result sm6_parser_globals_init(struct sm6_parser *sm6)
{
+ size_t i, count, base_value_idx = sm6->value_count;
const struct dxil_block *block = &sm6->root_block;
- size_t i, base_value_idx = sm6->value_count;
struct vkd3d_shader_instruction *ins;
const struct dxil_record *record;
enum vkd3d_result ret;
@@ -2887,6 +2887,10 @@ static enum vkd3d_result sm6_parser_globals_init(struct sm6_parser *sm6)
sm6->p.location.line = block->id;
sm6->p.location.column = 0;
+ for (i = 0, count = 0; i < block->record_count; ++i)
+ count += block->records[i]->code == MODULE_CODE_GLOBALVAR;
+ sm6_parser_require_space(sm6, count);
+
for (i = 0; i < block->record_count; ++i)
{
sm6->p.location.column = i;
@@ -6031,7 +6035,7 @@ static enum vkd3d_result sm6_parser_init(struct sm6_parser *sm6, const uint32_t
if ((magic = sm6->start[0]) != BITCODE_MAGIC)
{
WARN("Unknown magic number 0x%08x.\n", magic);
- vkd3d_shader_parser_warning(&sm6->p, VKD3D_SHADER_WARNING_DXIL_UNKNOWN_MAGIC_NUMBER,
+ vkd3d_shader_warning(message_context, &location, VKD3D_SHADER_WARNING_DXIL_UNKNOWN_MAGIC_NUMBER,
"DXIL bitcode chunk magic number 0x%08x is not the expected 0x%08x.", magic, BITCODE_MAGIC);
}
@@ -6040,7 +6044,7 @@ static enum vkd3d_result sm6_parser_init(struct sm6_parser *sm6, const uint32_t
if ((version.type = version_token >> 16) >= VKD3D_SHADER_TYPE_COUNT)
{
FIXME("Unknown shader type %#x.\n", version.type);
- vkd3d_shader_parser_warning(&sm6->p, VKD3D_SHADER_WARNING_DXIL_UNKNOWN_SHADER_TYPE,
+ vkd3d_shader_warning(message_context, &location, VKD3D_SHADER_WARNING_DXIL_UNKNOWN_SHADER_TYPE,
"Unknown shader type %#x.", version.type);
}
@@ -6066,10 +6070,10 @@ static enum vkd3d_result sm6_parser_init(struct sm6_parser *sm6, const uint32_t
if ((ret = dxil_block_init(block, NULL, sm6)) < 0)
{
if (ret == VKD3D_ERROR_OUT_OF_MEMORY)
- vkd3d_shader_error(message_context, &location, VKD3D_SHADER_ERROR_DXIL_OUT_OF_MEMORY,
+ vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_OUT_OF_MEMORY,
"Out of memory parsing DXIL bitcode chunk.");
else if (ret == VKD3D_ERROR_INVALID_SHADER)
- vkd3d_shader_error(message_context, &location, VKD3D_SHADER_ERROR_DXIL_INVALID_BITCODE,
+ vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_INVALID_BITCODE,
"DXIL bitcode chunk has invalid bitcode.");
else
vkd3d_unreachable();
@@ -6099,10 +6103,10 @@ static enum vkd3d_result sm6_parser_init(struct sm6_parser *sm6, const uint32_t
if ((ret = sm6_parser_type_table_init(sm6)) < 0)
{
if (ret == VKD3D_ERROR_OUT_OF_MEMORY)
- vkd3d_shader_error(message_context, &location, VKD3D_SHADER_ERROR_DXIL_OUT_OF_MEMORY,
+ vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_OUT_OF_MEMORY,
"Out of memory parsing DXIL type table.");
else if (ret == VKD3D_ERROR_INVALID_SHADER)
- vkd3d_shader_error(message_context, &location, VKD3D_SHADER_ERROR_DXIL_INVALID_TYPE_TABLE,
+ vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_INVALID_TYPE_TABLE,
"DXIL type table is invalid.");
else
vkd3d_unreachable();
@@ -6112,10 +6116,10 @@ static enum vkd3d_result sm6_parser_init(struct sm6_parser *sm6, const uint32_t
if ((ret = sm6_parser_symtab_init(sm6)) < 0)
{
if (ret == VKD3D_ERROR_OUT_OF_MEMORY)
- vkd3d_shader_error(message_context, &location, VKD3D_SHADER_ERROR_DXIL_OUT_OF_MEMORY,
+ vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_OUT_OF_MEMORY,
"Out of memory parsing DXIL value symbol table.");
else if (ret == VKD3D_ERROR_INVALID_SHADER)
- vkd3d_shader_error(message_context, &location, VKD3D_SHADER_ERROR_DXIL_INVALID_VALUE_SYMTAB,
+ vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_INVALID_VALUE_SYMTAB,
"DXIL value symbol table is invalid.");
else
vkd3d_unreachable();
@@ -6126,7 +6130,7 @@ static enum vkd3d_result sm6_parser_init(struct sm6_parser *sm6, const uint32_t
|| !(sm6->input_params = shader_parser_get_dst_params(&sm6->p, input_signature->element_count)))
{
ERR("Failed to allocate input/output parameters.\n");
- vkd3d_shader_error(message_context, &location, VKD3D_SHADER_ERROR_DXIL_OUT_OF_MEMORY,
+ vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_OUT_OF_MEMORY,
"Out of memory allocating input/output parameters.");
return VKD3D_ERROR_OUT_OF_MEMORY;
}
@@ -6135,7 +6139,7 @@ static enum vkd3d_result sm6_parser_init(struct sm6_parser *sm6, const uint32_t
if (!(sm6->functions = vkd3d_calloc(function_count, sizeof(*sm6->functions))))
{
ERR("Failed to allocate function array.\n");
- vkd3d_shader_error(message_context, &location, VKD3D_SHADER_ERROR_DXIL_OUT_OF_MEMORY,
+ vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_OUT_OF_MEMORY,
"Out of memory allocating DXIL function array.");
return VKD3D_ERROR_OUT_OF_MEMORY;
}
@@ -6143,14 +6147,14 @@ static enum vkd3d_result sm6_parser_init(struct sm6_parser *sm6, const uint32_t
if (sm6_parser_compute_max_value_count(sm6, &sm6->root_block, 0) == SIZE_MAX)
{
WARN("Value array count overflowed.\n");
- vkd3d_shader_error(message_context, &location, VKD3D_SHADER_ERROR_DXIL_INVALID_MODULE,
+ vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_INVALID_MODULE,
"Overflow occurred in the DXIL module value count.");
return VKD3D_ERROR_INVALID_SHADER;
}
if (!(sm6->values = vkd3d_calloc(sm6->value_capacity, sizeof(*sm6->values))))
{
ERR("Failed to allocate value array.\n");
- vkd3d_shader_error(message_context, &location, VKD3D_SHADER_ERROR_DXIL_OUT_OF_MEMORY,
+ vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_OUT_OF_MEMORY,
"Out of memory allocating DXIL value array.");
return VKD3D_ERROR_OUT_OF_MEMORY;
}
@@ -6177,7 +6181,7 @@ static enum vkd3d_result sm6_parser_init(struct sm6_parser *sm6, const uint32_t
if (j == ARRAY_SIZE(sm6->metadata_tables))
{
FIXME("Too many metadata tables.\n");
- vkd3d_shader_error(message_context, &location, VKD3D_SHADER_ERROR_DXIL_INVALID_METADATA,
+ vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_INVALID_METADATA,
"A metadata table count greater than %zu is unsupported.", ARRAY_SIZE(sm6->metadata_tables));
return VKD3D_ERROR_INVALID_SHADER;
}
@@ -6195,17 +6199,17 @@ static enum vkd3d_result sm6_parser_init(struct sm6_parser *sm6, const uint32_t
if ((ret = sm6_parser_module_init(sm6, &sm6->root_block, 0)) < 0)
{
if (ret == VKD3D_ERROR_OUT_OF_MEMORY)
- vkd3d_shader_error(message_context, &location, VKD3D_SHADER_ERROR_DXIL_OUT_OF_MEMORY,
+ vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_OUT_OF_MEMORY,
"Out of memory parsing DXIL module.");
else if (ret == VKD3D_ERROR_INVALID_SHADER)
- vkd3d_shader_error(message_context, &location, VKD3D_SHADER_ERROR_DXIL_INVALID_MODULE,
+ vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_INVALID_MODULE,
"DXIL module is invalid.");
return ret;
}
if (!sm6_parser_require_space(sm6, output_signature->element_count + input_signature->element_count))
{
- vkd3d_shader_error(message_context, &location, VKD3D_SHADER_ERROR_DXIL_OUT_OF_MEMORY,
+ vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_OUT_OF_MEMORY,
"Out of memory emitting shader signature declarations.");
return VKD3D_ERROR_OUT_OF_MEMORY;
}
@@ -6223,7 +6227,7 @@ static enum vkd3d_result sm6_parser_init(struct sm6_parser *sm6, const uint32_t
assert(sm6->function_count == 1);
if (!sm6_block_emit_instructions(fn->blocks[0], sm6))
{
- vkd3d_shader_error(message_context, &location, VKD3D_SHADER_ERROR_DXIL_OUT_OF_MEMORY,
+ vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_OUT_OF_MEMORY,
"Out of memory emitting shader instructions.");
return VKD3D_ERROR_OUT_OF_MEMORY;
}
diff --git a/libs/vkd3d/libs/vkd3d-shader/ir.c b/libs/vkd3d/libs/vkd3d-shader/ir.c
index a0b5ea27698..d38b3c39712 100644
--- a/libs/vkd3d/libs/vkd3d-shader/ir.c
+++ b/libs/vkd3d/libs/vkd3d-shader/ir.c
@@ -63,7 +63,7 @@ static void shader_instruction_eliminate_phase_instance_id(struct vkd3d_shader_i
if (shader_register_is_phase_instance_id(reg))
{
vsir_register_init(reg, VKD3DSPR_IMMCONST, reg->data_type, 0);
- reg->u.immconst_uint[0] = instance_id;
+ reg->u.immconst_u32[0] = instance_id;
continue;
}
shader_register_eliminate_phase_addressing(reg, instance_id);
@@ -1218,7 +1218,7 @@ static void shader_register_normalise_flat_constants(struct vkd3d_shader_src_par
param->reg.idx_count = 0;
param->reg.dimension = VSIR_DIMENSION_VEC4;
for (j = 0; j < 4; ++j)
- param->reg.u.immconst_uint[j] = normaliser->defs[i].value[j];
+ param->reg.u.immconst_u32[j] = normaliser->defs[i].value[j];
return;
}
}
@@ -1254,7 +1254,7 @@ static enum vkd3d_result instruction_array_normalise_flat_constants(struct vkd3d
get_flat_constant_register_type((struct vkd3d_shader_register *)&ins->dst[0].reg, &def->set, &def->index);
for (j = 0; j < 4; ++j)
- def->value[j] = ins->src[0].reg.u.immconst_uint[j];
+ def->value[j] = ins->src[0].reg.u.immconst_u32[j];
vkd3d_shader_instruction_make_nop(ins);
}
diff --git a/libs/vkd3d/libs/vkd3d-shader/spirv.c b/libs/vkd3d/libs/vkd3d-shader/spirv.c
index 9e3cd7549ba..387784f2358 100644
--- a/libs/vkd3d/libs/vkd3d-shader/spirv.c
+++ b/libs/vkd3d/libs/vkd3d-shader/spirv.c
@@ -3697,14 +3697,14 @@ static uint32_t spirv_compiler_emit_load_constant(struct spirv_compiler *compile
if (reg->dimension == VSIR_DIMENSION_SCALAR)
{
for (i = 0; i < component_count; ++i)
- values[i] = *reg->u.immconst_uint;
+ values[i] = *reg->u.immconst_u32;
}
else
{
for (i = 0, j = 0; i < VKD3D_VEC4_SIZE; ++i)
{
if (write_mask & (VKD3DSP_WRITEMASK_0 << i))
- values[j++] = reg->u.immconst_uint[vsir_swizzle_get_component(swizzle, i)];
+ values[j++] = reg->u.immconst_u32[vsir_swizzle_get_component(swizzle, i)];
}
}
@@ -3724,14 +3724,14 @@ static uint32_t spirv_compiler_emit_load_constant64(struct spirv_compiler *compi
if (reg->dimension == VSIR_DIMENSION_SCALAR)
{
for (i = 0; i < component_count; ++i)
- values[i] = *reg->u.immconst_uint64;
+ values[i] = *reg->u.immconst_u64;
}
else
{
for (i = 0, j = 0; i < VKD3D_DVEC2_SIZE; ++i)
{
if (write_mask & (VKD3DSP_WRITEMASK_0 << i))
- values[j++] = reg->u.immconst_uint64[vsir_swizzle_get_component64(swizzle, i)];
+ values[j++] = reg->u.immconst_u64[vsir_swizzle_get_component64(swizzle, i)];
}
}
@@ -7829,7 +7829,7 @@ static int spirv_compiler_emit_control_flow_instruction(struct spirv_compiler *c
"The swizzle for a switch case value is not scalar.");
}
assert(src->reg.type == VKD3DSPR_IMMCONST);
- value = *src->reg.u.immconst_uint;
+ value = *src->reg.u.immconst_u32;
if (!vkd3d_array_reserve((void **)&cf_info->u.switch_.case_blocks, &cf_info->u.switch_.case_blocks_size,
2 * (cf_info->u.switch_.case_block_count + 1), sizeof(*cf_info->u.switch_.case_blocks)))
diff --git a/libs/vkd3d/libs/vkd3d-shader/tpf.c b/libs/vkd3d/libs/vkd3d-shader/tpf.c
index 9508abfb868..f859e758d8e 100644
--- a/libs/vkd3d/libs/vkd3d-shader/tpf.c
+++ b/libs/vkd3d/libs/vkd3d-shader/tpf.c
@@ -1903,19 +1903,19 @@ static bool shader_sm4_read_param(struct vkd3d_shader_sm4_parser *priv, const ui
if (register_type == VKD3D_SM4_RT_IMMCONST || register_type == VKD3D_SM4_RT_IMMCONST64)
{
- unsigned int dword_count;
+ unsigned int u32_count;
switch (param->dimension)
{
case VSIR_DIMENSION_SCALAR:
- dword_count = 1 + (register_type == VKD3D_SM4_RT_IMMCONST64);
- if (end - *ptr < dword_count)
+ u32_count = 1 + (register_type == VKD3D_SM4_RT_IMMCONST64);
+ if (end - *ptr < u32_count)
{
WARN("Invalid ptr %p, end %p.\n", *ptr, end);
return false;
}
- memcpy(param->u.immconst_uint, *ptr, dword_count * sizeof(DWORD));
- *ptr += dword_count;
+ memcpy(param->u.immconst_u32, *ptr, u32_count * sizeof(uint32_t));
+ *ptr += u32_count;
break;
case VSIR_DIMENSION_VEC4:
@@ -1924,7 +1924,7 @@ static bool shader_sm4_read_param(struct vkd3d_shader_sm4_parser *priv, const ui
WARN("Invalid ptr %p, end %p.\n", *ptr, end);
return false;
}
- memcpy(param->u.immconst_uint, *ptr, VKD3D_VEC4_SIZE * sizeof(DWORD));
+ memcpy(param->u.immconst_u32, *ptr, VKD3D_VEC4_SIZE * sizeof(uint32_t));
*ptr += 4;
break;
@@ -3870,7 +3870,7 @@ static void sm4_src_from_constant_value(struct vkd3d_shader_src_param *src,
if (width == 1)
{
src->reg.dimension = VSIR_DIMENSION_SCALAR;
- src->reg.u.immconst_uint[0] = value->u[0].u;
+ src->reg.u.immconst_u32[0] = value->u[0].u;
}
else
{
@@ -3880,9 +3880,9 @@ static void sm4_src_from_constant_value(struct vkd3d_shader_src_param *src,
for (i = 0; i < 4; ++i)
{
if ((map_writemask & (1u << i)) && (j < width))
- src->reg.u.immconst_uint[i] = value->u[j++].u;
+ src->reg.u.immconst_u32[i] = value->u[j++].u;
else
- src->reg.u.immconst_uint[i] = 0;
+ src->reg.u.immconst_u32[i] = 0;
}
}
}
@@ -4077,12 +4077,12 @@ static void sm4_write_src_register(const struct tpf_writer *tpf, const struct vk
if (src->reg.type == VKD3DSPR_IMMCONST)
{
- put_u32(buffer, src->reg.u.immconst_uint[0]);
+ put_u32(buffer, src->reg.u.immconst_u32[0]);
if (src->reg.dimension == VSIR_DIMENSION_VEC4)
{
- put_u32(buffer, src->reg.u.immconst_uint[1]);
- put_u32(buffer, src->reg.u.immconst_uint[2]);
- put_u32(buffer, src->reg.u.immconst_uint[3]);
+ put_u32(buffer, src->reg.u.immconst_u32[1]);
+ put_u32(buffer, src->reg.u.immconst_u32[2]);
+ put_u32(buffer, src->reg.u.immconst_u32[3]);
}
}
}
@@ -4617,7 +4617,7 @@ static void write_sm4_ld(const struct tpf_writer *tpf, const struct hlsl_ir_node
memset(&instr.srcs[2], 0, sizeof(instr.srcs[2]));
reg->type = VKD3DSPR_IMMCONST;
reg->dimension = VSIR_DIMENSION_SCALAR;
- reg->u.immconst_uint[0] = index->value.u[0].u;
+ reg->u.immconst_u32[0] = index->value.u[0].u;
}
else if (tpf->ctx->profile->major_version == 4 && tpf->ctx->profile->minor_version == 0)
{
@@ -4778,7 +4778,7 @@ static void write_sm4_cast_from_bool(const struct tpf_writer *tpf, const struct
sm4_src_from_node(tpf, &instr.srcs[0], arg, instr.dsts[0].write_mask);
instr.srcs[1].reg.type = VKD3DSPR_IMMCONST;
instr.srcs[1].reg.dimension = VSIR_DIMENSION_SCALAR;
- instr.srcs[1].reg.u.immconst_uint[0] = mask;
+ instr.srcs[1].reg.u.immconst_u32[0] = mask;
instr.src_count = 2;
write_sm4_instruction(tpf, &instr);
diff --git a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c
index caf8a6a4a3e..8fd98d2a551 100644
--- a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c
+++ b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c
@@ -307,6 +307,16 @@ void vkd3d_shader_vwarning(struct vkd3d_shader_message_context *context, const s
vkd3d_string_buffer_printf(&context->messages, "\n");
}
+void vkd3d_shader_warning(struct vkd3d_shader_message_context *context, const struct vkd3d_shader_location *location,
+ enum vkd3d_shader_error error, const char *format, ...)
+{
+ va_list args;
+
+ va_start(args, format);
+ vkd3d_shader_vwarning(context, location, error, format, args);
+ va_end(args);
+}
+
void vkd3d_shader_verror(struct vkd3d_shader_message_context *context, const struct vkd3d_shader_location *location,
enum vkd3d_shader_error error, const char *format, va_list args)
{
diff --git a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
index ce7d74a72dc..47b245bd7ee 100644
--- a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
+++ b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
@@ -841,10 +841,10 @@ struct vkd3d_shader_register
unsigned int alignment;
union
{
- DWORD immconst_uint[VKD3D_VEC4_SIZE];
- float immconst_float[VKD3D_VEC4_SIZE];
- uint64_t immconst_uint64[VKD3D_DVEC2_SIZE];
- double immconst_double[VKD3D_DVEC2_SIZE];
+ uint32_t immconst_u32[VKD3D_VEC4_SIZE];
+ float immconst_f32[VKD3D_VEC4_SIZE];
+ uint64_t immconst_u64[VKD3D_DVEC2_SIZE];
+ double immconst_f64[VKD3D_DVEC2_SIZE];
unsigned fp_body_idx;
} u;
};
@@ -1398,6 +1398,8 @@ void vkd3d_shader_verror(struct vkd3d_shader_message_context *context, const str
enum vkd3d_shader_error error, const char *format, va_list args);
void vkd3d_shader_vnote(struct vkd3d_shader_message_context *context, const struct vkd3d_shader_location *location,
enum vkd3d_shader_log_level level, const char *format, va_list args);
+void vkd3d_shader_warning(struct vkd3d_shader_message_context *context, const struct vkd3d_shader_location *location,
+ enum vkd3d_shader_error error, const char *format, ...) VKD3D_PRINTF_FUNC(4, 5);
void vkd3d_shader_vwarning(struct vkd3d_shader_message_context *context, const struct vkd3d_shader_location *location,
enum vkd3d_shader_error error, const char *format, va_list args);
diff --git a/libs/vkd3d/libs/vkd3d/utils.c b/libs/vkd3d/libs/vkd3d/utils.c
index 9b28068be51..5ebe1b63e99 100644
--- a/libs/vkd3d/libs/vkd3d/utils.c
+++ b/libs/vkd3d/libs/vkd3d/utils.c
@@ -539,6 +539,7 @@ bool is_valid_feature_level(D3D_FEATURE_LEVEL feature_level)
{
static const D3D_FEATURE_LEVEL valid_feature_levels[] =
{
+ D3D_FEATURE_LEVEL_12_2,
D3D_FEATURE_LEVEL_12_1,
D3D_FEATURE_LEVEL_12_0,
D3D_FEATURE_LEVEL_11_1,
@@ -548,6 +549,7 @@ bool is_valid_feature_level(D3D_FEATURE_LEVEL feature_level)
D3D_FEATURE_LEVEL_9_3,
D3D_FEATURE_LEVEL_9_2,
D3D_FEATURE_LEVEL_9_1,
+ D3D_FEATURE_LEVEL_1_0_CORE,
};
unsigned int i;
--
2.43.0