You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-09-12 18:50:20 -07:00
Rebase against 22af42ac22279e6c0c671f033661f95c1761b4bb.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,323 +0,0 @@
|
||||
From 7827f274ee640bba481bf0092d5ac65b09c90965 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Tue, 13 May 2025 07:32:01 +1000
|
||||
Subject: [PATCH] Updated vkd3d to 3c8fd8a2f273aec73e02ce65260c54290a9739d6.
|
||||
|
||||
---
|
||||
libs/vkd3d/libs/vkd3d-shader/dxil.c | 116 ++++++++++++++++++----------
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl.c | 2 +-
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl.y | 2 +-
|
||||
3 files changed, 77 insertions(+), 43 deletions(-)
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/dxil.c b/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
||||
index da872afc265..ca79939a39b 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
||||
@@ -645,9 +645,12 @@ enum sm6_value_type
|
||||
{
|
||||
VALUE_TYPE_FUNCTION,
|
||||
VALUE_TYPE_REG,
|
||||
- VALUE_TYPE_ICB,
|
||||
+ VALUE_TYPE_DATA,
|
||||
VALUE_TYPE_HANDLE,
|
||||
VALUE_TYPE_SSA,
|
||||
+ VALUE_TYPE_ICB,
|
||||
+ VALUE_TYPE_IDXTEMP,
|
||||
+ VALUE_TYPE_GROUPSHAREDMEM,
|
||||
VALUE_TYPE_UNDEFINED,
|
||||
VALUE_TYPE_INVALID,
|
||||
};
|
||||
@@ -671,6 +674,22 @@ struct sm6_ssa_data
|
||||
unsigned int id;
|
||||
};
|
||||
|
||||
+struct sm6_icb_data
|
||||
+{
|
||||
+ unsigned int data_id;
|
||||
+ unsigned int id;
|
||||
+};
|
||||
+
|
||||
+struct sm6_idxtemp_data
|
||||
+{
|
||||
+ unsigned int id;
|
||||
+};
|
||||
+
|
||||
+struct sm6_groupsharedmem_data
|
||||
+{
|
||||
+ unsigned int id;
|
||||
+};
|
||||
+
|
||||
struct sm6_value
|
||||
{
|
||||
const struct sm6_type *type;
|
||||
@@ -680,9 +699,12 @@ struct sm6_value
|
||||
union
|
||||
{
|
||||
struct sm6_function_data function;
|
||||
- const struct vkd3d_shader_immediate_constant_buffer *icb;
|
||||
+ const struct vkd3d_shader_immediate_constant_buffer *data;
|
||||
struct sm6_handle_data handle;
|
||||
struct sm6_ssa_data ssa;
|
||||
+ struct sm6_icb_data icb;
|
||||
+ struct sm6_idxtemp_data idxtemp;
|
||||
+ struct sm6_groupsharedmem_data groupsharedmem;
|
||||
} u;
|
||||
struct vkd3d_shader_register reg;
|
||||
};
|
||||
@@ -2244,6 +2266,9 @@ static inline bool sm6_value_is_register(const struct sm6_value *value)
|
||||
{
|
||||
case VALUE_TYPE_REG:
|
||||
case VALUE_TYPE_SSA:
|
||||
+ case VALUE_TYPE_ICB:
|
||||
+ case VALUE_TYPE_IDXTEMP:
|
||||
+ case VALUE_TYPE_GROUPSHAREDMEM:
|
||||
case VALUE_TYPE_UNDEFINED:
|
||||
case VALUE_TYPE_INVALID:
|
||||
return true;
|
||||
@@ -2283,9 +2308,9 @@ static bool sm6_value_vector_is_constant_or_undef(const struct sm6_value **value
|
||||
return true;
|
||||
}
|
||||
|
||||
-static bool sm6_value_is_icb(const struct sm6_value *value)
|
||||
+static bool sm6_value_is_data(const struct sm6_value *value)
|
||||
{
|
||||
- return value->value_type == VALUE_TYPE_ICB;
|
||||
+ return value->value_type == VALUE_TYPE_DATA;
|
||||
}
|
||||
|
||||
static bool sm6_value_is_ssa(const struct sm6_value *value)
|
||||
@@ -2425,6 +2450,18 @@ static void sm6_register_from_value(struct vkd3d_shader_register *reg, const str
|
||||
reg->dimension = sm6_type_is_scalar(value->type) ? VSIR_DIMENSION_SCALAR : VSIR_DIMENSION_VEC4;
|
||||
break;
|
||||
|
||||
+ case VALUE_TYPE_ICB:
|
||||
+ register_init_with_id(reg, VKD3DSPR_IMMCONSTBUFFER, data_type, value->u.icb.id);
|
||||
+ break;
|
||||
+
|
||||
+ case VALUE_TYPE_IDXTEMP:
|
||||
+ register_init_with_id(reg, VKD3DSPR_IDXTEMP, data_type, value->u.idxtemp.id);
|
||||
+ break;
|
||||
+
|
||||
+ case VALUE_TYPE_GROUPSHAREDMEM:
|
||||
+ register_init_with_id(reg, VKD3DSPR_GROUPSHAREDMEM, data_type, value->u.groupsharedmem.id);
|
||||
+ break;
|
||||
+
|
||||
case VALUE_TYPE_UNDEFINED:
|
||||
case VALUE_TYPE_INVALID:
|
||||
vsir_register_init(reg, VKD3DSPR_UNDEF, data_type, 0);
|
||||
@@ -2432,7 +2469,7 @@ static void sm6_register_from_value(struct vkd3d_shader_register *reg, const str
|
||||
|
||||
case VALUE_TYPE_FUNCTION:
|
||||
case VALUE_TYPE_HANDLE:
|
||||
- case VALUE_TYPE_ICB:
|
||||
+ case VALUE_TYPE_DATA:
|
||||
vkd3d_unreachable();
|
||||
}
|
||||
}
|
||||
@@ -3021,13 +3058,6 @@ static float register_get_float_value(const struct vkd3d_shader_register *reg)
|
||||
return bitcast_uint_to_float(reg->u.immconst_u32[0]);
|
||||
}
|
||||
|
||||
-static inline float sm6_value_get_constant_float(const struct sm6_value *value)
|
||||
-{
|
||||
- if (!sm6_value_is_constant(value))
|
||||
- return UINT_MAX;
|
||||
- return register_get_float_value(&value->reg);
|
||||
-}
|
||||
-
|
||||
static enum vkd3d_result value_allocate_constant_array(struct sm6_value *dst, const struct sm6_type *type,
|
||||
const uint64_t *operands, struct sm6_parser *sm6)
|
||||
{
|
||||
@@ -3072,8 +3102,8 @@ static enum vkd3d_result value_allocate_constant_array(struct sm6_value *dst, co
|
||||
return VKD3D_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
- dst->value_type = VALUE_TYPE_ICB;
|
||||
- dst->u.icb = icb;
|
||||
+ dst->value_type = VALUE_TYPE_DATA;
|
||||
+ dst->u.data = icb;
|
||||
|
||||
icb->register_idx = sm6->icb_count++;
|
||||
icb->data_type = vkd3d_data_type_from_sm6_type(elem_type);
|
||||
@@ -3477,13 +3507,13 @@ static struct vkd3d_shader_instruction *sm6_parser_add_instruction(struct sm6_pa
|
||||
static void sm6_parser_declare_icb(struct sm6_parser *sm6, const struct sm6_type *elem_type, unsigned int count,
|
||||
unsigned int alignment, unsigned int init, struct sm6_value *dst)
|
||||
{
|
||||
- enum vkd3d_data_type data_type = vkd3d_data_type_from_sm6_type(elem_type);
|
||||
struct vkd3d_shader_instruction *ins;
|
||||
|
||||
ins = sm6_parser_add_instruction(sm6, VKD3DSIH_DCL_IMMEDIATE_CONSTANT_BUFFER);
|
||||
/* The icb value index will be resolved later so forward references can be handled. */
|
||||
ins->declaration.icb = (void *)(intptr_t)init;
|
||||
- register_init_with_id(&dst->reg, VKD3DSPR_IMMCONSTBUFFER, data_type, init);
|
||||
+ dst->value_type = VALUE_TYPE_ICB;
|
||||
+ dst->u.icb.data_id = init;
|
||||
}
|
||||
|
||||
static void sm6_parser_declare_indexable_temp(struct sm6_parser *sm6, const struct sm6_type *elem_type,
|
||||
@@ -3505,21 +3535,24 @@ static void sm6_parser_declare_indexable_temp(struct sm6_parser *sm6, const stru
|
||||
/* The initialiser value index will be resolved later so forward references can be handled. */
|
||||
ins->declaration.indexable_temp.initialiser = (void *)(uintptr_t)init;
|
||||
|
||||
- register_init_with_id(&dst->reg, VKD3DSPR_IDXTEMP, data_type, ins->declaration.indexable_temp.register_idx);
|
||||
+ dst->value_type = VALUE_TYPE_IDXTEMP;
|
||||
+ dst->u.idxtemp.id = ins->declaration.indexable_temp.register_idx;
|
||||
+ sm6_register_from_value(&dst->reg, dst);
|
||||
}
|
||||
|
||||
static void sm6_parser_declare_tgsm_raw(struct sm6_parser *sm6, const struct sm6_type *elem_type,
|
||||
unsigned int alignment, unsigned int init, struct sm6_value *dst)
|
||||
{
|
||||
- enum vkd3d_data_type data_type = vkd3d_data_type_from_sm6_type(elem_type);
|
||||
struct vkd3d_shader_instruction *ins;
|
||||
unsigned int byte_count;
|
||||
|
||||
ins = sm6_parser_add_instruction(sm6, VKD3DSIH_DCL_TGSM_RAW);
|
||||
dst_param_init(&ins->declaration.tgsm_raw.reg);
|
||||
- register_init_with_id(&ins->declaration.tgsm_raw.reg.reg, VKD3DSPR_GROUPSHAREDMEM, data_type, sm6->tgsm_count++);
|
||||
- dst->reg = ins->declaration.tgsm_raw.reg.reg;
|
||||
+ dst->value_type = VALUE_TYPE_GROUPSHAREDMEM;
|
||||
+ dst->u.groupsharedmem.id = sm6->tgsm_count++;
|
||||
dst->structure_stride = 0;
|
||||
+ sm6_register_from_value(&dst->reg, dst);
|
||||
+ sm6_register_from_value(&ins->declaration.tgsm_raw.reg.reg, dst);
|
||||
ins->declaration.tgsm_raw.alignment = alignment;
|
||||
byte_count = elem_type->u.width / 8u;
|
||||
if (byte_count != 4)
|
||||
@@ -3536,25 +3569,23 @@ static void sm6_parser_declare_tgsm_raw(struct sm6_parser *sm6, const struct sm6
|
||||
static void sm6_parser_declare_tgsm_structured(struct sm6_parser *sm6, const struct sm6_type *elem_type,
|
||||
unsigned int count, unsigned int alignment, unsigned int init, struct sm6_value *dst)
|
||||
{
|
||||
- enum vkd3d_data_type data_type = vkd3d_data_type_from_sm6_type(elem_type);
|
||||
struct vkd3d_shader_instruction *ins;
|
||||
- unsigned int structure_stride;
|
||||
|
||||
ins = sm6_parser_add_instruction(sm6, VKD3DSIH_DCL_TGSM_STRUCTURED);
|
||||
dst_param_init(&ins->declaration.tgsm_structured.reg);
|
||||
- register_init_with_id(&ins->declaration.tgsm_structured.reg.reg, VKD3DSPR_GROUPSHAREDMEM,
|
||||
- data_type, sm6->tgsm_count++);
|
||||
- dst->reg = ins->declaration.tgsm_structured.reg.reg;
|
||||
- structure_stride = elem_type->u.width / 8u;
|
||||
- if (structure_stride != 4)
|
||||
+ dst->value_type = VALUE_TYPE_GROUPSHAREDMEM;
|
||||
+ dst->u.groupsharedmem.id = sm6->tgsm_count++;
|
||||
+ dst->structure_stride = elem_type->u.width / 8u;
|
||||
+ sm6_register_from_value(&dst->reg, dst);
|
||||
+ sm6_register_from_value(&ins->declaration.tgsm_structured.reg.reg, dst);
|
||||
+ if (dst->structure_stride != 4)
|
||||
{
|
||||
- FIXME("Unsupported structure stride %u.\n", structure_stride);
|
||||
+ FIXME("Unsupported structure stride %u.\n", dst->structure_stride);
|
||||
vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_INVALID_OPERAND,
|
||||
- "Structured TGSM byte stride %u is not supported.", structure_stride);
|
||||
+ "Structured TGSM byte stride %u is not supported.", dst->structure_stride);
|
||||
}
|
||||
- dst->structure_stride = structure_stride;
|
||||
ins->declaration.tgsm_structured.alignment = alignment;
|
||||
- ins->declaration.tgsm_structured.byte_stride = structure_stride;
|
||||
+ ins->declaration.tgsm_structured.byte_stride = dst->structure_stride;
|
||||
ins->declaration.tgsm_structured.structure_count = count;
|
||||
/* The initialiser value index will be resolved later when forward references can be handled. */
|
||||
ins->flags = init;
|
||||
@@ -3717,16 +3748,16 @@ static const struct vkd3d_shader_immediate_constant_buffer *resolve_forward_init
|
||||
|
||||
VKD3D_ASSERT(index);
|
||||
--index;
|
||||
- if (!(value = sm6_parser_get_value_safe(sm6, index)) || (!sm6_value_is_icb(value) && !sm6_value_is_undef(value)))
|
||||
+ if (!(value = sm6_parser_get_value_safe(sm6, index)) || (!sm6_value_is_data(value) && !sm6_value_is_undef(value)))
|
||||
{
|
||||
WARN("Invalid initialiser index %zu.\n", index);
|
||||
vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_INVALID_OPERAND,
|
||||
"Global variable initialiser value index %zu is invalid.", index);
|
||||
return NULL;
|
||||
}
|
||||
- else if (sm6_value_is_icb(value))
|
||||
+ else if (sm6_value_is_data(value))
|
||||
{
|
||||
- return value->u.icb;
|
||||
+ return value->u.data;
|
||||
}
|
||||
/* In VSIR, initialisation with undefined values of objects is implied, not explicit. */
|
||||
return NULL;
|
||||
@@ -3741,14 +3772,14 @@ static bool resolve_forward_zero_initialiser(size_t index, struct sm6_parser *sm
|
||||
|
||||
--index;
|
||||
if (!(value = sm6_parser_get_value_safe(sm6, index))
|
||||
- || (!sm6_value_is_icb(value) && !sm6_value_is_constant(value) && !sm6_value_is_undef(value)))
|
||||
+ || (!sm6_value_is_data(value) && !sm6_value_is_constant(value) && !sm6_value_is_undef(value)))
|
||||
{
|
||||
WARN("Invalid initialiser index %zu.\n", index);
|
||||
vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_INVALID_OPERAND,
|
||||
"TGSM initialiser value index %zu is invalid.", index);
|
||||
return false;
|
||||
}
|
||||
- else if ((sm6_value_is_icb(value) && value->u.icb->is_null) || sm6_value_is_constant_zero(value))
|
||||
+ else if ((sm6_value_is_data(value) && value->u.data->is_null) || sm6_value_is_constant_zero(value))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -3853,11 +3884,14 @@ static enum vkd3d_result sm6_parser_globals_init(struct sm6_parser *sm6)
|
||||
const struct vkd3d_shader_immediate_constant_buffer *icb;
|
||||
struct sm6_value *value = &sm6->values[i];
|
||||
|
||||
- if (!sm6_value_is_register(value) || value->reg.type != VKD3DSPR_IMMCONSTBUFFER)
|
||||
+ if (value->value_type != VALUE_TYPE_ICB)
|
||||
continue;
|
||||
|
||||
- if ((icb = resolve_forward_initialiser(value->reg.idx[0].offset, sm6)))
|
||||
- value->reg.idx[0].offset = icb->register_idx;
|
||||
+ if ((icb = resolve_forward_initialiser(value->u.icb.data_id, sm6)))
|
||||
+ value->u.icb.id = icb->register_idx;
|
||||
+ else
|
||||
+ value->u.icb.id = 0;
|
||||
+ sm6_register_from_value(&value->reg, value);
|
||||
}
|
||||
|
||||
return VKD3D_OK;
|
||||
@@ -7732,7 +7766,7 @@ static bool sm6_metadata_get_float_value(const struct sm6_parser *sm6,
|
||||
if (!sm6_type_is_floating_point(value->type))
|
||||
return false;
|
||||
|
||||
- *f = sm6_value_get_constant_float(value);
|
||||
+ *f = register_get_float_value(&value->reg);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -8610,7 +8644,7 @@ static enum vkd3d_result sm6_parser_metadata_init(struct sm6_parser *sm6, const
|
||||
if (!(value = sm6_parser_get_value_safe(sm6, value_idx)))
|
||||
return VKD3D_ERROR_INVALID_SHADER;
|
||||
|
||||
- if (!sm6_value_is_constant(value) && !sm6_value_is_undef(value) && !sm6_value_is_icb(value)
|
||||
+ if (!sm6_value_is_constant(value) && !sm6_value_is_undef(value) && !sm6_value_is_data(value)
|
||||
&& !sm6_value_is_function_dcl(value))
|
||||
{
|
||||
WARN("Value at index %u is not a constant or a function declaration.\n", value_idx);
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.c b/libs/vkd3d/libs/vkd3d-shader/hlsl.c
|
||||
index 0f9aafbe13e..36c79f4c076 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.c
|
||||
@@ -2687,7 +2687,7 @@ static struct hlsl_ir_node *clone_interlocked(struct hlsl_ctx *ctx,
|
||||
|
||||
if (!(dst = hlsl_alloc(ctx, sizeof(*dst))))
|
||||
return NULL;
|
||||
- init_node(&dst->node, HLSL_IR_INTERLOCKED, NULL, &src->node.loc);
|
||||
+ init_node(&dst->node, HLSL_IR_INTERLOCKED, src->node.data_type, &src->node.loc);
|
||||
dst->op = src->op;
|
||||
|
||||
if (!clone_deref(ctx, map, &dst->dst, &src->dst))
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.y b/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
index 05657d27b38..24c7ae6b00b 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
@@ -4932,7 +4932,7 @@ static bool intrinsic_GetRenderTargetSampleCount(struct hlsl_ctx *ctx,
|
||||
"GetRenderTargetSampleCount() can only be used from a pixel shader using version 4.1 or higher.");
|
||||
|
||||
hlsl_block_add_expr(ctx, params->instrs, HLSL_OP0_RASTERIZER_SAMPLE_COUNT,
|
||||
- operands, hlsl_get_scalar_type(ctx, HLSL_TYPE_UINT), loc);
|
||||
+ operands, hlsl_get_vector_type(ctx, HLSL_TYPE_UINT, 1), loc);
|
||||
return true;
|
||||
}
|
||||
|
||||
--
|
||||
2.47.2
|
||||
|
@@ -1,448 +0,0 @@
|
||||
From 9520c6e767ef9d5e1c1024f56a20383c5692078b Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Thu, 15 May 2025 06:43:50 +1000
|
||||
Subject: [PATCH] Updated vkd3d to f5a26fd2b881d0fe602022c446ecfee45e1252b3.
|
||||
|
||||
---
|
||||
libs/vkd3d/include/private/vkd3d_version.h | 2 +-
|
||||
libs/vkd3d/include/vkd3d_shader.h | 5 +++
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl.c | 43 +++++++++++++++++++
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl.h | 4 ++
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl.y | 14 ++++--
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c | 42 ++++++------------
|
||||
.../libs/vkd3d-shader/hlsl_constant_ops.c | 9 ++--
|
||||
libs/vkd3d/libs/vkd3d-shader/ir.c | 10 ++++-
|
||||
libs/vkd3d/libs/vkd3d-shader/spirv.c | 14 +++---
|
||||
9 files changed, 92 insertions(+), 51 deletions(-)
|
||||
|
||||
diff --git a/libs/vkd3d/include/private/vkd3d_version.h b/libs/vkd3d/include/private/vkd3d_version.h
|
||||
index fb2e2f11f8b..f71f90e6b78 100644
|
||||
--- a/libs/vkd3d/include/private/vkd3d_version.h
|
||||
+++ b/libs/vkd3d/include/private/vkd3d_version.h
|
||||
@@ -1 +1 @@
|
||||
-#define VKD3D_VCS_ID " (git 4289ec60)"
|
||||
+#define VKD3D_VCS_ID " (git f5a26fd2)"
|
||||
diff --git a/libs/vkd3d/include/vkd3d_shader.h b/libs/vkd3d/include/vkd3d_shader.h
|
||||
index 6b2805e8759..1b7bdd196bb 100644
|
||||
--- a/libs/vkd3d/include/vkd3d_shader.h
|
||||
+++ b/libs/vkd3d/include/vkd3d_shader.h
|
||||
@@ -2740,6 +2740,10 @@ VKD3D_SHADER_API const enum vkd3d_shader_target_type *vkd3d_shader_get_supported
|
||||
* source code or byte code.
|
||||
*
|
||||
* This version of vkd3d-shader supports the following transformations:
|
||||
+ * - VKD3D_SHADER_SOURCE_DXBC_DXIL to VKD3D_SHADER_TARGET_SPIRV_BINARY
|
||||
+ * - VKD3D_SHADER_SOURCE_DXBC_DXIL to VKD3D_SHADER_TARGET_SPIRV_TEXT
|
||||
+ * (if vkd3d was compiled with SPIRV-Tools)
|
||||
+ * - VKD3D_SHADER_SOURCE_DXBC_DXIL to VKD3D_SHADER_TARGET_D3D_ASM
|
||||
* - VKD3D_SHADER_SOURCE_DXBC_TPF to VKD3D_SHADER_TARGET_SPIRV_BINARY
|
||||
* - VKD3D_SHADER_SOURCE_DXBC_TPF to VKD3D_SHADER_TARGET_SPIRV_TEXT
|
||||
* (if vkd3d was compiled with SPIRV-Tools)
|
||||
@@ -2952,6 +2956,7 @@ VKD3D_SHADER_API int vkd3d_shader_convert_root_signature(struct vkd3d_shader_ver
|
||||
* VKD3D_SHADER_RESOURCE_DATA_FLOAT.)
|
||||
*
|
||||
* Currently this function supports the following code types:
|
||||
+ * - VKD3D_SHADER_SOURCE_DXBC_DXIL
|
||||
* - VKD3D_SHADER_SOURCE_DXBC_TPF
|
||||
* - VKD3D_SHADER_SOURCE_D3D_BYTECODE
|
||||
*
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.c b/libs/vkd3d/libs/vkd3d-shader/hlsl.c
|
||||
index 36c79f4c076..653ddd2e8be 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.c
|
||||
@@ -319,6 +319,28 @@ bool hlsl_type_is_shader(const struct hlsl_type *type)
|
||||
return false;
|
||||
}
|
||||
|
||||
+bool hlsl_type_is_minimum_precision(const struct hlsl_type *type)
|
||||
+{
|
||||
+ if (!hlsl_is_numeric_type(type))
|
||||
+ return false;
|
||||
+
|
||||
+ switch (type->e.numeric.type)
|
||||
+ {
|
||||
+ case HLSL_TYPE_BOOL:
|
||||
+ case HLSL_TYPE_DOUBLE:
|
||||
+ case HLSL_TYPE_FLOAT:
|
||||
+ case HLSL_TYPE_HALF:
|
||||
+ case HLSL_TYPE_INT:
|
||||
+ case HLSL_TYPE_UINT:
|
||||
+ return false;
|
||||
+
|
||||
+ case HLSL_TYPE_MIN16UINT:
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ vkd3d_unreachable();
|
||||
+}
|
||||
+
|
||||
bool hlsl_type_is_patch_array(const struct hlsl_type *type)
|
||||
{
|
||||
return type->class == HLSL_CLASS_ARRAY && (type->e.array.array_type == HLSL_ARRAY_PATCH_INPUT
|
||||
@@ -350,6 +372,27 @@ bool hlsl_base_type_is_integer(enum hlsl_base_type type)
|
||||
vkd3d_unreachable();
|
||||
}
|
||||
|
||||
+bool hlsl_type_is_signed_integer(const struct hlsl_type *type)
|
||||
+{
|
||||
+ VKD3D_ASSERT(hlsl_is_numeric_type(type));
|
||||
+
|
||||
+ switch (type->e.numeric.type)
|
||||
+ {
|
||||
+ case HLSL_TYPE_INT:
|
||||
+ return true;
|
||||
+
|
||||
+ case HLSL_TYPE_BOOL:
|
||||
+ case HLSL_TYPE_DOUBLE:
|
||||
+ case HLSL_TYPE_FLOAT:
|
||||
+ case HLSL_TYPE_HALF:
|
||||
+ case HLSL_TYPE_MIN16UINT:
|
||||
+ case HLSL_TYPE_UINT:
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ vkd3d_unreachable();
|
||||
+}
|
||||
+
|
||||
bool hlsl_type_is_integer(const struct hlsl_type *type)
|
||||
{
|
||||
VKD3D_ASSERT(hlsl_is_numeric_type(type));
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.h b/libs/vkd3d/libs/vkd3d-shader/hlsl.h
|
||||
index 9eb86534f81..58f579cd9f9 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.h
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.h
|
||||
@@ -234,6 +234,8 @@ struct hlsl_type
|
||||
/* Offset where the type's description starts in the output bytecode, in bytes. */
|
||||
size_t bytecode_offset;
|
||||
|
||||
+ bool is_typedef;
|
||||
+
|
||||
uint32_t is_minimum_precision : 1;
|
||||
};
|
||||
|
||||
@@ -1771,10 +1773,12 @@ unsigned int hlsl_type_get_component_offset(struct hlsl_ctx *ctx, struct hlsl_ty
|
||||
bool hlsl_type_is_integer(const struct hlsl_type *type);
|
||||
bool hlsl_type_is_floating_point(const struct hlsl_type *type);
|
||||
bool hlsl_type_is_row_major(const struct hlsl_type *type);
|
||||
+bool hlsl_type_is_signed_integer(const struct hlsl_type *type);
|
||||
unsigned int hlsl_type_minor_size(const struct hlsl_type *type);
|
||||
unsigned int hlsl_type_major_size(const struct hlsl_type *type);
|
||||
unsigned int hlsl_type_element_count(const struct hlsl_type *type);
|
||||
bool hlsl_type_is_integer(const struct hlsl_type *type);
|
||||
+bool hlsl_type_is_minimum_precision(const struct hlsl_type *type);
|
||||
bool hlsl_type_is_resource(const struct hlsl_type *type);
|
||||
bool hlsl_type_is_shader(const struct hlsl_type *type);
|
||||
bool hlsl_type_is_patch_array(const struct hlsl_type *type);
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.y b/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
index 24c7ae6b00b..5aee1e701cd 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
@@ -1183,6 +1183,7 @@ static bool add_typedef(struct hlsl_ctx *ctx, struct hlsl_type *const orig_type,
|
||||
|
||||
vkd3d_free((void *)type->name);
|
||||
type->name = v->name;
|
||||
+ type->is_typedef = true;
|
||||
|
||||
ret = hlsl_scope_add_type(ctx->cur_scope, type);
|
||||
if (!ret)
|
||||
@@ -3189,6 +3190,11 @@ static bool elementwise_intrinsic_uint_convert_args(struct hlsl_ctx *ctx,
|
||||
static bool intrinsic_abs(struct hlsl_ctx *ctx,
|
||||
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
+ const struct hlsl_type *type = params->args[0]->data_type;
|
||||
+
|
||||
+ if (!hlsl_type_is_floating_point(type) && !hlsl_type_is_signed_integer(type))
|
||||
+ return true;
|
||||
+
|
||||
return !!add_unary_arithmetic_expr(ctx, params->instrs, HLSL_OP1_ABS, params->args[0], loc);
|
||||
}
|
||||
|
||||
@@ -8177,14 +8183,14 @@ type_no_void:
|
||||
| TYPE_IDENTIFIER
|
||||
{
|
||||
$$ = hlsl_get_type(ctx->cur_scope, $1, true, true);
|
||||
- if ($$->is_minimum_precision)
|
||||
+ if ($$->is_minimum_precision || hlsl_type_is_minimum_precision($$))
|
||||
{
|
||||
if (hlsl_version_lt(ctx, 4, 0))
|
||||
{
|
||||
hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
|
||||
"Target profile doesn't support minimum-precision types.");
|
||||
}
|
||||
- else
|
||||
+ else if ($$->is_minimum_precision)
|
||||
{
|
||||
FIXME("Reinterpreting type %s.\n", $$->name);
|
||||
}
|
||||
@@ -8214,8 +8220,8 @@ type_no_void:
|
||||
| KW_STRUCT TYPE_IDENTIFIER
|
||||
{
|
||||
$$ = hlsl_get_type(ctx->cur_scope, $2, true, true);
|
||||
- if ($$->class != HLSL_CLASS_STRUCT)
|
||||
- hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_REDEFINED, "\"%s\" redefined as a structure.", $2);
|
||||
+ if ($$->class != HLSL_CLASS_STRUCT || $$->is_typedef)
|
||||
+ hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_REDEFINED, "\"%s\" is not a structure.", $2);
|
||||
vkd3d_free($2);
|
||||
}
|
||||
| KW_RENDERTARGETVIEW
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
||||
index 9c3affda534..38d5c55c26b 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
||||
@@ -7154,7 +7154,7 @@ struct hlsl_reg hlsl_reg_from_deref(struct hlsl_ctx *ctx, const struct hlsl_dere
|
||||
}
|
||||
|
||||
static bool get_integral_argument_value(struct hlsl_ctx *ctx, const struct hlsl_attribute *attr,
|
||||
- unsigned int i, enum hlsl_base_type *base_type, int *value)
|
||||
+ unsigned int i, int *value)
|
||||
{
|
||||
const struct hlsl_ir_node *instr = attr->args[i].node;
|
||||
const struct hlsl_type *type = instr->data_type;
|
||||
@@ -7178,7 +7178,6 @@ static bool get_integral_argument_value(struct hlsl_ctx *ctx, const struct hlsl_
|
||||
return false;
|
||||
}
|
||||
|
||||
- *base_type = type->e.numeric.type;
|
||||
*value = hlsl_ir_constant(instr)->value.u[0].i;
|
||||
return true;
|
||||
}
|
||||
@@ -7205,6 +7204,7 @@ static const char *get_string_argument_value(struct hlsl_ctx *ctx, const struct
|
||||
|
||||
static void parse_numthreads_attribute(struct hlsl_ctx *ctx, const struct hlsl_attribute *attr)
|
||||
{
|
||||
+ static const unsigned int limits[3] = {1024, 1024, 64};
|
||||
unsigned int i;
|
||||
|
||||
ctx->found_numthreads = 1;
|
||||
@@ -7218,18 +7218,21 @@ static void parse_numthreads_attribute(struct hlsl_ctx *ctx, const struct hlsl_a
|
||||
|
||||
for (i = 0; i < attr->args_count; ++i)
|
||||
{
|
||||
- enum hlsl_base_type base_type;
|
||||
int value;
|
||||
|
||||
- if (!get_integral_argument_value(ctx, attr, i, &base_type, &value))
|
||||
+ if (!get_integral_argument_value(ctx, attr, i, &value))
|
||||
return;
|
||||
|
||||
- if ((base_type == HLSL_TYPE_INT && value <= 0) || (base_type == HLSL_TYPE_UINT && !value))
|
||||
+ if (value < 1 || value > limits[i])
|
||||
hlsl_error(ctx, &attr->args[i].node->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_THREAD_COUNT,
|
||||
- "Thread count must be a positive integer.");
|
||||
+ "Dimension %u of the thread count must be between 1 and %u.", i, limits[i]);
|
||||
|
||||
ctx->thread_count[i] = value;
|
||||
}
|
||||
+
|
||||
+ if (ctx->thread_count[0] * ctx->thread_count[1] * ctx->thread_count[2] > 1024)
|
||||
+ hlsl_error(ctx, &attr->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_THREAD_COUNT,
|
||||
+ "Product of thread count parameters cannot exceed 1024.");
|
||||
}
|
||||
|
||||
static void parse_domain_attribute(struct hlsl_ctx *ctx, const struct hlsl_attribute *attr)
|
||||
@@ -7260,7 +7263,6 @@ static void parse_domain_attribute(struct hlsl_ctx *ctx, const struct hlsl_attri
|
||||
|
||||
static void parse_outputcontrolpoints_attribute(struct hlsl_ctx *ctx, const struct hlsl_attribute *attr)
|
||||
{
|
||||
- enum hlsl_base_type base_type;
|
||||
int value;
|
||||
|
||||
if (attr->args_count != 1)
|
||||
@@ -7270,7 +7272,7 @@ static void parse_outputcontrolpoints_attribute(struct hlsl_ctx *ctx, const stru
|
||||
return;
|
||||
}
|
||||
|
||||
- if (!get_integral_argument_value(ctx, attr, 0, &base_type, &value))
|
||||
+ if (!get_integral_argument_value(ctx, attr, 0, &value))
|
||||
return;
|
||||
|
||||
if (value < 0 || value > 32)
|
||||
@@ -7373,7 +7375,6 @@ static void parse_patchconstantfunc_attribute(struct hlsl_ctx *ctx, const struct
|
||||
|
||||
static void parse_maxvertexcount_attribute(struct hlsl_ctx *ctx, const struct hlsl_attribute *attr)
|
||||
{
|
||||
- enum hlsl_base_type base_type;
|
||||
int value;
|
||||
|
||||
if (attr->args_count != 1)
|
||||
@@ -7383,7 +7384,7 @@ static void parse_maxvertexcount_attribute(struct hlsl_ctx *ctx, const struct hl
|
||||
return;
|
||||
}
|
||||
|
||||
- if (!get_integral_argument_value(ctx, attr, 0, &base_type, &value))
|
||||
+ if (!get_integral_argument_value(ctx, attr, 0, &value))
|
||||
return;
|
||||
|
||||
if (value < 1 || value > 1024)
|
||||
@@ -11838,25 +11839,6 @@ static void generate_vsir_scan_required_features(struct hlsl_ctx *ctx, struct vs
|
||||
* STENCIL_REF, and TYPED_UAV_LOAD_ADDITIONAL_FORMATS. */
|
||||
}
|
||||
|
||||
-static bool is_minimum_precision(enum hlsl_base_type type)
|
||||
-{
|
||||
- switch (type)
|
||||
- {
|
||||
- case HLSL_TYPE_BOOL:
|
||||
- case HLSL_TYPE_DOUBLE:
|
||||
- case HLSL_TYPE_FLOAT:
|
||||
- case HLSL_TYPE_HALF:
|
||||
- case HLSL_TYPE_INT:
|
||||
- case HLSL_TYPE_UINT:
|
||||
- return false;
|
||||
-
|
||||
- case HLSL_TYPE_MIN16UINT:
|
||||
- return true;
|
||||
- }
|
||||
-
|
||||
- vkd3d_unreachable();
|
||||
-}
|
||||
-
|
||||
static void generate_vsir_scan_global_flags(struct hlsl_ctx *ctx,
|
||||
struct vsir_program *program, const struct hlsl_ir_function_decl *entry_func)
|
||||
{
|
||||
@@ -11894,7 +11876,7 @@ static void generate_vsir_scan_global_flags(struct hlsl_ctx *ctx,
|
||||
/* Note that it doesn't matter if the semantic is unused or doesn't
|
||||
* generate a signature element (e.g. SV_DispatchThreadID). */
|
||||
if ((var->is_input_semantic || var->is_output_semantic)
|
||||
- && (type->is_minimum_precision || is_minimum_precision(type->e.numeric.type)))
|
||||
+ && (type->is_minimum_precision || hlsl_type_is_minimum_precision(type)))
|
||||
{
|
||||
program->global_flags |= VKD3DSGF_ENABLE_MINIMUM_PRECISION;
|
||||
break;
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl_constant_ops.c b/libs/vkd3d/libs/vkd3d-shader/hlsl_constant_ops.c
|
||||
index f74ecffcd4b..d339a06e6c7 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl_constant_ops.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl_constant_ops.c
|
||||
@@ -51,14 +51,11 @@ static bool fold_abs(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst,
|
||||
dst->u[k].i = abs(src->value.u[k].i);
|
||||
break;
|
||||
|
||||
+ case HLSL_TYPE_BOOL:
|
||||
case HLSL_TYPE_MIN16UINT:
|
||||
case HLSL_TYPE_UINT:
|
||||
- dst->u[k].u = src->value.u[k].u;
|
||||
- break;
|
||||
-
|
||||
- default:
|
||||
- FIXME("Fold abs() for type %s.\n", debug_hlsl_type(ctx, dst_type));
|
||||
- return false;
|
||||
+ /* Should not occur. */
|
||||
+ vkd3d_unreachable();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/ir.c b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
index 4101e92e91f..7466f7a2da1 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
@@ -862,12 +862,14 @@ static enum vkd3d_result vsir_program_lower_tex(struct vsir_program *program,
|
||||
}
|
||||
else if (tex->flags == VKD3DSI_TEXLD_BIAS)
|
||||
{
|
||||
+ enum vkd3d_shader_swizzle_component w = vsir_swizzle_get_component(srcs[0].swizzle, 3);
|
||||
+
|
||||
tex->opcode = VKD3DSIH_SAMPLE_B;
|
||||
tex->src = srcs;
|
||||
tex->src_count = 4;
|
||||
|
||||
srcs[3] = tex->src[0];
|
||||
- srcs[3].swizzle = VKD3D_SHADER_SWIZZLE(W, W, W, W);
|
||||
+ srcs[3].swizzle = vkd3d_shader_create_swizzle(w, w, w, w);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2048,23 +2050,27 @@ static enum vkd3d_result shader_signature_map_patch_constant_index_ranges(struct
|
||||
|
||||
for (i = 0; i < s->element_count; i += register_count)
|
||||
{
|
||||
+ uint32_t used_mask;
|
||||
+
|
||||
e = &s->elements[i];
|
||||
register_count = 1;
|
||||
|
||||
if (!e->sysval_semantic)
|
||||
continue;
|
||||
|
||||
+ used_mask = e->used_mask;
|
||||
for (j = i + 1; j < s->element_count; ++j, ++register_count)
|
||||
{
|
||||
f = &s->elements[j];
|
||||
if (f->register_index != e->register_index + register_count || !sysval_semantics_should_merge(e, f))
|
||||
break;
|
||||
+ used_mask |= f->used_mask;
|
||||
}
|
||||
if (register_count < 2)
|
||||
continue;
|
||||
|
||||
if ((ret = range_map_set_register_range(normaliser, range_map,
|
||||
- e->register_index, register_count, e->mask, e->used_mask, false)) < 0)
|
||||
+ e->register_index, register_count, e->mask, used_mask, false)) < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/spirv.c b/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
index 6a393c5f35d..4297d656e51 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
||||
@@ -5775,7 +5775,7 @@ static unsigned int shader_signature_next_location(const struct shader_signature
|
||||
return max_row;
|
||||
}
|
||||
|
||||
-static uint32_t spirv_compiler_emit_input(struct spirv_compiler *compiler,
|
||||
+static void spirv_compiler_emit_input(struct spirv_compiler *compiler,
|
||||
enum vkd3d_shader_register_type reg_type, unsigned int element_idx)
|
||||
{
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
@@ -5786,12 +5786,10 @@ static uint32_t spirv_compiler_emit_input(struct spirv_compiler *compiler,
|
||||
const struct vkd3d_spirv_builtin *builtin;
|
||||
enum vkd3d_shader_sysval_semantic sysval;
|
||||
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;
|
||||
struct vkd3d_symbol reg_symbol;
|
||||
SpvStorageClass storage_class;
|
||||
- struct rb_entry *entry = NULL;
|
||||
bool use_private_var = false;
|
||||
unsigned int array_sizes[2];
|
||||
|
||||
@@ -5806,6 +5804,9 @@ static uint32_t spirv_compiler_emit_input(struct spirv_compiler *compiler,
|
||||
if (compiler->shader_type == VKD3D_SHADER_TYPE_DOMAIN && reg_type != VKD3DSPR_PATCHCONST)
|
||||
sysval = VKD3D_SHADER_SV_NONE;
|
||||
|
||||
+ if (!signature_element->used_mask)
|
||||
+ return;
|
||||
+
|
||||
builtin = get_spirv_builtin_for_sysval(compiler, sysval);
|
||||
|
||||
array_sizes[0] = signature_element->register_count;
|
||||
@@ -5846,7 +5847,7 @@ static uint32_t spirv_compiler_emit_input(struct spirv_compiler *compiler,
|
||||
|
||||
vkd3d_symbol_make_io(®_symbol, reg_type, element_idx);
|
||||
|
||||
- if ((entry = rb_get(&compiler->symbol_table, ®_symbol)))
|
||||
+ if (rb_get(&compiler->symbol_table, ®_symbol))
|
||||
{
|
||||
/* Except for vicp there should be one declaration per signature element. Sources of
|
||||
* duplicate declarations are: a single register split into multiple declarations having
|
||||
@@ -5854,8 +5855,7 @@ static uint32_t spirv_compiler_emit_input(struct spirv_compiler *compiler,
|
||||
* being repeated in another (i.e. vcp/vocp), which should have been deleted. */
|
||||
if (reg_type != VKD3DSPR_INPUT || !is_in_fork_or_join_phase(compiler))
|
||||
FIXME("Duplicate input definition found.\n");
|
||||
- symbol = RB_ENTRY_VALUE(entry, struct vkd3d_symbol, entry);
|
||||
- return symbol->id;
|
||||
+ return;
|
||||
}
|
||||
|
||||
if (builtin)
|
||||
@@ -5927,8 +5927,6 @@ static uint32_t spirv_compiler_emit_input(struct spirv_compiler *compiler,
|
||||
|
||||
spirv_compiler_emit_store_reg(compiler, &dst_reg, signature_element->mask, val_id);
|
||||
}
|
||||
-
|
||||
- return input_id;
|
||||
}
|
||||
|
||||
static void spirv_compiler_emit_io_register(struct spirv_compiler *compiler,
|
||||
--
|
||||
2.47.2
|
||||
|
1
patches/vkd3d-latest/definition
Normal file
1
patches/vkd3d-latest/definition
Normal file
@@ -0,0 +1 @@
|
||||
# Keeping vkd3d to the latest git
|
@@ -1 +1 @@
|
||||
8f91df4c4e4fb8b32c737bb02e82dcddfb71a114
|
||||
22af42ac22279e6c0c671f033661f95c1761b4bb
|
||||
|
Reference in New Issue
Block a user