You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-04-13 14:42:51 -07:00
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
d0d5fef5bb | ||
|
7d45af5cb4 | ||
|
ad6dc1328b | ||
|
f6f66d11a2 | ||
|
5ab7824f62 | ||
|
c263c6fabb | ||
|
f10d2d0452 | ||
|
bc8dead787 | ||
|
3738f9baee |
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
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,302 +0,0 @@
|
||||
From 5e37d8d942ac5cc23c459cdd3fa86eec85a9216a Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Thu, 5 Dec 2024 09:55:52 +1100
|
||||
Subject: [PATCH] Updated vkd3d to 01117c716dea0e934ac594a7596d90ad94895d65.
|
||||
|
||||
---
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl.c | 3 --
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl.h | 3 --
|
||||
libs/vkd3d/libs/vkd3d-shader/ir.c | 16 +++++-
|
||||
libs/vkd3d/libs/vkd3d-shader/msl.c | 78 +++++++++++++++++++++++++++--
|
||||
4 files changed, 90 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.c b/libs/vkd3d/libs/vkd3d-shader/hlsl.c
|
||||
index f0d24b835e5..e7518404aa0 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.c
|
||||
@@ -3203,13 +3203,11 @@ const char *debug_hlsl_expr_op(enum hlsl_ir_expr_op op)
|
||||
[HLSL_OP1_LOG2] = "log2",
|
||||
[HLSL_OP1_LOGIC_NOT] = "!",
|
||||
[HLSL_OP1_NEG] = "-",
|
||||
- [HLSL_OP1_NRM] = "nrm",
|
||||
[HLSL_OP1_RCP] = "rcp",
|
||||
[HLSL_OP1_REINTERPRET] = "reinterpret",
|
||||
[HLSL_OP1_ROUND] = "round",
|
||||
[HLSL_OP1_RSQ] = "rsq",
|
||||
[HLSL_OP1_SAT] = "sat",
|
||||
- [HLSL_OP1_SIGN] = "sign",
|
||||
[HLSL_OP1_SIN] = "sin",
|
||||
[HLSL_OP1_SIN_REDUCED] = "sin_reduced",
|
||||
[HLSL_OP1_SQRT] = "sqrt",
|
||||
@@ -3219,7 +3217,6 @@ const char *debug_hlsl_expr_op(enum hlsl_ir_expr_op op)
|
||||
[HLSL_OP2_BIT_AND] = "&",
|
||||
[HLSL_OP2_BIT_OR] = "|",
|
||||
[HLSL_OP2_BIT_XOR] = "^",
|
||||
- [HLSL_OP2_CRS] = "crs",
|
||||
[HLSL_OP2_DIV] = "/",
|
||||
[HLSL_OP2_DOT] = "dot",
|
||||
[HLSL_OP2_EQUAL] = "==",
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.h b/libs/vkd3d/libs/vkd3d-shader/hlsl.h
|
||||
index addc98d5a43..b899c16357c 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.h
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.h
|
||||
@@ -714,13 +714,11 @@ enum hlsl_ir_expr_op
|
||||
HLSL_OP1_LOG2,
|
||||
HLSL_OP1_LOGIC_NOT,
|
||||
HLSL_OP1_NEG,
|
||||
- HLSL_OP1_NRM,
|
||||
HLSL_OP1_RCP,
|
||||
HLSL_OP1_REINTERPRET,
|
||||
HLSL_OP1_ROUND,
|
||||
HLSL_OP1_RSQ,
|
||||
HLSL_OP1_SAT,
|
||||
- HLSL_OP1_SIGN,
|
||||
HLSL_OP1_SIN,
|
||||
HLSL_OP1_SIN_REDUCED, /* Reduced range [-pi, pi], writes to .y */
|
||||
HLSL_OP1_SQRT,
|
||||
@@ -730,7 +728,6 @@ enum hlsl_ir_expr_op
|
||||
HLSL_OP2_BIT_AND,
|
||||
HLSL_OP2_BIT_OR,
|
||||
HLSL_OP2_BIT_XOR,
|
||||
- HLSL_OP2_CRS,
|
||||
HLSL_OP2_DIV,
|
||||
HLSL_OP2_DOT,
|
||||
HLSL_OP2_EQUAL,
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/ir.c b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
index 64c9585af52..fbc3ac0f49d 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
||||
@@ -7195,6 +7195,7 @@ static void vsir_validate_register_without_indices(struct validation_context *ct
|
||||
static void vsir_validate_io_register(struct validation_context *ctx,
|
||||
const struct vkd3d_shader_register *reg)
|
||||
{
|
||||
+ unsigned int control_point_count = 0, control_point_index;
|
||||
const struct shader_signature *signature;
|
||||
bool has_control_point = false;
|
||||
|
||||
@@ -7209,6 +7210,7 @@ static void vsir_validate_io_register(struct validation_context *ctx,
|
||||
case VKD3D_SHADER_TYPE_HULL:
|
||||
case VKD3D_SHADER_TYPE_DOMAIN:
|
||||
has_control_point = true;
|
||||
+ control_point_count = ctx->program->input_control_point_count;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -7225,6 +7227,7 @@ static void vsir_validate_io_register(struct validation_context *ctx,
|
||||
{
|
||||
signature = &ctx->program->output_signature;
|
||||
has_control_point = ctx->program->normalisation_level >= VSIR_NORMALISED_HULL_CONTROL_POINT_IO;
|
||||
+ control_point_count = ctx->program->output_control_point_count;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -7241,11 +7244,13 @@ static void vsir_validate_io_register(struct validation_context *ctx,
|
||||
case VKD3DSPR_INCONTROLPOINT:
|
||||
signature = &ctx->program->input_signature;
|
||||
has_control_point = true;
|
||||
+ control_point_count = ctx->program->input_control_point_count;
|
||||
break;
|
||||
|
||||
case VKD3DSPR_OUTCONTROLPOINT:
|
||||
signature = &ctx->program->output_signature;
|
||||
has_control_point = true;
|
||||
+ control_point_count = ctx->program->output_control_point_count;
|
||||
break;
|
||||
|
||||
case VKD3DSPR_PATCHCONST:
|
||||
@@ -7262,6 +7267,8 @@ static void vsir_validate_io_register(struct validation_context *ctx,
|
||||
* allowed to have a relative address. */
|
||||
unsigned int expected_idx_count = 1 + !!has_control_point;
|
||||
|
||||
+ control_point_index = 0;
|
||||
+
|
||||
if (reg->idx_count != expected_idx_count)
|
||||
{
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT,
|
||||
@@ -7280,7 +7287,7 @@ static void vsir_validate_io_register(struct validation_context *ctx,
|
||||
/* If the signature element is not an array, indices are
|
||||
* [signature] or [control point, signature]. If the signature
|
||||
* element is an array, indices are [array, signature] or
|
||||
- * [control point, array, signature]. In any case `signature' is
|
||||
+ * [array, control point, signature]. In any case `signature' is
|
||||
* not allowed to have a relative address, while the others are.
|
||||
*/
|
||||
if (reg->idx_count < 1)
|
||||
@@ -7314,6 +7321,7 @@ static void vsir_validate_io_register(struct validation_context *ctx,
|
||||
is_array = true;
|
||||
|
||||
expected_idx_count = 1 + !!has_control_point + !!is_array;
|
||||
+ control_point_index = !!is_array;
|
||||
|
||||
if (reg->idx_count != expected_idx_count)
|
||||
{
|
||||
@@ -7323,6 +7331,12 @@ static void vsir_validate_io_register(struct validation_context *ctx,
|
||||
return;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ if (has_control_point && !reg->idx[control_point_index].rel_addr
|
||||
+ && reg->idx[control_point_index].offset >= control_point_count)
|
||||
+ validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX,
|
||||
+ "Control point index %u exceeds the control point count %u in a register of type %#x.",
|
||||
+ reg->idx[control_point_index].offset, control_point_count, reg->type);
|
||||
}
|
||||
|
||||
static void vsir_validate_temp_register(struct validation_context *ctx,
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/msl.c b/libs/vkd3d/libs/vkd3d-shader/msl.c
|
||||
index 0406b8fbd51..f1ca581f1d2 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/msl.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/msl.c
|
||||
@@ -422,16 +422,25 @@ static void msl_dot(struct msl_generator *gen, const struct vkd3d_shader_instruc
|
||||
|
||||
static void msl_intrinsic(struct msl_generator *gen, const struct vkd3d_shader_instruction *ins, const char *op)
|
||||
{
|
||||
+ struct vkd3d_string_buffer *args;
|
||||
struct msl_src src;
|
||||
struct msl_dst dst;
|
||||
+ unsigned int i;
|
||||
uint32_t mask;
|
||||
|
||||
mask = msl_dst_init(&dst, gen, ins, &ins->dst[0]);
|
||||
- msl_src_init(&src, gen, &ins->src[0], mask);
|
||||
+ args = vkd3d_string_buffer_get(&gen->string_buffers);
|
||||
|
||||
- msl_print_assignment(gen, &dst, "%s(%s)", op, src.str->buffer);
|
||||
+ for (i = 0; i < ins->src_count; ++i)
|
||||
+ {
|
||||
+ msl_src_init(&src, gen, &ins->src[i], mask);
|
||||
+ vkd3d_string_buffer_printf(args, "%s%s", i ? ", " : "", src.str->buffer);
|
||||
+ msl_src_cleanup(&src, &gen->string_buffers);
|
||||
+ }
|
||||
|
||||
- msl_src_cleanup(&src, &gen->string_buffers);
|
||||
+ msl_print_assignment(gen, &dst, "%s(%s)", op, args->buffer);
|
||||
+
|
||||
+ vkd3d_string_buffer_release(&gen->string_buffers, args);
|
||||
msl_dst_cleanup(&dst, &gen->string_buffers);
|
||||
}
|
||||
|
||||
@@ -477,6 +486,31 @@ static void msl_cast(struct msl_generator *gen, const struct vkd3d_shader_instru
|
||||
msl_dst_cleanup(&dst, &gen->string_buffers);
|
||||
}
|
||||
|
||||
+static void msl_if(struct msl_generator *gen, const struct vkd3d_shader_instruction *ins)
|
||||
+{
|
||||
+ const char *condition;
|
||||
+ struct msl_src src;
|
||||
+
|
||||
+ msl_src_init(&src, gen, &ins->src[0], VKD3DSP_WRITEMASK_0);
|
||||
+
|
||||
+ msl_print_indent(gen->buffer, gen->indent);
|
||||
+ condition = ins->flags == VKD3D_SHADER_CONDITIONAL_OP_NZ ? "bool" : "!bool";
|
||||
+ vkd3d_string_buffer_printf(gen->buffer, "if (%s(%s))\n", condition, src.str->buffer);
|
||||
+
|
||||
+ msl_src_cleanup(&src, &gen->string_buffers);
|
||||
+
|
||||
+ msl_print_indent(gen->buffer, gen->indent);
|
||||
+ vkd3d_string_buffer_printf(gen->buffer, "{\n");
|
||||
+ ++gen->indent;
|
||||
+}
|
||||
+
|
||||
+static void msl_endif(struct msl_generator *gen)
|
||||
+{
|
||||
+ --gen->indent;
|
||||
+ msl_print_indent(gen->buffer, gen->indent);
|
||||
+ vkd3d_string_buffer_printf(gen->buffer, "}\n");
|
||||
+}
|
||||
+
|
||||
static void msl_mov(struct msl_generator *gen, const struct vkd3d_shader_instruction *ins)
|
||||
{
|
||||
struct msl_src src;
|
||||
@@ -549,6 +583,9 @@ static void msl_handle_instruction(struct msl_generator *gen, const struct vkd3d
|
||||
case VKD3DSIH_DP4:
|
||||
msl_dot(gen, ins, VKD3DSP_WRITEMASK_ALL);
|
||||
break;
|
||||
+ case VKD3DSIH_ENDIF:
|
||||
+ msl_endif(gen);
|
||||
+ break;
|
||||
case VKD3DSIH_IEQ:
|
||||
msl_relop(gen, ins, "==");
|
||||
break;
|
||||
@@ -567,9 +604,18 @@ static void msl_handle_instruction(struct msl_generator *gen, const struct vkd3d
|
||||
case VKD3DSIH_GEO:
|
||||
msl_relop(gen, ins, ">=");
|
||||
break;
|
||||
+ case VKD3DSIH_IF:
|
||||
+ msl_if(gen, ins);
|
||||
+ break;
|
||||
case VKD3DSIH_LTO:
|
||||
msl_relop(gen, ins, "<");
|
||||
break;
|
||||
+ case VKD3DSIH_MAX:
|
||||
+ msl_intrinsic(gen, ins, "max");
|
||||
+ break;
|
||||
+ case VKD3DSIH_MIN:
|
||||
+ msl_intrinsic(gen, ins, "min");
|
||||
+ break;
|
||||
case VKD3DSIH_INE:
|
||||
case VKD3DSIH_NEU:
|
||||
msl_relop(gen, ins, "!=");
|
||||
@@ -578,6 +624,9 @@ static void msl_handle_instruction(struct msl_generator *gen, const struct vkd3d
|
||||
case VKD3DSIH_UTOF:
|
||||
msl_cast(gen, ins, "float");
|
||||
break;
|
||||
+ case VKD3DSIH_LOG:
|
||||
+ msl_intrinsic(gen, ins, "log2");
|
||||
+ break;
|
||||
case VKD3DSIH_MOV:
|
||||
msl_mov(gen, ins);
|
||||
break;
|
||||
@@ -593,12 +642,21 @@ static void msl_handle_instruction(struct msl_generator *gen, const struct vkd3d
|
||||
case VKD3DSIH_RET:
|
||||
msl_ret(gen, ins);
|
||||
break;
|
||||
+ case VKD3DSIH_ROUND_NE:
|
||||
+ msl_intrinsic(gen, ins, "rint");
|
||||
+ break;
|
||||
+ case VKD3DSIH_ROUND_NI:
|
||||
+ msl_intrinsic(gen, ins, "floor");
|
||||
+ break;
|
||||
case VKD3DSIH_ROUND_PI:
|
||||
msl_intrinsic(gen, ins, "ceil");
|
||||
break;
|
||||
case VKD3DSIH_ROUND_Z:
|
||||
msl_intrinsic(gen, ins, "trunc");
|
||||
break;
|
||||
+ case VKD3DSIH_RSQ:
|
||||
+ msl_intrinsic(gen, ins, "rsqrt");
|
||||
+ break;
|
||||
case VKD3DSIH_SQRT:
|
||||
msl_intrinsic(gen, ins, "sqrt");
|
||||
break;
|
||||
@@ -765,6 +823,16 @@ static void msl_generate_input_struct_declarations(struct msl_generator *gen)
|
||||
|
||||
if (e->sysval_semantic)
|
||||
{
|
||||
+ if (e->sysval_semantic == VKD3D_SHADER_SV_IS_FRONT_FACE)
|
||||
+ {
|
||||
+ if (type != VKD3D_SHADER_TYPE_PIXEL)
|
||||
+ msl_compiler_error(gen, VKD3D_SHADER_ERROR_MSL_INTERNAL,
|
||||
+ "Internal compiler error: Unhandled SV_IS_FRONT_FACE in shader type #%x.", type);
|
||||
+
|
||||
+ msl_print_indent(gen->buffer, 1);
|
||||
+ vkd3d_string_buffer_printf(buffer, "bool is_front_face [[front_facing]];\n");
|
||||
+ continue;
|
||||
+ }
|
||||
msl_compiler_error(gen, VKD3D_SHADER_ERROR_MSL_INTERNAL,
|
||||
"Internal compiler error: Unhandled system value %#x.", e->sysval_semantic);
|
||||
continue;
|
||||
@@ -979,6 +1047,10 @@ static void msl_generate_entrypoint_prologue(struct msl_generator *gen)
|
||||
vkd3d_string_buffer_printf(buffer, " = input.shader_in_%u", i);
|
||||
msl_print_write_mask(buffer, e->mask);
|
||||
}
|
||||
+ else if (e->sysval_semantic == VKD3D_SHADER_SV_IS_FRONT_FACE)
|
||||
+ {
|
||||
+ vkd3d_string_buffer_printf(buffer, ".u = uint4(input.is_front_face ? 0xffffffffu : 0u, 0, 0, 0)");
|
||||
+ }
|
||||
else
|
||||
{
|
||||
vkd3d_string_buffer_printf(buffer, " = <unhandled sysval %#x>", e->sysval_semantic);
|
||||
--
|
||||
2.45.2
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,24 @@
|
||||
From 9281cca9b739538f3519f5ab602de53323e4f5a7 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Tue, 14 Jan 2025 06:41:42 +1100
|
||||
Subject: [PATCH] Updated vkd3d to c7e173a1ffa1ba6916dd549bf9f32225440d1ec6.
|
||||
|
||||
---
|
||||
libs/vkd3d/libs/vkd3d/device.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d/device.c b/libs/vkd3d/libs/vkd3d/device.c
|
||||
index 7b491805a72..9aa4adb6c06 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d/device.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d/device.c
|
||||
@@ -3443,6 +3443,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CheckFeatureSupport(ID3D12Device9
|
||||
for (i = 0; i < data->NumFeatureLevels; ++i)
|
||||
{
|
||||
D3D_FEATURE_LEVEL fl = data->pFeatureLevelsRequested[i];
|
||||
+ TRACE("Requested feature level %#x.\n", fl);
|
||||
if (data->MaxSupportedFeatureLevel < fl && fl <= vulkan_info->max_feature_level)
|
||||
data->MaxSupportedFeatureLevel = fl;
|
||||
}
|
||||
--
|
||||
2.45.2
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,340 @@
|
||||
From 150e550f9e45fc08850ee21cc7c954e60594858c Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Sat, 18 Jan 2025 16:15:28 +1100
|
||||
Subject: [PATCH] Updated vkd3d to a082daeb56c239b41d67b5df5abceb342c0b32b9.
|
||||
|
||||
---
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl.c | 1 +
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl.h | 1 +
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl.y | 14 ++
|
||||
libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c | 198 +++++++++++++++++++-
|
||||
libs/vkd3d/libs/vkd3d-shader/msl.c | 1 -
|
||||
5 files changed, 207 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.c b/libs/vkd3d/libs/vkd3d-shader/hlsl.c
|
||||
index 858186a1071..23f54d3edec 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.c
|
||||
@@ -3238,6 +3238,7 @@ const char *debug_hlsl_expr_op(enum hlsl_ir_expr_op op)
|
||||
[HLSL_OP1_F32TOF16] = "f32tof16",
|
||||
[HLSL_OP1_FLOOR] = "floor",
|
||||
[HLSL_OP1_FRACT] = "fract",
|
||||
+ [HLSL_OP1_ISINF] = "isinf",
|
||||
[HLSL_OP1_LOG2] = "log2",
|
||||
[HLSL_OP1_LOGIC_NOT] = "!",
|
||||
[HLSL_OP1_NEG] = "-",
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.h b/libs/vkd3d/libs/vkd3d-shader/hlsl.h
|
||||
index d712a325322..4d78dbebb34 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.h
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.h
|
||||
@@ -704,6 +704,7 @@ enum hlsl_ir_expr_op
|
||||
HLSL_OP1_F32TOF16,
|
||||
HLSL_OP1_FLOOR,
|
||||
HLSL_OP1_FRACT,
|
||||
+ HLSL_OP1_ISINF,
|
||||
HLSL_OP1_LOG2,
|
||||
HLSL_OP1_LOGIC_NOT,
|
||||
HLSL_OP1_NEG,
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.y b/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
index e6eaac78994..e5a03067d16 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
||||
@@ -4313,6 +4313,19 @@ static bool intrinsic_fwidth(struct hlsl_ctx *ctx,
|
||||
return !!add_user_call(ctx, func, params, false, loc);
|
||||
}
|
||||
|
||||
+static bool intrinsic_isinf(struct hlsl_ctx *ctx,
|
||||
+ const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||
+{
|
||||
+ struct hlsl_type *type = params->args[0]->data_type, *bool_type;
|
||||
+ struct hlsl_ir_node *args[HLSL_MAX_OPERANDS] = {0};
|
||||
+
|
||||
+ bool_type = hlsl_get_numeric_type(ctx, type->class, HLSL_TYPE_BOOL,
|
||||
+ type->e.numeric.dimx, type->e.numeric.dimy);
|
||||
+
|
||||
+ args[0] = params->args[0];
|
||||
+ return !!add_expr(ctx, params->instrs, HLSL_OP1_ISINF, args, bool_type, loc);
|
||||
+}
|
||||
+
|
||||
static bool intrinsic_ldexp(struct hlsl_ctx *ctx,
|
||||
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
@@ -5410,6 +5423,7 @@ intrinsic_functions[] =
|
||||
{"fmod", 2, true, intrinsic_fmod},
|
||||
{"frac", 1, true, intrinsic_frac},
|
||||
{"fwidth", 1, true, intrinsic_fwidth},
|
||||
+ {"isinf", 1, true, intrinsic_isinf},
|
||||
{"ldexp", 2, true, intrinsic_ldexp},
|
||||
{"length", 1, true, intrinsic_length},
|
||||
{"lerp", 3, true, intrinsic_lerp},
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
||||
index c666599b342..cef6a87c8b6 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
||||
@@ -2881,6 +2881,7 @@ static bool lower_separate_samples(struct hlsl_ctx *ctx, struct hlsl_ir_node *in
|
||||
load = hlsl_ir_resource_load(instr);
|
||||
|
||||
if (load->load_type != HLSL_RESOURCE_SAMPLE
|
||||
+ && load->load_type != HLSL_RESOURCE_SAMPLE_GRAD
|
||||
&& load->load_type != HLSL_RESOURCE_SAMPLE_LOD
|
||||
&& load->load_type != HLSL_RESOURCE_SAMPLE_LOD_BIAS)
|
||||
return false;
|
||||
@@ -2908,6 +2909,13 @@ static bool lower_separate_samples(struct hlsl_ctx *ctx, struct hlsl_ir_node *in
|
||||
return false;
|
||||
vkd3d_string_buffer_printf(name, "%s+%s", sampler->name, resource->name);
|
||||
|
||||
+ if (load->texel_offset.node)
|
||||
+ {
|
||||
+ hlsl_error(ctx, &instr->loc, VKD3D_SHADER_ERROR_HLSL_INCOMPATIBLE_PROFILE,
|
||||
+ "Texel offsets are not supported on profiles lower than 4.0.\n");
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
TRACE("Lowering to combined sampler %s.\n", debugstr_a(name->buffer));
|
||||
|
||||
if (!(var = hlsl_get_var(ctx->globals, name->buffer)))
|
||||
@@ -3099,11 +3107,24 @@ static bool sort_synthetic_separated_samplers_first(struct hlsl_ctx *ctx)
|
||||
return false;
|
||||
}
|
||||
|
||||
-/* Turn CAST to int or uint into FLOOR + REINTERPRET (which is written as a mere MOV). */
|
||||
+/* Turn CAST to int or uint as follows:
|
||||
+ *
|
||||
+ * CAST(x) = x - FRACT(x) + extra
|
||||
+ *
|
||||
+ * where
|
||||
+ *
|
||||
+ * extra = FRACT(x) > 0 && x < 0
|
||||
+ *
|
||||
+ * where the comparisons in the extra term are performed using CMP or SLT
|
||||
+ * depending on whether this is a pixel or vertex shader, respectively.
|
||||
+ *
|
||||
+ * A REINTERPET (which is written as a mere MOV) is also applied to the final
|
||||
+ * result for type consistency.
|
||||
+ */
|
||||
static bool lower_casts_to_int(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
|
||||
{
|
||||
struct hlsl_ir_node *operands[HLSL_MAX_OPERANDS] = { 0 };
|
||||
- struct hlsl_ir_node *arg, *floor, *res;
|
||||
+ struct hlsl_ir_node *arg, *res;
|
||||
struct hlsl_ir_expr *expr;
|
||||
|
||||
if (instr->type != HLSL_IR_EXPR)
|
||||
@@ -3118,12 +3139,83 @@ static bool lower_casts_to_int(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
|
||||
if (arg->data_type->e.numeric.type != HLSL_TYPE_FLOAT && arg->data_type->e.numeric.type != HLSL_TYPE_HALF)
|
||||
return false;
|
||||
|
||||
- if (!(floor = hlsl_new_unary_expr(ctx, HLSL_OP1_FLOOR, arg, &instr->loc)))
|
||||
- return false;
|
||||
- hlsl_block_add_instr(block, floor);
|
||||
+ if (ctx->profile->type == VKD3D_SHADER_TYPE_PIXEL)
|
||||
+ {
|
||||
+ struct hlsl_ir_node *fract, *neg_fract, *has_fract, *floor, *extra, *zero, *one;
|
||||
+ struct hlsl_constant_value zero_value, one_value;
|
||||
+
|
||||
+ memset(&zero_value, 0, sizeof(zero_value));
|
||||
+ if (!(zero = hlsl_new_constant(ctx, arg->data_type, &zero_value, &instr->loc)))
|
||||
+ return false;
|
||||
+ hlsl_block_add_instr(block, zero);
|
||||
+
|
||||
+ one_value.u[0].f = 1.0;
|
||||
+ one_value.u[1].f = 1.0;
|
||||
+ one_value.u[2].f = 1.0;
|
||||
+ one_value.u[3].f = 1.0;
|
||||
+ if (!(one = hlsl_new_constant(ctx, arg->data_type, &one_value, &instr->loc)))
|
||||
+ return false;
|
||||
+ hlsl_block_add_instr(block, one);
|
||||
+
|
||||
+ if (!(fract = hlsl_new_unary_expr(ctx, HLSL_OP1_FRACT, arg, &instr->loc)))
|
||||
+ return false;
|
||||
+ hlsl_block_add_instr(block, fract);
|
||||
+
|
||||
+ if (!(neg_fract = hlsl_new_unary_expr(ctx, HLSL_OP1_NEG, fract, &instr->loc)))
|
||||
+ return false;
|
||||
+ hlsl_block_add_instr(block, neg_fract);
|
||||
+
|
||||
+ if (!(has_fract = hlsl_new_ternary_expr(ctx, HLSL_OP3_CMP, neg_fract, zero, one)))
|
||||
+ return false;
|
||||
+ hlsl_block_add_instr(block, has_fract);
|
||||
+
|
||||
+ if (!(extra = hlsl_new_ternary_expr(ctx, HLSL_OP3_CMP, arg, zero, has_fract)))
|
||||
+ return false;
|
||||
+ hlsl_block_add_instr(block, extra);
|
||||
+
|
||||
+ if (!(floor = hlsl_new_binary_expr(ctx, HLSL_OP2_ADD, arg, neg_fract)))
|
||||
+ return false;
|
||||
+ hlsl_block_add_instr(block, floor);
|
||||
+
|
||||
+ if (!(res = hlsl_new_binary_expr(ctx, HLSL_OP2_ADD, floor, extra)))
|
||||
+ return false;
|
||||
+ hlsl_block_add_instr(block, res);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ struct hlsl_ir_node *neg_arg, *is_neg, *fract, *neg_fract, *has_fract, *floor;
|
||||
+
|
||||
+ if (!(neg_arg = hlsl_new_unary_expr(ctx, HLSL_OP1_NEG, arg, &instr->loc)))
|
||||
+ return false;
|
||||
+ hlsl_block_add_instr(block, neg_arg);
|
||||
+
|
||||
+ if (!(is_neg = hlsl_new_binary_expr(ctx, HLSL_OP2_SLT, arg, neg_arg)))
|
||||
+ return false;
|
||||
+ hlsl_block_add_instr(block, is_neg);
|
||||
+
|
||||
+ if (!(fract = hlsl_new_unary_expr(ctx, HLSL_OP1_FRACT, arg, &instr->loc)))
|
||||
+ return false;
|
||||
+ hlsl_block_add_instr(block, fract);
|
||||
+
|
||||
+ if (!(neg_fract = hlsl_new_unary_expr(ctx, HLSL_OP1_NEG, fract, &instr->loc)))
|
||||
+ return false;
|
||||
+ hlsl_block_add_instr(block, neg_fract);
|
||||
+
|
||||
+ if (!(has_fract = hlsl_new_binary_expr(ctx, HLSL_OP2_SLT, neg_fract, fract)))
|
||||
+ return false;
|
||||
+ hlsl_block_add_instr(block, has_fract);
|
||||
+
|
||||
+ if (!(floor = hlsl_new_binary_expr(ctx, HLSL_OP2_ADD, arg, neg_fract)))
|
||||
+ return false;
|
||||
+ hlsl_block_add_instr(block, floor);
|
||||
+
|
||||
+ if (!(res = hlsl_new_ternary_expr(ctx, HLSL_OP3_MAD, is_neg, has_fract, floor)))
|
||||
+ return false;
|
||||
+ hlsl_block_add_instr(block, res);
|
||||
+ }
|
||||
|
||||
memset(operands, 0, sizeof(operands));
|
||||
- operands[0] = floor;
|
||||
+ operands[0] = res;
|
||||
if (!(res = hlsl_new_expr(ctx, HLSL_OP1_REINTERPRET, operands, instr->data_type, &instr->loc)))
|
||||
return false;
|
||||
hlsl_block_add_instr(block, res);
|
||||
@@ -6977,7 +7069,8 @@ static void sm1_generate_vsir_sampler_dcls(struct hlsl_ctx *ctx,
|
||||
break;
|
||||
|
||||
case HLSL_SAMPLER_DIM_GENERIC:
|
||||
- /* These can appear in sm4-style combined sample instructions. */
|
||||
+ /* These can appear in sm4-style separate sample
|
||||
+ * instructions that haven't been lowered. */
|
||||
hlsl_fixme(ctx, &var->loc, "Generic samplers need to be lowered.");
|
||||
continue;
|
||||
|
||||
@@ -11732,6 +11825,95 @@ static bool lower_f32tof16(struct hlsl_ctx *ctx, struct hlsl_ir_node *node, stru
|
||||
return true;
|
||||
}
|
||||
|
||||
+static bool lower_isinf(struct hlsl_ctx *ctx, struct hlsl_ir_node *node, struct hlsl_block *block)
|
||||
+{
|
||||
+ struct hlsl_ir_node *call, *rhs, *store;
|
||||
+ struct hlsl_ir_function_decl *func;
|
||||
+ unsigned int component_count;
|
||||
+ struct hlsl_ir_load *load;
|
||||
+ struct hlsl_ir_expr *expr;
|
||||
+ struct hlsl_ir_var *lhs;
|
||||
+ const char *template;
|
||||
+ char *body;
|
||||
+
|
||||
+ static const char template_sm2[] =
|
||||
+ "typedef bool%u boolX;\n"
|
||||
+ "typedef float%u floatX;\n"
|
||||
+ "boolX isinf(floatX x)\n"
|
||||
+ "{\n"
|
||||
+ " floatX v = 1 / x;\n"
|
||||
+ " v = v * v;\n"
|
||||
+ " return v <= 0;\n"
|
||||
+ "}\n";
|
||||
+
|
||||
+ static const char template_sm3[] =
|
||||
+ "typedef bool%u boolX;\n"
|
||||
+ "typedef float%u floatX;\n"
|
||||
+ "boolX isinf(floatX x)\n"
|
||||
+ "{\n"
|
||||
+ " floatX v = 1 / x;\n"
|
||||
+ " return v <= 0;\n"
|
||||
+ "}\n";
|
||||
+
|
||||
+ static const char template_sm4[] =
|
||||
+ "typedef bool%u boolX;\n"
|
||||
+ "typedef float%u floatX;\n"
|
||||
+ "boolX isinf(floatX x)\n"
|
||||
+ "{\n"
|
||||
+ " return (asuint(x) & 0x7fffffff) == 0x7f800000;\n"
|
||||
+ "}\n";
|
||||
+
|
||||
+ static const char template_int[] =
|
||||
+ "typedef bool%u boolX;\n"
|
||||
+ "typedef float%u floatX;\n"
|
||||
+ "boolX isinf(floatX x)\n"
|
||||
+ "{\n"
|
||||
+ " return false;\n"
|
||||
+ "}";
|
||||
+
|
||||
+ if (node->type != HLSL_IR_EXPR)
|
||||
+ return false;
|
||||
+
|
||||
+ expr = hlsl_ir_expr(node);
|
||||
+
|
||||
+ if (expr->op != HLSL_OP1_ISINF)
|
||||
+ return false;
|
||||
+
|
||||
+ rhs = expr->operands[0].node;
|
||||
+
|
||||
+ if (hlsl_version_lt(ctx, 3, 0))
|
||||
+ template = template_sm2;
|
||||
+ else if (hlsl_version_lt(ctx, 4, 0))
|
||||
+ template = template_sm3;
|
||||
+ else if (type_is_integer(rhs->data_type))
|
||||
+ template = template_int;
|
||||
+ else
|
||||
+ template = template_sm4;
|
||||
+
|
||||
+ component_count = hlsl_type_component_count(rhs->data_type);
|
||||
+ if (!(body = hlsl_sprintf_alloc(ctx, template, component_count, component_count)))
|
||||
+ return false;
|
||||
+
|
||||
+ if (!(func = hlsl_compile_internal_function(ctx, "isinf", body)))
|
||||
+ return false;
|
||||
+
|
||||
+ lhs = func->parameters.vars[0];
|
||||
+
|
||||
+ if (!(store = hlsl_new_simple_store(ctx, lhs, rhs)))
|
||||
+ return false;
|
||||
+ hlsl_block_add_instr(block, store);
|
||||
+
|
||||
+ if (!(call = hlsl_new_call(ctx, func, &node->loc)))
|
||||
+ return false;
|
||||
+ hlsl_block_add_instr(block, call);
|
||||
+
|
||||
+ if (!(load = hlsl_new_var_load(ctx, func->return_var, &node->loc)))
|
||||
+ return false;
|
||||
+ hlsl_block_add_instr(block, &load->node);
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
static void process_entry_function(struct hlsl_ctx *ctx,
|
||||
const struct hlsl_block *global_uniform_block, struct hlsl_ir_function_decl *entry_func)
|
||||
{
|
||||
@@ -11765,6 +11947,8 @@ static void process_entry_function(struct hlsl_ctx *ctx,
|
||||
lower_ir(ctx, lower_f32tof16, body);
|
||||
}
|
||||
|
||||
+ lower_ir(ctx, lower_isinf, body);
|
||||
+
|
||||
lower_return(ctx, entry_func, body, false);
|
||||
|
||||
while (hlsl_transform_ir(ctx, lower_calls, body, NULL));
|
||||
diff --git a/libs/vkd3d/libs/vkd3d-shader/msl.c b/libs/vkd3d/libs/vkd3d-shader/msl.c
|
||||
index bb85e62e94c..e783128e236 100644
|
||||
--- a/libs/vkd3d/libs/vkd3d-shader/msl.c
|
||||
+++ b/libs/vkd3d/libs/vkd3d-shader/msl.c
|
||||
@@ -198,7 +198,6 @@ static void msl_print_register_name(struct vkd3d_string_buffer *buffer,
|
||||
vkd3d_string_buffer_printf(buffer, "uint4(%#xu, %#xu, %#xu, %#xu)",
|
||||
reg->u.immconst_u32[0], reg->u.immconst_u32[1],
|
||||
reg->u.immconst_u32[2], reg->u.immconst_u32[3]);
|
||||
- vkd3d_string_buffer_printf(buffer, "%#xu", reg->u.immconst_u32[0]);
|
||||
break;
|
||||
case VKD3D_DATA_FLOAT:
|
||||
vkd3d_string_buffer_printf(buffer, "as_type<float4>(uint4(%#xu, %#xu, %#xu, %#xu))",
|
||||
--
|
||||
2.45.2
|
||||
|
@@ -1 +1 @@
|
||||
Wine Staging 10.0-rc2
|
||||
Wine Staging 10.0-rc6
|
||||
|
@@ -1 +1 @@
|
||||
5bfbeb677f472d30c5dc5d855b0a045a7157cc43
|
||||
5b3306a0d0aff221195ecc29872f25ed082eedd0
|
||||
|
Reference in New Issue
Block a user