mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-09-13 09:17:20 -07:00
Updated vkd3d-latest patchset
Squashed afer release + rebased to latest (Added patch 0003).
This commit is contained in:
parent
19c6bb12cc
commit
e045af48e8
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,850 +0,0 @@
|
||||
From 9f12a2158273f6dda33aa5e74fa2853acaeb5a63 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Thu, 14 Dec 2023 10:07:09 +1100
|
||||
Subject: [PATCH] Updated vkd3d to 21491d1bbb168da8aeaa7bdde6e5f182b2205558.
|
||||
|
||||
---
|
||||
libs/vkd3d/libs/vkd3d-shader/d3d_asm.c | 2 +-
|
||||
libs/vkd3d/libs/vkd3d-shader/ir.c | 14 +-
|
||||
libs/vkd3d/libs/vkd3d-shader/spirv.c | 201 ++++++++++--------
|
||||
libs/vkd3d/libs/vkd3d-shader/tpf.c | 7 +-
|
||||
.../libs/vkd3d-shader/vkd3d_shader_private.h | 13 +-
|
||||
libs/vkd3d/libs/vkd3d/state.c | 4 +-
|
||||
6 files changed, 134 insertions(+), 107 deletions(-)
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/d3d_asm.c b/libs/vkd3d/libs/vkd3d-shader/d3d_asm.c
|
||||
index 2d52ee07724..86ddd1ffded 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/d3d_asm.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/d3d_asm.c
|
||||
@@ -1317,7 +1317,7 @@ static void shader_dump_dst_param(struct vkd3d_d3d_asm_compiler *compiler,
|
||||
static const char write_mask_chars[] = "xyzw";
|
||||
|
||||
if (param->reg.data_type == VKD3D_DATA_DOUBLE)
|
||||
- write_mask = vkd3d_write_mask_32_from_64(write_mask);
|
||||
+ write_mask = vsir_write_mask_32_from_64(write_mask);
|
||||
|
||||
shader_addline(buffer, ".%s", compiler->colours.write_mask);
|
||||
if (write_mask & VKD3DSP_WRITEMASK_0)
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/ir.c b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
index a35ef862096..1a569619707 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
@@ -593,19 +593,19 @@ struct signature_element *vsir_signature_find_element_for_reg(const struct shade
|
||||
}
|
||||
|
||||
static unsigned int range_map_get_register_count(uint8_t range_map[][VKD3D_VEC4_SIZE],
|
||||
- unsigned int register_idx, unsigned int write_mask)
|
||||
+ unsigned int register_idx, uint32_t write_mask)
|
||||
{
|
||||
- return range_map[register_idx][vkd3d_write_mask_get_component_idx(write_mask)];
|
||||
+ return range_map[register_idx][vsir_write_mask_get_component_idx(write_mask)];
|
||||
}
|
||||
|
||||
static void range_map_set_register_range(uint8_t range_map[][VKD3D_VEC4_SIZE], unsigned int register_idx,
|
||||
- unsigned int register_count, unsigned int write_mask, bool is_dcl_indexrange)
|
||||
+ unsigned int register_count, uint32_t write_mask, bool is_dcl_indexrange)
|
||||
{
|
||||
unsigned int i, j, r, c, component_idx, component_count;
|
||||
|
||||
assert(write_mask <= VKD3DSP_WRITEMASK_ALL);
|
||||
- component_idx = vkd3d_write_mask_get_component_idx(write_mask);
|
||||
- component_count = vkd3d_write_mask_component_count(write_mask);
|
||||
+ component_idx = vsir_write_mask_get_component_idx(write_mask);
|
||||
+ component_count = vsir_write_mask_component_count(write_mask);
|
||||
|
||||
assert(register_idx < MAX_REG_OUTPUT && MAX_REG_OUTPUT - register_idx >= register_count);
|
||||
|
||||
@@ -899,7 +899,7 @@ static bool shader_dst_param_io_normalise(struct vkd3d_shader_dst_param *dst_par
|
||||
element_idx = shader_signature_find_element_for_reg(signature, reg_idx, write_mask);
|
||||
e = &signature->elements[element_idx];
|
||||
|
||||
- dst_param->write_mask >>= vkd3d_write_mask_get_component_idx(e->mask);
|
||||
+ dst_param->write_mask >>= vsir_write_mask_get_component_idx(e->mask);
|
||||
if (is_io_dcl)
|
||||
{
|
||||
/* Validated in the TPF reader. */
|
||||
@@ -1011,7 +1011,7 @@ static void shader_src_param_io_normalise(struct vkd3d_shader_src_param *src_par
|
||||
reg->idx[id_idx].offset = element_idx;
|
||||
reg->idx_count = id_idx + 1;
|
||||
|
||||
- if ((component_idx = vkd3d_write_mask_get_component_idx(e->mask)))
|
||||
+ if ((component_idx = vsir_write_mask_get_component_idx(e->mask)))
|
||||
{
|
||||
for (i = 0; i < VKD3D_VEC4_SIZE; ++i)
|
||||
if (vkd3d_swizzle_get_component(src_param->swizzle, i))
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/spirv.c b/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
index db45920200d..5c537598e1e 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
@@ -133,7 +133,7 @@ static void vkd3d_spirv_dump(const struct vkd3d_shader_code *spirv,
|
||||
}
|
||||
}
|
||||
|
||||
-static void vkd3d_spirv_validate(const struct vkd3d_shader_code *spirv,
|
||||
+static bool vkd3d_spirv_validate(struct vkd3d_string_buffer *buffer, const struct vkd3d_shader_code *spirv,
|
||||
enum vkd3d_shader_spirv_environment environment)
|
||||
{
|
||||
spv_diagnostic diagnostic = NULL;
|
||||
@@ -145,12 +145,13 @@ static void vkd3d_spirv_validate(const struct vkd3d_shader_code *spirv,
|
||||
if ((ret = spvValidateBinary(context, spirv->code, spirv->size / sizeof(uint32_t),
|
||||
&diagnostic)))
|
||||
{
|
||||
- FIXME("Failed to validate SPIR-V binary, ret %d.\n", ret);
|
||||
- FIXME("Diagnostic message: %s.\n", debugstr_a(diagnostic->error));
|
||||
+ vkd3d_string_buffer_printf(buffer, "%s", diagnostic->error);
|
||||
}
|
||||
|
||||
spvDiagnosticDestroy(diagnostic);
|
||||
spvContextDestroy(context);
|
||||
+
|
||||
+ return !ret;
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -163,8 +164,11 @@ static enum vkd3d_result vkd3d_spirv_binary_to_text(const struct vkd3d_shader_co
|
||||
}
|
||||
static void vkd3d_spirv_dump(const struct vkd3d_shader_code *spirv,
|
||||
enum vkd3d_shader_spirv_environment environment) {}
|
||||
-static void vkd3d_spirv_validate(const struct vkd3d_shader_code *spirv,
|
||||
- enum vkd3d_shader_spirv_environment environment) {}
|
||||
+static bool vkd3d_spirv_validate(struct vkd3d_string_buffer *buffer, const struct vkd3d_shader_code *spirv,
|
||||
+ enum vkd3d_shader_spirv_environment environment)
|
||||
+{
|
||||
+ return true;
|
||||
+}
|
||||
|
||||
#endif /* HAVE_SPIRV_TOOLS */
|
||||
|
||||
@@ -2403,6 +2407,8 @@ struct spirv_compiler
|
||||
|
||||
struct ssa_register_info *ssa_register_info;
|
||||
unsigned int ssa_register_count;
|
||||
+
|
||||
+ uint64_t config_flags;
|
||||
};
|
||||
|
||||
static bool is_in_default_phase(const struct spirv_compiler *compiler)
|
||||
@@ -2458,7 +2464,8 @@ static void spirv_compiler_destroy(struct spirv_compiler *compiler)
|
||||
static struct spirv_compiler *spirv_compiler_create(const struct vkd3d_shader_version *shader_version,
|
||||
struct vkd3d_shader_desc *shader_desc, const struct vkd3d_shader_compile_info *compile_info,
|
||||
const struct vkd3d_shader_scan_descriptor_info1 *scan_descriptor_info,
|
||||
- struct vkd3d_shader_message_context *message_context, const struct vkd3d_shader_location *location)
|
||||
+ struct vkd3d_shader_message_context *message_context, const struct vkd3d_shader_location *location,
|
||||
+ uint64_t config_flags)
|
||||
{
|
||||
const struct shader_signature *patch_constant_signature = &shader_desc->patch_constant_signature;
|
||||
const struct shader_signature *output_signature = &shader_desc->output_signature;
|
||||
@@ -2475,6 +2482,7 @@ static struct spirv_compiler *spirv_compiler_create(const struct vkd3d_shader_ve
|
||||
memset(compiler, 0, sizeof(*compiler));
|
||||
compiler->message_context = message_context;
|
||||
compiler->location = *location;
|
||||
+ compiler->config_flags = config_flags;
|
||||
|
||||
if ((target_info = vkd3d_find_struct(compile_info->next, SPIRV_TARGET_INFO)))
|
||||
{
|
||||
@@ -3041,13 +3049,13 @@ static uint32_t spirv_compiler_get_constant_double_vector(struct spirv_compiler
|
||||
}
|
||||
|
||||
static uint32_t spirv_compiler_get_type_id_for_reg(struct spirv_compiler *compiler,
|
||||
- const struct vkd3d_shader_register *reg, DWORD write_mask)
|
||||
+ const struct vkd3d_shader_register *reg, uint32_t write_mask)
|
||||
{
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
|
||||
return vkd3d_spirv_get_type_id(builder,
|
||||
vkd3d_component_type_from_data_type(reg->data_type),
|
||||
- vkd3d_write_mask_component_count(write_mask));
|
||||
+ vsir_write_mask_component_count(write_mask));
|
||||
}
|
||||
|
||||
static uint32_t spirv_compiler_get_type_id_for_dst(struct spirv_compiler *compiler,
|
||||
@@ -3555,7 +3563,7 @@ static void spirv_compiler_emit_dereference_register(struct spirv_compiler *comp
|
||||
|
||||
if (index_count)
|
||||
{
|
||||
- component_count = vkd3d_write_mask_component_count(register_info->write_mask);
|
||||
+ component_count = vsir_write_mask_component_count(register_info->write_mask);
|
||||
type_id = vkd3d_spirv_get_type_id(builder, register_info->component_type, component_count);
|
||||
ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, register_info->storage_class, type_id);
|
||||
register_info->id = vkd3d_spirv_build_op_access_chain(builder, ptr_type_id,
|
||||
@@ -3596,15 +3604,15 @@ static bool vkd3d_swizzle_is_scalar(unsigned int swizzle)
|
||||
}
|
||||
|
||||
static uint32_t spirv_compiler_emit_swizzle(struct spirv_compiler *compiler,
|
||||
- uint32_t val_id, unsigned int val_write_mask, enum vkd3d_shader_component_type component_type,
|
||||
- unsigned int swizzle, unsigned int write_mask)
|
||||
+ uint32_t val_id, uint32_t val_write_mask, enum vkd3d_shader_component_type component_type,
|
||||
+ unsigned int swizzle, uint32_t write_mask)
|
||||
{
|
||||
unsigned int i, component_idx, component_count, val_component_count;
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
uint32_t type_id, components[VKD3D_VEC4_SIZE];
|
||||
|
||||
- component_count = vkd3d_write_mask_component_count(write_mask);
|
||||
- val_component_count = vkd3d_write_mask_component_count(val_write_mask);
|
||||
+ component_count = vsir_write_mask_component_count(write_mask);
|
||||
+ val_component_count = vsir_write_mask_component_count(val_write_mask);
|
||||
|
||||
if (component_count == val_component_count
|
||||
&& (component_count == 1 || vkd3d_swizzle_is_equal(val_write_mask, swizzle, write_mask)))
|
||||
@@ -3614,9 +3622,9 @@ static uint32_t spirv_compiler_emit_swizzle(struct spirv_compiler *compiler,
|
||||
|
||||
if (component_count == 1)
|
||||
{
|
||||
- component_idx = vkd3d_write_mask_get_component_idx(write_mask);
|
||||
+ component_idx = vsir_write_mask_get_component_idx(write_mask);
|
||||
component_idx = vkd3d_swizzle_get_component(swizzle, component_idx);
|
||||
- component_idx -= vkd3d_write_mask_get_component_idx(val_write_mask);
|
||||
+ component_idx -= vsir_write_mask_get_component_idx(val_write_mask);
|
||||
return vkd3d_spirv_build_op_composite_extract1(builder, type_id, val_id, component_idx);
|
||||
}
|
||||
|
||||
@@ -3667,9 +3675,9 @@ static uint32_t spirv_compiler_emit_vector_shuffle(struct spirv_compiler *compil
|
||||
}
|
||||
|
||||
static uint32_t spirv_compiler_emit_load_constant(struct spirv_compiler *compiler,
|
||||
- const struct vkd3d_shader_register *reg, DWORD swizzle, DWORD write_mask)
|
||||
+ const struct vkd3d_shader_register *reg, DWORD swizzle, uint32_t write_mask)
|
||||
{
|
||||
- unsigned int component_count = vkd3d_write_mask_component_count(write_mask);
|
||||
+ unsigned int component_count = vsir_write_mask_component_count(write_mask);
|
||||
uint32_t values[VKD3D_VEC4_SIZE] = {0};
|
||||
unsigned int i, j;
|
||||
|
||||
@@ -3694,9 +3702,9 @@ static uint32_t spirv_compiler_emit_load_constant(struct spirv_compiler *compile
|
||||
}
|
||||
|
||||
static uint32_t spirv_compiler_emit_load_constant64(struct spirv_compiler *compiler,
|
||||
- const struct vkd3d_shader_register *reg, DWORD swizzle, DWORD write_mask)
|
||||
+ const struct vkd3d_shader_register *reg, DWORD swizzle, uint32_t write_mask)
|
||||
{
|
||||
- unsigned int component_count = vkd3d_write_mask_component_count(write_mask);
|
||||
+ unsigned int component_count = vsir_write_mask_component_count(write_mask);
|
||||
uint64_t values[VKD3D_DVEC2_SIZE] = {0};
|
||||
unsigned int i, j;
|
||||
|
||||
@@ -3721,9 +3729,9 @@ static uint32_t spirv_compiler_emit_load_constant64(struct spirv_compiler *compi
|
||||
}
|
||||
|
||||
static uint32_t spirv_compiler_emit_load_undef(struct spirv_compiler *compiler,
|
||||
- const struct vkd3d_shader_register *reg, DWORD write_mask)
|
||||
+ const struct vkd3d_shader_register *reg, uint32_t write_mask)
|
||||
{
|
||||
- unsigned int component_count = vkd3d_write_mask_component_count(write_mask);
|
||||
+ unsigned int component_count = vsir_write_mask_component_count(write_mask);
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
uint32_t type_id;
|
||||
|
||||
@@ -3734,28 +3742,28 @@ static uint32_t spirv_compiler_emit_load_undef(struct spirv_compiler *compiler,
|
||||
}
|
||||
|
||||
static uint32_t spirv_compiler_emit_load_scalar(struct spirv_compiler *compiler,
|
||||
- const struct vkd3d_shader_register *reg, DWORD swizzle, DWORD write_mask,
|
||||
+ const struct vkd3d_shader_register *reg, DWORD swizzle, uint32_t write_mask,
|
||||
const struct vkd3d_shader_register_info *reg_info)
|
||||
{
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
uint32_t type_id, ptr_type_id, index, reg_id, val_id;
|
||||
unsigned int component_idx, reg_component_count;
|
||||
enum vkd3d_shader_component_type component_type;
|
||||
- unsigned int skipped_component_mask;
|
||||
+ uint32_t skipped_component_mask;
|
||||
|
||||
assert(!register_is_constant_or_undef(reg));
|
||||
- assert(vkd3d_write_mask_component_count(write_mask) == 1);
|
||||
+ assert(vsir_write_mask_component_count(write_mask) == 1);
|
||||
|
||||
- component_idx = vkd3d_write_mask_get_component_idx(write_mask);
|
||||
+ component_idx = vsir_write_mask_get_component_idx(write_mask);
|
||||
component_idx = vkd3d_swizzle_get_component(swizzle, component_idx);
|
||||
skipped_component_mask = ~reg_info->write_mask & ((VKD3DSP_WRITEMASK_0 << component_idx) - 1);
|
||||
if (skipped_component_mask)
|
||||
- component_idx -= vkd3d_write_mask_component_count(skipped_component_mask);
|
||||
+ component_idx -= vsir_write_mask_component_count(skipped_component_mask);
|
||||
component_type = vkd3d_component_type_from_data_type(reg->data_type);
|
||||
|
||||
- reg_component_count = vkd3d_write_mask_component_count(reg_info->write_mask);
|
||||
+ reg_component_count = vsir_write_mask_component_count(reg_info->write_mask);
|
||||
|
||||
- if (component_idx >= vkd3d_write_mask_component_count(reg_info->write_mask))
|
||||
+ if (component_idx >= vsir_write_mask_component_count(reg_info->write_mask))
|
||||
{
|
||||
ERR("Invalid component_idx %u for register %#x, %u (write_mask %#x).\n",
|
||||
component_idx, reg->type, reg->idx[0].offset, reg_info->write_mask);
|
||||
@@ -3894,14 +3902,14 @@ static uint32_t spirv_compiler_emit_load_ssa_reg(struct spirv_compiler *compiler
|
||||
}
|
||||
|
||||
static uint32_t spirv_compiler_emit_load_reg(struct spirv_compiler *compiler,
|
||||
- const struct vkd3d_shader_register *reg, DWORD swizzle, DWORD write_mask)
|
||||
+ const struct vkd3d_shader_register *reg, DWORD swizzle, uint32_t write_mask)
|
||||
{
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
enum vkd3d_shader_component_type component_type;
|
||||
struct vkd3d_shader_register_info reg_info;
|
||||
unsigned int component_count;
|
||||
- unsigned int write_mask32;
|
||||
uint32_t type_id, val_id;
|
||||
+ uint32_t write_mask32;
|
||||
|
||||
if (reg->type == VKD3DSPR_IMMCONST)
|
||||
return spirv_compiler_emit_load_constant(compiler, reg, swizzle, write_mask);
|
||||
@@ -3910,7 +3918,7 @@ static uint32_t spirv_compiler_emit_load_reg(struct spirv_compiler *compiler,
|
||||
else if (reg->type == VKD3DSPR_UNDEF)
|
||||
return spirv_compiler_emit_load_undef(compiler, reg, write_mask);
|
||||
|
||||
- component_count = vkd3d_write_mask_component_count(write_mask);
|
||||
+ component_count = vsir_write_mask_component_count(write_mask);
|
||||
component_type = vkd3d_component_type_from_data_type(reg->data_type);
|
||||
|
||||
if (reg->type == VKD3DSPR_SSA)
|
||||
@@ -3924,21 +3932,21 @@ static uint32_t spirv_compiler_emit_load_reg(struct spirv_compiler *compiler,
|
||||
assert(reg_info.component_type != VKD3D_SHADER_COMPONENT_DOUBLE);
|
||||
spirv_compiler_emit_dereference_register(compiler, reg, ®_info);
|
||||
|
||||
- write_mask32 = (reg->data_type == VKD3D_DATA_DOUBLE) ? vkd3d_write_mask_32_from_64(write_mask) : write_mask;
|
||||
+ write_mask32 = (reg->data_type == VKD3D_DATA_DOUBLE) ? vsir_write_mask_32_from_64(write_mask) : write_mask;
|
||||
|
||||
/* Intermediate value (no storage class). */
|
||||
if (reg_info.storage_class == SpvStorageClassMax)
|
||||
{
|
||||
val_id = reg_info.id;
|
||||
}
|
||||
- else if (vkd3d_write_mask_component_count(write_mask32) == 1)
|
||||
+ else if (vsir_write_mask_component_count(write_mask32) == 1)
|
||||
{
|
||||
return spirv_compiler_emit_load_scalar(compiler, reg, swizzle, write_mask, ®_info);
|
||||
}
|
||||
else
|
||||
{
|
||||
type_id = vkd3d_spirv_get_type_id(builder,
|
||||
- reg_info.component_type, vkd3d_write_mask_component_count(reg_info.write_mask));
|
||||
+ reg_info.component_type, vsir_write_mask_component_count(reg_info.write_mask));
|
||||
val_id = vkd3d_spirv_build_op_load(builder, type_id, reg_info.id, SpvMemoryAccessMaskNone);
|
||||
}
|
||||
|
||||
@@ -4041,19 +4049,19 @@ static uint32_t spirv_compiler_emit_load_src_with_type(struct spirv_compiler *co
|
||||
}
|
||||
|
||||
static void spirv_compiler_emit_store_scalar(struct spirv_compiler *compiler,
|
||||
- uint32_t dst_id, unsigned int dst_write_mask, enum vkd3d_shader_component_type component_type,
|
||||
- SpvStorageClass storage_class, unsigned int write_mask, uint32_t val_id)
|
||||
+ uint32_t dst_id, uint32_t dst_write_mask, enum vkd3d_shader_component_type component_type,
|
||||
+ SpvStorageClass storage_class, uint32_t write_mask, uint32_t val_id)
|
||||
{
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
uint32_t type_id, ptr_type_id, index;
|
||||
unsigned int component_idx;
|
||||
|
||||
- if (vkd3d_write_mask_component_count(dst_write_mask) > 1)
|
||||
+ if (vsir_write_mask_component_count(dst_write_mask) > 1)
|
||||
{
|
||||
type_id = vkd3d_spirv_get_type_id(builder, component_type, 1);
|
||||
ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, storage_class, type_id);
|
||||
- component_idx = vkd3d_write_mask_get_component_idx(write_mask);
|
||||
- component_idx -= vkd3d_write_mask_get_component_idx(dst_write_mask);
|
||||
+ component_idx = vsir_write_mask_get_component_idx(write_mask);
|
||||
+ component_idx -= vsir_write_mask_get_component_idx(dst_write_mask);
|
||||
index = spirv_compiler_get_constant_uint(compiler, component_idx);
|
||||
dst_id = vkd3d_spirv_build_op_in_bounds_access_chain1(builder, ptr_type_id, dst_id, index);
|
||||
}
|
||||
@@ -4062,8 +4070,8 @@ static void spirv_compiler_emit_store_scalar(struct spirv_compiler *compiler,
|
||||
}
|
||||
|
||||
static void spirv_compiler_emit_store(struct spirv_compiler *compiler,
|
||||
- uint32_t dst_id, unsigned int dst_write_mask, enum vkd3d_shader_component_type component_type,
|
||||
- SpvStorageClass storage_class, unsigned int write_mask, uint32_t val_id)
|
||||
+ uint32_t dst_id, uint32_t dst_write_mask, enum vkd3d_shader_component_type component_type,
|
||||
+ SpvStorageClass storage_class, uint32_t write_mask, uint32_t val_id)
|
||||
{
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
unsigned int component_count, dst_component_count;
|
||||
@@ -4073,14 +4081,14 @@ static void spirv_compiler_emit_store(struct spirv_compiler *compiler,
|
||||
|
||||
assert(write_mask);
|
||||
|
||||
- component_count = vkd3d_write_mask_component_count(write_mask);
|
||||
- dst_component_count = vkd3d_write_mask_component_count(dst_write_mask);
|
||||
+ component_count = vsir_write_mask_component_count(write_mask);
|
||||
+ dst_component_count = vsir_write_mask_component_count(dst_write_mask);
|
||||
|
||||
if (dst_component_count == 1 && component_count != 1)
|
||||
{
|
||||
type_id = vkd3d_spirv_get_type_id(builder, component_type, 1);
|
||||
val_id = vkd3d_spirv_build_op_composite_extract1(builder, type_id, val_id,
|
||||
- vkd3d_write_mask_get_component_idx(dst_write_mask));
|
||||
+ vsir_write_mask_get_component_idx(dst_write_mask));
|
||||
write_mask &= dst_write_mask;
|
||||
component_count = 1;
|
||||
}
|
||||
@@ -4117,12 +4125,12 @@ static void spirv_compiler_emit_store(struct spirv_compiler *compiler,
|
||||
}
|
||||
|
||||
static void spirv_compiler_emit_store_reg(struct spirv_compiler *compiler,
|
||||
- const struct vkd3d_shader_register *reg, unsigned int write_mask, uint32_t val_id)
|
||||
+ const struct vkd3d_shader_register *reg, uint32_t write_mask, uint32_t val_id)
|
||||
{
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
enum vkd3d_shader_component_type component_type;
|
||||
struct vkd3d_shader_register_info reg_info;
|
||||
- unsigned int src_write_mask = write_mask;
|
||||
+ uint32_t src_write_mask = write_mask;
|
||||
uint32_t type_id;
|
||||
|
||||
assert(!register_is_constant_or_undef(reg));
|
||||
@@ -4141,9 +4149,9 @@ static void spirv_compiler_emit_store_reg(struct spirv_compiler *compiler,
|
||||
if (component_type != reg_info.component_type)
|
||||
{
|
||||
if (reg->data_type == VKD3D_DATA_DOUBLE)
|
||||
- src_write_mask = vkd3d_write_mask_32_from_64(write_mask);
|
||||
+ src_write_mask = vsir_write_mask_32_from_64(write_mask);
|
||||
type_id = vkd3d_spirv_get_type_id(builder, reg_info.component_type,
|
||||
- vkd3d_write_mask_component_count(src_write_mask));
|
||||
+ vsir_write_mask_component_count(src_write_mask));
|
||||
val_id = vkd3d_spirv_build_op_bitcast(builder, type_id, val_id);
|
||||
component_type = reg_info.component_type;
|
||||
}
|
||||
@@ -4153,9 +4161,9 @@ static void spirv_compiler_emit_store_reg(struct spirv_compiler *compiler,
|
||||
}
|
||||
|
||||
static uint32_t spirv_compiler_emit_sat(struct spirv_compiler *compiler,
|
||||
- const struct vkd3d_shader_register *reg, DWORD write_mask, uint32_t val_id)
|
||||
+ const struct vkd3d_shader_register *reg, uint32_t write_mask, uint32_t val_id)
|
||||
{
|
||||
- unsigned int component_count = vkd3d_write_mask_component_count(write_mask);
|
||||
+ unsigned int component_count = vsir_write_mask_component_count(write_mask);
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
uint32_t type_id, zero_id, one_id;
|
||||
|
||||
@@ -4206,7 +4214,7 @@ static void spirv_compiler_emit_store_dst_components(struct spirv_compiler *comp
|
||||
const struct vkd3d_shader_dst_param *dst, enum vkd3d_shader_component_type component_type,
|
||||
uint32_t *component_ids)
|
||||
{
|
||||
- unsigned int component_count = vkd3d_write_mask_component_count(dst->write_mask);
|
||||
+ unsigned int component_count = vsir_write_mask_component_count(dst->write_mask);
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
uint32_t type_id, val_id;
|
||||
|
||||
@@ -4227,11 +4235,11 @@ static void spirv_compiler_emit_store_dst_scalar(struct spirv_compiler *compiler
|
||||
const struct vkd3d_shader_dst_param *dst, uint32_t val_id,
|
||||
enum vkd3d_shader_component_type component_type, DWORD swizzle)
|
||||
{
|
||||
- unsigned int component_count = vkd3d_write_mask_component_count(dst->write_mask);
|
||||
+ unsigned int component_count = vsir_write_mask_component_count(dst->write_mask);
|
||||
uint32_t component_ids[VKD3D_VEC4_SIZE];
|
||||
unsigned int component_idx, i;
|
||||
|
||||
- component_idx = vkd3d_write_mask_get_component_idx(dst->write_mask);
|
||||
+ component_idx = vsir_write_mask_get_component_idx(dst->write_mask);
|
||||
for (i = 0; i < component_count; ++i)
|
||||
{
|
||||
if (vkd3d_swizzle_get_component(swizzle, component_idx + i))
|
||||
@@ -4771,7 +4779,7 @@ static uint32_t spirv_compiler_emit_input(struct spirv_compiler *compiler,
|
||||
enum vkd3d_shader_component_type component_type;
|
||||
const struct vkd3d_spirv_builtin *builtin;
|
||||
enum vkd3d_shader_sysval_semantic sysval;
|
||||
- unsigned int write_mask, reg_write_mask;
|
||||
+ uint32_t write_mask, reg_write_mask;
|
||||
struct vkd3d_symbol *symbol = NULL;
|
||||
uint32_t val_id, input_id, var_id;
|
||||
uint32_t type_id, float_type_id;
|
||||
@@ -4813,8 +4821,8 @@ static uint32_t spirv_compiler_emit_input(struct spirv_compiler *compiler,
|
||||
else
|
||||
{
|
||||
component_type = signature_element->component_type;
|
||||
- input_component_count = vkd3d_write_mask_component_count(signature_element->mask);
|
||||
- component_idx = vkd3d_write_mask_get_component_idx(signature_element->mask);
|
||||
+ input_component_count = vsir_write_mask_component_count(signature_element->mask);
|
||||
+ component_idx = vsir_write_mask_get_component_idx(signature_element->mask);
|
||||
}
|
||||
|
||||
if (needs_private_io_variable(builtin))
|
||||
@@ -4824,7 +4832,7 @@ static uint32_t spirv_compiler_emit_input(struct spirv_compiler *compiler,
|
||||
}
|
||||
else
|
||||
{
|
||||
- component_idx = vkd3d_write_mask_get_component_idx(write_mask);
|
||||
+ component_idx = vsir_write_mask_get_component_idx(write_mask);
|
||||
reg_write_mask = write_mask >> component_idx;
|
||||
}
|
||||
|
||||
@@ -4980,7 +4988,7 @@ static void calculate_clip_or_cull_distance_mask(const struct signature_element
|
||||
return;
|
||||
}
|
||||
|
||||
- write_mask = e->mask >> vkd3d_write_mask_get_component_idx(e->mask);
|
||||
+ write_mask = e->mask >> vsir_write_mask_get_component_idx(e->mask);
|
||||
*mask |= (write_mask & VKD3DSP_WRITEMASK_ALL) << (VKD3D_VEC4_SIZE * e->semantic_index);
|
||||
}
|
||||
|
||||
@@ -5118,7 +5126,7 @@ static void spirv_compiler_emit_output(struct spirv_compiler *compiler,
|
||||
const struct shader_signature *shader_signature;
|
||||
const struct vkd3d_spirv_builtin *builtin;
|
||||
enum vkd3d_shader_sysval_semantic sysval;
|
||||
- unsigned int write_mask, reg_write_mask;
|
||||
+ uint32_t write_mask, reg_write_mask;
|
||||
bool use_private_variable = false;
|
||||
struct vkd3d_symbol reg_symbol;
|
||||
SpvStorageClass storage_class;
|
||||
@@ -5144,8 +5152,8 @@ static void spirv_compiler_emit_output(struct spirv_compiler *compiler,
|
||||
|
||||
write_mask = signature_element->mask;
|
||||
|
||||
- component_idx = vkd3d_write_mask_get_component_idx(write_mask);
|
||||
- output_component_count = vkd3d_write_mask_component_count(write_mask);
|
||||
+ component_idx = vsir_write_mask_get_component_idx(write_mask);
|
||||
+ output_component_count = vsir_write_mask_component_count(write_mask);
|
||||
if (builtin)
|
||||
{
|
||||
component_type = builtin->component_type;
|
||||
@@ -5285,9 +5293,9 @@ static uint32_t spirv_compiler_get_output_array_index(struct spirv_compiler *com
|
||||
static void spirv_compiler_emit_store_shader_output(struct spirv_compiler *compiler,
|
||||
const struct shader_signature *signature, const struct signature_element *output,
|
||||
const struct vkd3d_shader_output_info *output_info,
|
||||
- uint32_t output_index_id, uint32_t val_id, unsigned int write_mask)
|
||||
+ uint32_t output_index_id, uint32_t val_id, uint32_t write_mask)
|
||||
{
|
||||
- unsigned int dst_write_mask, use_mask, uninit_mask, swizzle, mask;
|
||||
+ uint32_t dst_write_mask, use_mask, uninit_mask, swizzle, mask;
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
uint32_t type_id, zero_id, ptr_type_id, chain_id, object_id;
|
||||
const struct signature_element *element;
|
||||
@@ -5309,7 +5317,7 @@ static void spirv_compiler_emit_store_shader_output(struct spirv_compiler *compi
|
||||
use_mask |= element->used_mask;
|
||||
}
|
||||
}
|
||||
- index = vkd3d_write_mask_get_component_idx(output->mask);
|
||||
+ index = vsir_write_mask_get_component_idx(output->mask);
|
||||
dst_write_mask >>= index;
|
||||
use_mask >>= index;
|
||||
write_mask &= dst_write_mask;
|
||||
@@ -5333,7 +5341,7 @@ static void spirv_compiler_emit_store_shader_output(struct spirv_compiler *compi
|
||||
output_info->component_type, VKD3D_VEC4_SIZE, 0);
|
||||
val_id = spirv_compiler_emit_vector_shuffle(compiler,
|
||||
zero_id, val_id, swizzle, uninit_mask, output_info->component_type,
|
||||
- vkd3d_write_mask_component_count(write_mask));
|
||||
+ vsir_write_mask_component_count(write_mask));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -5345,7 +5353,7 @@ static void spirv_compiler_emit_store_shader_output(struct spirv_compiler *compi
|
||||
if (output_index_id)
|
||||
{
|
||||
type_id = vkd3d_spirv_get_type_id(builder,
|
||||
- output_info->component_type, vkd3d_write_mask_component_count(dst_write_mask));
|
||||
+ output_info->component_type, vsir_write_mask_component_count(dst_write_mask));
|
||||
ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, SpvStorageClassOutput, type_id);
|
||||
output_id = vkd3d_spirv_build_op_access_chain1(builder, ptr_type_id, output_id, output_index_id);
|
||||
}
|
||||
@@ -6553,7 +6561,7 @@ static void spirv_compiler_emit_default_control_point_phase(struct spirv_compile
|
||||
spirv_compiler_get_register_info(compiler, &output_reg, &output_reg_info);
|
||||
|
||||
component_type = output->component_type;
|
||||
- component_count = vkd3d_write_mask_component_count(output->mask);
|
||||
+ component_count = vsir_write_mask_component_count(output->mask);
|
||||
type_id = vkd3d_spirv_get_type_id(builder, component_type, component_count);
|
||||
output_ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, SpvStorageClassOutput, type_id);
|
||||
|
||||
@@ -6788,7 +6796,7 @@ static enum vkd3d_result spirv_compiler_emit_alu_instruction(struct spirv_compil
|
||||
|| instruction->handler_idx == VKD3DSIH_ISHR || instruction->handler_idx == VKD3DSIH_USHR))
|
||||
{
|
||||
uint32_t mask_id = spirv_compiler_get_constant_vector(compiler,
|
||||
- VKD3D_SHADER_COMPONENT_UINT, vkd3d_write_mask_component_count(dst->write_mask), 0x1f);
|
||||
+ VKD3D_SHADER_COMPONENT_UINT, vsir_write_mask_component_count(dst->write_mask), 0x1f);
|
||||
src_ids[1] = vkd3d_spirv_build_op_and(builder, type_id, src_ids[1], mask_id);
|
||||
}
|
||||
|
||||
@@ -6918,7 +6926,7 @@ static void spirv_compiler_emit_mov(struct spirv_compiler *compiler,
|
||||
return;
|
||||
}
|
||||
|
||||
- component_count = vkd3d_write_mask_component_count(dst->write_mask);
|
||||
+ component_count = vsir_write_mask_component_count(dst->write_mask);
|
||||
if (component_count != 1 && component_count != VKD3D_VEC4_SIZE
|
||||
&& dst_reg_info.write_mask == VKD3DSP_WRITEMASK_ALL)
|
||||
{
|
||||
@@ -6949,7 +6957,7 @@ general_implementation:
|
||||
if (dst->reg.data_type != src->reg.data_type)
|
||||
{
|
||||
val_id = vkd3d_spirv_build_op_bitcast(builder, vkd3d_spirv_get_type_id_for_data_type(builder,
|
||||
- dst->reg.data_type, vkd3d_write_mask_component_count(dst->write_mask)), val_id);
|
||||
+ dst->reg.data_type, vsir_write_mask_component_count(dst->write_mask)), val_id);
|
||||
}
|
||||
spirv_compiler_emit_store_dst(compiler, dst, val_id);
|
||||
}
|
||||
@@ -6967,7 +6975,7 @@ static void spirv_compiler_emit_movc(struct spirv_compiler *compiler,
|
||||
src1_id = spirv_compiler_emit_load_src(compiler, &src[1], dst->write_mask);
|
||||
src2_id = spirv_compiler_emit_load_src(compiler, &src[2], dst->write_mask);
|
||||
|
||||
- component_count = vkd3d_write_mask_component_count(dst->write_mask);
|
||||
+ component_count = vsir_write_mask_component_count(dst->write_mask);
|
||||
type_id = spirv_compiler_get_type_id_for_dst(compiler, dst);
|
||||
|
||||
if (src[0].reg.data_type != VKD3D_DATA_BOOL)
|
||||
@@ -6993,7 +7001,7 @@ static void spirv_compiler_emit_swapc(struct spirv_compiler *compiler,
|
||||
src1_id = spirv_compiler_emit_load_src(compiler, &src[1], dst->write_mask);
|
||||
src2_id = spirv_compiler_emit_load_src(compiler, &src[2], dst->write_mask);
|
||||
|
||||
- component_count = vkd3d_write_mask_component_count(dst->write_mask);
|
||||
+ component_count = vsir_write_mask_component_count(dst->write_mask);
|
||||
type_id = vkd3d_spirv_get_type_id(builder, VKD3D_SHADER_COMPONENT_FLOAT, component_count);
|
||||
|
||||
condition_id = spirv_compiler_emit_int_to_bool(compiler,
|
||||
@@ -7016,7 +7024,7 @@ static void spirv_compiler_emit_dot(struct spirv_compiler *compiler,
|
||||
unsigned int component_count, i;
|
||||
DWORD write_mask;
|
||||
|
||||
- component_count = vkd3d_write_mask_component_count(dst->write_mask);
|
||||
+ component_count = vsir_write_mask_component_count(dst->write_mask);
|
||||
component_type = vkd3d_component_type_from_data_type(dst->reg.data_type);
|
||||
|
||||
if (instruction->handler_idx == VKD3DSIH_DP4)
|
||||
@@ -7054,7 +7062,7 @@ static void spirv_compiler_emit_rcp(struct spirv_compiler *compiler,
|
||||
uint32_t type_id, src_id, val_id, div_id;
|
||||
unsigned int component_count;
|
||||
|
||||
- component_count = vkd3d_write_mask_component_count(dst->write_mask);
|
||||
+ component_count = vsir_write_mask_component_count(dst->write_mask);
|
||||
type_id = spirv_compiler_get_type_id_for_dst(compiler, dst);
|
||||
|
||||
src_id = spirv_compiler_emit_load_src(compiler, src, dst->write_mask);
|
||||
@@ -7134,7 +7142,7 @@ static void spirv_compiler_emit_imad(struct spirv_compiler *compiler,
|
||||
uint32_t type_id, val_id, src_ids[3];
|
||||
unsigned int i, component_count;
|
||||
|
||||
- component_count = vkd3d_write_mask_component_count(dst->write_mask);
|
||||
+ component_count = vsir_write_mask_component_count(dst->write_mask);
|
||||
type_id = vkd3d_spirv_get_type_id(builder, VKD3D_SHADER_COMPONENT_INT, component_count);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(src_ids); ++i)
|
||||
@@ -7168,7 +7176,7 @@ static void spirv_compiler_emit_int_div(struct spirv_compiler *compiler,
|
||||
|
||||
if (dst[0].reg.type != VKD3DSPR_NULL)
|
||||
{
|
||||
- component_count = vkd3d_write_mask_component_count(dst[0].write_mask);
|
||||
+ component_count = vsir_write_mask_component_count(dst[0].write_mask);
|
||||
type_id = spirv_compiler_get_type_id_for_dst(compiler, &dst[0]);
|
||||
|
||||
src0_id = spirv_compiler_emit_load_src(compiler, &src[0], dst[0].write_mask);
|
||||
@@ -7190,7 +7198,7 @@ static void spirv_compiler_emit_int_div(struct spirv_compiler *compiler,
|
||||
{
|
||||
if (!component_count || dst[0].write_mask != dst[1].write_mask)
|
||||
{
|
||||
- component_count = vkd3d_write_mask_component_count(dst[1].write_mask);
|
||||
+ component_count = vsir_write_mask_component_count(dst[1].write_mask);
|
||||
type_id = spirv_compiler_get_type_id_for_dst(compiler, &dst[1]);
|
||||
|
||||
src0_id = spirv_compiler_emit_load_src(compiler, &src[0], dst[1].write_mask);
|
||||
@@ -7228,7 +7236,7 @@ static void spirv_compiler_emit_ftoi(struct spirv_compiler *compiler,
|
||||
* as a signed integer, but Direct3D expects the result to saturate,
|
||||
* and for NaN to yield zero. */
|
||||
|
||||
- component_count = vkd3d_write_mask_component_count(dst->write_mask);
|
||||
+ component_count = vsir_write_mask_component_count(dst->write_mask);
|
||||
src_type_id = spirv_compiler_get_type_id_for_reg(compiler, &src->reg, dst->write_mask);
|
||||
dst_type_id = spirv_compiler_get_type_id_for_dst(compiler, dst);
|
||||
src_id = spirv_compiler_emit_load_src(compiler, src, dst->write_mask);
|
||||
@@ -7281,7 +7289,7 @@ static void spirv_compiler_emit_ftou(struct spirv_compiler *compiler,
|
||||
* as an unsigned integer, but Direct3D expects the result to saturate,
|
||||
* and for NaN to yield zero. */
|
||||
|
||||
- component_count = vkd3d_write_mask_component_count(dst->write_mask);
|
||||
+ component_count = vsir_write_mask_component_count(dst->write_mask);
|
||||
src_type_id = spirv_compiler_get_type_id_for_reg(compiler, &src->reg, dst->write_mask);
|
||||
dst_type_id = spirv_compiler_get_type_id_for_dst(compiler, dst);
|
||||
src_id = spirv_compiler_emit_load_src(compiler, src, dst->write_mask);
|
||||
@@ -7468,7 +7476,7 @@ static void spirv_compiler_emit_comparison_instruction(struct spirv_compiler *co
|
||||
return;
|
||||
}
|
||||
|
||||
- component_count = vkd3d_write_mask_component_count(dst->write_mask);
|
||||
+ component_count = vsir_write_mask_component_count(dst->write_mask);
|
||||
|
||||
src0_id = spirv_compiler_emit_load_src(compiler, &src[0], dst->write_mask);
|
||||
src1_id = spirv_compiler_emit_load_src(compiler, &src[1], dst->write_mask);
|
||||
@@ -8621,7 +8629,7 @@ static void spirv_compiler_emit_store_uav_raw_structured(struct spirv_compiler *
|
||||
assert(data->reg.data_type == VKD3D_DATA_UINT);
|
||||
val_id = spirv_compiler_emit_load_src(compiler, data, dst->write_mask);
|
||||
|
||||
- component_count = vkd3d_write_mask_component_count(dst->write_mask);
|
||||
+ component_count = vsir_write_mask_component_count(dst->write_mask);
|
||||
for (component_idx = 0; component_idx < component_count; ++component_idx)
|
||||
{
|
||||
data_id = component_count > 1 ?
|
||||
@@ -8650,7 +8658,7 @@ static void spirv_compiler_emit_store_uav_raw_structured(struct spirv_compiler *
|
||||
assert(data->reg.data_type == VKD3D_DATA_UINT);
|
||||
val_id = spirv_compiler_emit_load_src(compiler, data, dst->write_mask);
|
||||
|
||||
- component_count = vkd3d_write_mask_component_count(dst->write_mask);
|
||||
+ component_count = vsir_write_mask_component_count(dst->write_mask);
|
||||
for (component_idx = 0; component_idx < component_count; ++component_idx)
|
||||
{
|
||||
/* Mesa Vulkan drivers require the texel parameter to be a vector. */
|
||||
@@ -8694,7 +8702,7 @@ static void spirv_compiler_emit_store_tgsm(struct spirv_compiler *compiler,
|
||||
assert(data->reg.data_type == VKD3D_DATA_UINT);
|
||||
val_id = spirv_compiler_emit_load_src(compiler, data, dst->write_mask);
|
||||
|
||||
- component_count = vkd3d_write_mask_component_count(dst->write_mask);
|
||||
+ component_count = vsir_write_mask_component_count(dst->write_mask);
|
||||
for (component_idx = 0; component_idx < component_count; ++component_idx)
|
||||
{
|
||||
data_id = component_count > 1 ?
|
||||
@@ -9356,7 +9364,7 @@ static void spirv_compiler_emit_eval_attrib(struct spirv_compiler *compiler,
|
||||
}
|
||||
|
||||
type_id = vkd3d_spirv_get_type_id(builder, VKD3D_SHADER_COMPONENT_FLOAT,
|
||||
- vkd3d_write_mask_component_count(register_info.write_mask));
|
||||
+ vsir_write_mask_component_count(register_info.write_mask));
|
||||
|
||||
instr_set_id = vkd3d_spirv_get_glsl_std450_instr_set(builder);
|
||||
val_id = vkd3d_spirv_build_op_ext_inst(builder, type_id, instr_set_id, op, src_ids, src_count);
|
||||
@@ -9977,11 +9985,28 @@ static int spirv_compiler_generate_spirv(struct spirv_compiler *compiler,
|
||||
if (!vkd3d_spirv_compile_module(builder, spirv, spirv_compiler_get_entry_point_name(compiler)))
|
||||
return VKD3D_ERROR;
|
||||
|
||||
- if (TRACE_ON())
|
||||
+ if (TRACE_ON() || parser->config_flags & VKD3D_SHADER_CONFIG_FLAG_FORCE_VALIDATION)
|
||||
{
|
||||
enum vkd3d_shader_spirv_environment environment = spirv_compiler_get_target_environment(compiler);
|
||||
- vkd3d_spirv_dump(spirv, environment);
|
||||
- vkd3d_spirv_validate(spirv, environment);
|
||||
+ struct vkd3d_string_buffer buffer;
|
||||
+
|
||||
+ if (TRACE_ON())
|
||||
+ vkd3d_spirv_dump(spirv, environment);
|
||||
+
|
||||
+ vkd3d_string_buffer_init(&buffer);
|
||||
+ if (!vkd3d_spirv_validate(&buffer, spirv, environment))
|
||||
+ {
|
||||
+ FIXME("Failed to validate SPIR-V binary.\n");
|
||||
+ vkd3d_shader_trace_text(buffer.buffer, buffer.content_size);
|
||||
+
|
||||
+ if (compiler->config_flags & VKD3D_SHADER_CONFIG_FLAG_FORCE_VALIDATION)
|
||||
+ {
|
||||
+ spirv_compiler_error(compiler, VKD3D_SHADER_ERROR_SPV_INVALID_SHADER,
|
||||
+ "Execution generated an invalid shader, failing compilation:\n%s",
|
||||
+ buffer.buffer);
|
||||
+ }
|
||||
+ }
|
||||
+ vkd3d_string_buffer_cleanup(&buffer);
|
||||
}
|
||||
|
||||
if (compiler->failed)
|
||||
@@ -10008,7 +10033,7 @@ int spirv_compile(struct vkd3d_shader_parser *parser,
|
||||
int ret;
|
||||
|
||||
if (!(spirv_compiler = spirv_compiler_create(&parser->shader_version, &parser->shader_desc,
|
||||
- compile_info, scan_descriptor_info, message_context, &parser->location)))
|
||||
+ compile_info, scan_descriptor_info, message_context, &parser->location, parser->config_flags)))
|
||||
{
|
||||
ERR("Failed to create SPIR-V compiler.\n");
|
||||
return VKD3D_ERROR;
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/tpf.c b/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
||||
index 1b009c13016..235e855223f 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
||||
@@ -920,10 +920,11 @@ static void shader_sm4_read_dcl_index_range(struct vkd3d_shader_instruction *ins
|
||||
uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv)
|
||||
{
|
||||
struct vkd3d_shader_index_range *index_range = &ins->declaration.index_range;
|
||||
- unsigned int i, register_idx, register_count, write_mask;
|
||||
+ unsigned int i, register_idx, register_count;
|
||||
enum vkd3d_shader_register_type type;
|
||||
struct sm4_index_range_array *ranges;
|
||||
unsigned int *io_masks;
|
||||
+ uint32_t write_mask;
|
||||
|
||||
shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], VKD3D_DATA_OPAQUE,
|
||||
&index_range->dst);
|
||||
@@ -933,7 +934,7 @@ static void shader_sm4_read_dcl_index_range(struct vkd3d_shader_instruction *ins
|
||||
register_count = index_range->register_count;
|
||||
write_mask = index_range->dst.write_mask;
|
||||
|
||||
- if (vkd3d_write_mask_component_count(write_mask) != 1)
|
||||
+ if (vsir_write_mask_component_count(write_mask) != 1)
|
||||
{
|
||||
WARN("Unhandled write mask %#x.\n", write_mask);
|
||||
vkd3d_shader_parser_warning(&priv->p, VKD3D_SHADER_WARNING_TPF_UNHANDLED_INDEX_RANGE_MASK,
|
||||
@@ -2230,7 +2231,7 @@ static bool shader_sm4_read_dst_param(struct vkd3d_shader_sm4_parser *priv, cons
|
||||
}
|
||||
|
||||
if (data_type == VKD3D_DATA_DOUBLE)
|
||||
- dst_param->write_mask = vkd3d_write_mask_64_from_32(dst_param->write_mask);
|
||||
+ dst_param->write_mask = vsir_write_mask_64_from_32(dst_param->write_mask);
|
||||
/* Some scalar registers are declared with no write mask in shader bytecode. */
|
||||
if (!dst_param->write_mask && shader_sm4_is_scalar_register(&dst_param->reg))
|
||||
dst_param->write_mask = VKD3DSP_WRITEMASK_0;
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
||||
index 0e8d75d9897..6fa57a111bb 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
||||
@@ -96,6 +96,7 @@ enum vkd3d_shader_error
|
||||
VKD3D_SHADER_ERROR_SPV_INVALID_TYPE = 2006,
|
||||
VKD3D_SHADER_ERROR_SPV_INVALID_HANDLER = 2007,
|
||||
VKD3D_SHADER_ERROR_SPV_NOT_IMPLEMENTED = 2008,
|
||||
+ VKD3D_SHADER_ERROR_SPV_INVALID_SHADER = 2009,
|
||||
|
||||
VKD3D_SHADER_WARNING_SPV_INVALID_SWIZZLE = 2300,
|
||||
|
||||
@@ -1515,7 +1516,7 @@ static inline enum vkd3d_shader_input_sysval_semantic vkd3d_siv_from_sysval(enum
|
||||
return vkd3d_siv_from_sysval_indexed(sysval, 0);
|
||||
}
|
||||
|
||||
-static inline unsigned int vkd3d_write_mask_get_component_idx(DWORD write_mask)
|
||||
+static inline unsigned int vsir_write_mask_get_component_idx(uint32_t write_mask)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
@@ -1530,7 +1531,7 @@ static inline unsigned int vkd3d_write_mask_get_component_idx(DWORD write_mask)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static inline unsigned int vkd3d_write_mask_component_count(DWORD write_mask)
|
||||
+static inline unsigned int vsir_write_mask_component_count(uint32_t write_mask)
|
||||
{
|
||||
unsigned int count = vkd3d_popcount(write_mask & VKD3DSP_WRITEMASK_ALL);
|
||||
assert(1 <= count && count <= VKD3D_VEC4_SIZE);
|
||||
@@ -1543,15 +1544,15 @@ static inline unsigned int vkd3d_write_mask_from_component_count(unsigned int co
|
||||
return (VKD3DSP_WRITEMASK_0 << component_count) - 1;
|
||||
}
|
||||
|
||||
-static inline unsigned int vkd3d_write_mask_64_from_32(DWORD write_mask32)
|
||||
+static inline uint32_t vsir_write_mask_64_from_32(uint32_t write_mask32)
|
||||
{
|
||||
- unsigned int write_mask64 = write_mask32 | (write_mask32 >> 1);
|
||||
+ uint32_t write_mask64 = write_mask32 | (write_mask32 >> 1);
|
||||
return (write_mask64 & VKD3DSP_WRITEMASK_0) | ((write_mask64 & VKD3DSP_WRITEMASK_2) >> 1);
|
||||
}
|
||||
|
||||
-static inline unsigned int vkd3d_write_mask_32_from_64(unsigned int write_mask64)
|
||||
+static inline uint32_t vsir_write_mask_32_from_64(uint32_t write_mask64)
|
||||
{
|
||||
- unsigned int write_mask32 = (write_mask64 | (write_mask64 << 1))
|
||||
+ uint32_t write_mask32 = (write_mask64 | (write_mask64 << 1))
|
||||
& (VKD3DSP_WRITEMASK_0 | VKD3DSP_WRITEMASK_2);
|
||||
return write_mask32 | (write_mask32 << 1);
|
||||
}
|
||||
diff --git a/libs/vkd3d/libs/vkd3d/state.c b/libs/vkd3d/libs/vkd3d/state.c
|
||||
index fc3187f4bea..9a039452c99 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d/state.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d/state.c
|
||||
@@ -515,7 +515,7 @@ static HRESULT d3d12_root_signature_init_push_constants(struct d3d12_root_signat
|
||||
assert(p->ShaderVisibility <= D3D12_SHADER_VISIBILITY_PIXEL);
|
||||
push_constants[p->ShaderVisibility].stageFlags = use_vk_heaps ? VK_SHADER_STAGE_ALL
|
||||
: stage_flags_from_visibility(p->ShaderVisibility);
|
||||
- push_constants[p->ShaderVisibility].size += p->u.Constants.Num32BitValues * sizeof(uint32_t);
|
||||
+ push_constants[p->ShaderVisibility].size += align(p->u.Constants.Num32BitValues, 4) * sizeof(uint32_t);
|
||||
}
|
||||
if (push_constants[D3D12_SHADER_VISIBILITY_ALL].size)
|
||||
{
|
||||
@@ -564,7 +564,7 @@ static HRESULT d3d12_root_signature_init_push_constants(struct d3d12_root_signat
|
||||
|
||||
idx = push_constant_count == 1 ? 0 : p->ShaderVisibility;
|
||||
offset = push_constants_offset[idx];
|
||||
- push_constants_offset[idx] += p->u.Constants.Num32BitValues * sizeof(uint32_t);
|
||||
+ push_constants_offset[idx] += align(p->u.Constants.Num32BitValues, 4) * sizeof(uint32_t);
|
||||
|
||||
root_signature->parameters[i].parameter_type = p->ParameterType;
|
||||
root_constant->stage_flags = push_constant_count == 1
|
||||
--
|
||||
2.43.0
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,819 +0,0 @@
|
||||
From 69aefad3adb6facfe89d9347d333da1c7603d8ac Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Sat, 16 Dec 2023 09:37:22 +1100
|
||||
Subject: [PATCH] Updated vkd3d to f96a791807701a4583e6c613c2f5bd47c00ea767.
|
||||
|
||||
---
|
||||
libs/vkd3d/libs/vkd3d-shader/d3d_asm.c | 8 +-
|
||||
libs/vkd3d/libs/vkd3d-shader/d3dbc.c | 10 +-
|
||||
libs/vkd3d/libs/vkd3d-shader/ir.c | 4 +-
|
||||
libs/vkd3d/libs/vkd3d-shader/spirv.c | 54 ++++-----
|
||||
libs/vkd3d/libs/vkd3d-shader/tpf.c | 18 +--
|
||||
.../libs/vkd3d-shader/vkd3d_shader_main.c | 29 +++--
|
||||
.../libs/vkd3d-shader/vkd3d_shader_private.h | 10 +-
|
||||
libs/vkd3d/libs/vkd3d/command.c | 4 +
|
||||
libs/vkd3d/libs/vkd3d/device.c | 114 +++++++++++++++++-
|
||||
libs/vkd3d/libs/vkd3d/resource.c | 19 ++-
|
||||
libs/vkd3d/libs/vkd3d/state.c | 12 +-
|
||||
libs/vkd3d/libs/vkd3d/vkd3d_private.h | 23 +++-
|
||||
12 files changed, 220 insertions(+), 85 deletions(-)
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/d3d_asm.c b/libs/vkd3d/libs/vkd3d-shader/d3d_asm.c
|
||||
index 86ddd1ffded..ac1c41f96e2 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/d3d_asm.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/d3d_asm.c
|
||||
@@ -1381,10 +1381,10 @@ static void shader_dump_src_param(struct vkd3d_d3d_asm_compiler *compiler,
|
||||
if (param->reg.type != VKD3DSPR_IMMCONST && param->reg.type != VKD3DSPR_IMMCONST64
|
||||
&& param->reg.dimension == VSIR_DIMENSION_VEC4)
|
||||
{
|
||||
- unsigned int swizzle_x = vkd3d_swizzle_get_component(swizzle, 0);
|
||||
- unsigned int swizzle_y = vkd3d_swizzle_get_component(swizzle, 1);
|
||||
- unsigned int swizzle_z = vkd3d_swizzle_get_component(swizzle, 2);
|
||||
- unsigned int swizzle_w = vkd3d_swizzle_get_component(swizzle, 3);
|
||||
+ unsigned int swizzle_x = vsir_swizzle_get_component(swizzle, 0);
|
||||
+ unsigned int swizzle_y = vsir_swizzle_get_component(swizzle, 1);
|
||||
+ unsigned int swizzle_z = vsir_swizzle_get_component(swizzle, 2);
|
||||
+ unsigned int swizzle_w = vsir_swizzle_get_component(swizzle, 3);
|
||||
|
||||
static const char swizzle_chars[] = "xyzw";
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
||||
index c78ffebac69..d40ea4b5942 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
||||
@@ -1063,12 +1063,12 @@ static void shader_sm1_validate_instruction(struct vkd3d_shader_sm1_parser *sm1,
|
||||
}
|
||||
}
|
||||
|
||||
-static unsigned int mask_from_swizzle(unsigned int swizzle)
|
||||
+static unsigned int mask_from_swizzle(uint32_t swizzle)
|
||||
{
|
||||
- return (1u << vkd3d_swizzle_get_component(swizzle, 0))
|
||||
- | (1u << vkd3d_swizzle_get_component(swizzle, 1))
|
||||
- | (1u << vkd3d_swizzle_get_component(swizzle, 2))
|
||||
- | (1u << vkd3d_swizzle_get_component(swizzle, 3));
|
||||
+ return (1u << vsir_swizzle_get_component(swizzle, 0))
|
||||
+ | (1u << vsir_swizzle_get_component(swizzle, 1))
|
||||
+ | (1u << vsir_swizzle_get_component(swizzle, 2))
|
||||
+ | (1u << vsir_swizzle_get_component(swizzle, 3));
|
||||
}
|
||||
|
||||
static void shader_sm1_read_instruction(struct vkd3d_shader_sm1_parser *sm1, struct vkd3d_shader_instruction *ins)
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/ir.c b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
index 1a569619707..a0b5ea27698 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
@@ -1002,7 +1002,7 @@ static void shader_src_param_io_normalise(struct vkd3d_shader_src_param *src_par
|
||||
|
||||
id_idx = reg->idx_count - 1;
|
||||
reg_idx = reg->idx[id_idx].offset;
|
||||
- write_mask = VKD3DSP_WRITEMASK_0 << vkd3d_swizzle_get_component(src_param->swizzle, 0);
|
||||
+ write_mask = VKD3DSP_WRITEMASK_0 << vsir_swizzle_get_component(src_param->swizzle, 0);
|
||||
element_idx = shader_signature_find_element_for_reg(signature, reg_idx, write_mask);
|
||||
|
||||
e = &signature->elements[element_idx];
|
||||
@@ -1014,7 +1014,7 @@ static void shader_src_param_io_normalise(struct vkd3d_shader_src_param *src_par
|
||||
if ((component_idx = vsir_write_mask_get_component_idx(e->mask)))
|
||||
{
|
||||
for (i = 0; i < VKD3D_VEC4_SIZE; ++i)
|
||||
- if (vkd3d_swizzle_get_component(src_param->swizzle, i))
|
||||
+ if (vsir_swizzle_get_component(src_param->swizzle, i))
|
||||
src_param->swizzle -= component_idx << VKD3D_SHADER_SWIZZLE_SHIFT(i);
|
||||
}
|
||||
}
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/spirv.c b/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
index 5c537598e1e..f77bc25329d 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
@@ -3595,17 +3595,17 @@ static bool vkd3d_swizzle_is_equal(unsigned int dst_write_mask,
|
||||
return vkd3d_compact_swizzle(VKD3D_SHADER_NO_SWIZZLE, dst_write_mask) == vkd3d_compact_swizzle(swizzle, write_mask);
|
||||
}
|
||||
|
||||
-static bool vkd3d_swizzle_is_scalar(unsigned int swizzle)
|
||||
+static bool vkd3d_swizzle_is_scalar(uint32_t swizzle)
|
||||
{
|
||||
- unsigned int component_idx = vkd3d_swizzle_get_component(swizzle, 0);
|
||||
- return vkd3d_swizzle_get_component(swizzle, 1) == component_idx
|
||||
- && vkd3d_swizzle_get_component(swizzle, 2) == component_idx
|
||||
- && vkd3d_swizzle_get_component(swizzle, 3) == component_idx;
|
||||
+ unsigned int component_idx = vsir_swizzle_get_component(swizzle, 0);
|
||||
+ return vsir_swizzle_get_component(swizzle, 1) == component_idx
|
||||
+ && vsir_swizzle_get_component(swizzle, 2) == component_idx
|
||||
+ && vsir_swizzle_get_component(swizzle, 3) == component_idx;
|
||||
}
|
||||
|
||||
static uint32_t spirv_compiler_emit_swizzle(struct spirv_compiler *compiler,
|
||||
uint32_t val_id, uint32_t val_write_mask, enum vkd3d_shader_component_type component_type,
|
||||
- unsigned int swizzle, uint32_t write_mask)
|
||||
+ uint32_t swizzle, uint32_t write_mask)
|
||||
{
|
||||
unsigned int i, component_idx, component_count, val_component_count;
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
@@ -3623,7 +3623,7 @@ static uint32_t spirv_compiler_emit_swizzle(struct spirv_compiler *compiler,
|
||||
if (component_count == 1)
|
||||
{
|
||||
component_idx = vsir_write_mask_get_component_idx(write_mask);
|
||||
- component_idx = vkd3d_swizzle_get_component(swizzle, component_idx);
|
||||
+ component_idx = vsir_swizzle_get_component(swizzle, component_idx);
|
||||
component_idx -= vsir_write_mask_get_component_idx(val_write_mask);
|
||||
return vkd3d_spirv_build_op_composite_extract1(builder, type_id, val_id, component_idx);
|
||||
}
|
||||
@@ -3634,7 +3634,7 @@ static uint32_t spirv_compiler_emit_swizzle(struct spirv_compiler *compiler,
|
||||
{
|
||||
if (write_mask & (VKD3DSP_WRITEMASK_0 << i))
|
||||
{
|
||||
- assert(VKD3DSP_WRITEMASK_0 << vkd3d_swizzle_get_component(swizzle, i) == val_write_mask);
|
||||
+ assert(VKD3DSP_WRITEMASK_0 << vsir_swizzle_get_component(swizzle, i) == val_write_mask);
|
||||
components[component_idx++] = val_id;
|
||||
}
|
||||
}
|
||||
@@ -3644,14 +3644,14 @@ static uint32_t spirv_compiler_emit_swizzle(struct spirv_compiler *compiler,
|
||||
for (i = 0, component_idx = 0; i < VKD3D_VEC4_SIZE; ++i)
|
||||
{
|
||||
if (write_mask & (VKD3DSP_WRITEMASK_0 << i))
|
||||
- components[component_idx++] = vkd3d_swizzle_get_component(swizzle, i);
|
||||
+ components[component_idx++] = vsir_swizzle_get_component(swizzle, i);
|
||||
}
|
||||
return vkd3d_spirv_build_op_vector_shuffle(builder,
|
||||
type_id, val_id, val_id, components, component_count);
|
||||
}
|
||||
|
||||
static uint32_t spirv_compiler_emit_vector_shuffle(struct spirv_compiler *compiler,
|
||||
- uint32_t vector1_id, uint32_t vector2_id, unsigned int swizzle, unsigned int write_mask,
|
||||
+ uint32_t vector1_id, uint32_t vector2_id, uint32_t swizzle, uint32_t write_mask,
|
||||
enum vkd3d_shader_component_type component_type, unsigned int component_count)
|
||||
{
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
@@ -3664,9 +3664,9 @@ static uint32_t spirv_compiler_emit_vector_shuffle(struct spirv_compiler *compil
|
||||
for (i = 0; i < component_count; ++i)
|
||||
{
|
||||
if (write_mask & (VKD3DSP_WRITEMASK_0 << i))
|
||||
- components[i] = vkd3d_swizzle_get_component(swizzle, i);
|
||||
+ components[i] = vsir_swizzle_get_component(swizzle, i);
|
||||
else
|
||||
- components[i] = VKD3D_VEC4_SIZE + vkd3d_swizzle_get_component(swizzle, i);
|
||||
+ components[i] = VKD3D_VEC4_SIZE + vsir_swizzle_get_component(swizzle, i);
|
||||
}
|
||||
|
||||
type_id = vkd3d_spirv_get_type_id(builder, component_type, component_count);
|
||||
@@ -3675,7 +3675,7 @@ static uint32_t spirv_compiler_emit_vector_shuffle(struct spirv_compiler *compil
|
||||
}
|
||||
|
||||
static uint32_t spirv_compiler_emit_load_constant(struct spirv_compiler *compiler,
|
||||
- const struct vkd3d_shader_register *reg, DWORD swizzle, uint32_t write_mask)
|
||||
+ const struct vkd3d_shader_register *reg, uint32_t swizzle, uint32_t write_mask)
|
||||
{
|
||||
unsigned int component_count = vsir_write_mask_component_count(write_mask);
|
||||
uint32_t values[VKD3D_VEC4_SIZE] = {0};
|
||||
@@ -3693,7 +3693,7 @@ static uint32_t spirv_compiler_emit_load_constant(struct spirv_compiler *compile
|
||||
for (i = 0, j = 0; i < VKD3D_VEC4_SIZE; ++i)
|
||||
{
|
||||
if (write_mask & (VKD3DSP_WRITEMASK_0 << i))
|
||||
- values[j++] = reg->u.immconst_uint[vkd3d_swizzle_get_component(swizzle, i)];
|
||||
+ values[j++] = reg->u.immconst_uint[vsir_swizzle_get_component(swizzle, i)];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3702,7 +3702,7 @@ static uint32_t spirv_compiler_emit_load_constant(struct spirv_compiler *compile
|
||||
}
|
||||
|
||||
static uint32_t spirv_compiler_emit_load_constant64(struct spirv_compiler *compiler,
|
||||
- const struct vkd3d_shader_register *reg, DWORD swizzle, uint32_t write_mask)
|
||||
+ const struct vkd3d_shader_register *reg, uint32_t swizzle, uint32_t write_mask)
|
||||
{
|
||||
unsigned int component_count = vsir_write_mask_component_count(write_mask);
|
||||
uint64_t values[VKD3D_DVEC2_SIZE] = {0};
|
||||
@@ -3720,7 +3720,7 @@ static uint32_t spirv_compiler_emit_load_constant64(struct spirv_compiler *compi
|
||||
for (i = 0, j = 0; i < VKD3D_DVEC2_SIZE; ++i)
|
||||
{
|
||||
if (write_mask & (VKD3DSP_WRITEMASK_0 << i))
|
||||
- values[j++] = reg->u.immconst_uint64[vkd3d_swizzle_get_component64(swizzle, i)];
|
||||
+ values[j++] = reg->u.immconst_uint64[vsir_swizzle_get_component64(swizzle, i)];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3742,7 +3742,7 @@ static uint32_t spirv_compiler_emit_load_undef(struct spirv_compiler *compiler,
|
||||
}
|
||||
|
||||
static uint32_t spirv_compiler_emit_load_scalar(struct spirv_compiler *compiler,
|
||||
- const struct vkd3d_shader_register *reg, DWORD swizzle, uint32_t write_mask,
|
||||
+ const struct vkd3d_shader_register *reg, uint32_t swizzle, uint32_t write_mask,
|
||||
const struct vkd3d_shader_register_info *reg_info)
|
||||
{
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
@@ -3755,7 +3755,7 @@ static uint32_t spirv_compiler_emit_load_scalar(struct spirv_compiler *compiler,
|
||||
assert(vsir_write_mask_component_count(write_mask) == 1);
|
||||
|
||||
component_idx = vsir_write_mask_get_component_idx(write_mask);
|
||||
- component_idx = vkd3d_swizzle_get_component(swizzle, component_idx);
|
||||
+ component_idx = vsir_swizzle_get_component(swizzle, component_idx);
|
||||
skipped_component_mask = ~reg_info->write_mask & ((VKD3DSP_WRITEMASK_0 << component_idx) - 1);
|
||||
if (skipped_component_mask)
|
||||
component_idx -= vsir_write_mask_component_count(skipped_component_mask);
|
||||
@@ -3871,7 +3871,7 @@ static void spirv_compiler_set_ssa_register_info(const struct spirv_compiler *co
|
||||
|
||||
static uint32_t spirv_compiler_emit_load_ssa_reg(struct spirv_compiler *compiler,
|
||||
const struct vkd3d_shader_register *reg, enum vkd3d_shader_component_type component_type,
|
||||
- unsigned int swizzle)
|
||||
+ uint32_t swizzle)
|
||||
{
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
enum vkd3d_shader_component_type reg_component_type;
|
||||
@@ -3897,7 +3897,7 @@ static uint32_t spirv_compiler_emit_load_ssa_reg(struct spirv_compiler *compiler
|
||||
}
|
||||
|
||||
type_id = vkd3d_spirv_get_type_id(builder, component_type, 1);
|
||||
- component_idx = vkd3d_swizzle_get_component(swizzle, 0);
|
||||
+ component_idx = vsir_swizzle_get_component(swizzle, 0);
|
||||
return vkd3d_spirv_build_op_composite_extract1(builder, type_id, val_id, component_idx);
|
||||
}
|
||||
|
||||
@@ -4233,7 +4233,7 @@ static void spirv_compiler_emit_store_dst_components(struct spirv_compiler *comp
|
||||
|
||||
static void spirv_compiler_emit_store_dst_scalar(struct spirv_compiler *compiler,
|
||||
const struct vkd3d_shader_dst_param *dst, uint32_t val_id,
|
||||
- enum vkd3d_shader_component_type component_type, DWORD swizzle)
|
||||
+ enum vkd3d_shader_component_type component_type, uint32_t swizzle)
|
||||
{
|
||||
unsigned int component_count = vsir_write_mask_component_count(dst->write_mask);
|
||||
uint32_t component_ids[VKD3D_VEC4_SIZE];
|
||||
@@ -4242,7 +4242,7 @@ static void spirv_compiler_emit_store_dst_scalar(struct spirv_compiler *compiler
|
||||
component_idx = vsir_write_mask_get_component_idx(dst->write_mask);
|
||||
for (i = 0; i < component_count; ++i)
|
||||
{
|
||||
- if (vkd3d_swizzle_get_component(swizzle, component_idx + i))
|
||||
+ if (vsir_swizzle_get_component(swizzle, component_idx + i))
|
||||
ERR("Invalid swizzle %#x for scalar value, write mask %#x.\n", swizzle, dst->write_mask);
|
||||
|
||||
component_ids[i] = val_id;
|
||||
@@ -6940,7 +6940,7 @@ static void spirv_compiler_emit_mov(struct spirv_compiler *compiler,
|
||||
for (i = 0; i < ARRAY_SIZE(components); ++i)
|
||||
{
|
||||
if (dst->write_mask & (VKD3DSP_WRITEMASK_0 << i))
|
||||
- components[i] = VKD3D_VEC4_SIZE + vkd3d_swizzle_get_component(src->swizzle, i);
|
||||
+ components[i] = VKD3D_VEC4_SIZE + vsir_swizzle_get_component(src->swizzle, i);
|
||||
else
|
||||
components[i] = i;
|
||||
}
|
||||
@@ -8414,7 +8414,7 @@ static void spirv_compiler_emit_gather4(struct spirv_compiler *compiler,
|
||||
}
|
||||
else
|
||||
{
|
||||
- component_idx = vkd3d_swizzle_get_component(sampler->swizzle, 0);
|
||||
+ component_idx = vsir_swizzle_get_component(sampler->swizzle, 0);
|
||||
/* Nvidia driver requires signed integer type. */
|
||||
component_id = spirv_compiler_get_constant(compiler,
|
||||
VKD3D_SHADER_COMPONENT_INT, 1, &component_idx);
|
||||
@@ -8492,7 +8492,7 @@ static void spirv_compiler_emit_ld_raw_structured_srv_uav(struct spirv_compiler
|
||||
if (!(dst->write_mask & (VKD3DSP_WRITEMASK_0 << i)))
|
||||
continue;
|
||||
|
||||
- component_idx = vkd3d_swizzle_get_component(resource->swizzle, i);
|
||||
+ component_idx = vsir_swizzle_get_component(resource->swizzle, i);
|
||||
coordinate_id = base_coordinate_id;
|
||||
if (component_idx)
|
||||
coordinate_id = vkd3d_spirv_build_op_iadd(builder, type_id,
|
||||
@@ -8524,7 +8524,7 @@ static void spirv_compiler_emit_ld_raw_structured_srv_uav(struct spirv_compiler
|
||||
if (!(dst->write_mask & (VKD3DSP_WRITEMASK_0 << i)))
|
||||
continue;
|
||||
|
||||
- component_idx = vkd3d_swizzle_get_component(resource->swizzle, i);
|
||||
+ component_idx = vsir_swizzle_get_component(resource->swizzle, i);
|
||||
coordinate_id = base_coordinate_id;
|
||||
if (component_idx)
|
||||
coordinate_id = vkd3d_spirv_build_op_iadd(builder, type_id,
|
||||
@@ -8568,7 +8568,7 @@ static void spirv_compiler_emit_ld_tgsm(struct spirv_compiler *compiler,
|
||||
if (!(dst->write_mask & (VKD3DSP_WRITEMASK_0 << i)))
|
||||
continue;
|
||||
|
||||
- component_idx = vkd3d_swizzle_get_component(resource->swizzle, i);
|
||||
+ component_idx = vsir_swizzle_get_component(resource->swizzle, i);
|
||||
coordinate_id = base_coordinate_id;
|
||||
if (component_idx)
|
||||
coordinate_id = vkd3d_spirv_build_op_iadd(builder, type_id,
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/tpf.c b/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
||||
index 235e855223f..9508abfb868 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
||||
@@ -1982,10 +1982,10 @@ static uint32_t swizzle_from_sm4(uint32_t s)
|
||||
static uint32_t swizzle_to_sm4(uint32_t s)
|
||||
{
|
||||
uint32_t ret = 0;
|
||||
- ret |= ((vkd3d_swizzle_get_component(s, 0)) & 0x3);
|
||||
- ret |= ((vkd3d_swizzle_get_component(s, 1)) & 0x3) << 2;
|
||||
- ret |= ((vkd3d_swizzle_get_component(s, 2)) & 0x3) << 4;
|
||||
- ret |= ((vkd3d_swizzle_get_component(s, 3)) & 0x3) << 6;
|
||||
+ ret |= ((vsir_swizzle_get_component(s, 0)) & 0x3);
|
||||
+ ret |= ((vsir_swizzle_get_component(s, 1)) & 0x3) << 2;
|
||||
+ ret |= ((vsir_swizzle_get_component(s, 2)) & 0x3) << 4;
|
||||
+ ret |= ((vsir_swizzle_get_component(s, 3)) & 0x3) << 6;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2014,12 +2014,12 @@ static bool register_is_control_point_input(const struct vkd3d_shader_register *
|
||||
|| priv->p.shader_version.type == VKD3D_SHADER_TYPE_GEOMETRY));
|
||||
}
|
||||
|
||||
-static unsigned int mask_from_swizzle(unsigned int swizzle)
|
||||
+static uint32_t mask_from_swizzle(uint32_t swizzle)
|
||||
{
|
||||
- return (1u << vkd3d_swizzle_get_component(swizzle, 0))
|
||||
- | (1u << vkd3d_swizzle_get_component(swizzle, 1))
|
||||
- | (1u << vkd3d_swizzle_get_component(swizzle, 2))
|
||||
- | (1u << vkd3d_swizzle_get_component(swizzle, 3));
|
||||
+ return (1u << vsir_swizzle_get_component(swizzle, 0))
|
||||
+ | (1u << vsir_swizzle_get_component(swizzle, 1))
|
||||
+ | (1u << vsir_swizzle_get_component(swizzle, 2))
|
||||
+ | (1u << vsir_swizzle_get_component(swizzle, 3));
|
||||
}
|
||||
|
||||
static bool shader_sm4_validate_input_output_register(struct vkd3d_shader_sm4_parser *priv,
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c
|
||||
index 4fd5c9bd034..caf8a6a4a3e 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c
|
||||
@@ -1073,6 +1073,9 @@ static int vkd3d_shader_scan_instruction(struct vkd3d_shader_scan_context *conte
|
||||
vkd3d_shader_scan_sampler_declaration(context, instruction);
|
||||
break;
|
||||
case VKD3DSIH_DCL:
|
||||
+ if (instruction->declaration.semantic.resource_type == VKD3D_SHADER_RESOURCE_NONE)
|
||||
+ break;
|
||||
+
|
||||
if (instruction->declaration.semantic.resource.reg.reg.type == VKD3DSPR_COMBINED_SAMPLER)
|
||||
{
|
||||
vkd3d_shader_scan_combined_sampler_declaration(context, &instruction->declaration.semantic);
|
||||
@@ -1540,9 +1543,6 @@ static int vkd3d_shader_parser_compile(struct vkd3d_shader_parser *parser,
|
||||
|
||||
scan_info = *compile_info;
|
||||
|
||||
- if ((ret = scan_with_parser(&scan_info, message_context, &scan_descriptor_info, parser)) < 0)
|
||||
- return ret;
|
||||
-
|
||||
switch (compile_info->target_type)
|
||||
{
|
||||
case VKD3D_SHADER_TARGET_D3D_ASM:
|
||||
@@ -1550,6 +1550,8 @@ static int vkd3d_shader_parser_compile(struct vkd3d_shader_parser *parser,
|
||||
break;
|
||||
|
||||
case VKD3D_SHADER_TARGET_GLSL:
|
||||
+ if ((ret = scan_with_parser(&scan_info, message_context, &scan_descriptor_info, parser)) < 0)
|
||||
+ return ret;
|
||||
if (!(glsl_generator = vkd3d_glsl_generator_create(&parser->shader_version,
|
||||
message_context, &parser->location)))
|
||||
{
|
||||
@@ -1560,19 +1562,22 @@ static int vkd3d_shader_parser_compile(struct vkd3d_shader_parser *parser,
|
||||
|
||||
ret = vkd3d_glsl_generator_generate(glsl_generator, parser, out);
|
||||
vkd3d_glsl_generator_destroy(glsl_generator);
|
||||
+ vkd3d_shader_free_scan_descriptor_info1(&scan_descriptor_info);
|
||||
break;
|
||||
|
||||
case VKD3D_SHADER_TARGET_SPIRV_BINARY:
|
||||
case VKD3D_SHADER_TARGET_SPIRV_TEXT:
|
||||
+ if ((ret = scan_with_parser(&scan_info, message_context, &scan_descriptor_info, parser)) < 0)
|
||||
+ return ret;
|
||||
ret = spirv_compile(parser, &scan_descriptor_info, compile_info, out, message_context);
|
||||
+ vkd3d_shader_free_scan_descriptor_info1(&scan_descriptor_info);
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Validation should prevent us from reaching this. */
|
||||
- assert(0);
|
||||
+ vkd3d_unreachable();
|
||||
}
|
||||
|
||||
- vkd3d_shader_free_scan_descriptor_info1(&scan_descriptor_info);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1621,14 +1626,10 @@ static int compile_d3d_bytecode(const struct vkd3d_shader_compile_info *compile_
|
||||
return ret;
|
||||
}
|
||||
|
||||
- if (compile_info->target_type == VKD3D_SHADER_TARGET_D3D_ASM)
|
||||
- {
|
||||
- ret = vkd3d_dxbc_binary_to_text(&parser->instructions, &parser->shader_version, compile_info, out, VSIR_ASM_D3D);
|
||||
- vkd3d_shader_parser_destroy(parser);
|
||||
- return ret;
|
||||
- }
|
||||
+ ret = vkd3d_shader_parser_compile(parser, compile_info, out, message_context);
|
||||
|
||||
- return VKD3D_ERROR;
|
||||
+ vkd3d_shader_parser_destroy(parser);
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
static int compile_dxbc_dxil(const struct vkd3d_shader_compile_info *compile_info,
|
||||
@@ -1906,6 +1907,10 @@ const enum vkd3d_shader_target_type *vkd3d_shader_get_supported_target_types(
|
||||
|
||||
static const enum vkd3d_shader_target_type d3dbc_types[] =
|
||||
{
|
||||
+ VKD3D_SHADER_TARGET_SPIRV_BINARY,
|
||||
+#ifdef HAVE_SPIRV_TOOLS
|
||||
+ VKD3D_SHADER_TARGET_SPIRV_TEXT,
|
||||
+#endif
|
||||
VKD3D_SHADER_TARGET_D3D_ASM,
|
||||
};
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
||||
index 6fa57a111bb..274faf296e8 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
||||
@@ -1557,19 +1557,17 @@ static inline uint32_t vsir_write_mask_32_from_64(uint32_t write_mask64)
|
||||
return write_mask32 | (write_mask32 << 1);
|
||||
}
|
||||
|
||||
-static inline unsigned int vkd3d_swizzle_get_component(DWORD swizzle,
|
||||
- unsigned int idx)
|
||||
+static inline unsigned int vsir_swizzle_get_component(uint32_t swizzle, unsigned int idx)
|
||||
{
|
||||
return (swizzle >> VKD3D_SHADER_SWIZZLE_SHIFT(idx)) & VKD3D_SHADER_SWIZZLE_MASK;
|
||||
}
|
||||
|
||||
-static inline unsigned int vkd3d_swizzle_get_component64(DWORD swizzle,
|
||||
- unsigned int idx)
|
||||
+static inline unsigned int vsir_swizzle_get_component64(uint32_t swizzle, unsigned int idx)
|
||||
{
|
||||
return ((swizzle >> VKD3D_SHADER_SWIZZLE_SHIFT(idx * 2)) & VKD3D_SHADER_SWIZZLE_MASK) / 2u;
|
||||
}
|
||||
|
||||
-static inline unsigned int vkd3d_compact_swizzle(unsigned int swizzle, unsigned int write_mask)
|
||||
+static inline unsigned int vkd3d_compact_swizzle(uint32_t swizzle, uint32_t write_mask)
|
||||
{
|
||||
unsigned int i, compacted_swizzle = 0;
|
||||
|
||||
@@ -1578,7 +1576,7 @@ static inline unsigned int vkd3d_compact_swizzle(unsigned int swizzle, unsigned
|
||||
if (write_mask & (VKD3DSP_WRITEMASK_0 << i))
|
||||
{
|
||||
compacted_swizzle <<= VKD3D_SHADER_SWIZZLE_SHIFT(1);
|
||||
- compacted_swizzle |= vkd3d_swizzle_get_component(swizzle, i);
|
||||
+ compacted_swizzle |= vsir_swizzle_get_component(swizzle, i);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d/command.c b/libs/vkd3d/libs/vkd3d/command.c
|
||||
index 15c8317b191..549f6a45ffb 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d/command.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d/command.c
|
||||
@@ -2644,6 +2644,8 @@ static bool d3d12_command_list_update_compute_pipeline(struct d3d12_command_list
|
||||
{
|
||||
const struct vkd3d_vk_device_procs *vk_procs = &list->device->vk_procs;
|
||||
|
||||
+ vkd3d_cond_signal(&list->device->worker_cond);
|
||||
+
|
||||
if (list->current_pipeline != VK_NULL_HANDLE)
|
||||
return true;
|
||||
|
||||
@@ -2665,6 +2667,8 @@ static bool d3d12_command_list_update_graphics_pipeline(struct d3d12_command_lis
|
||||
VkRenderPass vk_render_pass;
|
||||
VkPipeline vk_pipeline;
|
||||
|
||||
+ vkd3d_cond_signal(&list->device->worker_cond);
|
||||
+
|
||||
if (list->current_pipeline != VK_NULL_HANDLE)
|
||||
return true;
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d/device.c b/libs/vkd3d/libs/vkd3d/device.c
|
||||
index 5c801ca4676..69a46e9188a 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d/device.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d/device.c
|
||||
@@ -2056,7 +2056,7 @@ static HRESULT d3d12_device_init_pipeline_cache(struct d3d12_device *device)
|
||||
VkPipelineCacheCreateInfo cache_info;
|
||||
VkResult vr;
|
||||
|
||||
- vkd3d_mutex_init(&device->mutex);
|
||||
+ vkd3d_mutex_init(&device->pipeline_cache_mutex);
|
||||
|
||||
cache_info.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO;
|
||||
cache_info.pNext = NULL;
|
||||
@@ -2080,7 +2080,7 @@ static void d3d12_device_destroy_pipeline_cache(struct d3d12_device *device)
|
||||
if (device->vk_pipeline_cache)
|
||||
VK_CALL(vkDestroyPipelineCache(device->vk_device, device->vk_pipeline_cache, NULL));
|
||||
|
||||
- vkd3d_mutex_destroy(&device->mutex);
|
||||
+ vkd3d_mutex_destroy(&device->pipeline_cache_mutex);
|
||||
}
|
||||
|
||||
#define VKD3D_VA_FALLBACK_BASE 0x8000000000000000ull
|
||||
@@ -2495,6 +2495,28 @@ static ULONG STDMETHODCALLTYPE d3d12_device_AddRef(ID3D12Device5 *iface)
|
||||
return refcount;
|
||||
}
|
||||
|
||||
+static HRESULT device_worker_stop(struct d3d12_device *device)
|
||||
+{
|
||||
+ HRESULT hr;
|
||||
+
|
||||
+ TRACE("device %p.\n", device);
|
||||
+
|
||||
+ vkd3d_mutex_lock(&device->worker_mutex);
|
||||
+
|
||||
+ device->worker_should_exit = true;
|
||||
+ vkd3d_cond_signal(&device->worker_cond);
|
||||
+
|
||||
+ vkd3d_mutex_unlock(&device->worker_mutex);
|
||||
+
|
||||
+ if (FAILED(hr = vkd3d_join_thread(device->vkd3d_instance, &device->worker_thread)))
|
||||
+ return hr;
|
||||
+
|
||||
+ vkd3d_mutex_destroy(&device->worker_mutex);
|
||||
+ vkd3d_cond_destroy(&device->worker_cond);
|
||||
+
|
||||
+ return S_OK;
|
||||
+}
|
||||
+
|
||||
static ULONG STDMETHODCALLTYPE d3d12_device_Release(ID3D12Device5 *iface)
|
||||
{
|
||||
struct d3d12_device *device = impl_from_ID3D12Device5(iface);
|
||||
@@ -2520,6 +2542,9 @@ static ULONG STDMETHODCALLTYPE d3d12_device_Release(ID3D12Device5 *iface)
|
||||
d3d12_device_destroy_vkd3d_queues(device);
|
||||
vkd3d_desc_object_cache_cleanup(&device->view_desc_cache);
|
||||
vkd3d_desc_object_cache_cleanup(&device->cbuffer_desc_cache);
|
||||
+ if (device->use_vk_heaps)
|
||||
+ device_worker_stop(device);
|
||||
+ vkd3d_free(device->heaps);
|
||||
VK_CALL(vkDestroyDevice(device->vk_device, NULL));
|
||||
if (device->parent)
|
||||
IUnknown_Release(device->parent);
|
||||
@@ -4251,6 +4276,40 @@ struct d3d12_device *unsafe_impl_from_ID3D12Device5(ID3D12Device5 *iface)
|
||||
return impl_from_ID3D12Device5(iface);
|
||||
}
|
||||
|
||||
+static void *device_worker_main(void *arg)
|
||||
+{
|
||||
+ struct d3d12_descriptor_heap *heap;
|
||||
+ struct d3d12_device *device = arg;
|
||||
+ size_t i;
|
||||
+
|
||||
+ vkd3d_set_thread_name("device_worker");
|
||||
+
|
||||
+ vkd3d_mutex_lock(&device->worker_mutex);
|
||||
+
|
||||
+ while (!device->worker_should_exit)
|
||||
+ {
|
||||
+ for (i = 0; i < device->heap_count; ++i)
|
||||
+ {
|
||||
+ /* Descriptor updates are not written to Vulkan descriptor sets until a command list
|
||||
+ * is submitted to a queue, while the client is free to write d3d12 descriptors earlier,
|
||||
+ * from any thread. This causes a delay right before command list execution, so
|
||||
+ * handling these updates in a worker thread can speed up execution significantly. */
|
||||
+ heap = device->heaps[i];
|
||||
+ if (heap->dirty_list_head == UINT_MAX)
|
||||
+ continue;
|
||||
+ vkd3d_mutex_lock(&heap->vk_sets_mutex);
|
||||
+ d3d12_desc_flush_vk_heap_updates_locked(heap, device);
|
||||
+ vkd3d_mutex_unlock(&heap->vk_sets_mutex);
|
||||
+ }
|
||||
+
|
||||
+ vkd3d_cond_wait(&device->worker_cond, &device->worker_mutex);
|
||||
+ }
|
||||
+
|
||||
+ vkd3d_mutex_unlock(&device->worker_mutex);
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
static HRESULT d3d12_device_init(struct d3d12_device *device,
|
||||
struct vkd3d_instance *instance, const struct vkd3d_device_create_info *create_info)
|
||||
{
|
||||
@@ -4270,6 +4329,14 @@ static HRESULT d3d12_device_init(struct d3d12_device *device,
|
||||
|
||||
device->vk_device = VK_NULL_HANDLE;
|
||||
|
||||
+ device->heaps = NULL;
|
||||
+ device->heap_capacity = 0;
|
||||
+ device->heap_count = 0;
|
||||
+ memset(&device->worker_thread, 0, sizeof(device->worker_thread));
|
||||
+ device->worker_should_exit = false;
|
||||
+ vkd3d_mutex_init(&device->worker_mutex);
|
||||
+ vkd3d_cond_init(&device->worker_cond);
|
||||
+
|
||||
if (FAILED(hr = vkd3d_create_vk_device(device, create_info)))
|
||||
goto out_free_instance;
|
||||
|
||||
@@ -4291,6 +4358,13 @@ static HRESULT d3d12_device_init(struct d3d12_device *device,
|
||||
if (FAILED(hr = vkd3d_vk_descriptor_heap_layouts_init(device)))
|
||||
goto out_cleanup_uav_clear_state;
|
||||
|
||||
+ if (device->use_vk_heaps && FAILED(hr = vkd3d_create_thread(device->vkd3d_instance,
|
||||
+ device_worker_main, device, &device->worker_thread)))
|
||||
+ {
|
||||
+ WARN("Failed to create worker thread, hr %#x.\n", hr);
|
||||
+ goto out_cleanup_descriptor_heap_layouts;
|
||||
+ }
|
||||
+
|
||||
vkd3d_render_pass_cache_init(&device->render_pass_cache);
|
||||
vkd3d_gpu_va_allocator_init(&device->gpu_va_allocator);
|
||||
vkd3d_time_domains_init(device);
|
||||
@@ -4308,6 +4382,8 @@ static HRESULT d3d12_device_init(struct d3d12_device *device,
|
||||
|
||||
return S_OK;
|
||||
|
||||
+out_cleanup_descriptor_heap_layouts:
|
||||
+ vkd3d_vk_descriptor_heap_layouts_cleanup(device);
|
||||
out_cleanup_uav_clear_state:
|
||||
vkd3d_uav_clear_state_cleanup(&device->uav_clear_state, device);
|
||||
out_destroy_null_resources:
|
||||
@@ -4361,6 +4437,40 @@ void d3d12_device_mark_as_removed(struct d3d12_device *device, HRESULT reason,
|
||||
device->removed_reason = reason;
|
||||
}
|
||||
|
||||
+HRESULT d3d12_device_add_descriptor_heap(struct d3d12_device *device, struct d3d12_descriptor_heap *heap)
|
||||
+{
|
||||
+ vkd3d_mutex_lock(&device->worker_mutex);
|
||||
+
|
||||
+ if (!vkd3d_array_reserve((void **)&device->heaps, &device->heap_capacity, device->heap_count + 1,
|
||||
+ sizeof(*device->heaps)))
|
||||
+ {
|
||||
+ vkd3d_mutex_unlock(&device->worker_mutex);
|
||||
+ return E_OUTOFMEMORY;
|
||||
+ }
|
||||
+ device->heaps[device->heap_count++] = heap;
|
||||
+
|
||||
+ vkd3d_mutex_unlock(&device->worker_mutex);
|
||||
+
|
||||
+ return S_OK;
|
||||
+}
|
||||
+
|
||||
+void d3d12_device_remove_descriptor_heap(struct d3d12_device *device, struct d3d12_descriptor_heap *heap)
|
||||
+{
|
||||
+ size_t i;
|
||||
+
|
||||
+ vkd3d_mutex_lock(&device->worker_mutex);
|
||||
+
|
||||
+ for (i = 0; i < device->heap_count; ++i)
|
||||
+ {
|
||||
+ if (device->heaps[i] == heap)
|
||||
+ {
|
||||
+ device->heaps[i] = device->heaps[--device->heap_count];
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ vkd3d_mutex_unlock(&device->worker_mutex);
|
||||
+}
|
||||
|
||||
#ifdef _WIN32
|
||||
struct thread_data
|
||||
diff --git a/libs/vkd3d/libs/vkd3d/resource.c b/libs/vkd3d/libs/vkd3d/resource.c
|
||||
index abbdfbe2015..609c67102a6 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d/resource.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d/resource.c
|
||||
@@ -2632,20 +2632,18 @@ void d3d12_desc_flush_vk_heap_updates_locked(struct d3d12_descriptor_heap *descr
|
||||
for (; i != UINT_MAX; i = next)
|
||||
{
|
||||
src = &descriptors[i];
|
||||
- next = (int)src->next >> 1;
|
||||
+ next = vkd3d_atomic_exchange(&src->next, 0);
|
||||
+ next = (int)next >> 1;
|
||||
|
||||
+ /* A race exists here between updating src->next and getting the current object. The best
|
||||
+ * we can do is get the object last, which may result in a harmless rewrite later. */
|
||||
u.object = d3d12_desc_get_object_ref(src, device);
|
||||
|
||||
if (!u.object)
|
||||
- {
|
||||
- vkd3d_atomic_exchange(&src->next, 0);
|
||||
continue;
|
||||
- }
|
||||
|
||||
writes.held_refs[writes.held_ref_count++] = u.object;
|
||||
d3d12_desc_write_vk_heap(descriptor_heap, i, &writes, u.object, device);
|
||||
-
|
||||
- vkd3d_atomic_exchange(&src->next, 0);
|
||||
}
|
||||
|
||||
/* Avoid thunk calls wherever possible. */
|
||||
@@ -3997,6 +3995,9 @@ static ULONG STDMETHODCALLTYPE d3d12_descriptor_heap_Release(ID3D12DescriptorHea
|
||||
{
|
||||
struct d3d12_desc *descriptors = (struct d3d12_desc *)heap->descriptors;
|
||||
|
||||
+ if (heap->use_vk_heaps)
|
||||
+ d3d12_device_remove_descriptor_heap(device, heap);
|
||||
+
|
||||
for (i = 0; i < heap->desc.NumDescriptors; ++i)
|
||||
{
|
||||
d3d12_desc_destroy(&descriptors[i], device);
|
||||
@@ -4320,6 +4321,12 @@ HRESULT d3d12_descriptor_heap_create(struct d3d12_device *device,
|
||||
dst[i].next = 0;
|
||||
}
|
||||
object->dirty_list_head = UINT_MAX;
|
||||
+
|
||||
+ if (object->use_vk_heaps && FAILED(hr = d3d12_device_add_descriptor_heap(device, object)))
|
||||
+ {
|
||||
+ vkd3d_free(object);
|
||||
+ return hr;
|
||||
+ }
|
||||
}
|
||||
else
|
||||
{
|
||||
diff --git a/libs/vkd3d/libs/vkd3d/state.c b/libs/vkd3d/libs/vkd3d/state.c
|
||||
index 9a039452c99..626d6d62b3c 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d/state.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d/state.c
|
||||
@@ -1691,7 +1691,7 @@ HRESULT vkd3d_render_pass_cache_find(struct vkd3d_render_pass_cache *cache,
|
||||
HRESULT hr = S_OK;
|
||||
unsigned int i;
|
||||
|
||||
- vkd3d_mutex_lock(&device->mutex);
|
||||
+ vkd3d_mutex_lock(&device->pipeline_cache_mutex);
|
||||
|
||||
for (i = 0; i < cache->render_pass_count; ++i)
|
||||
{
|
||||
@@ -1708,7 +1708,7 @@ HRESULT vkd3d_render_pass_cache_find(struct vkd3d_render_pass_cache *cache,
|
||||
if (!found)
|
||||
hr = vkd3d_render_pass_cache_create_pass_locked(cache, device, key, vk_render_pass);
|
||||
|
||||
- vkd3d_mutex_unlock(&device->mutex);
|
||||
+ vkd3d_mutex_unlock(&device->pipeline_cache_mutex);
|
||||
|
||||
return hr;
|
||||
}
|
||||
@@ -3615,7 +3615,7 @@ static VkPipeline d3d12_pipeline_state_find_compiled_pipeline(const struct d3d12
|
||||
|
||||
*vk_render_pass = VK_NULL_HANDLE;
|
||||
|
||||
- vkd3d_mutex_lock(&device->mutex);
|
||||
+ vkd3d_mutex_lock(&device->pipeline_cache_mutex);
|
||||
|
||||
LIST_FOR_EACH_ENTRY(current, &graphics->compiled_pipelines, struct vkd3d_compiled_pipeline, entry)
|
||||
{
|
||||
@@ -3627,7 +3627,7 @@ static VkPipeline d3d12_pipeline_state_find_compiled_pipeline(const struct d3d12
|
||||
}
|
||||
}
|
||||
|
||||
- vkd3d_mutex_unlock(&device->mutex);
|
||||
+ vkd3d_mutex_unlock(&device->pipeline_cache_mutex);
|
||||
|
||||
return vk_pipeline;
|
||||
}
|
||||
@@ -3646,7 +3646,7 @@ static bool d3d12_pipeline_state_put_pipeline_to_cache(struct d3d12_pipeline_sta
|
||||
compiled_pipeline->vk_pipeline = vk_pipeline;
|
||||
compiled_pipeline->vk_render_pass = vk_render_pass;
|
||||
|
||||
- vkd3d_mutex_lock(&device->mutex);
|
||||
+ vkd3d_mutex_lock(&device->pipeline_cache_mutex);
|
||||
|
||||
LIST_FOR_EACH_ENTRY(current, &graphics->compiled_pipelines, struct vkd3d_compiled_pipeline, entry)
|
||||
{
|
||||
@@ -3661,7 +3661,7 @@ static bool d3d12_pipeline_state_put_pipeline_to_cache(struct d3d12_pipeline_sta
|
||||
if (compiled_pipeline)
|
||||
list_add_tail(&graphics->compiled_pipelines, &compiled_pipeline->entry);
|
||||
|
||||
- vkd3d_mutex_unlock(&device->mutex);
|
||||
+ vkd3d_mutex_unlock(&device->pipeline_cache_mutex);
|
||||
return compiled_pipeline;
|
||||
}
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/libs/vkd3d/vkd3d_private.h
|
||||
index f06f564d6ea..bd7e7290d9e 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d/vkd3d_private.h
|
||||
+++ b/libs/vkd3d/libs/vkd3d/vkd3d_private.h
|
||||
@@ -1757,9 +1757,23 @@ struct d3d12_device
|
||||
|
||||
struct vkd3d_gpu_va_allocator gpu_va_allocator;
|
||||
|
||||
- struct vkd3d_mutex mutex;
|
||||
struct vkd3d_desc_object_cache view_desc_cache;
|
||||
struct vkd3d_desc_object_cache cbuffer_desc_cache;
|
||||
+
|
||||
+ VkDescriptorPoolSize vk_pool_sizes[VKD3D_DESCRIPTOR_POOL_COUNT];
|
||||
+ unsigned int vk_pool_count;
|
||||
+ struct vkd3d_vk_descriptor_heap_layout vk_descriptor_heap_layouts[VKD3D_SET_INDEX_COUNT];
|
||||
+ bool use_vk_heaps;
|
||||
+
|
||||
+ struct d3d12_descriptor_heap **heaps;
|
||||
+ size_t heap_capacity;
|
||||
+ size_t heap_count;
|
||||
+ union vkd3d_thread_handle worker_thread;
|
||||
+ struct vkd3d_mutex worker_mutex;
|
||||
+ struct vkd3d_cond worker_cond;
|
||||
+ bool worker_should_exit;
|
||||
+
|
||||
+ struct vkd3d_mutex pipeline_cache_mutex;
|
||||
struct vkd3d_render_pass_cache render_pass_cache;
|
||||
VkPipelineCache vk_pipeline_cache;
|
||||
|
||||
@@ -1799,11 +1813,6 @@ struct d3d12_device
|
||||
const struct vkd3d_format_compatibility_list *format_compatibility_lists;
|
||||
struct vkd3d_null_resources null_resources;
|
||||
struct vkd3d_uav_clear_state uav_clear_state;
|
||||
-
|
||||
- VkDescriptorPoolSize vk_pool_sizes[VKD3D_DESCRIPTOR_POOL_COUNT];
|
||||
- unsigned int vk_pool_count;
|
||||
- struct vkd3d_vk_descriptor_heap_layout vk_descriptor_heap_layouts[VKD3D_SET_INDEX_COUNT];
|
||||
- bool use_vk_heaps;
|
||||
};
|
||||
|
||||
HRESULT d3d12_device_create(struct vkd3d_instance *instance,
|
||||
@@ -1813,6 +1822,8 @@ bool d3d12_device_is_uma(struct d3d12_device *device, bool *coherent);
|
||||
void d3d12_device_mark_as_removed(struct d3d12_device *device, HRESULT reason,
|
||||
const char *message, ...) VKD3D_PRINTF_FUNC(3, 4);
|
||||
struct d3d12_device *unsafe_impl_from_ID3D12Device5(ID3D12Device5 *iface);
|
||||
+HRESULT d3d12_device_add_descriptor_heap(struct d3d12_device *device, struct d3d12_descriptor_heap *heap);
|
||||
+void d3d12_device_remove_descriptor_heap(struct d3d12_device *device, struct d3d12_descriptor_heap *heap);
|
||||
|
||||
static inline HRESULT d3d12_device_query_interface(struct d3d12_device *device, REFIID iid, void **object)
|
||||
{
|
||||
--
|
||||
2.43.0
|
||||
|
@ -1,332 +0,0 @@
|
||||
From 4c76fe254fce377da5668d686843895d0d2d6d8c Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Wed, 3 Jan 2024 19:06:40 +1100
|
||||
Subject: [PATCH] Updated vkd3d to 78343dcf87d3a911264c6c9a87a9146c43c859c3.
|
||||
|
||||
---
|
||||
libs/vkd3d/include/vkd3d_shader.h | 2 +
|
||||
libs/vkd3d/libs/vkd3d-shader/spirv.c | 87 +++++++++++++------
|
||||
.../libs/vkd3d-shader/vkd3d_shader_private.h | 7 ++
|
||||
libs/vkd3d/libs/vkd3d/state.c | 11 +++
|
||||
4 files changed, 81 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git a/libs/vkd3d/include/vkd3d_shader.h b/libs/vkd3d/include/vkd3d_shader.h
|
||||
index a6bf8964183..b1a1fff6451 100644
|
||||
--- a/libs/vkd3d/include/vkd3d_shader.h
|
||||
+++ b/libs/vkd3d/include/vkd3d_shader.h
|
||||
@@ -1569,6 +1569,8 @@ enum vkd3d_shader_component_type
|
||||
VKD3D_SHADER_COMPONENT_BOOL = 0x4,
|
||||
/** 64-bit IEEE floating-point. */
|
||||
VKD3D_SHADER_COMPONENT_DOUBLE = 0x5,
|
||||
+ /** 64-bit unsigned integer. \since 1.11 */
|
||||
+ VKD3D_SHADER_COMPONENT_UINT64 = 0x6,
|
||||
|
||||
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPONENT_TYPE),
|
||||
};
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/spirv.c b/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
index f77bc25329d..9e3cd7549ba 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
@@ -1797,6 +1797,8 @@ static uint32_t vkd3d_spirv_get_type_id(struct vkd3d_spirv_builder *builder,
|
||||
break;
|
||||
case VKD3D_SHADER_COMPONENT_DOUBLE:
|
||||
return vkd3d_spirv_get_op_type_float(builder, 64);
|
||||
+ case VKD3D_SHADER_COMPONENT_UINT64:
|
||||
+ return vkd3d_spirv_get_op_type_int(builder, 64, 0);
|
||||
default:
|
||||
FIXME("Unhandled component type %#x.\n", component_type);
|
||||
return 0;
|
||||
@@ -1830,6 +1832,8 @@ static uint32_t vkd3d_spirv_get_type_id_for_data_type(struct vkd3d_spirv_builder
|
||||
break;
|
||||
case VKD3D_DATA_DOUBLE:
|
||||
return vkd3d_spirv_get_op_type_float(builder, 64);
|
||||
+ case VKD3D_DATA_UINT64:
|
||||
+ return vkd3d_spirv_get_op_type_int(builder, 64, 0);
|
||||
case VKD3D_DATA_BOOL:
|
||||
return vkd3d_spirv_get_op_type_bool(builder);
|
||||
default:
|
||||
@@ -2988,7 +2992,7 @@ static uint32_t spirv_compiler_get_constant64(struct spirv_compiler *compiler,
|
||||
assert(0 < component_count && component_count <= VKD3D_DVEC2_SIZE);
|
||||
type_id = vkd3d_spirv_get_type_id(builder, component_type, component_count);
|
||||
|
||||
- if (component_type != VKD3D_SHADER_COMPONENT_DOUBLE)
|
||||
+ if (component_type != VKD3D_SHADER_COMPONENT_DOUBLE && component_type != VKD3D_SHADER_COMPONENT_UINT64)
|
||||
{
|
||||
FIXME("Unhandled component_type %#x.\n", component_type);
|
||||
return vkd3d_spirv_get_op_undef(builder, type_id);
|
||||
@@ -3048,6 +3052,13 @@ static uint32_t spirv_compiler_get_constant_double_vector(struct spirv_compiler
|
||||
component_count, (const uint64_t *)values);
|
||||
}
|
||||
|
||||
+static uint32_t spirv_compiler_get_constant_uint64_vector(struct spirv_compiler *compiler,
|
||||
+ uint64_t value, unsigned int component_count)
|
||||
+{
|
||||
+ const uint64_t values[] = {value, value};
|
||||
+ return spirv_compiler_get_constant64(compiler, VKD3D_SHADER_COMPONENT_UINT64, component_count, values);
|
||||
+}
|
||||
+
|
||||
static uint32_t spirv_compiler_get_type_id_for_reg(struct spirv_compiler *compiler,
|
||||
const struct vkd3d_shader_register *reg, uint32_t write_mask)
|
||||
{
|
||||
@@ -3932,7 +3943,7 @@ static uint32_t spirv_compiler_emit_load_reg(struct spirv_compiler *compiler,
|
||||
assert(reg_info.component_type != VKD3D_SHADER_COMPONENT_DOUBLE);
|
||||
spirv_compiler_emit_dereference_register(compiler, reg, ®_info);
|
||||
|
||||
- write_mask32 = (reg->data_type == VKD3D_DATA_DOUBLE) ? vsir_write_mask_32_from_64(write_mask) : write_mask;
|
||||
+ write_mask32 = data_type_is_64_bit(reg->data_type) ? vsir_write_mask_32_from_64(write_mask) : write_mask;
|
||||
|
||||
/* Intermediate value (no storage class). */
|
||||
if (reg_info.storage_class == SpvStorageClassMax)
|
||||
@@ -4000,7 +4011,7 @@ static uint32_t spirv_compiler_emit_neg(struct spirv_compiler *compiler,
|
||||
type_id = spirv_compiler_get_type_id_for_reg(compiler, reg, write_mask);
|
||||
if (reg->data_type == VKD3D_DATA_FLOAT || reg->data_type == VKD3D_DATA_DOUBLE)
|
||||
return vkd3d_spirv_build_op_fnegate(builder, type_id, val_id);
|
||||
- else if (reg->data_type == VKD3D_DATA_INT || reg->data_type == VKD3D_DATA_UINT)
|
||||
+ else if (data_type_is_integer(reg->data_type))
|
||||
return vkd3d_spirv_build_op_snegate(builder, type_id, val_id);
|
||||
|
||||
FIXME("Unhandled data type %#x.\n", reg->data_type);
|
||||
@@ -4148,7 +4159,7 @@ static void spirv_compiler_emit_store_reg(struct spirv_compiler *compiler,
|
||||
component_type = vkd3d_component_type_from_data_type(reg->data_type);
|
||||
if (component_type != reg_info.component_type)
|
||||
{
|
||||
- if (reg->data_type == VKD3D_DATA_DOUBLE)
|
||||
+ if (data_type_is_64_bit(reg->data_type))
|
||||
src_write_mask = vsir_write_mask_32_from_64(write_mask);
|
||||
type_id = vkd3d_spirv_get_type_id(builder, reg_info.component_type,
|
||||
vsir_write_mask_component_count(src_write_mask));
|
||||
@@ -4287,14 +4298,18 @@ static void spirv_compiler_decorate_builtin(struct spirv_compiler *compiler,
|
||||
}
|
||||
|
||||
static void spirv_compiler_emit_interpolation_decorations(struct spirv_compiler *compiler,
|
||||
- uint32_t id, enum vkd3d_shader_interpolation_mode mode)
|
||||
+ enum vkd3d_shader_component_type component_type, uint32_t id, enum vkd3d_shader_interpolation_mode mode)
|
||||
{
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case VKD3DSIM_NONE:
|
||||
- break;
|
||||
+ /* VUID-StandaloneSpirv-Flat-04744: integer or double types must be
|
||||
+ * decorated 'Flat' for fragment shaders. */
|
||||
+ if (compiler->shader_type != VKD3D_SHADER_TYPE_PIXEL || component_type == VKD3D_SHADER_COMPONENT_FLOAT)
|
||||
+ break;
|
||||
+ /* fall through */
|
||||
case VKD3DSIM_CONSTANT:
|
||||
vkd3d_spirv_build_op_decorate(builder, id, SpvDecorationFlat, NULL, 0);
|
||||
break;
|
||||
@@ -4322,7 +4337,8 @@ static void spirv_compiler_emit_interpolation_decorations(struct spirv_compiler
|
||||
}
|
||||
|
||||
static uint32_t spirv_compiler_emit_int_to_bool(struct spirv_compiler *compiler,
|
||||
- enum vkd3d_shader_conditional_op condition, unsigned int component_count, uint32_t val_id)
|
||||
+ enum vkd3d_shader_conditional_op condition, enum vkd3d_data_type data_type,
|
||||
+ unsigned int component_count, uint32_t val_id)
|
||||
{
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
uint32_t type_id;
|
||||
@@ -4333,7 +4349,9 @@ static uint32_t spirv_compiler_emit_int_to_bool(struct spirv_compiler *compiler,
|
||||
type_id = vkd3d_spirv_get_type_id(builder, VKD3D_SHADER_COMPONENT_BOOL, component_count);
|
||||
op = condition & VKD3D_SHADER_CONDITIONAL_OP_Z ? SpvOpIEqual : SpvOpINotEqual;
|
||||
return vkd3d_spirv_build_op_tr2(builder, &builder->function_stream, op, type_id, val_id,
|
||||
- spirv_compiler_get_constant_uint_vector(compiler, 0, component_count));
|
||||
+ data_type == VKD3D_DATA_UINT64
|
||||
+ ? spirv_compiler_get_constant_uint64_vector(compiler, 0, component_count)
|
||||
+ : spirv_compiler_get_constant_uint_vector(compiler, 0, component_count));
|
||||
}
|
||||
|
||||
static uint32_t spirv_compiler_emit_bool_to_int(struct spirv_compiler *compiler,
|
||||
@@ -4348,6 +4366,19 @@ static uint32_t spirv_compiler_emit_bool_to_int(struct spirv_compiler *compiler,
|
||||
return vkd3d_spirv_build_op_select(builder, type_id, val_id, true_id, false_id);
|
||||
}
|
||||
|
||||
+static uint32_t spirv_compiler_emit_bool_to_int64(struct spirv_compiler *compiler,
|
||||
+ unsigned int component_count, uint32_t val_id, bool signedness)
|
||||
+{
|
||||
+ struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
+ uint32_t type_id, true_id, false_id;
|
||||
+
|
||||
+ true_id = spirv_compiler_get_constant_uint64_vector(compiler, signedness ? UINT64_MAX : 1,
|
||||
+ component_count);
|
||||
+ false_id = spirv_compiler_get_constant_uint64_vector(compiler, 0, component_count);
|
||||
+ type_id = vkd3d_spirv_get_type_id(builder, VKD3D_SHADER_COMPONENT_UINT64, component_count);
|
||||
+ return vkd3d_spirv_build_op_select(builder, type_id, val_id, true_id, false_id);
|
||||
+}
|
||||
+
|
||||
static uint32_t spirv_compiler_emit_bool_to_float(struct spirv_compiler *compiler,
|
||||
unsigned int component_count, uint32_t val_id, bool signedness)
|
||||
{
|
||||
@@ -4874,7 +4905,8 @@ static uint32_t spirv_compiler_emit_input(struct spirv_compiler *compiler,
|
||||
if (component_idx)
|
||||
vkd3d_spirv_build_op_decorate1(builder, input_id, SpvDecorationComponent, component_idx);
|
||||
|
||||
- spirv_compiler_emit_interpolation_decorations(compiler, input_id, signature_element->interpolation_mode);
|
||||
+ spirv_compiler_emit_interpolation_decorations(compiler, component_type, input_id,
|
||||
+ signature_element->interpolation_mode);
|
||||
}
|
||||
|
||||
var_id = input_id;
|
||||
@@ -6670,12 +6702,14 @@ static SpvOp spirv_compiler_map_alu_instruction(const struct vkd3d_shader_instru
|
||||
{VKD3DSIH_ISHR, SpvOpShiftRightArithmetic},
|
||||
{VKD3DSIH_ITOD, SpvOpConvertSToF},
|
||||
{VKD3DSIH_ITOF, SpvOpConvertSToF},
|
||||
+ {VKD3DSIH_ITOI, SpvOpSConvert},
|
||||
{VKD3DSIH_MUL, SpvOpFMul},
|
||||
{VKD3DSIH_NOT, SpvOpNot},
|
||||
{VKD3DSIH_OR, SpvOpBitwiseOr},
|
||||
{VKD3DSIH_USHR, SpvOpShiftRightLogical},
|
||||
{VKD3DSIH_UTOD, SpvOpConvertUToF},
|
||||
{VKD3DSIH_UTOF, SpvOpConvertUToF},
|
||||
+ {VKD3DSIH_UTOU, SpvOpUConvert},
|
||||
{VKD3DSIH_XOR, SpvOpBitwiseXor},
|
||||
};
|
||||
unsigned int i;
|
||||
@@ -6727,6 +6761,10 @@ static void spirv_compiler_emit_bool_cast(struct spirv_compiler *compiler,
|
||||
{
|
||||
val_id = spirv_compiler_emit_bool_to_int(compiler, 1, val_id, instruction->handler_idx == VKD3DSIH_ITOI);
|
||||
}
|
||||
+ else if (dst->reg.data_type == VKD3D_DATA_UINT64)
|
||||
+ {
|
||||
+ val_id = spirv_compiler_emit_bool_to_int64(compiler, 1, val_id, instruction->handler_idx == VKD3DSIH_ITOI);
|
||||
+ }
|
||||
else
|
||||
{
|
||||
WARN("Unhandled data type %u.\n", dst->reg.data_type);
|
||||
@@ -6980,7 +7018,7 @@ static void spirv_compiler_emit_movc(struct spirv_compiler *compiler,
|
||||
|
||||
if (src[0].reg.data_type != VKD3D_DATA_BOOL)
|
||||
condition_id = spirv_compiler_emit_int_to_bool(compiler,
|
||||
- VKD3D_SHADER_CONDITIONAL_OP_NZ, component_count, condition_id);
|
||||
+ VKD3D_SHADER_CONDITIONAL_OP_NZ, src[0].reg.data_type, component_count, condition_id);
|
||||
val_id = vkd3d_spirv_build_op_select(builder, type_id, condition_id, src1_id, src2_id);
|
||||
|
||||
spirv_compiler_emit_store_dst(compiler, dst, val_id);
|
||||
@@ -7005,7 +7043,7 @@ static void spirv_compiler_emit_swapc(struct spirv_compiler *compiler,
|
||||
type_id = vkd3d_spirv_get_type_id(builder, VKD3D_SHADER_COMPONENT_FLOAT, component_count);
|
||||
|
||||
condition_id = spirv_compiler_emit_int_to_bool(compiler,
|
||||
- VKD3D_SHADER_CONDITIONAL_OP_NZ, component_count, condition_id);
|
||||
+ VKD3D_SHADER_CONDITIONAL_OP_NZ, src[0].reg.data_type, component_count, condition_id);
|
||||
|
||||
val_id = vkd3d_spirv_build_op_select(builder, type_id, condition_id, src2_id, src1_id);
|
||||
spirv_compiler_emit_store_dst(compiler, &dst[0], val_id);
|
||||
@@ -7167,13 +7205,6 @@ static void spirv_compiler_emit_int_div(struct spirv_compiler *compiler,
|
||||
div_op = instruction->handler_idx == VKD3DSIH_IDIV ? SpvOpSDiv : SpvOpUDiv;
|
||||
mod_op = instruction->handler_idx == VKD3DSIH_IDIV ? SpvOpSRem : SpvOpUMod;
|
||||
|
||||
- if (dst[0].reg.data_type == VKD3D_DATA_UINT64 || dst[1].reg.data_type == VKD3D_DATA_UINT64)
|
||||
- {
|
||||
- FIXME("Unsupported 64-bit result.\n");
|
||||
- spirv_compiler_error(compiler, VKD3D_SHADER_ERROR_SPV_UNSUPPORTED_FEATURE,
|
||||
- "Bool cast to 64-bit integer is not supported.");
|
||||
- }
|
||||
-
|
||||
if (dst[0].reg.type != VKD3DSPR_NULL)
|
||||
{
|
||||
component_count = vsir_write_mask_component_count(dst[0].write_mask);
|
||||
@@ -7183,9 +7214,11 @@ static void spirv_compiler_emit_int_div(struct spirv_compiler *compiler,
|
||||
src1_id = spirv_compiler_emit_load_src(compiler, &src[1], dst[0].write_mask);
|
||||
|
||||
condition_id = spirv_compiler_emit_int_to_bool(compiler,
|
||||
- VKD3D_SHADER_CONDITIONAL_OP_NZ, component_count, src1_id);
|
||||
- uint_max_id = spirv_compiler_get_constant_uint_vector(compiler,
|
||||
- 0xffffffff, component_count);
|
||||
+ VKD3D_SHADER_CONDITIONAL_OP_NZ, src[1].reg.data_type, component_count, src1_id);
|
||||
+ if (dst[0].reg.data_type == VKD3D_DATA_UINT64)
|
||||
+ uint_max_id = spirv_compiler_get_constant_uint64_vector(compiler, UINT64_MAX, component_count);
|
||||
+ else
|
||||
+ uint_max_id = spirv_compiler_get_constant_uint_vector(compiler, 0xffffffff, component_count);
|
||||
|
||||
val_id = vkd3d_spirv_build_op_tr2(builder, &builder->function_stream, div_op, type_id, src0_id, src1_id);
|
||||
/* The SPIR-V spec says: "The resulting value is undefined if Operand 2 is 0." */
|
||||
@@ -7205,9 +7238,11 @@ static void spirv_compiler_emit_int_div(struct spirv_compiler *compiler,
|
||||
src1_id = spirv_compiler_emit_load_src(compiler, &src[1], dst[1].write_mask);
|
||||
|
||||
condition_id = spirv_compiler_emit_int_to_bool(compiler,
|
||||
- VKD3D_SHADER_CONDITIONAL_OP_NZ, component_count, src1_id);
|
||||
- uint_max_id = spirv_compiler_get_constant_uint_vector(compiler,
|
||||
- 0xffffffff, component_count);
|
||||
+ VKD3D_SHADER_CONDITIONAL_OP_NZ, src[1].reg.data_type, component_count, src1_id);
|
||||
+ if (dst[1].reg.data_type == VKD3D_DATA_UINT64)
|
||||
+ uint_max_id = spirv_compiler_get_constant_uint64_vector(compiler, UINT64_MAX, component_count);
|
||||
+ else
|
||||
+ uint_max_id = spirv_compiler_get_constant_uint_vector(compiler, 0xffffffff, component_count);
|
||||
}
|
||||
|
||||
val_id = vkd3d_spirv_build_op_tr2(builder, &builder->function_stream, mod_op, type_id, src0_id, src1_id);
|
||||
@@ -7498,7 +7533,7 @@ static uint32_t spirv_compiler_emit_conditional_branch(struct spirv_compiler *co
|
||||
uint32_t condition_id, merge_block_id;
|
||||
|
||||
condition_id = spirv_compiler_emit_load_src(compiler, src, VKD3DSP_WRITEMASK_0);
|
||||
- condition_id = spirv_compiler_emit_int_to_bool(compiler, instruction->flags, 1, condition_id);
|
||||
+ condition_id = spirv_compiler_emit_int_to_bool(compiler, instruction->flags, src->reg.data_type, 1, condition_id);
|
||||
|
||||
merge_block_id = vkd3d_spirv_alloc_id(builder);
|
||||
|
||||
@@ -7631,7 +7666,7 @@ static int spirv_compiler_emit_control_flow_instruction(struct spirv_compiler *c
|
||||
return VKD3D_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
val_id = spirv_compiler_emit_load_src(compiler, src, VKD3DSP_WRITEMASK_0);
|
||||
- condition_id = spirv_compiler_emit_int_to_bool(compiler, instruction->flags, 1, val_id);
|
||||
+ condition_id = spirv_compiler_emit_int_to_bool(compiler, instruction->flags, src->reg.data_type, 1, val_id);
|
||||
|
||||
true_label = vkd3d_spirv_alloc_id(builder);
|
||||
merge_block_id = vkd3d_spirv_alloc_id(builder);
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
||||
index 274faf296e8..ce7d74a72dc 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
||||
@@ -620,6 +620,11 @@ static inline bool data_type_is_bool(enum vkd3d_data_type data_type)
|
||||
return data_type == VKD3D_DATA_BOOL;
|
||||
}
|
||||
|
||||
+static inline bool data_type_is_64_bit(enum vkd3d_data_type data_type)
|
||||
+{
|
||||
+ return data_type == VKD3D_DATA_DOUBLE || data_type == VKD3D_DATA_UINT64;
|
||||
+}
|
||||
+
|
||||
enum vsir_dimension
|
||||
{
|
||||
VSIR_DIMENSION_NONE,
|
||||
@@ -1455,6 +1460,8 @@ static inline enum vkd3d_shader_component_type vkd3d_component_type_from_data_ty
|
||||
return VKD3D_SHADER_COMPONENT_INT;
|
||||
case VKD3D_DATA_DOUBLE:
|
||||
return VKD3D_SHADER_COMPONENT_DOUBLE;
|
||||
+ case VKD3D_DATA_UINT64:
|
||||
+ return VKD3D_SHADER_COMPONENT_UINT64;
|
||||
case VKD3D_DATA_BOOL:
|
||||
return VKD3D_SHADER_COMPONENT_BOOL;
|
||||
default:
|
||||
diff --git a/libs/vkd3d/libs/vkd3d/state.c b/libs/vkd3d/libs/vkd3d/state.c
|
||||
index 626d6d62b3c..1457ddf9c7f 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d/state.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d/state.c
|
||||
@@ -2129,6 +2129,16 @@ static inline unsigned int typed_uav_compile_option(const struct d3d12_device *d
|
||||
: VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV_READ_FORMAT_R32;
|
||||
}
|
||||
|
||||
+static unsigned int feature_flags_compile_option(const struct d3d12_device *device)
|
||||
+{
|
||||
+ unsigned int flags = 0;
|
||||
+
|
||||
+ if (device->feature_options1.Int64ShaderOps)
|
||||
+ flags |= VKD3D_SHADER_COMPILE_OPTION_FEATURE_INT64;
|
||||
+
|
||||
+ return flags;
|
||||
+}
|
||||
+
|
||||
static HRESULT create_shader_stage(struct d3d12_device *device,
|
||||
struct VkPipelineShaderStageCreateInfo *stage_desc, enum VkShaderStageFlagBits stage,
|
||||
const D3D12_SHADER_BYTECODE *code, const struct vkd3d_shader_interface_info *shader_interface)
|
||||
@@ -2145,6 +2155,7 @@ static HRESULT create_shader_stage(struct d3d12_device *device,
|
||||
{VKD3D_SHADER_COMPILE_OPTION_API_VERSION, VKD3D_SHADER_API_VERSION_1_10},
|
||||
{VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV, typed_uav_compile_option(device)},
|
||||
{VKD3D_SHADER_COMPILE_OPTION_WRITE_TESS_GEOM_POINT_SIZE, 0},
|
||||
+ {VKD3D_SHADER_COMPILE_OPTION_FEATURE, feature_flags_compile_option(device)},
|
||||
};
|
||||
|
||||
stage_desc->sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
|
||||
--
|
||||
2.43.0
|
||||
|
@ -1,595 +0,0 @@
|
||||
From 46f901c7b05653250a0b038d4a6195fc3ab19790 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
|
||||
|
@ -1,433 +0,0 @@
|
||||
From 4d4c7dc00548735da1f6d446971b74e15a74d106 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Fri, 5 Jan 2024 11:03:00 +1100
|
||||
Subject: [PATCH] Updated vkd3d to 50cebc72780dada0822a1d081f3247f7d1dbc728.
|
||||
|
||||
---
|
||||
libs/vkd3d/libs/vkd3d-shader/d3dbc.c | 24 +++-
|
||||
libs/vkd3d/libs/vkd3d-shader/dxil.c | 1 +
|
||||
libs/vkd3d/libs/vkd3d-shader/ir.c | 136 ++++++++++++++----
|
||||
libs/vkd3d/libs/vkd3d-shader/spirv.c | 9 +-
|
||||
libs/vkd3d/libs/vkd3d-shader/tpf.c | 2 +-
|
||||
.../libs/vkd3d-shader/vkd3d_shader_private.h | 11 +-
|
||||
libs/vkd3d/libs/vkd3d/utils.c | 12 +-
|
||||
7 files changed, 149 insertions(+), 46 deletions(-)
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
||||
index ca6e3b72de9..8fec1e6371a 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
||||
@@ -482,9 +482,23 @@ static void shader_sm1_parse_dst_param(uint32_t param, const struct vkd3d_shader
|
||||
dst->reg.dimension = VSIR_DIMENSION_SCALAR;
|
||||
else
|
||||
dst->reg.dimension = VSIR_DIMENSION_VEC4;
|
||||
- dst->write_mask = (param & VKD3D_SM1_WRITEMASK_MASK) >> VKD3D_SM1_WRITEMASK_SHIFT;
|
||||
dst->modifiers = (param & VKD3D_SM1_DST_MODIFIER_MASK) >> VKD3D_SM1_DST_MODIFIER_SHIFT;
|
||||
dst->shift = (param & VKD3D_SM1_DSTSHIFT_MASK) >> VKD3D_SM1_DSTSHIFT_SHIFT;
|
||||
+
|
||||
+ switch (dst->reg.dimension)
|
||||
+ {
|
||||
+ case VSIR_DIMENSION_SCALAR:
|
||||
+ dst->write_mask = VKD3DSP_WRITEMASK_0;
|
||||
+ break;
|
||||
+
|
||||
+ case VSIR_DIMENSION_VEC4:
|
||||
+ dst->write_mask = (param & VKD3D_SM1_WRITEMASK_MASK) >> VKD3D_SM1_WRITEMASK_SHIFT;
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ dst->write_mask = 0;
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
|
||||
static struct signature_element *find_signature_element(const struct shader_signature *signature,
|
||||
@@ -518,8 +532,6 @@ static struct signature_element *find_signature_element_by_register_index(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-#define SM1_COLOR_REGISTER_OFFSET 8
|
||||
-
|
||||
static bool add_signature_element(struct vkd3d_shader_sm1_parser *sm1, bool output,
|
||||
const char *name, unsigned int index, enum vkd3d_shader_sysval_semantic sysval,
|
||||
unsigned int register_index, bool is_dcl, unsigned int mask)
|
||||
@@ -647,15 +659,15 @@ static bool add_signature_element_from_register(struct vkd3d_shader_sm1_parser *
|
||||
{
|
||||
case 0:
|
||||
return add_signature_element(sm1, true, "POSITION", 0,
|
||||
- VKD3D_SHADER_SV_POSITION, register_index, is_dcl, mask);
|
||||
+ VKD3D_SHADER_SV_POSITION, SM1_RASTOUT_REGISTER_OFFSET + register_index, is_dcl, mask);
|
||||
|
||||
case 1:
|
||||
return add_signature_element(sm1, true, "FOG", 0,
|
||||
- VKD3D_SHADER_SV_NONE, register_index, is_dcl, 0x1);
|
||||
+ VKD3D_SHADER_SV_NONE, SM1_RASTOUT_REGISTER_OFFSET + register_index, is_dcl, 0x1);
|
||||
|
||||
case 2:
|
||||
return add_signature_element(sm1, true, "PSIZE", 0,
|
||||
- VKD3D_SHADER_SV_NONE, register_index, is_dcl, 0x1);
|
||||
+ VKD3D_SHADER_SV_NONE, SM1_RASTOUT_REGISTER_OFFSET + register_index, is_dcl, 0x1);
|
||||
|
||||
default:
|
||||
vkd3d_shader_parser_error(&sm1->p, VKD3D_SHADER_ERROR_D3DBC_INVALID_REGISTER_INDEX,
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/dxil.c b/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
||||
index 2424b176068..c744dfcedf0 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
||||
@@ -3432,6 +3432,7 @@ static void sm6_parser_emit_dx_create_handle(struct sm6_parser *sm6, struct sm6_
|
||||
/* Set idx_count to 3 for use with load instructions.
|
||||
* TODO: set register type from resource type when other types are supported. */
|
||||
vsir_register_init(reg, VKD3DSPR_CONSTBUFFER, VKD3D_DATA_FLOAT, 3);
|
||||
+ reg->dimension = VSIR_DIMENSION_VEC4;
|
||||
reg->idx[0].offset = id;
|
||||
register_index_address_init(®->idx[1], operands[2], sm6);
|
||||
reg->non_uniform = !!sm6_value_get_constant_uint(operands[3]);
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/ir.c b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
index d38b3c39712..bac4269198b 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
@@ -533,6 +533,7 @@ struct io_normaliser
|
||||
{
|
||||
struct vkd3d_shader_instruction_array instructions;
|
||||
enum vkd3d_shader_type shader_type;
|
||||
+ uint8_t major;
|
||||
struct shader_signature *input_signature;
|
||||
struct shader_signature *output_signature;
|
||||
struct shader_signature *patch_constant_signature;
|
||||
@@ -867,34 +868,65 @@ static bool shader_dst_param_io_normalise(struct vkd3d_shader_dst_param *dst_par
|
||||
const struct shader_signature *signature;
|
||||
const struct signature_element *e;
|
||||
|
||||
- if ((reg->type == VKD3DSPR_OUTPUT && io_normaliser_is_in_fork_or_join_phase(normaliser))
|
||||
- || reg->type == VKD3DSPR_PATCHCONST)
|
||||
- {
|
||||
- signature = normaliser->patch_constant_signature;
|
||||
- /* Convert patch constant outputs to the patch constant register type to avoid the need
|
||||
- * to convert compiler symbols when accessed as inputs in a later stage. */
|
||||
- reg->type = VKD3DSPR_PATCHCONST;
|
||||
- dcl_params = normaliser->pc_dcl_params;
|
||||
- }
|
||||
- else if (reg->type == VKD3DSPR_OUTPUT || dst_param->reg.type == VKD3DSPR_COLOROUT)
|
||||
- {
|
||||
- signature = normaliser->output_signature;
|
||||
- reg->type = VKD3DSPR_OUTPUT;
|
||||
- dcl_params = normaliser->output_dcl_params;
|
||||
- }
|
||||
- else if (dst_param->reg.type == VKD3DSPR_INCONTROLPOINT || dst_param->reg.type == VKD3DSPR_INPUT)
|
||||
- {
|
||||
- signature = normaliser->input_signature;
|
||||
- reg->type = VKD3DSPR_INPUT;
|
||||
- dcl_params = normaliser->input_dcl_params;
|
||||
- }
|
||||
- else
|
||||
+ switch (reg->type)
|
||||
{
|
||||
- return true;
|
||||
+ case VKD3DSPR_OUTPUT:
|
||||
+ reg_idx = reg->idx[reg->idx_count - 1].offset;
|
||||
+ if (io_normaliser_is_in_fork_or_join_phase(normaliser))
|
||||
+ {
|
||||
+ signature = normaliser->patch_constant_signature;
|
||||
+ /* Convert patch constant outputs to the patch constant register type to avoid the need
|
||||
+ * to convert compiler symbols when accessed as inputs in a later stage. */
|
||||
+ reg->type = VKD3DSPR_PATCHCONST;
|
||||
+ dcl_params = normaliser->pc_dcl_params;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ signature = normaliser->output_signature;
|
||||
+ dcl_params = normaliser->output_dcl_params;
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
+ case VKD3DSPR_PATCHCONST:
|
||||
+ reg_idx = reg->idx[reg->idx_count - 1].offset;
|
||||
+ signature = normaliser->patch_constant_signature;
|
||||
+ dcl_params = normaliser->pc_dcl_params;
|
||||
+ break;
|
||||
+
|
||||
+ case VKD3DSPR_COLOROUT:
|
||||
+ reg_idx = reg->idx[0].offset;
|
||||
+ signature = normaliser->output_signature;
|
||||
+ reg->type = VKD3DSPR_OUTPUT;
|
||||
+ dcl_params = normaliser->output_dcl_params;
|
||||
+ break;
|
||||
+
|
||||
+ case VKD3DSPR_INCONTROLPOINT:
|
||||
+ case VKD3DSPR_INPUT:
|
||||
+ reg_idx = reg->idx[reg->idx_count - 1].offset;
|
||||
+ signature = normaliser->input_signature;
|
||||
+ reg->type = VKD3DSPR_INPUT;
|
||||
+ dcl_params = normaliser->input_dcl_params;
|
||||
+ break;
|
||||
+
|
||||
+ case VKD3DSPR_ATTROUT:
|
||||
+ reg_idx = SM1_COLOR_REGISTER_OFFSET + reg->idx[0].offset;
|
||||
+ signature = normaliser->output_signature;
|
||||
+ reg->type = VKD3DSPR_OUTPUT;
|
||||
+ dcl_params = normaliser->output_dcl_params;
|
||||
+ break;
|
||||
+
|
||||
+ case VKD3DSPR_RASTOUT:
|
||||
+ reg_idx = SM1_RASTOUT_REGISTER_OFFSET + reg->idx[0].offset;
|
||||
+ signature = normaliser->output_signature;
|
||||
+ reg->type = VKD3DSPR_OUTPUT;
|
||||
+ dcl_params = normaliser->output_dcl_params;
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ return true;
|
||||
}
|
||||
|
||||
id_idx = reg->idx_count - 1;
|
||||
- reg_idx = reg->idx[id_idx].offset;
|
||||
write_mask = dst_param->write_mask;
|
||||
element_idx = shader_signature_find_element_for_reg(signature, reg_idx, write_mask);
|
||||
e = &signature->elements[element_idx];
|
||||
@@ -982,26 +1014,42 @@ static void shader_src_param_io_normalise(struct vkd3d_shader_src_param *src_par
|
||||
switch (reg->type)
|
||||
{
|
||||
case VKD3DSPR_PATCHCONST:
|
||||
+ reg_idx = reg->idx[reg->idx_count - 1].offset;
|
||||
signature = normaliser->patch_constant_signature;
|
||||
break;
|
||||
+
|
||||
case VKD3DSPR_INCONTROLPOINT:
|
||||
reg->type = VKD3DSPR_INPUT;
|
||||
/* fall through */
|
||||
case VKD3DSPR_INPUT:
|
||||
+ if (normaliser->major < 3 && normaliser->shader_type == VKD3D_SHADER_TYPE_PIXEL)
|
||||
+ reg_idx = SM1_COLOR_REGISTER_OFFSET + reg->idx[0].offset;
|
||||
+ else
|
||||
+ reg_idx = reg->idx[reg->idx_count - 1].offset;
|
||||
signature = normaliser->input_signature;
|
||||
break;
|
||||
+
|
||||
case VKD3DSPR_OUTCONTROLPOINT:
|
||||
reg->type = VKD3DSPR_OUTPUT;
|
||||
/* fall through */
|
||||
case VKD3DSPR_OUTPUT:
|
||||
+ reg_idx = reg->idx[reg->idx_count - 1].offset;
|
||||
signature = normaliser->output_signature;
|
||||
break;
|
||||
+
|
||||
+ case VKD3DSPR_TEXTURE:
|
||||
+ if (normaliser->shader_type != VKD3D_SHADER_TYPE_PIXEL)
|
||||
+ return;
|
||||
+ reg->type = VKD3DSPR_INPUT;
|
||||
+ reg_idx = reg->idx[0].offset;
|
||||
+ signature = normaliser->input_signature;
|
||||
+ break;
|
||||
+
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
id_idx = reg->idx_count - 1;
|
||||
- reg_idx = reg->idx[id_idx].offset;
|
||||
write_mask = VKD3DSP_WRITEMASK_0 << vsir_swizzle_get_component(src_param->swizzle, 0);
|
||||
element_idx = shader_signature_find_element_for_reg(signature, reg_idx, write_mask);
|
||||
|
||||
@@ -1084,6 +1132,7 @@ static enum vkd3d_result shader_normalise_io_registers(struct vkd3d_shader_parse
|
||||
|
||||
normaliser.phase = VKD3DSIH_INVALID;
|
||||
normaliser.shader_type = parser->shader_version.type;
|
||||
+ normaliser.major = parser->shader_version.major;
|
||||
normaliser.input_signature = &parser->shader_desc.input_signature;
|
||||
normaliser.output_signature = &parser->shader_desc.output_signature;
|
||||
normaliser.patch_constant_signature = &parser->shader_desc.patch_constant_signature;
|
||||
@@ -1555,6 +1604,19 @@ static void vsir_validate_register(struct validation_context *ctx,
|
||||
reg->idx[0].offset, temp_count);
|
||||
break;
|
||||
|
||||
+ case VKD3DSPR_SSA:
|
||||
+ if (reg->idx_count != 1)
|
||||
+ validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT, "Invalid index count %u for a SSA register.",
|
||||
+ reg->idx_count);
|
||||
+
|
||||
+ if (reg->idx_count >= 1 && reg->idx[0].rel_addr)
|
||||
+ validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX, "Non-NULL relative address for a SSA register.");
|
||||
+
|
||||
+ if (reg->idx_count >= 1 && reg->idx[0].offset >= ctx->parser->shader_desc.ssa_count)
|
||||
+ validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX, "SSA register index %u exceeds the maximum count %u.",
|
||||
+ reg->idx[0].offset, ctx->parser->shader_desc.ssa_count);
|
||||
+ break;
|
||||
+
|
||||
case VKD3DSPR_NULL:
|
||||
if (reg->idx_count != 0)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT, "Invalid index count %u for a NULL register.",
|
||||
@@ -1587,6 +1649,26 @@ static void vsir_validate_dst_param(struct validation_context *ctx,
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_WRITE_MASK, "Destination has invalid write mask %#x.",
|
||||
dst->write_mask);
|
||||
|
||||
+ switch (dst->reg.dimension)
|
||||
+ {
|
||||
+ case VSIR_DIMENSION_SCALAR:
|
||||
+ if (dst->write_mask != VKD3DSP_WRITEMASK_0)
|
||||
+ validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_WRITE_MASK, "Scalar destination has invalid write mask %#x.",
|
||||
+ dst->write_mask);
|
||||
+ break;
|
||||
+
|
||||
+ case VSIR_DIMENSION_VEC4:
|
||||
+ if (dst->write_mask == 0)
|
||||
+ validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_WRITE_MASK, "Vec4 destination has empty write mask.");
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ if (dst->write_mask != 0)
|
||||
+ validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_WRITE_MASK, "Destination of dimension %u has invalid write mask %#x.",
|
||||
+ dst->reg.dimension, dst->write_mask);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
if (dst->modifiers & ~VKD3DSPDM_MASK)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_MODIFIERS, "Destination has invalid modifiers %#x.",
|
||||
dst->modifiers);
|
||||
@@ -1617,6 +1699,10 @@ static void vsir_validate_src_param(struct validation_context *ctx,
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_SWIZZLE, "Source has invalid swizzle %#x.",
|
||||
src->swizzle);
|
||||
|
||||
+ if (src->reg.dimension != VSIR_DIMENSION_VEC4 && src->swizzle != 0)
|
||||
+ validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_SWIZZLE, "Source of dimension %u has invalid swizzle %#x.",
|
||||
+ src->reg.dimension, src->swizzle);
|
||||
+
|
||||
if (src->modifiers >= VKD3DSPSM_COUNT)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_MODIFIERS, "Source has invalid modifiers %#x.",
|
||||
src->modifiers);
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/spirv.c b/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
index 387784f2358..a5565d552c0 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
@@ -3600,8 +3600,7 @@ static uint32_t spirv_compiler_get_register_id(struct spirv_compiler *compiler,
|
||||
SpvStorageClassPrivate, VKD3D_SHADER_COMPONENT_FLOAT, VKD3D_VEC4_SIZE);
|
||||
}
|
||||
|
||||
-static bool vkd3d_swizzle_is_equal(unsigned int dst_write_mask,
|
||||
- unsigned int swizzle, unsigned int write_mask)
|
||||
+static bool vkd3d_swizzle_is_equal(uint32_t dst_write_mask, uint32_t swizzle, uint32_t write_mask)
|
||||
{
|
||||
return vkd3d_compact_swizzle(VKD3D_SHADER_NO_SWIZZLE, dst_write_mask) == vkd3d_compact_swizzle(swizzle, write_mask);
|
||||
}
|
||||
@@ -3913,7 +3912,7 @@ static uint32_t spirv_compiler_emit_load_ssa_reg(struct spirv_compiler *compiler
|
||||
}
|
||||
|
||||
static uint32_t spirv_compiler_emit_load_reg(struct spirv_compiler *compiler,
|
||||
- const struct vkd3d_shader_register *reg, DWORD swizzle, uint32_t write_mask)
|
||||
+ const struct vkd3d_shader_register *reg, uint32_t swizzle, uint32_t write_mask)
|
||||
{
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
enum vkd3d_shader_component_type component_type;
|
||||
@@ -4209,7 +4208,7 @@ static void spirv_compiler_emit_store_dst(struct spirv_compiler *compiler,
|
||||
|
||||
static void spirv_compiler_emit_store_dst_swizzled(struct spirv_compiler *compiler,
|
||||
const struct vkd3d_shader_dst_param *dst, uint32_t val_id,
|
||||
- enum vkd3d_shader_component_type component_type, DWORD swizzle)
|
||||
+ enum vkd3d_shader_component_type component_type, uint32_t swizzle)
|
||||
{
|
||||
struct vkd3d_shader_dst_param typed_dst = *dst;
|
||||
val_id = spirv_compiler_emit_swizzle(compiler,
|
||||
@@ -9420,9 +9419,9 @@ static void spirv_compiler_emit_sync(struct spirv_compiler *compiler,
|
||||
const struct vkd3d_shader_instruction *instruction)
|
||||
{
|
||||
unsigned int memory_semantics = SpvMemorySemanticsAcquireReleaseMask;
|
||||
- unsigned int flags = instruction->flags;
|
||||
SpvScope execution_scope = SpvScopeMax;
|
||||
SpvScope memory_scope = SpvScopeDevice;
|
||||
+ uint32_t flags = instruction->flags;
|
||||
|
||||
if (flags & VKD3DSSF_GROUP_SHARED_MEMORY)
|
||||
{
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/tpf.c b/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
||||
index f859e758d8e..2cc56663efe 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
||||
@@ -5488,7 +5488,7 @@ static void write_sm4_loop(const struct tpf_writer *tpf, const struct hlsl_ir_lo
|
||||
|
||||
static void write_sm4_gather(const struct tpf_writer *tpf, const struct hlsl_ir_node *dst,
|
||||
const struct hlsl_deref *resource, const struct hlsl_deref *sampler,
|
||||
- const struct hlsl_ir_node *coords, DWORD swizzle, const struct hlsl_ir_node *texel_offset)
|
||||
+ const struct hlsl_ir_node *coords, uint32_t swizzle, const struct hlsl_ir_node *texel_offset)
|
||||
{
|
||||
struct vkd3d_shader_src_param *src;
|
||||
struct sm4_instruction instr;
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
||||
index 47b245bd7ee..224d27f4e1b 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
||||
@@ -871,14 +871,14 @@ struct vkd3d_shader_dst_param
|
||||
{
|
||||
struct vkd3d_shader_register reg;
|
||||
uint32_t write_mask;
|
||||
- DWORD modifiers;
|
||||
- DWORD shift;
|
||||
+ uint32_t modifiers;
|
||||
+ unsigned int shift;
|
||||
};
|
||||
|
||||
struct vkd3d_shader_src_param
|
||||
{
|
||||
struct vkd3d_shader_register reg;
|
||||
- DWORD swizzle;
|
||||
+ uint32_t swizzle;
|
||||
enum vkd3d_shader_src_modifier modifiers;
|
||||
};
|
||||
|
||||
@@ -955,6 +955,9 @@ enum vkd3d_shader_input_sysval_semantic
|
||||
VKD3D_SIV_LINE_DENSITY_TESS_FACTOR = 22,
|
||||
};
|
||||
|
||||
+#define SM1_COLOR_REGISTER_OFFSET 8
|
||||
+#define SM1_RASTOUT_REGISTER_OFFSET 10
|
||||
+
|
||||
#define SIGNATURE_TARGET_LOCATION_UNUSED (~0u)
|
||||
|
||||
struct signature_element
|
||||
@@ -1120,7 +1123,7 @@ struct vkd3d_shader_instruction
|
||||
{
|
||||
struct vkd3d_shader_location location;
|
||||
enum vkd3d_shader_opcode handler_idx;
|
||||
- DWORD flags;
|
||||
+ uint32_t flags;
|
||||
unsigned int dst_count;
|
||||
unsigned int src_count;
|
||||
const struct vkd3d_shader_dst_param *dst;
|
||||
diff --git a/libs/vkd3d/libs/vkd3d/utils.c b/libs/vkd3d/libs/vkd3d/utils.c
|
||||
index 5ebe1b63e99..751971220e7 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d/utils.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d/utils.c
|
||||
@@ -683,7 +683,7 @@ const char *debug_vk_extent_3d(VkExtent3D extent)
|
||||
|
||||
const char *debug_vk_queue_flags(VkQueueFlags flags)
|
||||
{
|
||||
- char buffer[120];
|
||||
+ char buffer[159];
|
||||
|
||||
buffer[0] = '\0';
|
||||
#define FLAG_TO_STR(f) if (flags & f) { strcat(buffer, " | "#f); flags &= ~f; }
|
||||
@@ -691,6 +691,10 @@ const char *debug_vk_queue_flags(VkQueueFlags flags)
|
||||
FLAG_TO_STR(VK_QUEUE_COMPUTE_BIT)
|
||||
FLAG_TO_STR(VK_QUEUE_TRANSFER_BIT)
|
||||
FLAG_TO_STR(VK_QUEUE_SPARSE_BINDING_BIT)
|
||||
+ FLAG_TO_STR(VK_QUEUE_PROTECTED_BIT)
|
||||
+#undef FLAG_TO_STR
|
||||
+#define FLAG_TO_STR(f, n) if (flags & f) { strcat(buffer, " | "#n); flags &= ~f; }
|
||||
+ FLAG_TO_STR(0x20, VK_QUEUE_VIDEO_DECODE_BIT_KHR)
|
||||
#undef FLAG_TO_STR
|
||||
if (flags)
|
||||
FIXME("Unrecognized flag(s) %#x.\n", flags);
|
||||
@@ -729,10 +733,8 @@ const char *debug_vk_memory_property_flags(VkMemoryPropertyFlags flags)
|
||||
FLAG_TO_STR(VK_MEMORY_PROPERTY_HOST_CACHED_BIT)
|
||||
FLAG_TO_STR(VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT)
|
||||
FLAG_TO_STR(VK_MEMORY_PROPERTY_PROTECTED_BIT)
|
||||
-#undef FLAG_TO_STR
|
||||
-#define FLAG_TO_STR(f, n) if (flags & f) { strcat(buffer, " | "#n); flags &= ~f; }
|
||||
- FLAG_TO_STR(0x40, VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD)
|
||||
- FLAG_TO_STR(0x80, VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD)
|
||||
+ FLAG_TO_STR(VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD)
|
||||
+ FLAG_TO_STR(VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD)
|
||||
#undef FLAG_TO_STR
|
||||
if (flags)
|
||||
FIXME("Unrecognized flag(s) %#x.\n", flags);
|
||||
--
|
||||
2.43.0
|
||||
|
@ -1,636 +0,0 @@
|
||||
From ce0a7dcf546461d3aa2bad522274f09def0e8daa Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Wed, 10 Jan 2024 07:40:09 +1100
|
||||
Subject: [PATCH] Updated vkd3d to bb64bfff6334c847d06d219840882ec75766b330.
|
||||
|
||||
---
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl.c | 22 +++---
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl.h | 22 +++---
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl.y | 31 ++++-----
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c | 22 +++---
|
||||
libs/vkd3d/libs/vkd3d-shader/spirv.c | 15 ++++-
|
||||
libs/vkd3d/libs/vkd3d/command.c | 3 +-
|
||||
libs/vkd3d/libs/vkd3d/resource.c | 74 ++++++++++++++++-----
|
||||
7 files changed, 125 insertions(+), 64 deletions(-)
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.c b/libs/vkd3d/libs/vkd3d-shader/hlsl.c
|
||||
index da3bbda1bc3..a41967876a2 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.c
|
||||
@@ -920,7 +920,7 @@ bool hlsl_types_are_equal(const struct hlsl_type *t1, const struct hlsl_type *t2
|
||||
}
|
||||
|
||||
struct hlsl_type *hlsl_type_clone(struct hlsl_ctx *ctx, struct hlsl_type *old,
|
||||
- unsigned int default_majority, unsigned int modifiers)
|
||||
+ unsigned int default_majority, uint32_t modifiers)
|
||||
{
|
||||
struct hlsl_type *type;
|
||||
|
||||
@@ -1030,7 +1030,7 @@ struct hlsl_ir_node *hlsl_new_copy(struct hlsl_ctx *ctx, struct hlsl_ir_node *no
|
||||
}
|
||||
|
||||
struct hlsl_ir_var *hlsl_new_var(struct hlsl_ctx *ctx, const char *name, struct hlsl_type *type,
|
||||
- const struct vkd3d_shader_location *loc, const struct hlsl_semantic *semantic, unsigned int modifiers,
|
||||
+ const struct vkd3d_shader_location *loc, const struct hlsl_semantic *semantic, uint32_t modifiers,
|
||||
const struct hlsl_reg_reservation *reg_reservation)
|
||||
{
|
||||
struct hlsl_ir_var *var;
|
||||
@@ -1505,7 +1505,7 @@ struct hlsl_ir_node *hlsl_new_resource_store(struct hlsl_ctx *ctx, const struct
|
||||
return &store->node;
|
||||
}
|
||||
|
||||
-struct hlsl_ir_node *hlsl_new_swizzle(struct hlsl_ctx *ctx, DWORD s, unsigned int components,
|
||||
+struct hlsl_ir_node *hlsl_new_swizzle(struct hlsl_ctx *ctx, uint32_t s, unsigned int components,
|
||||
struct hlsl_ir_node *val, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
struct hlsl_ir_swizzle *swizzle;
|
||||
@@ -2246,7 +2246,7 @@ const char *debug_hlsl_type(struct hlsl_ctx *ctx, const struct hlsl_type *type)
|
||||
return ret;
|
||||
}
|
||||
|
||||
-struct vkd3d_string_buffer *hlsl_modifiers_to_string(struct hlsl_ctx *ctx, unsigned int modifiers)
|
||||
+struct vkd3d_string_buffer *hlsl_modifiers_to_string(struct hlsl_ctx *ctx, uint32_t modifiers)
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
|
||||
@@ -2432,7 +2432,7 @@ const char *debug_hlsl_writemask(unsigned int writemask)
|
||||
return vkd3d_dbg_sprintf(".%s", string);
|
||||
}
|
||||
|
||||
-const char *debug_hlsl_swizzle(unsigned int swizzle, unsigned int size)
|
||||
+const char *debug_hlsl_swizzle(uint32_t swizzle, unsigned int size)
|
||||
{
|
||||
static const char components[] = {'x', 'y', 'z', 'w'};
|
||||
char string[5];
|
||||
@@ -3147,9 +3147,10 @@ void hlsl_add_function(struct hlsl_ctx *ctx, char *name, struct hlsl_ir_function
|
||||
rb_put(&ctx->functions, func->name, &func->entry);
|
||||
}
|
||||
|
||||
-unsigned int hlsl_map_swizzle(unsigned int swizzle, unsigned int writemask)
|
||||
+uint32_t hlsl_map_swizzle(uint32_t swizzle, unsigned int writemask)
|
||||
{
|
||||
- unsigned int i, ret = 0;
|
||||
+ uint32_t ret = 0;
|
||||
+ unsigned int i;
|
||||
|
||||
/* Leave replicate swizzles alone; some instructions need them. */
|
||||
if (swizzle == HLSL_SWIZZLE(X, X, X, X)
|
||||
@@ -3169,7 +3170,7 @@ unsigned int hlsl_map_swizzle(unsigned int swizzle, unsigned int writemask)
|
||||
return ret;
|
||||
}
|
||||
|
||||
-unsigned int hlsl_swizzle_from_writemask(unsigned int writemask)
|
||||
+uint32_t hlsl_swizzle_from_writemask(unsigned int writemask)
|
||||
{
|
||||
static const unsigned int swizzles[16] =
|
||||
{
|
||||
@@ -3210,9 +3211,10 @@ unsigned int hlsl_combine_writemasks(unsigned int first, unsigned int second)
|
||||
return ret;
|
||||
}
|
||||
|
||||
-unsigned int hlsl_combine_swizzles(unsigned int first, unsigned int second, unsigned int dim)
|
||||
+uint32_t hlsl_combine_swizzles(uint32_t first, uint32_t second, unsigned int dim)
|
||||
{
|
||||
- unsigned int ret = 0, i;
|
||||
+ uint32_t ret = 0;
|
||||
+ unsigned int i;
|
||||
for (i = 0; i < dim; ++i)
|
||||
{
|
||||
unsigned int s = hlsl_swizzle_get_component(second, i);
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.h b/libs/vkd3d/libs/vkd3d-shader/hlsl.h
|
||||
index ca75a1936f1..b56dea10f4c 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.h
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.h
|
||||
@@ -65,7 +65,7 @@
|
||||
#define HLSL_SWIZZLE_MASK (0x3u)
|
||||
#define HLSL_SWIZZLE_SHIFT(idx) (2u * (idx))
|
||||
|
||||
-static inline unsigned int hlsl_swizzle_get_component(unsigned int swizzle, unsigned int idx)
|
||||
+static inline unsigned int hlsl_swizzle_get_component(uint32_t swizzle, unsigned int idx)
|
||||
{
|
||||
return (swizzle >> HLSL_SWIZZLE_SHIFT(idx)) & HLSL_SWIZZLE_MASK;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ struct hlsl_type
|
||||
/* Bitfield for storing type modifiers, subset of HLSL_TYPE_MODIFIERS_MASK.
|
||||
* Modifiers that don't fall inside this mask are to be stored in the variable in
|
||||
* hlsl_ir_var.modifiers, or in the struct field in hlsl_ir_field.modifiers. */
|
||||
- unsigned int modifiers;
|
||||
+ uint32_t modifiers;
|
||||
/* Size of the type values on each dimension. For non-numeric types, they are set for the
|
||||
* convenience of the sm1/sm4 backends.
|
||||
* If type is HLSL_CLASS_SCALAR, then both dimx = 1 and dimy = 1.
|
||||
@@ -234,7 +234,7 @@ struct hlsl_struct_field
|
||||
/* Bitfield for storing modifiers that are not in HLSL_TYPE_MODIFIERS_MASK (these are stored in
|
||||
* type->modifiers instead) and that also are specific to the field and not the whole variable.
|
||||
* In particular, interpolation modifiers. */
|
||||
- unsigned int storage_modifiers;
|
||||
+ uint32_t storage_modifiers;
|
||||
/* Offset of the field within the type it belongs to, in register components, for each regset. */
|
||||
unsigned int reg_offset[HLSL_REGSET_LAST + 1];
|
||||
|
||||
@@ -392,7 +392,7 @@ struct hlsl_ir_var
|
||||
/* Buffer where the variable's value is stored, in case it is uniform. */
|
||||
struct hlsl_buffer *buffer;
|
||||
/* Bitfield for storage modifiers (type modifiers are stored in data_type->modifiers). */
|
||||
- unsigned int storage_modifiers;
|
||||
+ uint32_t storage_modifiers;
|
||||
/* Optional reservations of registers and/or offsets for variables within constant buffers. */
|
||||
struct hlsl_reg_reservation reg_reservation;
|
||||
|
||||
@@ -622,7 +622,7 @@ struct hlsl_ir_swizzle
|
||||
{
|
||||
struct hlsl_ir_node node;
|
||||
struct hlsl_src val;
|
||||
- DWORD swizzle;
|
||||
+ uint32_t swizzle;
|
||||
};
|
||||
|
||||
struct hlsl_ir_index
|
||||
@@ -1250,7 +1250,7 @@ struct hlsl_ir_node *hlsl_new_resource_store(struct hlsl_ctx *ctx, const struct
|
||||
struct hlsl_ir_node *coords, struct hlsl_ir_node *value, const struct vkd3d_shader_location *loc);
|
||||
struct hlsl_type *hlsl_new_struct_type(struct hlsl_ctx *ctx, const char *name,
|
||||
struct hlsl_struct_field *fields, size_t field_count);
|
||||
-struct hlsl_ir_node *hlsl_new_swizzle(struct hlsl_ctx *ctx, DWORD s, unsigned int components,
|
||||
+struct hlsl_ir_node *hlsl_new_swizzle(struct hlsl_ctx *ctx, uint32_t s, unsigned int components,
|
||||
struct hlsl_ir_node *val, const struct vkd3d_shader_location *loc);
|
||||
struct hlsl_ir_var *hlsl_new_synthetic_var(struct hlsl_ctx *ctx, const char *template,
|
||||
struct hlsl_type *type, const struct vkd3d_shader_location *loc);
|
||||
@@ -1264,7 +1264,7 @@ struct hlsl_ir_node *hlsl_new_uint_constant(struct hlsl_ctx *ctx, unsigned int n
|
||||
struct hlsl_ir_node *hlsl_new_unary_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op, struct hlsl_ir_node *arg,
|
||||
const struct vkd3d_shader_location *loc);
|
||||
struct hlsl_ir_var *hlsl_new_var(struct hlsl_ctx *ctx, const char *name, struct hlsl_type *type,
|
||||
- const struct vkd3d_shader_location *loc, const struct hlsl_semantic *semantic, unsigned int modifiers,
|
||||
+ const struct vkd3d_shader_location *loc, const struct hlsl_semantic *semantic, uint32_t modifiers,
|
||||
const struct hlsl_reg_reservation *reg_reservation);
|
||||
struct hlsl_ir_switch_case *hlsl_new_switch_case(struct hlsl_ctx *ctx, unsigned int value, bool is_default,
|
||||
struct hlsl_block *body, const struct vkd3d_shader_location *loc);
|
||||
@@ -1286,7 +1286,7 @@ void hlsl_pop_scope(struct hlsl_ctx *ctx);
|
||||
bool hlsl_scope_add_type(struct hlsl_scope *scope, struct hlsl_type *type);
|
||||
|
||||
struct hlsl_type *hlsl_type_clone(struct hlsl_ctx *ctx, struct hlsl_type *old,
|
||||
- unsigned int default_majority, unsigned int modifiers);
|
||||
+ unsigned int default_majority, uint32_t modifiers);
|
||||
unsigned int hlsl_type_component_count(const struct hlsl_type *type);
|
||||
unsigned int hlsl_type_get_array_element_reg_size(const struct hlsl_type *type, enum hlsl_regset regset);
|
||||
struct hlsl_type *hlsl_type_get_component_type(struct hlsl_ctx *ctx, struct hlsl_type *type,
|
||||
@@ -1304,10 +1304,10 @@ bool hlsl_types_are_equal(const struct hlsl_type *t1, const struct hlsl_type *t2
|
||||
const struct hlsl_type *hlsl_get_multiarray_element_type(const struct hlsl_type *type);
|
||||
unsigned int hlsl_get_multiarray_size(const struct hlsl_type *type);
|
||||
|
||||
-unsigned int hlsl_combine_swizzles(unsigned int first, unsigned int second, unsigned int dim);
|
||||
+uint32_t hlsl_combine_swizzles(uint32_t first, uint32_t second, unsigned int dim);
|
||||
unsigned int hlsl_combine_writemasks(unsigned int first, unsigned int second);
|
||||
-unsigned int hlsl_map_swizzle(unsigned int swizzle, unsigned int writemask);
|
||||
-unsigned int hlsl_swizzle_from_writemask(unsigned int writemask);
|
||||
+uint32_t hlsl_map_swizzle(uint32_t swizzle, unsigned int writemask);
|
||||
+uint32_t hlsl_swizzle_from_writemask(unsigned int writemask);
|
||||
|
||||
struct hlsl_type *hlsl_deref_get_type(struct hlsl_ctx *ctx, const struct hlsl_deref *deref);
|
||||
enum hlsl_regset hlsl_deref_get_regset(struct hlsl_ctx *ctx, const struct hlsl_deref *deref);
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.y b/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
index ed053f16312..26f9357419b 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
@@ -40,7 +40,7 @@ struct parse_parameter
|
||||
const char *name;
|
||||
struct hlsl_semantic semantic;
|
||||
struct hlsl_reg_reservation reg_reservation;
|
||||
- unsigned int modifiers;
|
||||
+ uint32_t modifiers;
|
||||
};
|
||||
|
||||
struct parse_colon_attribute
|
||||
@@ -75,7 +75,7 @@ struct parse_variable_def
|
||||
struct parse_initializer initializer;
|
||||
|
||||
struct hlsl_type *basic_type;
|
||||
- unsigned int modifiers;
|
||||
+ uint32_t modifiers;
|
||||
struct vkd3d_shader_location modifiers_loc;
|
||||
};
|
||||
|
||||
@@ -405,7 +405,7 @@ static struct hlsl_ir_node *add_implicit_conversion(struct hlsl_ctx *ctx, struct
|
||||
return add_cast(ctx, block, node, dst_type, loc);
|
||||
}
|
||||
|
||||
-static DWORD add_modifiers(struct hlsl_ctx *ctx, DWORD modifiers, DWORD mod,
|
||||
+static uint32_t add_modifiers(struct hlsl_ctx *ctx, uint32_t modifiers, uint32_t mod,
|
||||
const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
if (modifiers & mod)
|
||||
@@ -868,7 +868,7 @@ static const struct hlsl_struct_field *get_struct_field(const struct hlsl_struct
|
||||
}
|
||||
|
||||
static struct hlsl_type *apply_type_modifiers(struct hlsl_ctx *ctx, struct hlsl_type *type,
|
||||
- unsigned int *modifiers, bool force_majority, const struct vkd3d_shader_location *loc)
|
||||
+ uint32_t *modifiers, bool force_majority, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
unsigned int default_majority = 0;
|
||||
struct hlsl_type *new_type;
|
||||
@@ -926,7 +926,7 @@ static bool shader_profile_version_lt(const struct hlsl_ctx *ctx, unsigned int m
|
||||
}
|
||||
|
||||
static bool gen_struct_fields(struct hlsl_ctx *ctx, struct parse_fields *fields,
|
||||
- struct hlsl_type *type, unsigned int modifiers, struct list *defs)
|
||||
+ struct hlsl_type *type, uint32_t modifiers, struct list *defs)
|
||||
{
|
||||
struct parse_variable_def *v, *v_next;
|
||||
size_t i = 0;
|
||||
@@ -1019,7 +1019,7 @@ static bool add_typedef(struct hlsl_ctx *ctx, struct hlsl_type *const orig_type,
|
||||
}
|
||||
else
|
||||
{
|
||||
- unsigned int var_modifiers = 0;
|
||||
+ uint32_t var_modifiers = 0;
|
||||
|
||||
if (!(type = apply_type_modifiers(ctx, orig_type, &var_modifiers, true, &v->loc)))
|
||||
{
|
||||
@@ -1717,7 +1717,7 @@ static enum hlsl_ir_expr_op op_from_assignment(enum parse_assign_op op)
|
||||
return ops[op];
|
||||
}
|
||||
|
||||
-static bool invert_swizzle(unsigned int *swizzle, unsigned int *writemask, unsigned int *ret_width)
|
||||
+static bool invert_swizzle(uint32_t *swizzle, unsigned int *writemask, unsigned int *ret_width)
|
||||
{
|
||||
unsigned int i, j, bit = 0, inverted = 0, width, new_writemask = 0, new_swizzle = 0;
|
||||
|
||||
@@ -1791,8 +1791,9 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct hlsl_blo
|
||||
else if (lhs->type == HLSL_IR_SWIZZLE)
|
||||
{
|
||||
struct hlsl_ir_swizzle *swizzle = hlsl_ir_swizzle(lhs);
|
||||
- unsigned int width, s = swizzle->swizzle;
|
||||
struct hlsl_ir_node *new_swizzle;
|
||||
+ uint32_t s = swizzle->swizzle;
|
||||
+ unsigned int width;
|
||||
|
||||
if (lhs->data_type->class == HLSL_CLASS_MATRIX)
|
||||
hlsl_fixme(ctx, &lhs->loc, "Matrix assignment with a writemask.");
|
||||
@@ -4844,7 +4845,7 @@ static void check_duplicated_switch_cases(struct hlsl_ctx *ctx, const struct hls
|
||||
FLOAT floatval;
|
||||
bool boolval;
|
||||
char *name;
|
||||
- DWORD modifiers;
|
||||
+ uint32_t modifiers;
|
||||
struct hlsl_ir_node *instr;
|
||||
struct hlsl_block *block;
|
||||
struct list *list;
|
||||
@@ -5282,7 +5283,7 @@ field:
|
||||
var_modifiers field_type variables_def ';'
|
||||
{
|
||||
struct hlsl_type *type;
|
||||
- unsigned int modifiers = $1;
|
||||
+ uint32_t modifiers = $1;
|
||||
|
||||
if (!(type = apply_type_modifiers(ctx, $2, &modifiers, true, &@1)))
|
||||
YYABORT;
|
||||
@@ -5435,7 +5436,7 @@ func_prototype_no_attrs:
|
||||
/* var_modifiers is necessary to avoid shift/reduce conflicts. */
|
||||
var_modifiers type var_identifier '(' parameters ')' colon_attribute
|
||||
{
|
||||
- unsigned int modifiers = $1;
|
||||
+ uint32_t modifiers = $1;
|
||||
struct hlsl_ir_var *var;
|
||||
struct hlsl_type *type;
|
||||
|
||||
@@ -5709,7 +5710,7 @@ param_list:
|
||||
parameter:
|
||||
var_modifiers type_no_void any_identifier arrays colon_attribute
|
||||
{
|
||||
- unsigned int modifiers = $1;
|
||||
+ uint32_t modifiers = $1;
|
||||
struct hlsl_type *type;
|
||||
unsigned int i;
|
||||
|
||||
@@ -6023,7 +6024,7 @@ typedef:
|
||||
KW_TYPEDEF var_modifiers typedef_type type_specs ';'
|
||||
{
|
||||
struct parse_variable_def *v, *v_next;
|
||||
- unsigned int modifiers = $2;
|
||||
+ uint32_t modifiers = $2;
|
||||
struct hlsl_type *type;
|
||||
|
||||
if (!(type = apply_type_modifiers(ctx, $3, &modifiers, false, &@2)))
|
||||
@@ -6160,7 +6161,7 @@ variable_def:
|
||||
variable_def_typed:
|
||||
var_modifiers struct_spec variable_def
|
||||
{
|
||||
- unsigned int modifiers = $1;
|
||||
+ uint32_t modifiers = $1;
|
||||
struct hlsl_type *type;
|
||||
|
||||
if (!(type = apply_type_modifiers(ctx, $2, &modifiers, true, &@1)))
|
||||
@@ -6175,7 +6176,7 @@ variable_def_typed:
|
||||
}
|
||||
| var_modifiers type variable_def
|
||||
{
|
||||
- unsigned int modifiers = $1;
|
||||
+ uint32_t modifiers = $1;
|
||||
struct hlsl_type *type;
|
||||
|
||||
if (!(type = apply_type_modifiers(ctx, $2, &modifiers, true, &@1)))
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
||||
index 88cbef61d5f..acc19dd8ba5 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
||||
@@ -263,7 +263,7 @@ static bool types_are_semantic_equivalent(struct hlsl_ctx *ctx, const struct hls
|
||||
}
|
||||
|
||||
static struct hlsl_ir_var *add_semantic_var(struct hlsl_ctx *ctx, struct hlsl_ir_var *var,
|
||||
- struct hlsl_type *type, unsigned int modifiers, struct hlsl_semantic *semantic,
|
||||
+ struct hlsl_type *type, uint32_t modifiers, struct hlsl_semantic *semantic,
|
||||
uint32_t index, bool output, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
struct hlsl_semantic new_semantic;
|
||||
@@ -331,7 +331,7 @@ static struct hlsl_ir_var *add_semantic_var(struct hlsl_ctx *ctx, struct hlsl_ir
|
||||
}
|
||||
|
||||
static void prepend_input_copy(struct hlsl_ctx *ctx, struct hlsl_block *block, struct hlsl_ir_load *lhs,
|
||||
- unsigned int modifiers, struct hlsl_semantic *semantic, uint32_t semantic_index)
|
||||
+ uint32_t modifiers, struct hlsl_semantic *semantic, uint32_t semantic_index)
|
||||
{
|
||||
struct hlsl_type *type = lhs->node.data_type, *vector_type_src, *vector_type_dst;
|
||||
struct vkd3d_shader_location *loc = &lhs->node.loc;
|
||||
@@ -395,7 +395,7 @@ static void prepend_input_copy(struct hlsl_ctx *ctx, struct hlsl_block *block, s
|
||||
}
|
||||
|
||||
static void prepend_input_copy_recurse(struct hlsl_ctx *ctx, struct hlsl_block *block, struct hlsl_ir_load *lhs,
|
||||
- unsigned int modifiers, struct hlsl_semantic *semantic, uint32_t semantic_index)
|
||||
+ uint32_t modifiers, struct hlsl_semantic *semantic, uint32_t semantic_index)
|
||||
{
|
||||
struct vkd3d_shader_location *loc = &lhs->node.loc;
|
||||
struct hlsl_type *type = lhs->node.data_type;
|
||||
@@ -411,7 +411,7 @@ static void prepend_input_copy_recurse(struct hlsl_ctx *ctx, struct hlsl_block *
|
||||
|
||||
for (i = 0; i < hlsl_type_element_count(type); ++i)
|
||||
{
|
||||
- unsigned int element_modifiers = modifiers;
|
||||
+ uint32_t element_modifiers = modifiers;
|
||||
|
||||
if (type->class == HLSL_CLASS_ARRAY)
|
||||
{
|
||||
@@ -473,7 +473,7 @@ static void prepend_input_var_copy(struct hlsl_ctx *ctx, struct hlsl_block *bloc
|
||||
}
|
||||
|
||||
static void append_output_copy(struct hlsl_ctx *ctx, struct hlsl_block *block, struct hlsl_ir_load *rhs,
|
||||
- unsigned int modifiers, struct hlsl_semantic *semantic, uint32_t semantic_index)
|
||||
+ uint32_t modifiers, struct hlsl_semantic *semantic, uint32_t semantic_index)
|
||||
{
|
||||
struct hlsl_type *type = rhs->node.data_type, *vector_type;
|
||||
struct vkd3d_shader_location *loc = &rhs->node.loc;
|
||||
@@ -529,7 +529,7 @@ static void append_output_copy(struct hlsl_ctx *ctx, struct hlsl_block *block, s
|
||||
}
|
||||
|
||||
static void append_output_copy_recurse(struct hlsl_ctx *ctx, struct hlsl_block *block, struct hlsl_ir_load *rhs,
|
||||
- unsigned int modifiers, struct hlsl_semantic *semantic, uint32_t semantic_index)
|
||||
+ uint32_t modifiers, struct hlsl_semantic *semantic, uint32_t semantic_index)
|
||||
{
|
||||
struct vkd3d_shader_location *loc = &rhs->node.loc;
|
||||
struct hlsl_type *type = rhs->node.data_type;
|
||||
@@ -1519,7 +1519,7 @@ static void copy_propagation_set_value(struct hlsl_ctx *ctx, struct copy_propaga
|
||||
|
||||
static bool copy_propagation_replace_with_single_instr(struct hlsl_ctx *ctx,
|
||||
const struct copy_propagation_state *state, const struct hlsl_ir_load *load,
|
||||
- unsigned int swizzle, struct hlsl_ir_node *instr)
|
||||
+ uint32_t swizzle, struct hlsl_ir_node *instr)
|
||||
{
|
||||
const unsigned int instr_component_count = hlsl_type_component_count(instr->data_type);
|
||||
const struct hlsl_deref *deref = &load->src;
|
||||
@@ -1527,7 +1527,7 @@ static bool copy_propagation_replace_with_single_instr(struct hlsl_ctx *ctx,
|
||||
struct hlsl_ir_node *new_instr = NULL;
|
||||
unsigned int time = load->node.index;
|
||||
unsigned int start, count, i;
|
||||
- unsigned int ret_swizzle = 0;
|
||||
+ uint32_t ret_swizzle = 0;
|
||||
|
||||
if (!hlsl_component_index_range_from_deref(ctx, deref, &start, &count))
|
||||
return false;
|
||||
@@ -1573,7 +1573,7 @@ static bool copy_propagation_replace_with_single_instr(struct hlsl_ctx *ctx,
|
||||
|
||||
static bool copy_propagation_replace_with_constant_vector(struct hlsl_ctx *ctx,
|
||||
const struct copy_propagation_state *state, const struct hlsl_ir_load *load,
|
||||
- unsigned int swizzle, struct hlsl_ir_node *instr)
|
||||
+ uint32_t swizzle, struct hlsl_ir_node *instr)
|
||||
{
|
||||
const unsigned int instr_component_count = hlsl_type_component_count(instr->data_type);
|
||||
const struct hlsl_deref *deref = &load->src;
|
||||
@@ -2239,7 +2239,7 @@ static bool fold_swizzle_chains(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr
|
||||
if (next_instr->type == HLSL_IR_SWIZZLE)
|
||||
{
|
||||
struct hlsl_ir_node *new_swizzle;
|
||||
- unsigned int combined_swizzle;
|
||||
+ uint32_t combined_swizzle;
|
||||
|
||||
combined_swizzle = hlsl_combine_swizzles(hlsl_ir_swizzle(next_instr)->swizzle,
|
||||
swizzle->swizzle, instr->data_type->dimx);
|
||||
@@ -3145,7 +3145,7 @@ static bool lower_int_dot(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, stru
|
||||
|
||||
for (i = 0; i < dimx; ++i)
|
||||
{
|
||||
- unsigned int s = hlsl_swizzle_from_writemask(1 << i);
|
||||
+ uint32_t s = hlsl_swizzle_from_writemask(1 << i);
|
||||
|
||||
if (!(comps[i] = hlsl_new_swizzle(ctx, s, 1, mult, &instr->loc)))
|
||||
return false;
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/spirv.c b/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
index a5565d552c0..987197887de 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
@@ -1764,6 +1764,15 @@ static uint32_t vkd3d_spirv_build_op_glsl_std450_max(struct vkd3d_spirv_builder
|
||||
GLSLstd450NMax, operands, ARRAY_SIZE(operands));
|
||||
}
|
||||
|
||||
+static uint32_t vkd3d_spirv_build_op_glsl_std450_umin(struct vkd3d_spirv_builder *builder,
|
||||
+ uint32_t result_type, uint32_t x, uint32_t y)
|
||||
+{
|
||||
+ uint32_t glsl_std450_id = vkd3d_spirv_get_glsl_std450_instr_set(builder);
|
||||
+ uint32_t operands[] = {x, y};
|
||||
+ return vkd3d_spirv_build_op_ext_inst(builder, result_type, glsl_std450_id,
|
||||
+ GLSLstd450UMin, operands, ARRAY_SIZE(operands));
|
||||
+}
|
||||
+
|
||||
static uint32_t vkd3d_spirv_build_op_glsl_std450_nclamp(struct vkd3d_spirv_builder *builder,
|
||||
uint32_t result_type, uint32_t x, uint32_t min, uint32_t max)
|
||||
{
|
||||
@@ -7355,7 +7364,7 @@ static void spirv_compiler_emit_ftou(struct spirv_compiler *compiler,
|
||||
static void spirv_compiler_emit_bitfield_instruction(struct spirv_compiler *compiler,
|
||||
const struct vkd3d_shader_instruction *instruction)
|
||||
{
|
||||
- uint32_t src_ids[4], constituents[VKD3D_VEC4_SIZE], type_id, mask_id;
|
||||
+ uint32_t src_ids[4], constituents[VKD3D_VEC4_SIZE], type_id, mask_id, size_id, max_count_id;
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
const struct vkd3d_shader_dst_param *dst = instruction->dst;
|
||||
const struct vkd3d_shader_src_param *src = instruction->src;
|
||||
@@ -7370,6 +7379,7 @@ static void spirv_compiler_emit_bitfield_instruction(struct spirv_compiler *comp
|
||||
component_type = vkd3d_component_type_from_data_type(dst->reg.data_type);
|
||||
type_id = vkd3d_spirv_get_type_id(builder, component_type, 1);
|
||||
mask_id = spirv_compiler_get_constant_uint(compiler, 0x1f);
|
||||
+ size_id = spirv_compiler_get_constant_uint(compiler, 0x20);
|
||||
|
||||
switch (instruction->handler_idx)
|
||||
{
|
||||
@@ -7398,6 +7408,9 @@ static void spirv_compiler_emit_bitfield_instruction(struct spirv_compiler *comp
|
||||
{
|
||||
src_ids[j] = vkd3d_spirv_build_op_and(builder, type_id, src_ids[j], mask_id);
|
||||
}
|
||||
+ max_count_id = vkd3d_spirv_build_op_isub(builder, type_id, size_id, src_ids[src_count - 2]);
|
||||
+ src_ids[src_count - 1] = vkd3d_spirv_build_op_glsl_std450_umin(builder, type_id,
|
||||
+ src_ids[src_count - 1], max_count_id);
|
||||
|
||||
constituents[k++] = vkd3d_spirv_build_op_trv(builder, &builder->function_stream,
|
||||
op, type_id, src_ids, src_count);
|
||||
diff --git a/libs/vkd3d/libs/vkd3d/command.c b/libs/vkd3d/libs/vkd3d/command.c
|
||||
index 549f6a45ffb..013b5d0751f 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d/command.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d/command.c
|
||||
@@ -6512,7 +6512,7 @@ static void STDMETHODCALLTYPE d3d12_command_queue_CopyTileMappings(ID3D12Command
|
||||
if (!(op = d3d12_command_queue_op_array_require_space(&command_queue->op_queue)))
|
||||
{
|
||||
ERR("Failed to add op.\n");
|
||||
- return;
|
||||
+ goto unlock_mutex;
|
||||
}
|
||||
op->opcode = VKD3D_CS_OP_COPY_MAPPINGS;
|
||||
op->u.copy_mappings.dst_resource = dst_resource_impl;
|
||||
@@ -6524,6 +6524,7 @@ static void STDMETHODCALLTYPE d3d12_command_queue_CopyTileMappings(ID3D12Command
|
||||
|
||||
d3d12_command_queue_submit_locked(command_queue);
|
||||
|
||||
+unlock_mutex:
|
||||
vkd3d_mutex_unlock(&command_queue->op_mutex);
|
||||
}
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d/resource.c b/libs/vkd3d/libs/vkd3d/resource.c
|
||||
index 609c67102a6..f4ce1ccaffa 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d/resource.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d/resource.c
|
||||
@@ -3444,6 +3444,7 @@ static void vkd3d_create_null_uav(struct d3d12_desc *descriptor,
|
||||
vkd3d_desc.miplevel_count = 1;
|
||||
vkd3d_desc.layer_idx = 0;
|
||||
vkd3d_desc.layer_count = 1;
|
||||
+ vkd3d_desc.vk_image_aspect = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
vkd3d_desc.components.r = VK_COMPONENT_SWIZZLE_R;
|
||||
vkd3d_desc.components.g = VK_COMPONENT_SWIZZLE_G;
|
||||
vkd3d_desc.components.b = VK_COMPONENT_SWIZZLE_B;
|
||||
@@ -3661,11 +3662,27 @@ static VkSamplerAddressMode vk_address_mode_from_d3d12(const struct d3d12_device
|
||||
}
|
||||
}
|
||||
|
||||
+static VkBorderColor vk_border_colour_from_d3d12(D3D12_STATIC_BORDER_COLOR colour)
|
||||
+{
|
||||
+ switch (colour)
|
||||
+ {
|
||||
+ case D3D12_STATIC_BORDER_COLOR_TRANSPARENT_BLACK:
|
||||
+ return VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK;
|
||||
+ case D3D12_STATIC_BORDER_COLOR_OPAQUE_BLACK:
|
||||
+ return VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK;
|
||||
+ case D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE:
|
||||
+ return VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE;
|
||||
+ default:
|
||||
+ FIXME("Unhandled border colour %#x.\n", colour);
|
||||
+ return VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static VkResult d3d12_create_sampler(struct d3d12_device *device, D3D12_FILTER filter,
|
||||
D3D12_TEXTURE_ADDRESS_MODE address_u, D3D12_TEXTURE_ADDRESS_MODE address_v,
|
||||
D3D12_TEXTURE_ADDRESS_MODE address_w, float mip_lod_bias, unsigned int max_anisotropy,
|
||||
- D3D12_COMPARISON_FUNC comparison_func, float min_lod, float max_lod,
|
||||
- VkSampler *vk_sampler)
|
||||
+ D3D12_COMPARISON_FUNC comparison_func, D3D12_STATIC_BORDER_COLOR border_colour,
|
||||
+ float min_lod, float max_lod, VkSampler *vk_sampler)
|
||||
{
|
||||
const struct vkd3d_vk_device_procs *vk_procs;
|
||||
struct VkSamplerCreateInfo sampler_desc;
|
||||
@@ -3695,15 +3712,48 @@ static VkResult d3d12_create_sampler(struct d3d12_device *device, D3D12_FILTER f
|
||||
sampler_desc.maxLod = max_lod;
|
||||
sampler_desc.borderColor = VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK;
|
||||
sampler_desc.unnormalizedCoordinates = VK_FALSE;
|
||||
+
|
||||
+ if (address_u == D3D12_TEXTURE_ADDRESS_MODE_BORDER || address_v == D3D12_TEXTURE_ADDRESS_MODE_BORDER
|
||||
+ || address_w == D3D12_TEXTURE_ADDRESS_MODE_BORDER)
|
||||
+ sampler_desc.borderColor = vk_border_colour_from_d3d12(border_colour);
|
||||
+
|
||||
if ((vr = VK_CALL(vkCreateSampler(device->vk_device, &sampler_desc, NULL, vk_sampler))) < 0)
|
||||
WARN("Failed to create Vulkan sampler, vr %d.\n", vr);
|
||||
|
||||
return vr;
|
||||
}
|
||||
|
||||
+static D3D12_STATIC_BORDER_COLOR d3d12_static_border_colour(const float *colour)
|
||||
+{
|
||||
+ unsigned int i;
|
||||
+
|
||||
+ static const struct
|
||||
+ {
|
||||
+ float colour[4];
|
||||
+ D3D12_STATIC_BORDER_COLOR static_colour;
|
||||
+ }
|
||||
+ colours[] =
|
||||
+ {
|
||||
+ {{0.0f, 0.0f, 0.0f, 0.0f}, D3D12_STATIC_BORDER_COLOR_TRANSPARENT_BLACK},
|
||||
+ {{0.0f, 0.0f, 0.0f, 1.0f}, D3D12_STATIC_BORDER_COLOR_OPAQUE_BLACK},
|
||||
+ {{1.0f, 1.0f, 1.0f, 1.0f}, D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE},
|
||||
+ };
|
||||
+
|
||||
+ for (i = 0; i < ARRAY_SIZE(colours); ++i)
|
||||
+ {
|
||||
+ if (!memcmp(colour, colours[i].colour, sizeof(colours[i].colour)))
|
||||
+ return colours[i].static_colour;
|
||||
+ }
|
||||
+
|
||||
+ FIXME("Unhandled border colour {%.8e, %.8e, %.8e, %.8e}.\n", colour[0], colour[1], colour[2], colour[3]);
|
||||
+
|
||||
+ return D3D12_STATIC_BORDER_COLOR_TRANSPARENT_BLACK;
|
||||
+}
|
||||
+
|
||||
void d3d12_desc_create_sampler(struct d3d12_desc *sampler,
|
||||
struct d3d12_device *device, const D3D12_SAMPLER_DESC *desc)
|
||||
{
|
||||
+ D3D12_STATIC_BORDER_COLOR static_colour = D3D12_STATIC_BORDER_COLOR_TRANSPARENT_BLACK;
|
||||
struct vkd3d_view *view;
|
||||
|
||||
if (!desc)
|
||||
@@ -3715,8 +3765,7 @@ void d3d12_desc_create_sampler(struct d3d12_desc *sampler,
|
||||
if (desc->AddressU == D3D12_TEXTURE_ADDRESS_MODE_BORDER
|
||||
|| desc->AddressV == D3D12_TEXTURE_ADDRESS_MODE_BORDER
|
||||
|| desc->AddressW == D3D12_TEXTURE_ADDRESS_MODE_BORDER)
|
||||
- FIXME("Ignoring border color {%.8e, %.8e, %.8e, %.8e}.\n",
|
||||
- desc->BorderColor[0], desc->BorderColor[1], desc->BorderColor[2], desc->BorderColor[3]);
|
||||
+ static_colour = d3d12_static_border_colour(desc->BorderColor);
|
||||
|
||||
if (!(view = vkd3d_view_create(VKD3D_DESCRIPTOR_MAGIC_SAMPLER, VK_DESCRIPTOR_TYPE_SAMPLER,
|
||||
VKD3D_VIEW_TYPE_SAMPLER, device)))
|
||||
@@ -3724,9 +3773,9 @@ void d3d12_desc_create_sampler(struct d3d12_desc *sampler,
|
||||
view->v.u.vk_sampler = VK_NULL_HANDLE;
|
||||
view->v.format = NULL;
|
||||
|
||||
- if (d3d12_create_sampler(device, desc->Filter, desc->AddressU,
|
||||
- desc->AddressV, desc->AddressW, desc->MipLODBias, desc->MaxAnisotropy,
|
||||
- desc->ComparisonFunc, desc->MinLOD, desc->MaxLOD, &view->v.u.vk_sampler) < 0)
|
||||
+ if (d3d12_create_sampler(device, desc->Filter, desc->AddressU, desc->AddressV,
|
||||
+ desc->AddressW, desc->MipLODBias, desc->MaxAnisotropy, desc->ComparisonFunc,
|
||||
+ static_colour, desc->MinLOD, desc->MaxLOD, &view->v.u.vk_sampler) < 0)
|
||||
{
|
||||
vkd3d_view_decref(view, device);
|
||||
return;
|
||||
@@ -3740,14 +3789,9 @@ HRESULT vkd3d_create_static_sampler(struct d3d12_device *device,
|
||||
{
|
||||
VkResult vr;
|
||||
|
||||
- if (desc->AddressU == D3D12_TEXTURE_ADDRESS_MODE_BORDER
|
||||
- || desc->AddressV == D3D12_TEXTURE_ADDRESS_MODE_BORDER
|
||||
- || desc->AddressW == D3D12_TEXTURE_ADDRESS_MODE_BORDER)
|
||||
- FIXME("Ignoring border %#x.\n", desc->BorderColor);
|
||||
-
|
||||
- vr = d3d12_create_sampler(device, desc->Filter, desc->AddressU,
|
||||
- desc->AddressV, desc->AddressW, desc->MipLODBias, desc->MaxAnisotropy,
|
||||
- desc->ComparisonFunc, desc->MinLOD, desc->MaxLOD, vk_sampler);
|
||||
+ vr = d3d12_create_sampler(device, desc->Filter, desc->AddressU, desc->AddressV,
|
||||
+ desc->AddressW, desc->MipLODBias, desc->MaxAnisotropy, desc->ComparisonFunc,
|
||||
+ desc->BorderColor, desc->MinLOD, desc->MaxLOD, vk_sampler);
|
||||
return hresult_from_vk_result(vr);
|
||||
}
|
||||
|
||||
--
|
||||
2.43.0
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,956 +0,0 @@
|
||||
From 6763e88d1a79484e304096631e47726784ebcb6a Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Tue, 16 Jan 2024 10:48:52 +1100
|
||||
Subject: [PATCH] Updated vkd3d to 68b898fcb6b4ab2a9660f35edf3554465ab0efbe.
|
||||
|
||||
---
|
||||
libs/vkd3d/include/private/vkd3d_common.h | 4 -
|
||||
libs/vkd3d/libs/vkd3d-shader/d3dbc.c | 11 +-
|
||||
libs/vkd3d/libs/vkd3d-shader/dxil.c | 2 +-
|
||||
libs/vkd3d/libs/vkd3d-shader/fx.c | 235 +++++++++++++++++-
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl.y | 40 ++-
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c | 39 +++
|
||||
libs/vkd3d/libs/vkd3d-shader/ir.c | 171 ++++++++++++-
|
||||
libs/vkd3d/libs/vkd3d-shader/spirv.c | 5 +-
|
||||
libs/vkd3d/libs/vkd3d-shader/tpf.c | 26 +-
|
||||
.../libs/vkd3d-shader/vkd3d_shader_private.h | 3 +-
|
||||
10 files changed, 482 insertions(+), 54 deletions(-)
|
||||
|
||||
diff --git a/libs/vkd3d/include/private/vkd3d_common.h b/libs/vkd3d/include/private/vkd3d_common.h
|
||||
index 54fe1ca5017..4c97fa06e32 100644
|
||||
--- a/libs/vkd3d/include/private/vkd3d_common.h
|
||||
+++ b/libs/vkd3d/include/private/vkd3d_common.h
|
||||
@@ -277,10 +277,6 @@ static inline LONG64 InterlockedIncrement64(LONG64 volatile *x)
|
||||
{
|
||||
return __sync_add_and_fetch(x, 1);
|
||||
}
|
||||
-static inline LONG InterlockedAdd(LONG volatile *x, LONG val)
|
||||
-{
|
||||
- return __sync_add_and_fetch(x, val);
|
||||
-}
|
||||
# else
|
||||
# error "InterlockedIncrement() not implemented for this platform"
|
||||
# endif /* HAVE_SYNC_ADD_AND_FETCH */
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
||||
index 8fec1e6371a..aa0dd8f4b0d 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
||||
@@ -1360,18 +1360,21 @@ int vkd3d_shader_sm1_parser_create(const struct vkd3d_shader_compile_info *compi
|
||||
sm1->p.shader_desc.flat_constant_count[i].external = get_external_constant_count(sm1, i);
|
||||
|
||||
if (!sm1->p.failed)
|
||||
- vsir_validate(&sm1->p);
|
||||
+ ret = vsir_validate(&sm1->p);
|
||||
|
||||
- if (sm1->p.failed)
|
||||
+ if (sm1->p.failed && ret >= 0)
|
||||
+ ret = VKD3D_ERROR_INVALID_SHADER;
|
||||
+
|
||||
+ if (ret < 0)
|
||||
{
|
||||
WARN("Failed to parse shader.\n");
|
||||
shader_sm1_destroy(&sm1->p);
|
||||
- return VKD3D_ERROR_INVALID_SHADER;
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
*parser = &sm1->p;
|
||||
|
||||
- return VKD3D_OK;
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
bool hlsl_sm1_register_from_semantic(struct hlsl_ctx *ctx, const struct hlsl_semantic *semantic,
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/dxil.c b/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
||||
index 869a709d63f..b39ec204bff 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
||||
@@ -6282,7 +6282,7 @@ int vkd3d_shader_sm6_parser_create(const struct vkd3d_shader_compile_info *compi
|
||||
vkd3d_free(byte_code);
|
||||
|
||||
if (!sm6->p.failed && ret >= 0)
|
||||
- vsir_validate(&sm6->p);
|
||||
+ ret = vsir_validate(&sm6->p);
|
||||
|
||||
if (sm6->p.failed && ret >= 0)
|
||||
ret = VKD3D_ERROR_INVALID_SHADER;
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/fx.c b/libs/vkd3d/libs/vkd3d-shader/fx.c
|
||||
index 6c4c1203d48..17b9627b6bd 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/fx.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/fx.c
|
||||
@@ -20,32 +20,146 @@
|
||||
|
||||
#include "hlsl.h"
|
||||
|
||||
+struct string_entry
|
||||
+{
|
||||
+ struct rb_entry entry;
|
||||
+ /* String points to original data, should not be freed. */
|
||||
+ const char *string;
|
||||
+ uint32_t offset;
|
||||
+};
|
||||
+
|
||||
+static int string_storage_compare(const void *key, const struct rb_entry *entry)
|
||||
+{
|
||||
+ struct string_entry *string_entry = RB_ENTRY_VALUE(entry, struct string_entry, entry);
|
||||
+ const char *string = key;
|
||||
+
|
||||
+ return strcmp(string, string_entry->string);
|
||||
+}
|
||||
+
|
||||
+static void string_storage_destroy(struct rb_entry *entry, void *context)
|
||||
+{
|
||||
+ struct string_entry *string_entry = RB_ENTRY_VALUE(entry, struct string_entry, entry);
|
||||
+
|
||||
+ vkd3d_free(string_entry);
|
||||
+}
|
||||
+
|
||||
struct fx_write_context
|
||||
{
|
||||
+ struct hlsl_ctx *ctx;
|
||||
+
|
||||
struct vkd3d_bytecode_buffer unstructured;
|
||||
struct vkd3d_bytecode_buffer structured;
|
||||
|
||||
+ struct rb_tree strings;
|
||||
+
|
||||
+ unsigned int min_technique_version;
|
||||
+ unsigned int max_technique_version;
|
||||
+
|
||||
uint32_t technique_count;
|
||||
+ uint32_t group_count;
|
||||
int status;
|
||||
};
|
||||
|
||||
+static void fx_write_context_init(struct hlsl_ctx *ctx, struct fx_write_context *fx)
|
||||
+{
|
||||
+ unsigned int version = ctx->profile->major_version;
|
||||
+
|
||||
+ memset(fx, 0, sizeof(*fx));
|
||||
+
|
||||
+ fx->ctx = ctx;
|
||||
+ if (version == 2)
|
||||
+ {
|
||||
+ fx->min_technique_version = 9;
|
||||
+ fx->max_technique_version = 9;
|
||||
+ }
|
||||
+ else if (version == 4)
|
||||
+ {
|
||||
+ fx->min_technique_version = 10;
|
||||
+ fx->max_technique_version = 10;
|
||||
+ }
|
||||
+ else if (version == 5)
|
||||
+ {
|
||||
+ fx->min_technique_version = 10;
|
||||
+ fx->max_technique_version = 11;
|
||||
+ }
|
||||
+
|
||||
+ rb_init(&fx->strings, string_storage_compare);
|
||||
+}
|
||||
+
|
||||
+static int fx_write_context_cleanup(struct fx_write_context *fx)
|
||||
+{
|
||||
+ int status = fx->status;
|
||||
+ rb_destroy(&fx->strings, string_storage_destroy, NULL);
|
||||
+
|
||||
+ return status;
|
||||
+}
|
||||
+
|
||||
+static bool technique_matches_version(const struct hlsl_ir_var *var, const struct fx_write_context *fx)
|
||||
+{
|
||||
+ const struct hlsl_type *type = var->data_type;
|
||||
+
|
||||
+ if (type->base_type != HLSL_TYPE_TECHNIQUE)
|
||||
+ return false;
|
||||
+
|
||||
+ return type->e.version >= fx->min_technique_version && type->e.version <= fx->max_technique_version;
|
||||
+}
|
||||
+
|
||||
static uint32_t fx_put_raw_string(struct fx_write_context *fx, const char *string)
|
||||
{
|
||||
+ struct string_entry *string_entry;
|
||||
+ struct rb_entry *entry;
|
||||
+
|
||||
/* NULLs are emitted as empty strings using the same 4 bytes at the start of the section. */
|
||||
- return string ? put_string(&fx->unstructured, string) : 0;
|
||||
+ if (!string)
|
||||
+ return 0;
|
||||
+
|
||||
+ if ((entry = rb_get(&fx->strings, string)))
|
||||
+ {
|
||||
+ string_entry = RB_ENTRY_VALUE(entry, struct string_entry, entry);
|
||||
+ return string_entry->offset;
|
||||
+ }
|
||||
+
|
||||
+ if (!(string_entry = hlsl_alloc(fx->ctx, sizeof(*string_entry))))
|
||||
+ return 0;
|
||||
+
|
||||
+ string_entry->offset = put_string(&fx->unstructured, string);
|
||||
+ string_entry->string = string;
|
||||
+
|
||||
+ rb_put(&fx->strings, string, &string_entry->entry);
|
||||
+
|
||||
+ return string_entry->offset;
|
||||
}
|
||||
|
||||
-static void write_technique(struct hlsl_ir_var *var, struct fx_write_context *fx)
|
||||
+static void write_pass(struct hlsl_ir_var *var, struct fx_write_context *fx)
|
||||
{
|
||||
struct vkd3d_bytecode_buffer *buffer = &fx->structured;
|
||||
uint32_t name_offset;
|
||||
|
||||
name_offset = fx_put_raw_string(fx, var->name);
|
||||
put_u32(buffer, name_offset);
|
||||
- put_u32(buffer, 0); /* Pass count. */
|
||||
put_u32(buffer, 0); /* Annotation count. */
|
||||
+ put_u32(buffer, 0); /* Assignment count. */
|
||||
+}
|
||||
+
|
||||
+static void write_technique(struct hlsl_ir_var *var, struct fx_write_context *fx)
|
||||
+{
|
||||
+ struct vkd3d_bytecode_buffer *buffer = &fx->structured;
|
||||
+ uint32_t name_offset, count = 0;
|
||||
+ struct hlsl_ir_var *pass;
|
||||
+ uint32_t count_offset;
|
||||
|
||||
- /* TODO: passes */
|
||||
+ name_offset = fx_put_raw_string(fx, var->name);
|
||||
+ put_u32(buffer, name_offset);
|
||||
+ count_offset = put_u32(buffer, 0);
|
||||
+ put_u32(buffer, 0); /* Annotation count. */
|
||||
+
|
||||
+ LIST_FOR_EACH_ENTRY(pass, &var->scope->vars, struct hlsl_ir_var, scope_entry)
|
||||
+ {
|
||||
+ write_pass(pass, fx);
|
||||
+ ++count;
|
||||
+ }
|
||||
+
|
||||
+ set_u32(buffer, count_offset, count);
|
||||
}
|
||||
|
||||
static void set_status(struct fx_write_context *fx, int status)
|
||||
@@ -75,13 +189,55 @@ static void write_techniques(struct hlsl_scope *scope, struct fx_write_context *
|
||||
set_status(fx, fx->structured.status);
|
||||
}
|
||||
|
||||
+static void write_group(struct hlsl_scope *scope, const char *name, struct fx_write_context *fx)
|
||||
+{
|
||||
+ struct vkd3d_bytecode_buffer *buffer = &fx->structured;
|
||||
+ uint32_t name_offset = fx_put_raw_string(fx, name);
|
||||
+ uint32_t count_offset, count;
|
||||
+
|
||||
+ put_u32(buffer, name_offset);
|
||||
+ count_offset = put_u32(buffer, 0); /* Technique count */
|
||||
+ put_u32(buffer, 0); /* Annotation count */
|
||||
+
|
||||
+ count = fx->technique_count;
|
||||
+ write_techniques(scope, fx);
|
||||
+ set_u32(buffer, count_offset, fx->technique_count - count);
|
||||
+
|
||||
+ ++fx->group_count;
|
||||
+}
|
||||
+
|
||||
+static void write_groups(struct hlsl_scope *scope, struct fx_write_context *fx)
|
||||
+{
|
||||
+ bool needs_default_group = false;
|
||||
+ struct hlsl_ir_var *var;
|
||||
+
|
||||
+ LIST_FOR_EACH_ENTRY(var, &scope->vars, struct hlsl_ir_var, scope_entry)
|
||||
+ {
|
||||
+ if (technique_matches_version(var, fx))
|
||||
+ {
|
||||
+ needs_default_group = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (needs_default_group)
|
||||
+ write_group(scope, NULL, fx);
|
||||
+ LIST_FOR_EACH_ENTRY(var, &scope->vars, struct hlsl_ir_var, scope_entry)
|
||||
+ {
|
||||
+ const struct hlsl_type *type = var->data_type;
|
||||
+
|
||||
+ if (type->base_type == HLSL_TYPE_EFFECT_GROUP)
|
||||
+ write_group(var->scope, var->name, fx);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static int hlsl_fx_4_write(struct hlsl_ctx *ctx, struct vkd3d_shader_code *out)
|
||||
{
|
||||
struct vkd3d_bytecode_buffer buffer = { 0 };
|
||||
struct fx_write_context fx;
|
||||
uint32_t size_offset, size;
|
||||
|
||||
- memset(&fx, 0, sizeof(fx));
|
||||
+ fx_write_context_init(ctx, &fx);
|
||||
|
||||
put_u32(&fx.unstructured, 0); /* Empty string placeholder. */
|
||||
|
||||
@@ -132,7 +288,71 @@ static int hlsl_fx_4_write(struct hlsl_ctx *ctx, struct vkd3d_shader_code *out)
|
||||
if (fx.status < 0)
|
||||
ctx->result = fx.status;
|
||||
|
||||
- return fx.status;
|
||||
+ return fx_write_context_cleanup(&fx);
|
||||
+}
|
||||
+
|
||||
+static int hlsl_fx_5_write(struct hlsl_ctx *ctx, struct vkd3d_shader_code *out)
|
||||
+{
|
||||
+ struct vkd3d_bytecode_buffer buffer = { 0 };
|
||||
+ struct fx_write_context fx;
|
||||
+ uint32_t size_offset, size;
|
||||
+
|
||||
+ fx_write_context_init(ctx, &fx);
|
||||
+
|
||||
+ put_u32(&fx.unstructured, 0); /* Empty string placeholder. */
|
||||
+
|
||||
+ /* TODO: buffers */
|
||||
+ /* TODO: objects */
|
||||
+ /* TODO: interface variables */
|
||||
+
|
||||
+ write_groups(ctx->globals, &fx);
|
||||
+
|
||||
+ put_u32(&buffer, 0xfeff2001); /* Version. */
|
||||
+ put_u32(&buffer, 0); /* Buffer count. */
|
||||
+ put_u32(&buffer, 0); /* Variable count. */
|
||||
+ put_u32(&buffer, 0); /* Object count. */
|
||||
+ put_u32(&buffer, 0); /* Pool buffer count. */
|
||||
+ put_u32(&buffer, 0); /* Pool variable count. */
|
||||
+ put_u32(&buffer, 0); /* Pool object count. */
|
||||
+ put_u32(&buffer, fx.technique_count);
|
||||
+ size_offset = put_u32(&buffer, 0); /* Unstructured size. */
|
||||
+ put_u32(&buffer, 0); /* String count. */
|
||||
+ put_u32(&buffer, 0); /* Texture object count. */
|
||||
+ put_u32(&buffer, 0); /* Depth stencil state count. */
|
||||
+ put_u32(&buffer, 0); /* Blend state count. */
|
||||
+ put_u32(&buffer, 0); /* Rasterizer state count. */
|
||||
+ put_u32(&buffer, 0); /* Sampler state count. */
|
||||
+ put_u32(&buffer, 0); /* Rendertarget view count. */
|
||||
+ put_u32(&buffer, 0); /* Depth stencil view count. */
|
||||
+ put_u32(&buffer, 0); /* Shader count. */
|
||||
+ put_u32(&buffer, 0); /* Inline shader count. */
|
||||
+ put_u32(&buffer, fx.group_count); /* Group count. */
|
||||
+ put_u32(&buffer, 0); /* UAV count. */
|
||||
+ put_u32(&buffer, 0); /* Interface variables count. */
|
||||
+ put_u32(&buffer, 0); /* Interface variable element count. */
|
||||
+ put_u32(&buffer, 0); /* Class instance elements count. */
|
||||
+
|
||||
+ size = align(fx.unstructured.size, 4);
|
||||
+ set_u32(&buffer, size_offset, size);
|
||||
+
|
||||
+ bytecode_put_bytes(&buffer, fx.unstructured.data, fx.unstructured.size);
|
||||
+ bytecode_put_bytes(&buffer, fx.structured.data, fx.structured.size);
|
||||
+
|
||||
+ vkd3d_free(fx.unstructured.data);
|
||||
+ vkd3d_free(fx.structured.data);
|
||||
+
|
||||
+ set_status(&fx, buffer.status);
|
||||
+
|
||||
+ if (!fx.status)
|
||||
+ {
|
||||
+ out->code = buffer.data;
|
||||
+ out->size = buffer.size;
|
||||
+ }
|
||||
+
|
||||
+ if (fx.status < 0)
|
||||
+ ctx->result = fx.status;
|
||||
+
|
||||
+ return fx_write_context_cleanup(&fx);
|
||||
}
|
||||
|
||||
int hlsl_emit_effect_binary(struct hlsl_ctx *ctx, struct vkd3d_shader_code *out)
|
||||
@@ -148,8 +368,7 @@ int hlsl_emit_effect_binary(struct hlsl_ctx *ctx, struct vkd3d_shader_code *out)
|
||||
}
|
||||
else if (ctx->profile->major_version == 5)
|
||||
{
|
||||
- hlsl_fixme(ctx, &ctx->location, "Writing fx_5_0 binaries is not implemented.");
|
||||
- return VKD3D_ERROR_NOT_IMPLEMENTED;
|
||||
+ return hlsl_fx_5_write(ctx, out);
|
||||
}
|
||||
else
|
||||
{
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.y b/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
index 7424e63a478..b11cbde26f1 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
@@ -1096,8 +1096,8 @@ static bool add_func_parameter(struct hlsl_ctx *ctx, struct hlsl_func_parameters
|
||||
return true;
|
||||
}
|
||||
|
||||
-static bool add_technique(struct hlsl_ctx *ctx, const char *name, const char *typename,
|
||||
- const struct vkd3d_shader_location *loc)
|
||||
+static bool add_technique(struct hlsl_ctx *ctx, const char *name, struct hlsl_scope *scope,
|
||||
+ const char *typename, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
struct hlsl_ir_var *var;
|
||||
struct hlsl_type *type;
|
||||
@@ -1105,6 +1105,7 @@ static bool add_technique(struct hlsl_ctx *ctx, const char *name, const char *ty
|
||||
type = hlsl_get_type(ctx->globals, typename, false, false);
|
||||
if (!(var = hlsl_new_var(ctx, name, type, loc, NULL, 0, NULL)))
|
||||
return false;
|
||||
+ var->scope = scope;
|
||||
|
||||
if (!hlsl_add_var(ctx, var, false))
|
||||
{
|
||||
@@ -5102,7 +5103,7 @@ static void check_duplicated_switch_cases(struct hlsl_ctx *ctx, const struct hls
|
||||
|
||||
%type <name> any_identifier
|
||||
%type <name> var_identifier
|
||||
-%type <name> technique_name
|
||||
+%type <name> name_opt
|
||||
|
||||
%type <parameter> parameter
|
||||
|
||||
@@ -5148,42 +5149,59 @@ hlsl_prog:
|
||||
| hlsl_prog effect_group
|
||||
| hlsl_prog ';'
|
||||
|
||||
-technique_name:
|
||||
+name_opt:
|
||||
%empty
|
||||
{
|
||||
$$ = NULL;
|
||||
}
|
||||
| any_identifier
|
||||
|
||||
+pass:
|
||||
+ KW_PASS name_opt '{' '}'
|
||||
+
|
||||
pass_list:
|
||||
- %empty
|
||||
+ pass
|
||||
+ | pass_list pass
|
||||
+
|
||||
+passes:
|
||||
+ scope_start
|
||||
+ | scope_start pass_list
|
||||
|
||||
technique9:
|
||||
- KW_TECHNIQUE technique_name '{' pass_list '}'
|
||||
+ KW_TECHNIQUE name_opt '{' passes '}'
|
||||
{
|
||||
- if (!add_technique(ctx, $2, "technique", &@1))
|
||||
+ struct hlsl_scope *scope = ctx->cur_scope;
|
||||
+ hlsl_pop_scope(ctx);
|
||||
+
|
||||
+ if (!add_technique(ctx, $2, scope, "technique", &@1))
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
technique10:
|
||||
- KW_TECHNIQUE10 technique_name '{' pass_list '}'
|
||||
+ KW_TECHNIQUE10 name_opt '{' passes '}'
|
||||
{
|
||||
+ struct hlsl_scope *scope = ctx->cur_scope;
|
||||
+ hlsl_pop_scope(ctx);
|
||||
+
|
||||
if (ctx->profile->type == VKD3D_SHADER_TYPE_EFFECT && ctx->profile->major_version == 2)
|
||||
hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_INVALID_SYNTAX,
|
||||
"The 'technique10' keyword is invalid for this profile.");
|
||||
|
||||
- if (!add_technique(ctx, $2, "technique10", &@1))
|
||||
+ if (!add_technique(ctx, $2, scope, "technique10", &@1))
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
technique11:
|
||||
- KW_TECHNIQUE11 technique_name '{' pass_list '}'
|
||||
+ KW_TECHNIQUE11 name_opt '{' passes '}'
|
||||
{
|
||||
+ struct hlsl_scope *scope = ctx->cur_scope;
|
||||
+ hlsl_pop_scope(ctx);
|
||||
+
|
||||
if (ctx->profile->type == VKD3D_SHADER_TYPE_EFFECT && ctx->profile->major_version == 2)
|
||||
hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_INVALID_SYNTAX,
|
||||
"The 'technique11' keyword is invalid for this profile.");
|
||||
|
||||
- if (!add_technique(ctx, $2, "technique11", &@1))
|
||||
+ if (!add_technique(ctx, $2, scope, "technique11", &@1))
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
||||
index acc19dd8ba5..d37bef15cce 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
||||
@@ -32,6 +32,11 @@ static struct hlsl_ir_node *new_offset_from_path_index(struct hlsl_ctx *ctx, str
|
||||
switch (type->class)
|
||||
{
|
||||
case HLSL_CLASS_VECTOR:
|
||||
+ if (idx->type != HLSL_IR_CONSTANT)
|
||||
+ {
|
||||
+ hlsl_fixme(ctx, &idx->loc, "Non-constant vector addressing.");
|
||||
+ break;
|
||||
+ }
|
||||
*offset_component += hlsl_ir_constant(idx)->value.u[0].u;
|
||||
break;
|
||||
|
||||
@@ -2478,6 +2483,38 @@ static bool lower_nonconstant_vector_derefs(struct hlsl_ctx *ctx, struct hlsl_ir
|
||||
return false;
|
||||
}
|
||||
|
||||
+static bool validate_nonconstant_vector_store_derefs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
|
||||
+{
|
||||
+ struct hlsl_ir_node *idx;
|
||||
+ struct hlsl_deref *deref;
|
||||
+ struct hlsl_type *type;
|
||||
+ unsigned int i;
|
||||
+
|
||||
+ if (instr->type != HLSL_IR_STORE)
|
||||
+ return false;
|
||||
+
|
||||
+ deref = &hlsl_ir_store(instr)->lhs;
|
||||
+ assert(deref->var);
|
||||
+
|
||||
+ if (deref->path_len == 0)
|
||||
+ return false;
|
||||
+
|
||||
+ type = deref->var->data_type;
|
||||
+ for (i = 0; i < deref->path_len - 1; ++i)
|
||||
+ type = hlsl_get_element_type_from_path_index(ctx, type, deref->path[i].node);
|
||||
+
|
||||
+ idx = deref->path[deref->path_len - 1].node;
|
||||
+
|
||||
+ if (type->class == HLSL_CLASS_VECTOR && idx->type != HLSL_IR_CONSTANT)
|
||||
+ {
|
||||
+ /* We should turn this into an hlsl_error after we implement unrolling, because if we get
|
||||
+ * here after that, it means that the HLSL is invalid. */
|
||||
+ hlsl_fixme(ctx, &instr->loc, "Non-constant vector addressing on store. Unrolling may be missing.");
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
/* Lower combined samples and sampler variables to synthesized separated textures and samplers.
|
||||
* That is, translate SM1-style samples in the source to SM4-style samples in the bytecode. */
|
||||
static bool lower_combined_samples(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
|
||||
@@ -4969,6 +5006,8 @@ int hlsl_emit_bytecode(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry
|
||||
lower_ir(ctx, lower_abs, body);
|
||||
}
|
||||
|
||||
+ lower_ir(ctx, validate_nonconstant_vector_store_derefs, body);
|
||||
+
|
||||
/* TODO: move forward, remove when no longer needed */
|
||||
transform_derefs(ctx, replace_deref_path_with_offset, body);
|
||||
while (hlsl_transform_ir(ctx, hlsl_fold_constant_exprs, body, NULL));
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/ir.c b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
index 9fd60fa76a4..28c7d158452 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
@@ -1511,7 +1511,7 @@ enum vkd3d_result vkd3d_shader_normalise(struct vkd3d_shader_parser *parser,
|
||||
vkd3d_shader_trace(instructions, &parser->shader_version);
|
||||
|
||||
if (result >= 0 && !parser->failed)
|
||||
- vsir_validate(parser);
|
||||
+ result = vsir_validate(parser);
|
||||
|
||||
if (result >= 0 && parser->failed)
|
||||
result = VKD3D_ERROR_INVALID_SHADER;
|
||||
@@ -1523,10 +1523,26 @@ struct validation_context
|
||||
{
|
||||
struct vkd3d_shader_parser *parser;
|
||||
size_t instruction_idx;
|
||||
+ bool invalid_instruction_idx;
|
||||
bool dcl_temps_found;
|
||||
unsigned int temp_count;
|
||||
enum vkd3d_shader_opcode phase;
|
||||
|
||||
+ struct validation_context_temp_data
|
||||
+ {
|
||||
+ enum vsir_dimension dimension;
|
||||
+ size_t first_seen;
|
||||
+ } *temps;
|
||||
+
|
||||
+ struct validation_context_ssa_data
|
||||
+ {
|
||||
+ enum vsir_dimension dimension;
|
||||
+ size_t first_seen;
|
||||
+ uint32_t write_mask;
|
||||
+ uint32_t read_mask;
|
||||
+ size_t first_assigned;
|
||||
+ } *ssas;
|
||||
+
|
||||
enum vkd3d_shader_opcode *blocks;
|
||||
size_t depth;
|
||||
size_t blocks_capacity;
|
||||
@@ -1544,8 +1560,16 @@ static void VKD3D_PRINTF_FUNC(3, 4) validator_error(struct validation_context *c
|
||||
vkd3d_string_buffer_vprintf(&buf, format, args);
|
||||
va_end(args);
|
||||
|
||||
- vkd3d_shader_parser_error(ctx->parser, error, "instruction %zu: %s", ctx->instruction_idx + 1, buf.buffer);
|
||||
- ERR("VSIR validation error: instruction %zu: %s\n", ctx->instruction_idx + 1, buf.buffer);
|
||||
+ if (ctx->invalid_instruction_idx)
|
||||
+ {
|
||||
+ vkd3d_shader_parser_error(ctx->parser, error, "%s", buf.buffer);
|
||||
+ ERR("VSIR validation error: %s\n", buf.buffer);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ vkd3d_shader_parser_error(ctx->parser, error, "instruction %zu: %s", ctx->instruction_idx + 1, buf.buffer);
|
||||
+ ERR("VSIR validation error: instruction %zu: %s\n", ctx->instruction_idx + 1, buf.buffer);
|
||||
+ }
|
||||
|
||||
vkd3d_string_buffer_cleanup(&buf);
|
||||
}
|
||||
@@ -1592,30 +1616,101 @@ static void vsir_validate_register(struct validation_context *ctx,
|
||||
switch (reg->type)
|
||||
{
|
||||
case VKD3DSPR_TEMP:
|
||||
+ {
|
||||
+ struct validation_context_temp_data *data;
|
||||
+
|
||||
if (reg->idx_count != 1)
|
||||
+ {
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT, "Invalid index count %u for a TEMP register.",
|
||||
reg->idx_count);
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
- if (reg->idx_count >= 1 && reg->idx[0].rel_addr)
|
||||
+ if (reg->idx[0].rel_addr)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX, "Non-NULL relative address for a TEMP register.");
|
||||
|
||||
- if (reg->idx_count >= 1 && reg->idx[0].offset >= temp_count)
|
||||
+ if (reg->idx[0].offset >= temp_count)
|
||||
+ {
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX, "TEMP register index %u exceeds the maximum count %u.",
|
||||
reg->idx[0].offset, temp_count);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ /* parser->shader_desc.temp_count might be smaller then
|
||||
+ * temp_count if the parser made a mistake; we still don't
|
||||
+ * want to overflow the array. */
|
||||
+ if (reg->idx[0].offset >= ctx->parser->shader_desc.temp_count)
|
||||
+ break;
|
||||
+ data = &ctx->temps[reg->idx[0].offset];
|
||||
+
|
||||
+ if (reg->dimension == VSIR_DIMENSION_NONE)
|
||||
+ {
|
||||
+ validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DIMENSION, "Invalid dimension NONE for a TEMP register.");
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ /* TEMP registers can be scalar or vec4, provided that
|
||||
+ * each individual register always appears with the same
|
||||
+ * dimension. */
|
||||
+ if (data->dimension == VSIR_DIMENSION_NONE)
|
||||
+ {
|
||||
+ data->dimension = reg->dimension;
|
||||
+ data->first_seen = ctx->instruction_idx;
|
||||
+ }
|
||||
+ else if (data->dimension != reg->dimension)
|
||||
+ {
|
||||
+ validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DIMENSION, "Invalid dimension %#x for a TEMP register: "
|
||||
+ "it has already been seen with dimension %#x at instruction %zu.",
|
||||
+ reg->dimension, data->dimension, data->first_seen);
|
||||
+ }
|
||||
break;
|
||||
+ }
|
||||
|
||||
case VKD3DSPR_SSA:
|
||||
+ {
|
||||
+ struct validation_context_ssa_data *data;
|
||||
+
|
||||
if (reg->idx_count != 1)
|
||||
+ {
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT, "Invalid index count %u for a SSA register.",
|
||||
reg->idx_count);
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
- if (reg->idx_count >= 1 && reg->idx[0].rel_addr)
|
||||
+ if (reg->idx[0].rel_addr)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX, "Non-NULL relative address for a SSA register.");
|
||||
|
||||
- if (reg->idx_count >= 1 && reg->idx[0].offset >= ctx->parser->shader_desc.ssa_count)
|
||||
+ if (reg->idx[0].offset >= ctx->parser->shader_desc.ssa_count)
|
||||
+ {
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX, "SSA register index %u exceeds the maximum count %u.",
|
||||
reg->idx[0].offset, ctx->parser->shader_desc.ssa_count);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ data = &ctx->ssas[reg->idx[0].offset];
|
||||
+
|
||||
+ if (reg->dimension == VSIR_DIMENSION_NONE)
|
||||
+ {
|
||||
+ validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DIMENSION, "Invalid dimension NONE for a SSA register.");
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ /* SSA registers can be scalar or vec4, provided that each
|
||||
+ * individual register always appears with the same
|
||||
+ * dimension. */
|
||||
+ if (data->dimension == VSIR_DIMENSION_NONE)
|
||||
+ {
|
||||
+ data->dimension = reg->dimension;
|
||||
+ data->first_seen = ctx->instruction_idx;
|
||||
+ }
|
||||
+ else if (data->dimension != reg->dimension)
|
||||
+ {
|
||||
+ validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DIMENSION, "Invalid dimension %#x for a SSA register: "
|
||||
+ "it has already been seen with dimension %#x at instruction %zu.",
|
||||
+ reg->dimension, data->dimension, data->first_seen);
|
||||
+ }
|
||||
break;
|
||||
+ }
|
||||
|
||||
case VKD3DSPR_NULL:
|
||||
if (reg->idx_count != 0)
|
||||
@@ -1688,6 +1783,23 @@ static void vsir_validate_dst_param(struct validation_context *ctx,
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_SHIFT, "Destination has invalid shift %#x.",
|
||||
dst->shift);
|
||||
}
|
||||
+
|
||||
+ if (dst->reg.type == VKD3DSPR_SSA && dst->reg.idx[0].offset < ctx->parser->shader_desc.ssa_count)
|
||||
+ {
|
||||
+ struct validation_context_ssa_data *data = &ctx->ssas[dst->reg.idx[0].offset];
|
||||
+
|
||||
+ if (data->write_mask == 0)
|
||||
+ {
|
||||
+ data->write_mask = dst->write_mask;
|
||||
+ data->first_assigned = ctx->instruction_idx;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_SSA_USAGE,
|
||||
+ "SSA register is already assigned at instruction %zu.",
|
||||
+ data->first_assigned);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
static void vsir_validate_src_param(struct validation_context *ctx,
|
||||
@@ -1706,6 +1818,15 @@ static void vsir_validate_src_param(struct validation_context *ctx,
|
||||
if (src->modifiers >= VKD3DSPSM_COUNT)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_MODIFIERS, "Source has invalid modifiers %#x.",
|
||||
src->modifiers);
|
||||
+
|
||||
+ if (src->reg.type == VKD3DSPR_SSA && src->reg.idx[0].offset < ctx->parser->shader_desc.ssa_count)
|
||||
+ {
|
||||
+ struct validation_context_ssa_data *data = &ctx->ssas[src->reg.idx[0].offset];
|
||||
+ unsigned int i;
|
||||
+
|
||||
+ for (i = 0; i < VKD3D_VEC4_SIZE; ++i)
|
||||
+ data->read_mask |= (1u << vsir_swizzle_get_component(src->swizzle, i));
|
||||
+ }
|
||||
}
|
||||
|
||||
static void vsir_validate_dst_count(struct validation_context *ctx,
|
||||
@@ -1877,22 +1998,52 @@ static void vsir_validate_instruction(struct validation_context *ctx)
|
||||
}
|
||||
}
|
||||
|
||||
-void vsir_validate(struct vkd3d_shader_parser *parser)
|
||||
+enum vkd3d_result vsir_validate(struct vkd3d_shader_parser *parser)
|
||||
{
|
||||
struct validation_context ctx =
|
||||
{
|
||||
.parser = parser,
|
||||
.phase = VKD3DSIH_INVALID,
|
||||
};
|
||||
+ unsigned int i;
|
||||
|
||||
if (!(parser->config_flags & VKD3D_SHADER_CONFIG_FLAG_FORCE_VALIDATION))
|
||||
- return;
|
||||
+ return VKD3D_OK;
|
||||
+
|
||||
+ if (!(ctx.temps = vkd3d_calloc(parser->shader_desc.temp_count, sizeof(*ctx.temps))))
|
||||
+ goto fail;
|
||||
+
|
||||
+ if (!(ctx.ssas = vkd3d_calloc(parser->shader_desc.ssa_count, sizeof(*ctx.ssas))))
|
||||
+ goto fail;
|
||||
|
||||
for (ctx.instruction_idx = 0; ctx.instruction_idx < parser->instructions.count; ++ctx.instruction_idx)
|
||||
vsir_validate_instruction(&ctx);
|
||||
|
||||
+ ctx.invalid_instruction_idx = true;
|
||||
+
|
||||
if (ctx.depth != 0)
|
||||
validator_error(&ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INSTRUCTION_NESTING, "%zu nested blocks were not closed.", ctx.depth);
|
||||
|
||||
- free(ctx.blocks);
|
||||
+ for (i = 0; i < parser->shader_desc.ssa_count; ++i)
|
||||
+ {
|
||||
+ struct validation_context_ssa_data *data = &ctx.ssas[i];
|
||||
+
|
||||
+ if ((data->write_mask | data->read_mask) != data->write_mask)
|
||||
+ validator_error(&ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_SSA_USAGE,
|
||||
+ "SSA register %u has invalid read mask %#x, which is not a subset of the write mask %#x "
|
||||
+ "at the point of definition.", i, data->read_mask, data->write_mask);
|
||||
+ }
|
||||
+
|
||||
+ vkd3d_free(ctx.blocks);
|
||||
+ vkd3d_free(ctx.temps);
|
||||
+ vkd3d_free(ctx.ssas);
|
||||
+
|
||||
+ return VKD3D_OK;
|
||||
+
|
||||
+fail:
|
||||
+ vkd3d_free(ctx.blocks);
|
||||
+ vkd3d_free(ctx.temps);
|
||||
+ vkd3d_free(ctx.ssas);
|
||||
+
|
||||
+ return VKD3D_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/spirv.c b/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
index a9e02d0a98e..7743319bed5 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
@@ -6907,8 +6907,8 @@ static void spirv_compiler_emit_ext_glsl_instruction(struct spirv_compiler *comp
|
||||
const struct vkd3d_shader_src_param *src = instruction->src;
|
||||
uint32_t src_id[SPIRV_MAX_SRC_COUNT];
|
||||
uint32_t instr_set_id, type_id, val_id;
|
||||
+ unsigned int i, component_count;
|
||||
enum GLSLstd450 glsl_inst;
|
||||
- unsigned int i;
|
||||
|
||||
glsl_inst = spirv_compiler_map_ext_glsl_instruction(instruction);
|
||||
if (glsl_inst == GLSLstd450Bad)
|
||||
@@ -6934,8 +6934,9 @@ static void spirv_compiler_emit_ext_glsl_instruction(struct spirv_compiler *comp
|
||||
|| instruction->handler_idx == VKD3DSIH_FIRSTBIT_SHI)
|
||||
{
|
||||
/* In D3D bits are numbered from the most significant bit. */
|
||||
+ component_count = vsir_write_mask_component_count(dst->write_mask);
|
||||
val_id = vkd3d_spirv_build_op_isub(builder, type_id,
|
||||
- spirv_compiler_get_constant_uint(compiler, 31), val_id);
|
||||
+ spirv_compiler_get_constant_uint_vector(compiler, 31, component_count), val_id);
|
||||
}
|
||||
|
||||
spirv_compiler_emit_store_dst(compiler, dst, val_id);
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/tpf.c b/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
||||
index 43b3525bb7b..1f1944bc0da 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
||||
@@ -821,7 +821,7 @@ static void shader_sm4_read_dcl_resource(struct vkd3d_shader_instruction *ins, u
|
||||
const uint32_t *end = &tokens[token_count];
|
||||
enum vkd3d_sm4_data_type data_type;
|
||||
enum vkd3d_data_type reg_data_type;
|
||||
- DWORD components;
|
||||
+ uint32_t components;
|
||||
unsigned int i;
|
||||
|
||||
resource_type = (opcode_token & VKD3D_SM4_RESOURCE_TYPE_MASK) >> VKD3D_SM4_RESOURCE_TYPE_SHIFT;
|
||||
@@ -1759,11 +1759,11 @@ static bool shader_sm4_read_param(struct vkd3d_shader_sm4_parser *priv, const ui
|
||||
const struct vkd3d_sm4_register_type_info *register_type_info;
|
||||
enum vkd3d_shader_register_type vsir_register_type;
|
||||
enum vkd3d_sm4_register_precision precision;
|
||||
+ uint32_t token, order, extended, addressing;
|
||||
enum vkd3d_sm4_register_type register_type;
|
||||
enum vkd3d_sm4_extended_operand_type type;
|
||||
- enum vkd3d_sm4_register_modifier m;
|
||||
enum vkd3d_sm4_dimension sm4_dimension;
|
||||
- uint32_t token, order, extended;
|
||||
+ enum vkd3d_sm4_register_modifier m;
|
||||
|
||||
if (*ptr >= end)
|
||||
{
|
||||
@@ -1861,7 +1861,7 @@ static bool shader_sm4_read_param(struct vkd3d_shader_sm4_parser *priv, const ui
|
||||
|
||||
if (order >= 1)
|
||||
{
|
||||
- DWORD addressing = (token & VKD3D_SM4_ADDRESSING_MASK0) >> VKD3D_SM4_ADDRESSING_SHIFT0;
|
||||
+ addressing = (token & VKD3D_SM4_ADDRESSING_MASK0) >> VKD3D_SM4_ADDRESSING_SHIFT0;
|
||||
if (!(shader_sm4_read_reg_idx(priv, ptr, end, addressing, ¶m->idx[0])))
|
||||
{
|
||||
ERR("Failed to read register index.\n");
|
||||
@@ -1871,7 +1871,7 @@ static bool shader_sm4_read_param(struct vkd3d_shader_sm4_parser *priv, const ui
|
||||
|
||||
if (order >= 2)
|
||||
{
|
||||
- DWORD addressing = (token & VKD3D_SM4_ADDRESSING_MASK1) >> VKD3D_SM4_ADDRESSING_SHIFT1;
|
||||
+ addressing = (token & VKD3D_SM4_ADDRESSING_MASK1) >> VKD3D_SM4_ADDRESSING_SHIFT1;
|
||||
if (!(shader_sm4_read_reg_idx(priv, ptr, end, addressing, ¶m->idx[1])))
|
||||
{
|
||||
ERR("Failed to read register index.\n");
|
||||
@@ -1881,7 +1881,7 @@ static bool shader_sm4_read_param(struct vkd3d_shader_sm4_parser *priv, const ui
|
||||
|
||||
if (order >= 3)
|
||||
{
|
||||
- DWORD addressing = (token & VKD3D_SM4_ADDRESSING_MASK2) >> VKD3D_SM4_ADDRESSING_SHIFT2;
|
||||
+ addressing = (token & VKD3D_SM4_ADDRESSING_MASK2) >> VKD3D_SM4_ADDRESSING_SHIFT2;
|
||||
if (!(shader_sm4_read_reg_idx(priv, ptr, end, addressing, ¶m->idx[2])))
|
||||
{
|
||||
ERR("Failed to read register index.\n");
|
||||
@@ -2075,7 +2075,7 @@ static bool shader_sm4_read_src_param(struct vkd3d_shader_sm4_parser *priv, cons
|
||||
const uint32_t *end, enum vkd3d_data_type data_type, struct vkd3d_shader_src_param *src_param)
|
||||
{
|
||||
unsigned int dimension, mask;
|
||||
- DWORD token;
|
||||
+ uint32_t token;
|
||||
|
||||
if (*ptr >= end)
|
||||
{
|
||||
@@ -2162,7 +2162,7 @@ static bool shader_sm4_read_dst_param(struct vkd3d_shader_sm4_parser *priv, cons
|
||||
enum vkd3d_sm4_swizzle_type swizzle_type;
|
||||
enum vkd3d_shader_src_modifier modifier;
|
||||
unsigned int dimension, swizzle;
|
||||
- DWORD token;
|
||||
+ uint32_t token;
|
||||
|
||||
if (*ptr >= end)
|
||||
{
|
||||
@@ -2242,7 +2242,7 @@ static bool shader_sm4_read_dst_param(struct vkd3d_shader_sm4_parser *priv, cons
|
||||
return true;
|
||||
}
|
||||
|
||||
-static void shader_sm4_read_instruction_modifier(DWORD modifier, struct vkd3d_shader_instruction *ins)
|
||||
+static void shader_sm4_read_instruction_modifier(uint32_t modifier, struct vkd3d_shader_instruction *ins)
|
||||
{
|
||||
enum vkd3d_sm4_instruction_modifier modifier_type = modifier & VKD3D_SM4_MODIFIER_MASK;
|
||||
|
||||
@@ -2250,7 +2250,7 @@ static void shader_sm4_read_instruction_modifier(DWORD modifier, struct vkd3d_sh
|
||||
{
|
||||
case VKD3D_SM4_MODIFIER_AOFFIMMI:
|
||||
{
|
||||
- static const DWORD recognized_bits = VKD3D_SM4_INSTRUCTION_MODIFIER
|
||||
+ static const uint32_t recognized_bits = VKD3D_SM4_INSTRUCTION_MODIFIER
|
||||
| VKD3D_SM4_MODIFIER_MASK
|
||||
| VKD3D_SM4_AOFFIMMI_U_MASK
|
||||
| VKD3D_SM4_AOFFIMMI_V_MASK
|
||||
@@ -2278,7 +2278,7 @@ static void shader_sm4_read_instruction_modifier(DWORD modifier, struct vkd3d_sh
|
||||
|
||||
case VKD3D_SM5_MODIFIER_DATA_TYPE:
|
||||
{
|
||||
- DWORD components = (modifier & VKD3D_SM5_MODIFIER_DATA_TYPE_MASK) >> VKD3D_SM5_MODIFIER_DATA_TYPE_SHIFT;
|
||||
+ uint32_t components = (modifier & VKD3D_SM5_MODIFIER_DATA_TYPE_MASK) >> VKD3D_SM5_MODIFIER_DATA_TYPE_SHIFT;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < VKD3D_VEC4_SIZE; i++)
|
||||
@@ -2334,9 +2334,9 @@ static void shader_sm4_read_instruction(struct vkd3d_shader_sm4_parser *sm4, str
|
||||
struct vkd3d_shader_src_param *src_params;
|
||||
const uint32_t **ptr = &sm4->ptr;
|
||||
unsigned int i, len;
|
||||
- size_t remaining;
|
||||
const uint32_t *p;
|
||||
- DWORD precise;
|
||||
+ uint32_t precise;
|
||||
+ size_t remaining;
|
||||
|
||||
if (*ptr >= sm4->end)
|
||||
{
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
||||
index cc156f88074..0af7ea0d266 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
||||
@@ -216,6 +216,7 @@ enum vkd3d_shader_error
|
||||
VKD3D_SHADER_ERROR_VSIR_INVALID_DCL_TEMPS = 9014,
|
||||
VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX = 9015,
|
||||
VKD3D_SHADER_ERROR_VSIR_INVALID_INSTRUCTION_NESTING = 9016,
|
||||
+ VKD3D_SHADER_ERROR_VSIR_INVALID_SSA_USAGE = 9017,
|
||||
|
||||
VKD3D_SHADER_WARNING_VSIR_DYNAMIC_DESCRIPTOR_ARRAY = 9300,
|
||||
};
|
||||
@@ -1450,7 +1451,7 @@ int preproc_lexer_parse(const struct vkd3d_shader_compile_info *compile_info,
|
||||
int hlsl_compile_shader(const struct vkd3d_shader_code *hlsl, const struct vkd3d_shader_compile_info *compile_info,
|
||||
struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context);
|
||||
|
||||
-void vsir_validate(struct vkd3d_shader_parser *parser);
|
||||
+enum vkd3d_result vsir_validate(struct vkd3d_shader_parser *parser);
|
||||
|
||||
static inline enum vkd3d_shader_component_type vkd3d_component_type_from_data_type(
|
||||
enum vkd3d_data_type data_type)
|
||||
--
|
||||
2.43.0
|
||||
|
Loading…
Reference in New Issue
Block a user