You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-12-15 08:03:15 -08:00
1572 lines
72 KiB
Diff
1572 lines
72 KiB
Diff
From 9b60d920c564bef944c2e4becd92dd61775ea468 Mon Sep 17 00:00:00 2001
|
|
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
|
Date: Tue, 7 Oct 2025 08:00:36 +1100
|
|
Subject: [PATCH] Updated vkd3d to cd64aa69c886c7dd7148072ee69b6e70bff2f064.
|
|
|
|
---
|
|
libs/vkd3d/libs/vkd3d-shader/d3dbc.c | 57 ++-
|
|
libs/vkd3d/libs/vkd3d-shader/hlsl.h | 1 +
|
|
libs/vkd3d/libs/vkd3d-shader/hlsl.y | 28 +-
|
|
libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c | 51 ++-
|
|
libs/vkd3d/libs/vkd3d-shader/ir.c | 431 +++++++++++++++++-
|
|
libs/vkd3d/libs/vkd3d-shader/spirv.c | 171 ++++---
|
|
libs/vkd3d/libs/vkd3d-shader/tpf.c | 14 +-
|
|
.../libs/vkd3d-shader/vkd3d_shader_main.c | 2 +-
|
|
.../libs/vkd3d-shader/vkd3d_shader_private.h | 5 +-
|
|
9 files changed, 616 insertions(+), 144 deletions(-)
|
|
|
|
diff --git a/libs/vkd3d/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
|
index fbf9de20278..2379efd3a02 100644
|
|
--- a/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
|
+++ b/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
|
@@ -659,7 +659,7 @@ static unsigned int make_mask_contiguous(unsigned int mask)
|
|
|
|
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)
|
|
+ unsigned int register_index, bool is_dcl, unsigned int mask, uint32_t dst_modifiers)
|
|
{
|
|
struct vsir_program *program = sm1->program;
|
|
struct shader_signature *signature;
|
|
@@ -695,7 +695,8 @@ static bool add_signature_element(struct vkd3d_shader_sm1_parser *sm1, bool outp
|
|
element->mask = make_mask_contiguous(mask);
|
|
element->used_mask = is_dcl ? 0 : mask;
|
|
if (program->shader_version.type == VKD3D_SHADER_TYPE_PIXEL && !output)
|
|
- element->interpolation_mode = VKD3DSIM_LINEAR;
|
|
+ element->interpolation_mode = (dst_modifiers & VKD3DSPDM_MSAMPCENTROID)
|
|
+ ? VKD3DSIM_LINEAR_CENTROID : VKD3DSIM_LINEAR;
|
|
|
|
return true;
|
|
}
|
|
@@ -748,7 +749,7 @@ static void add_signature_mask(struct vkd3d_shader_sm1_parser *sm1, bool output,
|
|
}
|
|
|
|
static bool add_signature_element_from_register(struct vkd3d_shader_sm1_parser *sm1,
|
|
- const struct vkd3d_shader_register *reg, bool is_dcl, unsigned int mask)
|
|
+ const struct vkd3d_shader_register *reg, bool is_dcl, unsigned int mask, uint32_t dst_modifiers)
|
|
{
|
|
const struct vkd3d_shader_version *version = &sm1->program->shader_version;
|
|
unsigned int register_index = reg->idx_count > 0 ? reg->idx[0].offset : 0;
|
|
@@ -757,7 +758,8 @@ static bool add_signature_element_from_register(struct vkd3d_shader_sm1_parser *
|
|
{
|
|
case VKD3DSPR_TEMP:
|
|
if (version->type == VKD3D_SHADER_TYPE_PIXEL && version->major == 1 && !register_index)
|
|
- return add_signature_element(sm1, true, "COLOR", 0, VKD3D_SHADER_SV_TARGET, 0, is_dcl, mask);
|
|
+ return add_signature_element(sm1, true, "COLOR", 0, VKD3D_SHADER_SV_TARGET,
|
|
+ 0, is_dcl, mask, dst_modifiers);
|
|
return true;
|
|
|
|
case VKD3DSPR_INPUT:
|
|
@@ -769,15 +771,15 @@ static bool add_signature_element_from_register(struct vkd3d_shader_sm1_parser *
|
|
return true;
|
|
}
|
|
return add_signature_element(sm1, false, "COLOR", register_index,
|
|
- VKD3D_SHADER_SV_NONE, SM1_COLOR_REGISTER_OFFSET + register_index, is_dcl, mask);
|
|
+ VKD3D_SHADER_SV_NONE, SM1_COLOR_REGISTER_OFFSET + register_index, is_dcl, mask, dst_modifiers);
|
|
|
|
case VKD3DSPR_TEXTURE:
|
|
return add_signature_element(sm1, false, "TEXCOORD", register_index,
|
|
- VKD3D_SHADER_SV_NONE, register_index, is_dcl, mask);
|
|
+ VKD3D_SHADER_SV_NONE, register_index, is_dcl, mask, dst_modifiers);
|
|
|
|
case VKD3DSPR_TEXCRDOUT:
|
|
return add_signature_element(sm1, true, "TEXCOORD", register_index,
|
|
- VKD3D_SHADER_SV_NONE, register_index, is_dcl, mask);
|
|
+ VKD3D_SHADER_SV_NONE, register_index, is_dcl, mask, dst_modifiers);
|
|
|
|
case VKD3DSPR_OUTPUT:
|
|
if (version->type == VKD3D_SHADER_TYPE_VERTEX)
|
|
@@ -789,30 +791,30 @@ static bool add_signature_element_from_register(struct vkd3d_shader_sm1_parser *
|
|
|
|
case VKD3DSPR_ATTROUT:
|
|
return add_signature_element(sm1, true, "COLOR", register_index,
|
|
- VKD3D_SHADER_SV_NONE, SM1_COLOR_REGISTER_OFFSET + register_index, is_dcl, mask);
|
|
+ VKD3D_SHADER_SV_NONE, SM1_COLOR_REGISTER_OFFSET + register_index, is_dcl, mask, dst_modifiers);
|
|
|
|
case VKD3DSPR_COLOROUT:
|
|
return add_signature_element(sm1, true, "COLOR", register_index,
|
|
- VKD3D_SHADER_SV_TARGET, register_index, is_dcl, mask);
|
|
+ VKD3D_SHADER_SV_TARGET, register_index, is_dcl, mask, dst_modifiers);
|
|
|
|
case VKD3DSPR_DEPTHOUT:
|
|
return add_signature_element(sm1, true, "DEPTH", 0,
|
|
- VKD3D_SHADER_SV_DEPTH, register_index, is_dcl, 0x1);
|
|
+ VKD3D_SHADER_SV_DEPTH, register_index, is_dcl, 0x1, dst_modifiers);
|
|
|
|
case VKD3DSPR_RASTOUT:
|
|
switch (register_index)
|
|
{
|
|
case 0:
|
|
- return add_signature_element(sm1, true, "POSITION", 0,
|
|
- VKD3D_SHADER_SV_POSITION, SM1_RASTOUT_REGISTER_OFFSET + register_index, is_dcl, mask);
|
|
+ return add_signature_element(sm1, true, "POSITION", 0, VKD3D_SHADER_SV_POSITION,
|
|
+ SM1_RASTOUT_REGISTER_OFFSET + register_index, is_dcl, mask, dst_modifiers);
|
|
|
|
case 1:
|
|
- return add_signature_element(sm1, true, "FOG", 0,
|
|
- VKD3D_SHADER_SV_NONE, SM1_RASTOUT_REGISTER_OFFSET + register_index, is_dcl, 0x1);
|
|
+ return add_signature_element(sm1, true, "FOG", 0, VKD3D_SHADER_SV_NONE,
|
|
+ SM1_RASTOUT_REGISTER_OFFSET + register_index, is_dcl, 0x1, dst_modifiers);
|
|
|
|
case 2:
|
|
- return add_signature_element(sm1, true, "PSIZE", 0,
|
|
- VKD3D_SHADER_SV_NONE, SM1_RASTOUT_REGISTER_OFFSET + register_index, is_dcl, 0x1);
|
|
+ return add_signature_element(sm1, true, "PSIZE", 0, VKD3D_SHADER_SV_NONE,
|
|
+ SM1_RASTOUT_REGISTER_OFFSET + register_index, is_dcl, 0x1, dst_modifiers);
|
|
|
|
default:
|
|
vkd3d_shader_parser_error(&sm1->p, VKD3D_SHADER_ERROR_D3DBC_INVALID_REGISTER_INDEX,
|
|
@@ -825,11 +827,11 @@ static bool add_signature_element_from_register(struct vkd3d_shader_sm1_parser *
|
|
{
|
|
case 0:
|
|
return add_signature_element(sm1, false, "VPOS", 0,
|
|
- VKD3D_SHADER_SV_POSITION, register_index, is_dcl, mask);
|
|
+ VKD3D_SHADER_SV_POSITION, register_index, is_dcl, mask, dst_modifiers);
|
|
|
|
case 1:
|
|
return add_signature_element(sm1, false, "VFACE", 0,
|
|
- VKD3D_SHADER_SV_IS_FRONT_FACE, register_index, is_dcl, 0x1);
|
|
+ VKD3D_SHADER_SV_IS_FRONT_FACE, register_index, is_dcl, 0x1, dst_modifiers);
|
|
|
|
default:
|
|
vkd3d_shader_parser_error(&sm1->p, VKD3D_SHADER_ERROR_D3DBC_INVALID_REGISTER_INDEX,
|
|
@@ -849,6 +851,7 @@ static bool add_signature_element_from_semantic(struct vkd3d_shader_sm1_parser *
|
|
const struct vkd3d_shader_register *reg = &semantic->resource.reg.reg;
|
|
enum vkd3d_shader_sysval_semantic sysval = VKD3D_SHADER_SV_NONE;
|
|
unsigned int mask = semantic->resource.reg.write_mask;
|
|
+ uint32_t modifiers = semantic->resource.reg.modifiers;
|
|
bool output;
|
|
|
|
static const char sm1_semantic_names[][13] =
|
|
@@ -874,11 +877,11 @@ static bool add_signature_element_from_semantic(struct vkd3d_shader_sm1_parser *
|
|
else if (reg->type == VKD3DSPR_INPUT || reg->type == VKD3DSPR_TEXTURE)
|
|
output = false;
|
|
else /* vpos and vface don't have a semantic. */
|
|
- return add_signature_element_from_register(sm1, reg, true, mask);
|
|
+ return add_signature_element_from_register(sm1, reg, true, mask, modifiers);
|
|
|
|
/* sm2 pixel shaders use DCL but don't provide a semantic. */
|
|
if (version->type == VKD3D_SHADER_TYPE_PIXEL && version->major == 2)
|
|
- return add_signature_element_from_register(sm1, reg, true, mask);
|
|
+ return add_signature_element_from_register(sm1, reg, true, mask, modifiers);
|
|
|
|
/* With the exception of vertex POSITION output, none of these are system
|
|
* values. Pixel POSITION input is not equivalent to SV_Position; the closer
|
|
@@ -887,8 +890,8 @@ static bool add_signature_element_from_semantic(struct vkd3d_shader_sm1_parser *
|
|
&& output && semantic->usage == VKD3D_DECL_USAGE_POSITION)
|
|
sysval = VKD3D_SHADER_SV_POSITION;
|
|
|
|
- return add_signature_element(sm1, output, sm1_semantic_names[semantic->usage],
|
|
- semantic->usage_idx, sysval, reg->idx[0].offset, true, mask);
|
|
+ return add_signature_element(sm1, output, sm1_semantic_names[semantic->usage], semantic->usage_idx, sysval,
|
|
+ reg->idx[0].offset, true, mask, modifiers);
|
|
}
|
|
|
|
static void record_constant_register(struct vkd3d_shader_sm1_parser *sm1,
|
|
@@ -932,7 +935,7 @@ static void shader_sm1_scan_register(struct vkd3d_shader_sm1_parser *sm1,
|
|
break;
|
|
}
|
|
|
|
- add_signature_element_from_register(sm1, reg, false, mask);
|
|
+ add_signature_element_from_register(sm1, reg, false, mask, 0);
|
|
}
|
|
|
|
/* Read a parameter token from the input stream, and possibly a relative
|
|
@@ -1990,6 +1993,9 @@ static void d3dbc_write_vsir_instruction(struct d3dbc_compiler *d3dbc, const str
|
|
|
|
switch (ins->opcode)
|
|
{
|
|
+ case VSIR_OP_NOP:
|
|
+ break;
|
|
+
|
|
case VSIR_OP_DEF:
|
|
d3dbc_write_vsir_def(d3dbc, ins);
|
|
break;
|
|
@@ -2097,6 +2103,8 @@ static void d3dbc_write_semantic_dcl(struct d3dbc_compiler *d3dbc,
|
|
put_u32(buffer, token);
|
|
|
|
reg.write_mask = element->mask;
|
|
+ if (element->interpolation_mode == VKD3DSIM_LINEAR_CENTROID)
|
|
+ reg.modifiers |= VKD3DSPDM_MSAMPCENTROID;
|
|
write_sm1_dst_register(buffer, ®);
|
|
}
|
|
|
|
@@ -2147,6 +2155,9 @@ int d3dbc_compile(struct vsir_program *program, uint64_t config_flags,
|
|
struct vkd3d_bytecode_buffer *buffer = &d3dbc.buffer;
|
|
int result;
|
|
|
|
+ if ((result = vsir_program_optimize(program, config_flags, compile_info, message_context)))
|
|
+ return result;
|
|
+
|
|
if ((result = vsir_allocate_temp_registers(program, message_context)))
|
|
return result;
|
|
|
|
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.h b/libs/vkd3d/libs/vkd3d-shader/hlsl.h
|
|
index 8dbfd062177..6c6243db799 100644
|
|
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.h
|
|
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.h
|
|
@@ -248,6 +248,7 @@ struct hlsl_semantic
|
|
const char *name;
|
|
uint32_t index;
|
|
uint32_t stream_index;
|
|
+ uint32_t modifiers;
|
|
|
|
/* Name exactly as it appears in the sources. */
|
|
const char *raw_name;
|
|
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.y b/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
|
index d3004d7cc8a..37b116bed40 100644
|
|
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
|
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.y
|
|
@@ -1082,7 +1082,7 @@ static bool gen_struct_fields(struct hlsl_ctx *ctx, struct parse_fields *fields,
|
|
field->loc = v->loc;
|
|
field->name = v->name;
|
|
field->semantic = v->semantic;
|
|
- field->storage_modifiers = modifiers;
|
|
+ field->storage_modifiers = modifiers | v->semantic.modifiers;
|
|
if (v->initializer.args_count)
|
|
{
|
|
hlsl_error(ctx, &v->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_SYNTAX, "Illegal initializer on a struct field.");
|
|
@@ -1211,16 +1211,17 @@ static void initialize_var_components(struct hlsl_ctx *ctx, struct hlsl_block *i
|
|
static bool add_func_parameter(struct hlsl_ctx *ctx, struct hlsl_func_parameters *parameters,
|
|
struct parse_parameter *param, const struct vkd3d_shader_location *loc)
|
|
{
|
|
+ uint32_t modifiers = param->modifiers | param->semantic.modifiers;
|
|
struct hlsl_ir_var *var;
|
|
|
|
if (param->type->class == HLSL_CLASS_MATRIX)
|
|
VKD3D_ASSERT(param->type->modifiers & HLSL_MODIFIERS_MAJORITY_MASK);
|
|
|
|
- if ((param->modifiers & HLSL_STORAGE_OUT) && (param->modifiers & HLSL_STORAGE_UNIFORM))
|
|
+ if ((modifiers & HLSL_STORAGE_OUT) && (modifiers & HLSL_STORAGE_UNIFORM))
|
|
hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_MODIFIER,
|
|
"Parameter '%s' is declared as both \"out\" and \"uniform\".", param->name);
|
|
|
|
- if ((param->modifiers & HLSL_STORAGE_OUT) && !(param->modifiers & HLSL_STORAGE_IN)
|
|
+ if ((modifiers & HLSL_STORAGE_OUT) && !(modifiers & HLSL_STORAGE_IN)
|
|
&& (param->type->modifiers & HLSL_MODIFIER_CONST))
|
|
hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_MODIFIER,
|
|
"Parameter '%s' is declared as both \"out\" and \"const\".", param->name);
|
|
@@ -1234,14 +1235,14 @@ static bool add_func_parameter(struct hlsl_ctx *ctx, struct hlsl_func_parameters
|
|
hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_MISSING_INITIALIZER,
|
|
"Missing default value for parameter '%s'.", param->name);
|
|
|
|
- if (param->initializer.args_count && (param->modifiers & HLSL_STORAGE_OUT))
|
|
+ if (param->initializer.args_count && (modifiers & HLSL_STORAGE_OUT))
|
|
hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_MODIFIER,
|
|
"Output parameter '%s' has a default value.", param->name);
|
|
|
|
if (hlsl_get_stream_output_type(param->type))
|
|
check_invalid_stream_output_object(ctx, param->type, param->name, loc);
|
|
|
|
- if (!(var = hlsl_new_var(ctx, param->name, param->type, loc, ¶m->semantic, param->modifiers,
|
|
+ if (!(var = hlsl_new_var(ctx, param->name, param->type, loc, ¶m->semantic, modifiers,
|
|
¶m->reg_reservation)))
|
|
return false;
|
|
var->is_param = 1;
|
|
@@ -2408,10 +2409,10 @@ static void check_invalid_object_fields(struct hlsl_ctx *ctx, const struct hlsl_
|
|
|
|
static void declare_var(struct hlsl_ctx *ctx, struct parse_variable_def *v)
|
|
{
|
|
+ uint32_t modifiers = v->modifiers | v->semantic.modifiers;
|
|
struct hlsl_type *basic_type = v->basic_type;
|
|
struct hlsl_ir_function_decl *func;
|
|
struct hlsl_semantic new_semantic;
|
|
- uint32_t modifiers = v->modifiers;
|
|
bool unbounded_res_array = false;
|
|
bool constant_buffer = false;
|
|
struct hlsl_ir_var *var;
|
|
@@ -7847,15 +7848,28 @@ colon_attributes:
|
|
semantic:
|
|
':' any_identifier
|
|
{
|
|
+ static const char *centroid_suffix = "_centroid";
|
|
+ uint32_t modifiers = 0;
|
|
+ size_t len;
|
|
char *p;
|
|
|
|
if (!($$.raw_name = hlsl_strdup(ctx, $2)))
|
|
YYABORT;
|
|
|
|
- for (p = $2 + strlen($2); p > $2 && isdigit(p[-1]); --p)
|
|
+ len = strlen($2);
|
|
+ if (ascii_strncasecmp($2, "sv_", 3)
|
|
+ && len > strlen(centroid_suffix)
|
|
+ && !ascii_strcasecmp($2 + (len - strlen(centroid_suffix)), centroid_suffix))
|
|
+ {
|
|
+ modifiers = HLSL_STORAGE_CENTROID;
|
|
+ len -= strlen(centroid_suffix);
|
|
+ }
|
|
+
|
|
+ for (p = $2 + len; p > $2 && isdigit(p[-1]); --p)
|
|
;
|
|
$$.name = $2;
|
|
$$.index = atoi(p);
|
|
+ $$.modifiers = modifiers;
|
|
$$.reported_missing = false;
|
|
$$.reported_duplicated_output_next_index = 0;
|
|
$$.reported_duplicated_input_incompatible_next_index = 0;
|
|
diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
|
index 2138c3776a7..d22330cedb7 100644
|
|
--- a/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
|
+++ b/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c
|
|
@@ -6756,8 +6756,8 @@ static void allocate_temp_registers(struct hlsl_ctx *ctx, struct hlsl_block *bod
|
|
allocate_temp_registers_recurse(ctx, body);
|
|
}
|
|
|
|
-static enum vkd3d_shader_interpolation_mode sm4_get_interpolation_mode(struct hlsl_type *type,
|
|
- unsigned int storage_modifiers)
|
|
+static enum vkd3d_shader_interpolation_mode get_interpolation_mode(const struct vkd3d_shader_version *version,
|
|
+ struct hlsl_type *type, unsigned int storage_modifiers)
|
|
{
|
|
unsigned int i;
|
|
|
|
@@ -6779,6 +6779,9 @@ static enum vkd3d_shader_interpolation_mode sm4_get_interpolation_mode(struct hl
|
|
|
|
VKD3D_ASSERT(hlsl_is_numeric_type(type));
|
|
|
|
+ if (version->major < 4)
|
|
+ storage_modifiers &= HLSL_STORAGE_LINEAR | HLSL_STORAGE_CENTROID;
|
|
+
|
|
if ((storage_modifiers & HLSL_STORAGE_NOINTERPOLATION)
|
|
|| base_type_get_semantic_equivalent(type->e.numeric.type) == HLSL_TYPE_UINT)
|
|
return VKD3DSIM_CONSTANT;
|
|
@@ -6885,12 +6888,11 @@ static void allocate_semantic_register(struct hlsl_ctx *ctx, struct hlsl_ir_var
|
|
{
|
|
unsigned int component_count = is_primitive
|
|
? var->data_type->e.array.type->e.numeric.dimx : var->data_type->e.numeric.dimx;
|
|
- int mode = (ctx->profile->major_version < 4)
|
|
- ? 0 : sm4_get_interpolation_mode(var->data_type, var->storage_modifiers);
|
|
unsigned int reg_size = optimize ? component_count : 4;
|
|
+ int mode = VKD3DSIM_NONE;
|
|
|
|
- if (special_interpolation)
|
|
- mode = VKD3DSIM_NONE;
|
|
+ if (version.major >= 4 && !special_interpolation)
|
|
+ mode = get_interpolation_mode(&version, var->data_type, var->storage_modifiers);
|
|
|
|
var->regs[HLSL_REGSET_NUMERIC] = allocate_register(ctx, allocator,
|
|
reg_size, component_count, mode, var->force_align, vip_allocation);
|
|
@@ -8582,6 +8584,7 @@ static void generate_vsir_signature_entry(struct hlsl_ctx *ctx, struct vsir_prog
|
|
struct shader_signature *signature, bool output, struct hlsl_ir_var *var)
|
|
{
|
|
enum vkd3d_shader_component_type component_type = VKD3D_SHADER_COMPONENT_VOID;
|
|
+ enum vkd3d_shader_interpolation_mode interpolation_mode = VKD3DSIM_NONE;
|
|
bool is_primitive = hlsl_type_is_primitive_array(var->data_type);
|
|
enum vkd3d_shader_sysval_semantic sysval = VKD3D_SHADER_SV_NONE;
|
|
unsigned int register_index, mask, use_mask;
|
|
@@ -8589,6 +8592,9 @@ static void generate_vsir_signature_entry(struct hlsl_ctx *ctx, struct vsir_prog
|
|
enum vkd3d_shader_register_type type;
|
|
struct signature_element *element;
|
|
|
|
+ if (program->shader_version.type == VKD3D_SHADER_TYPE_PIXEL && !output)
|
|
+ interpolation_mode = get_interpolation_mode(&program->shader_version, var->data_type, var->storage_modifiers);
|
|
+
|
|
if (hlsl_version_ge(ctx, 4, 0))
|
|
{
|
|
struct vkd3d_string_buffer *string;
|
|
@@ -8668,6 +8674,13 @@ static void generate_vsir_signature_entry(struct hlsl_ctx *ctx, struct vsir_prog
|
|
|| (type == VKD3DSPR_INPUT && program->shader_version.type == VKD3D_SHADER_TYPE_PIXEL))
|
|
register_index += SM1_COLOR_REGISTER_OFFSET;
|
|
}
|
|
+
|
|
+ if (interpolation_mode == VKD3DSIM_LINEAR_CENTROID
|
|
+ && (vkd3d_shader_ver_ge(&program->shader_version, 3, 0) || type != VKD3DSPR_TEXTURE))
|
|
+ {
|
|
+ hlsl_error(ctx, &var->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_MODIFIER,
|
|
+ "The centroid interpolation mode is not supported by the '%s' semantic.", var->semantic.name);
|
|
+ }
|
|
}
|
|
else
|
|
{
|
|
@@ -8735,13 +8748,7 @@ static void generate_vsir_signature_entry(struct hlsl_ctx *ctx, struct vsir_prog
|
|
element->register_count = 1;
|
|
element->mask = mask;
|
|
element->used_mask = use_mask;
|
|
- if (program->shader_version.type == VKD3D_SHADER_TYPE_PIXEL && !output)
|
|
- {
|
|
- if (program->shader_version.major >= 4)
|
|
- element->interpolation_mode = sm4_get_interpolation_mode(var->data_type, var->storage_modifiers);
|
|
- else
|
|
- element->interpolation_mode = VKD3DSIM_LINEAR;
|
|
- }
|
|
+ element->interpolation_mode = interpolation_mode;
|
|
|
|
switch (var->data_type->e.numeric.type)
|
|
{
|
|
@@ -9133,6 +9140,8 @@ static bool sm4_generate_vsir_reg_from_deref(struct hlsl_ctx *ctx, struct vsir_p
|
|
reg->type = VKD3DSPR_RESOURCE;
|
|
reg->dimension = VSIR_DIMENSION_VEC4;
|
|
reg->idx[0].offset = var->regs[HLSL_REGSET_TEXTURES].id;
|
|
+ if (vkd3d_shader_ver_le(version, 5, 0))
|
|
+ reg->idx[0].offset += hlsl_offset_from_deref_safe(ctx, deref);
|
|
reg->idx[1].offset = var->regs[HLSL_REGSET_TEXTURES].index;
|
|
reg->idx[1].offset += hlsl_offset_from_deref_safe(ctx, deref);
|
|
reg->idx_count = 2;
|
|
@@ -9144,6 +9153,8 @@ static bool sm4_generate_vsir_reg_from_deref(struct hlsl_ctx *ctx, struct vsir_p
|
|
reg->type = VKD3DSPR_UAV;
|
|
reg->dimension = VSIR_DIMENSION_VEC4;
|
|
reg->idx[0].offset = var->regs[HLSL_REGSET_UAVS].id;
|
|
+ if (vkd3d_shader_ver_le(version, 5, 0))
|
|
+ reg->idx[0].offset += hlsl_offset_from_deref_safe(ctx, deref);
|
|
reg->idx[1].offset = var->regs[HLSL_REGSET_UAVS].index;
|
|
reg->idx[1].offset += hlsl_offset_from_deref_safe(ctx, deref);
|
|
reg->idx_count = 2;
|
|
@@ -9155,6 +9166,8 @@ static bool sm4_generate_vsir_reg_from_deref(struct hlsl_ctx *ctx, struct vsir_p
|
|
reg->type = VKD3DSPR_SAMPLER;
|
|
reg->dimension = VSIR_DIMENSION_NONE;
|
|
reg->idx[0].offset = var->regs[HLSL_REGSET_SAMPLERS].id;
|
|
+ if (vkd3d_shader_ver_le(version, 5, 0))
|
|
+ reg->idx[0].offset += hlsl_offset_from_deref_safe(ctx, deref);
|
|
reg->idx[1].offset = var->regs[HLSL_REGSET_SAMPLERS].index;
|
|
reg->idx[1].offset += hlsl_offset_from_deref_safe(ctx, deref);
|
|
reg->idx_count = 2;
|
|
@@ -10801,7 +10814,7 @@ static void sm4_generate_vsir_instr_dcl_semantic(struct hlsl_ctx *ctx, struct vs
|
|
dst_param->write_mask = write_mask;
|
|
|
|
if (var->is_input_semantic && version->type == VKD3D_SHADER_TYPE_PIXEL)
|
|
- ins->flags = sm4_get_interpolation_mode(var->data_type, var->storage_modifiers);
|
|
+ ins->flags = get_interpolation_mode(version, var->data_type, var->storage_modifiers);
|
|
}
|
|
|
|
static void sm4_generate_vsir_instr_dcl_temps(struct hlsl_ctx *ctx, struct vsir_program *program,
|
|
@@ -12530,7 +12543,7 @@ static struct extern_resource *sm4_get_extern_resources(struct hlsl_ctx *ctx, un
|
|
extern_resources[*count].component_type = component_type;
|
|
|
|
extern_resources[*count].regset = regset;
|
|
- extern_resources[*count].id = var->regs[regset].id;
|
|
+ extern_resources[*count].id = var->regs[regset].id + regset_offset;
|
|
extern_resources[*count].space = var->regs[regset].space;
|
|
extern_resources[*count].index = var->regs[regset].index + regset_offset;
|
|
extern_resources[*count].bind_count = 1;
|
|
@@ -12765,7 +12778,7 @@ static void sm4_generate_vsir_add_dcl_sampler(struct hlsl_ctx *ctx,
|
|
ins->declaration.sampler.range.last = array_last;
|
|
ins->declaration.sampler.range.space = resource->space;
|
|
|
|
- src_param->reg.idx[0].offset = resource->id;
|
|
+ src_param->reg.idx[0].offset = resource->id + i;
|
|
src_param->reg.idx[1].offset = array_first;
|
|
src_param->reg.idx[2].offset = array_last;
|
|
src_param->reg.idx_count = 3;
|
|
@@ -12923,13 +12936,11 @@ static void sm4_generate_vsir_add_dcl_texture(struct hlsl_ctx *ctx,
|
|
vsir_resource->range.last = array_last;
|
|
vsir_resource->range.space = resource->space;
|
|
|
|
- vsir_resource->reg.reg.idx[0].offset = resource->id;
|
|
+ vsir_resource->reg.reg.idx[0].offset = resource->id + i;
|
|
vsir_resource->reg.reg.idx[1].offset = array_first;
|
|
vsir_resource->reg.reg.idx[2].offset = array_last;
|
|
vsir_resource->reg.reg.idx_count = 3;
|
|
|
|
- ins->resource_type = sm4_generate_vsir_get_resource_type(resource->component_type);
|
|
-
|
|
if (component_type->sampler_dim == HLSL_SAMPLER_DIM_RAW_BUFFER)
|
|
{
|
|
ins->raw = true;
|
|
@@ -12942,6 +12953,8 @@ static void sm4_generate_vsir_add_dcl_texture(struct hlsl_ctx *ctx,
|
|
}
|
|
else
|
|
{
|
|
+ ins->declaration.semantic.resource_type = sm4_generate_vsir_get_resource_type(resource->component_type);
|
|
+
|
|
for (unsigned int j = 0; j < 4; ++j)
|
|
ins->declaration.semantic.resource_data_type[j] = sm4_generate_vsir_get_format_type(component_type);
|
|
|
|
diff --git a/libs/vkd3d/libs/vkd3d-shader/ir.c b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
|
index 453b79c75d2..670f6c31cf8 100644
|
|
--- a/libs/vkd3d/libs/vkd3d-shader/ir.c
|
|
+++ b/libs/vkd3d/libs/vkd3d-shader/ir.c
|
|
@@ -28,6 +28,7 @@ struct vsir_transformation_context
|
|
const struct vkd3d_shader_compile_info *compile_info;
|
|
struct vkd3d_shader_message_context *message_context;
|
|
struct vkd3d_shader_location null_location;
|
|
+ bool progress;
|
|
};
|
|
|
|
static void vsir_transformation_context_init(struct vsir_transformation_context *ctx,
|
|
@@ -8850,7 +8851,7 @@ struct liveness_tracker
|
|
bool written;
|
|
bool fixed_mask;
|
|
uint8_t mask;
|
|
- unsigned int first_write, last_access;
|
|
+ unsigned int first_write, last_access, last_read;
|
|
} *ssa_regs, *temp_regs;
|
|
};
|
|
|
|
@@ -8864,9 +8865,15 @@ static void liveness_track_src(struct liveness_tracker *tracker,
|
|
}
|
|
|
|
if (src->reg.type == VKD3DSPR_SSA)
|
|
+ {
|
|
+ tracker->ssa_regs[src->reg.idx[0].offset].last_read = index;
|
|
tracker->ssa_regs[src->reg.idx[0].offset].last_access = index;
|
|
+ }
|
|
else if (src->reg.type == VKD3DSPR_TEMP)
|
|
+ {
|
|
+ tracker->temp_regs[src->reg.idx[0].offset].last_read = index;
|
|
tracker->temp_regs[src->reg.idx[0].offset].last_access = index;
|
|
+ }
|
|
}
|
|
|
|
static void liveness_track_dst(struct liveness_tracker *tracker, struct vkd3d_shader_dst_param *dst,
|
|
@@ -9020,6 +9027,8 @@ static enum vkd3d_result track_liveness(struct vsir_program *program, struct liv
|
|
reg->first_write = loop_start;
|
|
if (reg->last_access < i)
|
|
reg->last_access = i;
|
|
+ if (reg->last_read < i)
|
|
+ reg->last_read = i;
|
|
}
|
|
|
|
for (unsigned int j = 0; j < program->temp_count; ++j)
|
|
@@ -9030,6 +9039,8 @@ static enum vkd3d_result track_liveness(struct vsir_program *program, struct liv
|
|
reg->first_write = loop_start;
|
|
if (reg->last_access < i)
|
|
reg->last_access = i;
|
|
+ if (reg->last_read < i)
|
|
+ reg->last_read = i;
|
|
}
|
|
}
|
|
}
|
|
@@ -12888,6 +12899,8 @@ static void vsir_transform_(
|
|
struct vsir_transformation_context *ctx, const char *step_name,
|
|
enum vkd3d_result (*step)(struct vsir_program *program, struct vsir_transformation_context *ctx))
|
|
{
|
|
+ ctx->progress = false;
|
|
+
|
|
if (ctx->result < 0)
|
|
return;
|
|
|
|
@@ -12905,6 +12918,422 @@ static void vsir_transform_(
|
|
}
|
|
}
|
|
|
|
+static bool vsir_instruction_has_side_effects(const struct vkd3d_shader_instruction *ins)
|
|
+{
|
|
+ switch (ins->opcode)
|
|
+ {
|
|
+ case VSIR_OP_ABS:
|
|
+ case VSIR_OP_ACOS:
|
|
+ case VSIR_OP_ADD:
|
|
+ case VSIR_OP_AND:
|
|
+ case VSIR_OP_ASIN:
|
|
+ case VSIR_OP_ATAN:
|
|
+ case VSIR_OP_BEM:
|
|
+ case VSIR_OP_BFI:
|
|
+ case VSIR_OP_BFREV:
|
|
+ case VSIR_OP_BUFINFO:
|
|
+ case VSIR_OP_CHECK_ACCESS_FULLY_MAPPED:
|
|
+ case VSIR_OP_CMP:
|
|
+ case VSIR_OP_CND:
|
|
+ case VSIR_OP_COS:
|
|
+ case VSIR_OP_COUNTBITS:
|
|
+ case VSIR_OP_CRS:
|
|
+ case VSIR_OP_DADD:
|
|
+ case VSIR_OP_DDIV:
|
|
+ case VSIR_OP_DEF:
|
|
+ case VSIR_OP_DEFB:
|
|
+ case VSIR_OP_DEFI:
|
|
+ case VSIR_OP_DEQO:
|
|
+ case VSIR_OP_DFMA:
|
|
+ case VSIR_OP_DGEO:
|
|
+ case VSIR_OP_DIV:
|
|
+ case VSIR_OP_DLT:
|
|
+ case VSIR_OP_DMAX:
|
|
+ case VSIR_OP_DMIN:
|
|
+ case VSIR_OP_DMOV:
|
|
+ case VSIR_OP_DMOVC:
|
|
+ case VSIR_OP_DMUL:
|
|
+ case VSIR_OP_DNE:
|
|
+ case VSIR_OP_DP2:
|
|
+ case VSIR_OP_DP2ADD:
|
|
+ case VSIR_OP_DP3:
|
|
+ case VSIR_OP_DP4:
|
|
+ case VSIR_OP_DRCP:
|
|
+ case VSIR_OP_DST:
|
|
+ case VSIR_OP_DSX:
|
|
+ case VSIR_OP_DSX_COARSE:
|
|
+ case VSIR_OP_DSX_FINE:
|
|
+ case VSIR_OP_DSY:
|
|
+ case VSIR_OP_DSY_COARSE:
|
|
+ case VSIR_OP_DSY_FINE:
|
|
+ case VSIR_OP_DTOF:
|
|
+ case VSIR_OP_DTOI:
|
|
+ case VSIR_OP_DTOU:
|
|
+ case VSIR_OP_EQO:
|
|
+ case VSIR_OP_EQU:
|
|
+ case VSIR_OP_EVAL_CENTROID:
|
|
+ case VSIR_OP_EVAL_SAMPLE_INDEX:
|
|
+ case VSIR_OP_EXP:
|
|
+ case VSIR_OP_EXPP:
|
|
+ case VSIR_OP_F16TOF32:
|
|
+ case VSIR_OP_F32TOF16:
|
|
+ case VSIR_OP_FIRSTBIT_HI:
|
|
+ case VSIR_OP_FIRSTBIT_LO:
|
|
+ case VSIR_OP_FIRSTBIT_SHI:
|
|
+ case VSIR_OP_FRC:
|
|
+ case VSIR_OP_FREM:
|
|
+ case VSIR_OP_FTOD:
|
|
+ case VSIR_OP_FTOI:
|
|
+ case VSIR_OP_FTOU:
|
|
+ case VSIR_OP_GATHER4:
|
|
+ case VSIR_OP_GATHER4_C:
|
|
+ case VSIR_OP_GATHER4_C_S:
|
|
+ case VSIR_OP_GATHER4_PO:
|
|
+ case VSIR_OP_GATHER4_PO_C:
|
|
+ case VSIR_OP_GATHER4_PO_C_S:
|
|
+ case VSIR_OP_GATHER4_PO_S:
|
|
+ case VSIR_OP_GATHER4_S:
|
|
+ case VSIR_OP_GEO:
|
|
+ case VSIR_OP_GEU:
|
|
+ case VSIR_OP_HCOS:
|
|
+ case VSIR_OP_HSIN:
|
|
+ case VSIR_OP_HTAN:
|
|
+ case VSIR_OP_IADD:
|
|
+ case VSIR_OP_IBFE:
|
|
+ case VSIR_OP_IDIV:
|
|
+ case VSIR_OP_IEQ:
|
|
+ case VSIR_OP_IGE:
|
|
+ case VSIR_OP_ILT:
|
|
+ case VSIR_OP_IMAD:
|
|
+ case VSIR_OP_IMAX:
|
|
+ case VSIR_OP_IMIN:
|
|
+ case VSIR_OP_IMUL:
|
|
+ case VSIR_OP_IMUL_LOW:
|
|
+ case VSIR_OP_INE:
|
|
+ case VSIR_OP_INEG:
|
|
+ case VSIR_OP_IREM:
|
|
+ case VSIR_OP_ISFINITE:
|
|
+ case VSIR_OP_ISHL:
|
|
+ case VSIR_OP_ISHR:
|
|
+ case VSIR_OP_ISINF:
|
|
+ case VSIR_OP_ISNAN:
|
|
+ case VSIR_OP_ITOD:
|
|
+ case VSIR_OP_ITOF:
|
|
+ case VSIR_OP_ITOI:
|
|
+ case VSIR_OP_LD:
|
|
+ case VSIR_OP_LD2DMS:
|
|
+ case VSIR_OP_LD2DMS_S:
|
|
+ case VSIR_OP_LD_RAW:
|
|
+ case VSIR_OP_LD_RAW_S:
|
|
+ case VSIR_OP_LD_S:
|
|
+ case VSIR_OP_LD_STRUCTURED:
|
|
+ case VSIR_OP_LD_STRUCTURED_S:
|
|
+ case VSIR_OP_LD_UAV_TYPED:
|
|
+ case VSIR_OP_LD_UAV_TYPED_S:
|
|
+ case VSIR_OP_LIT:
|
|
+ case VSIR_OP_LOD:
|
|
+ case VSIR_OP_LOG:
|
|
+ case VSIR_OP_LOGP:
|
|
+ case VSIR_OP_LRP:
|
|
+ case VSIR_OP_LTO:
|
|
+ case VSIR_OP_LTU:
|
|
+ case VSIR_OP_M3x2:
|
|
+ case VSIR_OP_M3x3:
|
|
+ case VSIR_OP_M3x4:
|
|
+ case VSIR_OP_M4x3:
|
|
+ case VSIR_OP_M4x4:
|
|
+ case VSIR_OP_MAD:
|
|
+ case VSIR_OP_MAX:
|
|
+ case VSIR_OP_MIN:
|
|
+ case VSIR_OP_MOV:
|
|
+ case VSIR_OP_MOVA:
|
|
+ case VSIR_OP_MOVC:
|
|
+ case VSIR_OP_MSAD:
|
|
+ case VSIR_OP_MUL:
|
|
+ case VSIR_OP_NEO:
|
|
+ case VSIR_OP_NEU:
|
|
+ case VSIR_OP_NOP:
|
|
+ case VSIR_OP_NOT:
|
|
+ case VSIR_OP_NRM:
|
|
+ case VSIR_OP_OR:
|
|
+ case VSIR_OP_ORD:
|
|
+ case VSIR_OP_PHI:
|
|
+ case VSIR_OP_POW:
|
|
+ case VSIR_OP_QUAD_READ_ACROSS_D:
|
|
+ case VSIR_OP_QUAD_READ_ACROSS_X:
|
|
+ case VSIR_OP_QUAD_READ_ACROSS_Y:
|
|
+ case VSIR_OP_QUAD_READ_LANE_AT:
|
|
+ case VSIR_OP_RCP:
|
|
+ case VSIR_OP_RESINFO:
|
|
+ case VSIR_OP_ROUND_NE:
|
|
+ case VSIR_OP_ROUND_NI:
|
|
+ case VSIR_OP_ROUND_PI:
|
|
+ case VSIR_OP_ROUND_Z:
|
|
+ case VSIR_OP_RSQ:
|
|
+ case VSIR_OP_SAMPLE:
|
|
+ case VSIR_OP_SAMPLE_B:
|
|
+ case VSIR_OP_SAMPLE_B_CL_S:
|
|
+ case VSIR_OP_SAMPLE_C:
|
|
+ case VSIR_OP_SAMPLE_C_CL_S:
|
|
+ case VSIR_OP_SAMPLE_C_LZ:
|
|
+ case VSIR_OP_SAMPLE_C_LZ_S:
|
|
+ case VSIR_OP_SAMPLE_CL_S:
|
|
+ case VSIR_OP_SAMPLE_GRAD:
|
|
+ case VSIR_OP_SAMPLE_GRAD_CL_S:
|
|
+ case VSIR_OP_SAMPLE_INFO:
|
|
+ case VSIR_OP_SAMPLE_LOD:
|
|
+ case VSIR_OP_SAMPLE_LOD_S:
|
|
+ case VSIR_OP_SAMPLE_POS:
|
|
+ case VSIR_OP_SETP:
|
|
+ case VSIR_OP_SGE:
|
|
+ case VSIR_OP_SGN:
|
|
+ case VSIR_OP_SIN:
|
|
+ case VSIR_OP_SINCOS:
|
|
+ case VSIR_OP_SLT:
|
|
+ case VSIR_OP_SQRT:
|
|
+ case VSIR_OP_SUB:
|
|
+ case VSIR_OP_SWAPC:
|
|
+ case VSIR_OP_TAN:
|
|
+ case VSIR_OP_TEX:
|
|
+ case VSIR_OP_TEXBEM:
|
|
+ case VSIR_OP_TEXBEML:
|
|
+ case VSIR_OP_TEXCOORD:
|
|
+ case VSIR_OP_TEXCRD:
|
|
+ case VSIR_OP_TEXDEPTH:
|
|
+ case VSIR_OP_TEXDP3:
|
|
+ case VSIR_OP_TEXDP3TEX:
|
|
+ case VSIR_OP_TEXLD:
|
|
+ case VSIR_OP_TEXLDD:
|
|
+ case VSIR_OP_TEXLDL:
|
|
+ case VSIR_OP_TEXM3x2DEPTH:
|
|
+ case VSIR_OP_TEXM3x2PAD:
|
|
+ case VSIR_OP_TEXM3x2TEX:
|
|
+ case VSIR_OP_TEXM3x3:
|
|
+ case VSIR_OP_TEXM3x3DIFF:
|
|
+ case VSIR_OP_TEXM3x3PAD:
|
|
+ case VSIR_OP_TEXM3x3SPEC:
|
|
+ case VSIR_OP_TEXM3x3TEX:
|
|
+ case VSIR_OP_TEXM3x3VSPEC:
|
|
+ case VSIR_OP_TEXREG2AR:
|
|
+ case VSIR_OP_TEXREG2GB:
|
|
+ case VSIR_OP_TEXREG2RGB:
|
|
+ case VSIR_OP_UBFE:
|
|
+ case VSIR_OP_UDIV:
|
|
+ case VSIR_OP_UDIV_SIMPLE:
|
|
+ case VSIR_OP_UGE:
|
|
+ case VSIR_OP_ULT:
|
|
+ case VSIR_OP_UMAX:
|
|
+ case VSIR_OP_UMIN:
|
|
+ case VSIR_OP_UMUL:
|
|
+ case VSIR_OP_UNO:
|
|
+ case VSIR_OP_UREM:
|
|
+ case VSIR_OP_USHR:
|
|
+ case VSIR_OP_UTOD:
|
|
+ case VSIR_OP_UTOF:
|
|
+ case VSIR_OP_UTOU:
|
|
+ case VSIR_OP_WAVE_ACTIVE_ALL_EQUAL:
|
|
+ case VSIR_OP_WAVE_ACTIVE_BALLOT:
|
|
+ case VSIR_OP_WAVE_ACTIVE_BIT_AND:
|
|
+ case VSIR_OP_WAVE_ACTIVE_BIT_OR:
|
|
+ case VSIR_OP_WAVE_ACTIVE_BIT_XOR:
|
|
+ case VSIR_OP_WAVE_ALL_BIT_COUNT:
|
|
+ case VSIR_OP_WAVE_ALL_TRUE:
|
|
+ case VSIR_OP_WAVE_ANY_TRUE:
|
|
+ case VSIR_OP_WAVE_IS_FIRST_LANE:
|
|
+ case VSIR_OP_WAVE_OP_ADD:
|
|
+ case VSIR_OP_WAVE_OP_IMAX:
|
|
+ case VSIR_OP_WAVE_OP_IMIN:
|
|
+ case VSIR_OP_WAVE_OP_MAX:
|
|
+ case VSIR_OP_WAVE_OP_MIN:
|
|
+ case VSIR_OP_WAVE_OP_MUL:
|
|
+ case VSIR_OP_WAVE_OP_UMAX:
|
|
+ case VSIR_OP_WAVE_OP_UMIN:
|
|
+ case VSIR_OP_WAVE_PREFIX_BIT_COUNT:
|
|
+ case VSIR_OP_WAVE_READ_LANE_AT:
|
|
+ case VSIR_OP_WAVE_READ_LANE_FIRST:
|
|
+ case VSIR_OP_XOR:
|
|
+ return false;
|
|
+
|
|
+ case VSIR_OP_ATOMIC_AND:
|
|
+ case VSIR_OP_ATOMIC_CMP_STORE:
|
|
+ case VSIR_OP_ATOMIC_IADD:
|
|
+ case VSIR_OP_ATOMIC_IMAX:
|
|
+ case VSIR_OP_ATOMIC_IMIN:
|
|
+ case VSIR_OP_ATOMIC_OR:
|
|
+ case VSIR_OP_ATOMIC_UMAX:
|
|
+ case VSIR_OP_ATOMIC_UMIN:
|
|
+ case VSIR_OP_ATOMIC_XOR:
|
|
+ case VSIR_OP_BRANCH:
|
|
+ case VSIR_OP_BREAK:
|
|
+ case VSIR_OP_BREAKC:
|
|
+ case VSIR_OP_BREAKP:
|
|
+ case VSIR_OP_CALL:
|
|
+ case VSIR_OP_CALLNZ:
|
|
+ case VSIR_OP_CASE:
|
|
+ case VSIR_OP_CONTINUE:
|
|
+ case VSIR_OP_CONTINUEP:
|
|
+ case VSIR_OP_CUT:
|
|
+ case VSIR_OP_CUT_STREAM:
|
|
+ case VSIR_OP_DCL:
|
|
+ case VSIR_OP_DCL_CONSTANT_BUFFER:
|
|
+ case VSIR_OP_DCL_FUNCTION_BODY:
|
|
+ case VSIR_OP_DCL_FUNCTION_TABLE:
|
|
+ case VSIR_OP_DCL_GLOBAL_FLAGS:
|
|
+ case VSIR_OP_DCL_GS_INSTANCES:
|
|
+ case VSIR_OP_DCL_HS_FORK_PHASE_INSTANCE_COUNT:
|
|
+ case VSIR_OP_DCL_HS_JOIN_PHASE_INSTANCE_COUNT:
|
|
+ case VSIR_OP_DCL_HS_MAX_TESSFACTOR:
|
|
+ case VSIR_OP_DCL_IMMEDIATE_CONSTANT_BUFFER:
|
|
+ case VSIR_OP_DCL_INDEX_RANGE:
|
|
+ case VSIR_OP_DCL_INDEXABLE_TEMP:
|
|
+ case VSIR_OP_DCL_INPUT:
|
|
+ case VSIR_OP_DCL_INPUT_CONTROL_POINT_COUNT:
|
|
+ case VSIR_OP_DCL_INPUT_PRIMITIVE:
|
|
+ case VSIR_OP_DCL_INPUT_PS:
|
|
+ case VSIR_OP_DCL_INPUT_PS_SGV:
|
|
+ case VSIR_OP_DCL_INPUT_PS_SIV:
|
|
+ case VSIR_OP_DCL_INPUT_SGV:
|
|
+ case VSIR_OP_DCL_INPUT_SIV:
|
|
+ case VSIR_OP_DCL_INTERFACE:
|
|
+ case VSIR_OP_DCL_OUTPUT:
|
|
+ case VSIR_OP_DCL_OUTPUT_CONTROL_POINT_COUNT:
|
|
+ case VSIR_OP_DCL_OUTPUT_SGV:
|
|
+ case VSIR_OP_DCL_OUTPUT_SIV:
|
|
+ case VSIR_OP_DCL_OUTPUT_TOPOLOGY:
|
|
+ case VSIR_OP_DCL_RESOURCE_RAW:
|
|
+ case VSIR_OP_DCL_RESOURCE_STRUCTURED:
|
|
+ case VSIR_OP_DCL_SAMPLER:
|
|
+ case VSIR_OP_DCL_STREAM:
|
|
+ case VSIR_OP_DCL_TEMPS:
|
|
+ case VSIR_OP_DCL_TESSELLATOR_DOMAIN:
|
|
+ case VSIR_OP_DCL_TESSELLATOR_OUTPUT_PRIMITIVE:
|
|
+ case VSIR_OP_DCL_TESSELLATOR_PARTITIONING:
|
|
+ case VSIR_OP_DCL_TGSM_RAW:
|
|
+ case VSIR_OP_DCL_TGSM_STRUCTURED:
|
|
+ case VSIR_OP_DCL_THREAD_GROUP:
|
|
+ case VSIR_OP_DCL_UAV_RAW:
|
|
+ case VSIR_OP_DCL_UAV_STRUCTURED:
|
|
+ case VSIR_OP_DCL_UAV_TYPED:
|
|
+ case VSIR_OP_DCL_VERTICES_OUT:
|
|
+ case VSIR_OP_DEFAULT:
|
|
+ case VSIR_OP_DISCARD:
|
|
+ case VSIR_OP_ELSE:
|
|
+ case VSIR_OP_EMIT:
|
|
+ case VSIR_OP_EMIT_STREAM:
|
|
+ case VSIR_OP_ENDIF:
|
|
+ case VSIR_OP_ENDLOOP:
|
|
+ case VSIR_OP_ENDREP:
|
|
+ case VSIR_OP_ENDSWITCH:
|
|
+ case VSIR_OP_FCALL:
|
|
+ case VSIR_OP_HS_CONTROL_POINT_PHASE:
|
|
+ case VSIR_OP_HS_DECLS:
|
|
+ case VSIR_OP_HS_FORK_PHASE:
|
|
+ case VSIR_OP_HS_JOIN_PHASE:
|
|
+ case VSIR_OP_IF:
|
|
+ case VSIR_OP_IFC:
|
|
+ case VSIR_OP_IMM_ATOMIC_ALLOC:
|
|
+ case VSIR_OP_IMM_ATOMIC_AND:
|
|
+ case VSIR_OP_IMM_ATOMIC_CMP_EXCH:
|
|
+ case VSIR_OP_IMM_ATOMIC_CONSUME:
|
|
+ case VSIR_OP_IMM_ATOMIC_EXCH:
|
|
+ case VSIR_OP_IMM_ATOMIC_IADD:
|
|
+ case VSIR_OP_IMM_ATOMIC_IMAX:
|
|
+ case VSIR_OP_IMM_ATOMIC_IMIN:
|
|
+ case VSIR_OP_IMM_ATOMIC_OR:
|
|
+ case VSIR_OP_IMM_ATOMIC_UMAX:
|
|
+ case VSIR_OP_IMM_ATOMIC_UMIN:
|
|
+ case VSIR_OP_IMM_ATOMIC_XOR:
|
|
+ case VSIR_OP_LABEL:
|
|
+ case VSIR_OP_LOOP:
|
|
+ case VSIR_OP_PHASE:
|
|
+ case VSIR_OP_REP:
|
|
+ case VSIR_OP_RET:
|
|
+ case VSIR_OP_RETP:
|
|
+ case VSIR_OP_STORE_RAW:
|
|
+ case VSIR_OP_STORE_STRUCTURED:
|
|
+ case VSIR_OP_STORE_UAV_TYPED:
|
|
+ case VSIR_OP_SWITCH:
|
|
+ case VSIR_OP_SWITCH_MONOLITHIC:
|
|
+ case VSIR_OP_SYNC:
|
|
+ case VSIR_OP_TEXKILL:
|
|
+ return true;
|
|
+
|
|
+ case VSIR_OP_INVALID:
|
|
+ case VSIR_OP_COUNT:
|
|
+ break;
|
|
+ }
|
|
+
|
|
+ vkd3d_unreachable();
|
|
+}
|
|
+
|
|
+static enum vkd3d_result vsir_program_dce(struct vsir_program *program,
|
|
+ struct vsir_transformation_context *ctx)
|
|
+{
|
|
+ struct vsir_program_iterator it = vsir_program_iterator(&program->instructions);
|
|
+ struct vkd3d_shader_instruction *ins;
|
|
+ struct liveness_tracker tracker;
|
|
+ enum vkd3d_result ret;
|
|
+ unsigned int i;
|
|
+
|
|
+ if ((ret = track_liveness(program, &tracker)))
|
|
+ return ret;
|
|
+
|
|
+ for (ins = vsir_program_iterator_head(&it), i = 0; ins; ins = vsir_program_iterator_next(&it), ++i)
|
|
+ {
|
|
+ unsigned int used_dst_count = 0;
|
|
+
|
|
+ /* FIXME: IMM_ATOMIC_* can still be effectively DCE'd by turning them
|
|
+ * into non-immediate ATOMIC_* instructions. */
|
|
+ if (vsir_instruction_has_side_effects(ins))
|
|
+ continue;
|
|
+
|
|
+ for (unsigned int j = 0; j < ins->dst_count; ++j)
|
|
+ {
|
|
+ struct vkd3d_shader_dst_param *dst = &ins->dst[j];
|
|
+
|
|
+ if (dst->reg.type == VKD3DSPR_SSA && !tracker.ssa_regs[dst->reg.idx[0].offset].last_read)
|
|
+ {
|
|
+ vsir_dst_param_init_null(dst);
|
|
+ ctx->progress = true;
|
|
+ }
|
|
+ else if (dst->reg.type == VKD3DSPR_TEMP
|
|
+ && tracker.temp_regs[dst->reg.idx[0].offset].last_read <= i
|
|
+ && !(program->shader_version.major == 1 && dst->reg.idx[0].offset == 0))
|
|
+ {
|
|
+ vsir_dst_param_init_null(dst);
|
|
+ ctx->progress = true;
|
|
+ }
|
|
+ else if (dst->reg.type != VKD3DSPR_NULL)
|
|
+ {
|
|
+ ++used_dst_count;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ if (!used_dst_count)
|
|
+ vkd3d_shader_instruction_make_nop(ins);
|
|
+ }
|
|
+
|
|
+ liveness_tracker_cleanup(&tracker);
|
|
+ return VKD3D_OK;
|
|
+}
|
|
+
|
|
+enum vkd3d_result vsir_program_optimize(struct vsir_program *program, uint64_t config_flags,
|
|
+ const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_message_context *message_context)
|
|
+{
|
|
+ struct vsir_transformation_context ctx;
|
|
+
|
|
+ vsir_transformation_context_init(&ctx, program, config_flags, compile_info, message_context);
|
|
+
|
|
+ do
|
|
+ vsir_transform(&ctx, vsir_program_dce);
|
|
+ while (ctx.progress);
|
|
+
|
|
+ if (TRACE_ON())
|
|
+ vsir_program_trace(program);
|
|
+
|
|
+ return ctx.result;
|
|
+}
|
|
+
|
|
/* Transformations which should happen at parse time, i.e. before scan
|
|
* information is returned to the user.
|
|
*
|
|
diff --git a/libs/vkd3d/libs/vkd3d-shader/spirv.c b/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
|
index 9c5f71ee11f..3deca660b00 100644
|
|
--- a/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
|
+++ b/libs/vkd3d/libs/vkd3d-shader/spirv.c
|
|
@@ -3063,7 +3063,7 @@ struct spirv_compiler
|
|
struct vkd3d_shader_output_info
|
|
{
|
|
uint32_t id;
|
|
- enum vkd3d_shader_component_type component_type;
|
|
+ enum vsir_data_type data_type;
|
|
uint32_t array_element_mask;
|
|
} *output_info;
|
|
uint32_t private_output_variable[MAX_REG_OUTPUT + 1]; /* 1 entry for oDepth */
|
|
@@ -3905,15 +3905,14 @@ static void spirv_compiler_emit_register_debug_name(struct vkd3d_spirv_builder *
|
|
}
|
|
|
|
static uint32_t spirv_compiler_emit_array_variable(struct spirv_compiler *compiler,
|
|
- struct vkd3d_spirv_stream *stream, SpvStorageClass storage_class,
|
|
- enum vkd3d_shader_component_type component_type, unsigned int component_count,
|
|
- const unsigned int *array_lengths, unsigned int length_count)
|
|
+ struct vkd3d_spirv_stream *stream, SpvStorageClass storage_class, enum vsir_data_type data_type,
|
|
+ unsigned int component_count, const unsigned int *array_lengths, unsigned int length_count)
|
|
{
|
|
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
|
uint32_t type_id, length_id, ptr_type_id;
|
|
unsigned int i;
|
|
|
|
- type_id = spirv_get_type_id_for_component_type(builder, component_type, component_count);
|
|
+ type_id = spirv_get_type_id(builder, data_type, component_count);
|
|
for (i = 0; i < length_count; ++i)
|
|
{
|
|
if (!array_lengths[i])
|
|
@@ -3921,17 +3920,16 @@ static uint32_t spirv_compiler_emit_array_variable(struct spirv_compiler *compil
|
|
length_id = spirv_compiler_get_constant_uint(compiler, array_lengths[i]);
|
|
type_id = vkd3d_spirv_get_op_type_array(builder, type_id, length_id);
|
|
}
|
|
-
|
|
ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, storage_class, type_id);
|
|
+
|
|
return vkd3d_spirv_build_op_variable(builder, stream, ptr_type_id, storage_class, 0);
|
|
}
|
|
|
|
-static uint32_t spirv_compiler_emit_variable(struct spirv_compiler *compiler,
|
|
- struct vkd3d_spirv_stream *stream, SpvStorageClass storage_class,
|
|
- enum vkd3d_shader_component_type component_type, unsigned int component_count)
|
|
+static uint32_t spirv_compiler_emit_variable(struct spirv_compiler *compiler, struct vkd3d_spirv_stream *stream,
|
|
+ SpvStorageClass storage_class, enum vsir_data_type data_type, unsigned int component_count)
|
|
{
|
|
- return spirv_compiler_emit_array_variable(compiler, stream, storage_class,
|
|
- component_type, component_count, NULL, 0);
|
|
+ return spirv_compiler_emit_array_variable(compiler, stream,
|
|
+ storage_class, data_type, component_count, NULL, 0);
|
|
}
|
|
|
|
static const struct vkd3d_spec_constant_info
|
|
@@ -4404,7 +4402,7 @@ static uint32_t spirv_compiler_get_register_id(struct spirv_compiler *compiler,
|
|
}
|
|
|
|
return spirv_compiler_emit_variable(compiler, &builder->global_stream,
|
|
- SpvStorageClassPrivate, VKD3D_SHADER_COMPONENT_FLOAT, VKD3D_VEC4_SIZE);
|
|
+ SpvStorageClassPrivate, VSIR_DATA_F32, VKD3D_VEC4_SIZE);
|
|
}
|
|
|
|
static bool vkd3d_swizzle_is_equal(uint32_t dst_write_mask, uint32_t swizzle, uint32_t write_mask)
|
|
@@ -4426,9 +4424,8 @@ static bool vkd3d_swizzle_is_scalar(uint32_t swizzle, const struct vkd3d_shader_
|
|
&& 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,
|
|
- uint32_t swizzle, uint32_t write_mask)
|
|
+static uint32_t spirv_compiler_emit_swizzle(struct spirv_compiler *compiler, uint32_t val_id,
|
|
+ uint32_t val_write_mask, enum vsir_data_type data_type, 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;
|
|
@@ -4441,7 +4438,7 @@ static uint32_t spirv_compiler_emit_swizzle(struct spirv_compiler *compiler,
|
|
&& (component_count == 1 || vkd3d_swizzle_is_equal(val_write_mask, swizzle, write_mask)))
|
|
return val_id;
|
|
|
|
- type_id = spirv_get_type_id_for_component_type(builder, component_type, component_count);
|
|
+ type_id = spirv_get_type_id(builder, data_type, component_count);
|
|
|
|
if (component_count == 1)
|
|
{
|
|
@@ -4469,13 +4466,14 @@ static uint32_t spirv_compiler_emit_swizzle(struct spirv_compiler *compiler,
|
|
if (write_mask & (VKD3DSP_WRITEMASK_0 << 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);
|
|
+
|
|
+ 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, uint32_t swizzle, uint32_t write_mask,
|
|
- enum vkd3d_shader_component_type component_type, unsigned int component_count)
|
|
+ enum vsir_data_type data_type, unsigned int component_count)
|
|
{
|
|
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
|
uint32_t components[VKD3D_VEC4_SIZE];
|
|
@@ -4491,10 +4489,10 @@ static uint32_t spirv_compiler_emit_vector_shuffle(struct spirv_compiler *compil
|
|
else
|
|
components[i] = VKD3D_VEC4_SIZE + vsir_swizzle_get_component(swizzle, i);
|
|
}
|
|
+ type_id = spirv_get_type_id(builder, data_type, component_count);
|
|
|
|
- type_id = spirv_get_type_id_for_component_type(builder, component_type, component_count);
|
|
- return vkd3d_spirv_build_op_vector_shuffle(builder,
|
|
- type_id, vector1_id, vector2_id, components, component_count);
|
|
+ return vkd3d_spirv_build_op_vector_shuffle(builder, type_id,
|
|
+ vector1_id, vector2_id, components, component_count);
|
|
}
|
|
|
|
static uint32_t spirv_compiler_emit_int_to_bool(struct spirv_compiler *compiler,
|
|
@@ -4812,8 +4810,8 @@ static uint32_t spirv_compiler_emit_load_reg(struct spirv_compiler *compiler,
|
|
swizzle = data_type_is_64_bit(reg->data_type) ? vsir_swizzle_32_from_64(swizzle) : swizzle;
|
|
}
|
|
|
|
- val_id = spirv_compiler_emit_swizzle(compiler, val_id, reg_info.write_mask,
|
|
- vkd3d_component_type_from_data_type(reg_info.data_type), swizzle, val_write_mask);
|
|
+ val_id = spirv_compiler_emit_swizzle(compiler, val_id,
|
|
+ reg_info.write_mask, reg_info.data_type, swizzle, val_write_mask);
|
|
if (reg->data_type == reg_info.data_type)
|
|
return val_id;
|
|
|
|
@@ -4920,7 +4918,7 @@ 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, uint32_t dst_write_mask, enum vkd3d_shader_component_type component_type,
|
|
+ uint32_t dst_id, uint32_t dst_write_mask, enum vsir_data_type data_type,
|
|
SpvStorageClass storage_class, uint32_t write_mask, uint32_t val_id)
|
|
{
|
|
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
|
@@ -4929,7 +4927,7 @@ static void spirv_compiler_emit_store_scalar(struct spirv_compiler *compiler,
|
|
|
|
if (vsir_write_mask_component_count(dst_write_mask) > 1)
|
|
{
|
|
- type_id = spirv_get_type_id_for_component_type(builder, component_type, 1);
|
|
+ type_id = spirv_get_type_id(builder, data_type, 1);
|
|
ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, storage_class, type_id);
|
|
component_idx = vsir_write_mask_get_component_idx(write_mask);
|
|
component_idx -= vsir_write_mask_get_component_idx(dst_write_mask);
|
|
@@ -4940,9 +4938,8 @@ static void spirv_compiler_emit_store_scalar(struct spirv_compiler *compiler,
|
|
vkd3d_spirv_build_op_store(builder, dst_id, val_id, SpvMemoryAccessMaskNone);
|
|
}
|
|
|
|
-static void spirv_compiler_emit_store(struct spirv_compiler *compiler,
|
|
- 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)
|
|
+static void spirv_compiler_emit_store(struct spirv_compiler *compiler, uint32_t dst_id, uint32_t dst_write_mask,
|
|
+ enum vsir_data_type data_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;
|
|
@@ -4957,7 +4954,7 @@ static void spirv_compiler_emit_store(struct spirv_compiler *compiler,
|
|
|
|
if (dst_component_count == 1 && component_count != 1)
|
|
{
|
|
- type_id = spirv_get_type_id_for_component_type(builder, component_type, 1);
|
|
+ type_id = spirv_get_type_id(builder, data_type, 1);
|
|
val_id = vkd3d_spirv_build_op_composite_extract1(builder, type_id, val_id,
|
|
vsir_write_mask_get_component_idx(dst_write_mask));
|
|
write_mask &= dst_write_mask;
|
|
@@ -4965,14 +4962,12 @@ static void spirv_compiler_emit_store(struct spirv_compiler *compiler,
|
|
}
|
|
|
|
if (component_count == 1)
|
|
- {
|
|
- return spirv_compiler_emit_store_scalar(compiler,
|
|
- dst_id, dst_write_mask, component_type, storage_class, write_mask, val_id);
|
|
- }
|
|
+ return spirv_compiler_emit_store_scalar(compiler, dst_id,
|
|
+ dst_write_mask, data_type, storage_class, write_mask, val_id);
|
|
|
|
if (dst_component_count != component_count)
|
|
{
|
|
- type_id = spirv_get_type_id_for_component_type(builder, component_type, dst_component_count);
|
|
+ type_id = spirv_get_type_id(builder, data_type, dst_component_count);
|
|
dst_val_id = vkd3d_spirv_build_op_load(builder, type_id, dst_id, SpvMemoryAccessMaskNone);
|
|
|
|
VKD3D_ASSERT(component_count <= ARRAY_SIZE(components));
|
|
@@ -5031,7 +5026,7 @@ static void spirv_compiler_emit_store_reg(struct spirv_compiler *compiler,
|
|
}
|
|
|
|
spirv_compiler_emit_store(compiler, reg_info.id, reg_info.write_mask,
|
|
- vkd3d_component_type_from_data_type(data_type), reg_info.storage_class, src_write_mask, val_id);
|
|
+ data_type, reg_info.storage_class, src_write_mask, val_id);
|
|
}
|
|
|
|
static uint32_t spirv_compiler_emit_sat(struct spirv_compiler *compiler,
|
|
@@ -5089,13 +5084,14 @@ static void spirv_compiler_emit_store_dst_swizzled(struct spirv_compiler *compil
|
|
const struct vkd3d_shader_dst_param *dst, uint32_t val_id,
|
|
enum vkd3d_shader_component_type component_type, uint32_t swizzle)
|
|
{
|
|
+ enum vsir_data_type data_type = vsir_data_type_from_component_type(component_type);
|
|
struct vkd3d_shader_dst_param typed_dst = *dst;
|
|
- val_id = spirv_compiler_emit_swizzle(compiler,
|
|
- val_id, VKD3DSP_WRITEMASK_ALL, component_type, swizzle, dst->write_mask);
|
|
+
|
|
+ val_id = spirv_compiler_emit_swizzle(compiler, val_id,
|
|
+ VKD3DSP_WRITEMASK_ALL, data_type, swizzle, dst->write_mask);
|
|
/* XXX: The register data type could be fixed by the shader parser. For SM5
|
|
- * shaders the data types are stored in instructions modifiers.
|
|
- */
|
|
- typed_dst.reg.data_type = vsir_data_type_from_component_type(component_type);
|
|
+ * shaders the data types are stored in instructions modifiers. */
|
|
+ typed_dst.reg.data_type = data_type;
|
|
spirv_compiler_emit_store_dst(compiler, &typed_dst, val_id);
|
|
}
|
|
|
|
@@ -5282,8 +5278,8 @@ static uint32_t spirv_compiler_emit_draw_parameter_fixup(struct spirv_compiler *
|
|
|
|
vkd3d_spirv_enable_capability(builder, SpvCapabilityDrawParameters);
|
|
|
|
- base_var_id = spirv_compiler_emit_variable(compiler, &builder->global_stream,
|
|
- SpvStorageClassInput, VKD3D_SHADER_COMPONENT_INT, 1);
|
|
+ base_var_id = spirv_compiler_emit_variable(compiler,
|
|
+ &builder->global_stream, SpvStorageClassInput, VSIR_DATA_I32, 1);
|
|
vkd3d_spirv_add_iface_variable(builder, base_var_id);
|
|
spirv_compiler_decorate_builtin(compiler, base_var_id, base);
|
|
|
|
@@ -5646,7 +5642,7 @@ static uint32_t spirv_compiler_emit_builtin_variable_v(struct spirv_compiler *co
|
|
sizes[0] = max(sizes[0], builtin->spirv_array_size);
|
|
|
|
id = spirv_compiler_emit_array_variable(compiler, &builder->global_stream, storage_class,
|
|
- vkd3d_component_type_from_data_type(builtin->data_type), builtin->component_count, array_sizes, size_count);
|
|
+ builtin->data_type, builtin->component_count, array_sizes, size_count);
|
|
vkd3d_spirv_add_iface_variable(builder, id);
|
|
spirv_compiler_decorate_builtin(compiler, id, builtin->spirv_builtin);
|
|
|
|
@@ -5834,7 +5830,7 @@ static void spirv_compiler_emit_input(struct spirv_compiler *compiler,
|
|
unsigned int location = signature_element->target_location;
|
|
|
|
input_id = spirv_compiler_emit_array_variable(compiler, &builder->global_stream,
|
|
- storage_class, component_type, input_component_count, array_sizes, 2);
|
|
+ storage_class, data_type, input_component_count, array_sizes, 2);
|
|
vkd3d_spirv_add_iface_variable(builder, input_id);
|
|
if (reg_type == VKD3DSPR_PATCHCONST)
|
|
{
|
|
@@ -5854,7 +5850,7 @@ static void spirv_compiler_emit_input(struct spirv_compiler *compiler,
|
|
{
|
|
storage_class = SpvStorageClassPrivate;
|
|
var_id = spirv_compiler_emit_array_variable(compiler, &builder->global_stream,
|
|
- storage_class, VKD3D_SHADER_COMPONENT_FLOAT, VKD3D_VEC4_SIZE, array_sizes, 2);
|
|
+ storage_class, VSIR_DATA_F32, VKD3D_VEC4_SIZE, array_sizes, 2);
|
|
}
|
|
|
|
vkd3d_symbol_set_register_info(®_symbol, var_id, storage_class,
|
|
@@ -5887,8 +5883,8 @@ static void spirv_compiler_emit_input(struct spirv_compiler *compiler,
|
|
}
|
|
|
|
val_id = spirv_compiler_emit_swizzle(compiler, val_id,
|
|
- vkd3d_write_mask_from_component_count(input_component_count),
|
|
- VKD3D_SHADER_COMPONENT_FLOAT, VKD3D_SHADER_NO_SWIZZLE, signature_element->mask >> component_idx);
|
|
+ vkd3d_write_mask_from_component_count(input_component_count), VSIR_DATA_F32,
|
|
+ VKD3D_SHADER_NO_SWIZZLE, signature_element->mask >> component_idx);
|
|
|
|
spirv_compiler_emit_store_reg(compiler, &dst_reg, signature_element->mask >> component_idx, val_id);
|
|
}
|
|
@@ -5979,13 +5975,13 @@ static void spirv_compiler_emit_shader_signature_outputs(struct spirv_compiler *
|
|
{
|
|
case VKD3D_SHADER_SV_CLIP_DISTANCE:
|
|
compiler->output_info[i].id = clip_distance_id;
|
|
- compiler->output_info[i].component_type = VKD3D_SHADER_COMPONENT_FLOAT;
|
|
+ compiler->output_info[i].data_type = VSIR_DATA_F32;
|
|
compiler->output_info[i].array_element_mask = clip_distance_mask;
|
|
break;
|
|
|
|
case VKD3D_SHADER_SV_CULL_DISTANCE:
|
|
compiler->output_info[i].id = cull_distance_id;
|
|
- compiler->output_info[i].component_type = VKD3D_SHADER_COMPONENT_FLOAT;
|
|
+ compiler->output_info[i].data_type = VSIR_DATA_F32;
|
|
compiler->output_info[i].array_element_mask = cull_distance_mask;
|
|
break;
|
|
|
|
@@ -6026,7 +6022,6 @@ static void spirv_compiler_emit_output(struct spirv_compiler *compiler,
|
|
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
|
unsigned int component_idx, output_component_count;
|
|
const struct signature_element *signature_element;
|
|
- enum vkd3d_shader_component_type component_type;
|
|
const struct shader_signature *shader_signature;
|
|
const struct vkd3d_spirv_builtin *builtin;
|
|
enum vkd3d_shader_sysval_semantic sysval;
|
|
@@ -6063,14 +6058,12 @@ static void spirv_compiler_emit_output(struct spirv_compiler *compiler,
|
|
if (builtin)
|
|
{
|
|
data_type = builtin->data_type;
|
|
- component_type = vkd3d_component_type_from_data_type(data_type);
|
|
if (!builtin->spirv_array_size)
|
|
output_component_count = builtin->component_count;
|
|
}
|
|
else
|
|
{
|
|
- component_type = signature_element->component_type;
|
|
- data_type = vsir_data_type_from_component_type(component_type);
|
|
+ data_type = vsir_data_type_from_component_type(signature_element->component_type);
|
|
}
|
|
|
|
storage_class = SpvStorageClassOutput;
|
|
@@ -6111,7 +6104,7 @@ static void spirv_compiler_emit_output(struct spirv_compiler *compiler,
|
|
{
|
|
storage_class = SpvStorageClassPrivate;
|
|
id = spirv_compiler_emit_array_variable(compiler, &builder->global_stream,
|
|
- storage_class, component_type, output_component_count, array_sizes, 2);
|
|
+ storage_class, data_type, output_component_count, array_sizes, 2);
|
|
}
|
|
else
|
|
{
|
|
@@ -6124,7 +6117,7 @@ static void spirv_compiler_emit_output(struct spirv_compiler *compiler,
|
|
location = signature_element->semantic_index;
|
|
|
|
id = spirv_compiler_emit_array_variable(compiler, &builder->global_stream,
|
|
- storage_class, component_type, output_component_count, array_sizes, 2);
|
|
+ storage_class, data_type, output_component_count, array_sizes, 2);
|
|
vkd3d_spirv_add_iface_variable(builder, id);
|
|
|
|
if (is_dual_source_blending(compiler) && location < 2)
|
|
@@ -6149,7 +6142,7 @@ static void spirv_compiler_emit_output(struct spirv_compiler *compiler,
|
|
if (!is_patch_constant)
|
|
{
|
|
compiler->output_info[element_idx].id = id;
|
|
- compiler->output_info[element_idx].component_type = component_type;
|
|
+ compiler->output_info[element_idx].data_type = data_type;
|
|
}
|
|
|
|
var_id = id;
|
|
@@ -6157,7 +6150,7 @@ static void spirv_compiler_emit_output(struct spirv_compiler *compiler,
|
|
{
|
|
storage_class = SpvStorageClassPrivate;
|
|
var_id = spirv_compiler_emit_variable(compiler, &builder->global_stream,
|
|
- storage_class, VKD3D_SHADER_COMPONENT_FLOAT, VKD3D_VEC4_SIZE);
|
|
+ storage_class, VSIR_DATA_F32, VKD3D_VEC4_SIZE);
|
|
}
|
|
|
|
vkd3d_symbol_set_register_info(®_symbol, var_id, storage_class,
|
|
@@ -6207,6 +6200,7 @@ static void spirv_compiler_emit_store_shader_output(struct spirv_compiler *compi
|
|
uint32_t type_id, zero_id, ptr_type_id, chain_id, object_id;
|
|
const struct signature_element *element;
|
|
unsigned int i, index, array_idx;
|
|
+ enum vsir_data_type data_type;
|
|
uint32_t output_id;
|
|
|
|
dst_write_mask = output->mask;
|
|
@@ -6232,9 +6226,11 @@ static void spirv_compiler_emit_store_shader_output(struct spirv_compiler *compi
|
|
if (!write_mask)
|
|
return;
|
|
|
|
- if (output_info->component_type != VKD3D_SHADER_COMPONENT_FLOAT)
|
|
+ data_type = output_info->data_type;
|
|
+
|
|
+ if (data_type != VSIR_DATA_F32)
|
|
{
|
|
- type_id = spirv_get_type_id_for_component_type(builder, output_info->component_type, VKD3D_VEC4_SIZE);
|
|
+ type_id = spirv_get_type_id(builder, data_type, VKD3D_VEC4_SIZE);
|
|
val_id = vkd3d_spirv_build_op_bitcast(builder, type_id, val_id);
|
|
}
|
|
|
|
@@ -6244,35 +6240,32 @@ static void spirv_compiler_emit_store_shader_output(struct spirv_compiler *compi
|
|
{
|
|
/* Set values to 0 for not initialized shader output components. */
|
|
write_mask |= uninit_mask;
|
|
- zero_id = spirv_compiler_get_constant_vector(compiler,
|
|
- vsir_data_type_from_component_type(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,
|
|
- vsir_write_mask_component_count(write_mask));
|
|
+ zero_id = spirv_compiler_get_constant_vector(compiler, data_type, VKD3D_VEC4_SIZE, 0);
|
|
+ val_id = spirv_compiler_emit_vector_shuffle(compiler, zero_id, val_id, swizzle,
|
|
+ uninit_mask, data_type, vsir_write_mask_component_count(write_mask));
|
|
}
|
|
else
|
|
{
|
|
- val_id = spirv_compiler_emit_swizzle(compiler,
|
|
- val_id, VKD3DSP_WRITEMASK_ALL, output_info->component_type, swizzle, write_mask);
|
|
+ val_id = spirv_compiler_emit_swizzle(compiler, val_id,
|
|
+ VKD3DSP_WRITEMASK_ALL, data_type, swizzle, write_mask);
|
|
}
|
|
|
|
output_id = output_info->id;
|
|
if (output_index_id)
|
|
{
|
|
- type_id = spirv_get_type_id_for_component_type(builder,
|
|
- output_info->component_type, vsir_write_mask_component_count(dst_write_mask));
|
|
+ type_id = spirv_get_type_id(builder, data_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);
|
|
}
|
|
|
|
if (!output_info->array_element_mask)
|
|
{
|
|
- spirv_compiler_emit_store(compiler,
|
|
- output_id, dst_write_mask, output_info->component_type, SpvStorageClassOutput, write_mask, val_id);
|
|
+ spirv_compiler_emit_store(compiler, output_id, dst_write_mask,
|
|
+ data_type, SpvStorageClassOutput, write_mask, val_id);
|
|
return;
|
|
}
|
|
|
|
- type_id = spirv_get_type_id_for_component_type(builder, output_info->component_type, 1);
|
|
+ type_id = spirv_get_type_id(builder, data_type, 1);
|
|
ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, SpvStorageClassOutput, type_id);
|
|
mask = output_info->array_element_mask;
|
|
array_idx = spirv_compiler_get_output_array_index(compiler, output);
|
|
@@ -6285,9 +6278,9 @@ static void spirv_compiler_emit_store_shader_output(struct spirv_compiler *compi
|
|
chain_id = vkd3d_spirv_build_op_access_chain1(builder,
|
|
ptr_type_id, output_id, spirv_compiler_get_constant_uint(compiler, index));
|
|
object_id = spirv_compiler_emit_swizzle(compiler, val_id, write_mask,
|
|
- output_info->component_type, VKD3D_SHADER_NO_SWIZZLE, VKD3DSP_WRITEMASK_0 << i);
|
|
- spirv_compiler_emit_store(compiler, chain_id, VKD3DSP_WRITEMASK_0,
|
|
- output_info->component_type, SpvStorageClassOutput, VKD3DSP_WRITEMASK_0 << i, object_id);
|
|
+ data_type, VKD3D_SHADER_NO_SWIZZLE, VKD3DSP_WRITEMASK_0 << i);
|
|
+ spirv_compiler_emit_store(compiler, chain_id, VKD3DSP_WRITEMASK_0, data_type,
|
|
+ SpvStorageClassOutput, VKD3DSP_WRITEMASK_0 << i, object_id);
|
|
++index;
|
|
}
|
|
}
|
|
@@ -6494,7 +6487,7 @@ static void spirv_compiler_emit_temps(struct spirv_compiler *compiler, uint32_t
|
|
for (i = 0; i < compiler->temp_count; ++i)
|
|
{
|
|
id = spirv_compiler_emit_variable(compiler, &builder->global_stream,
|
|
- SpvStorageClassPrivate, VKD3D_SHADER_COMPONENT_FLOAT, VKD3D_VEC4_SIZE);
|
|
+ SpvStorageClassPrivate, VSIR_DATA_F32, VKD3D_VEC4_SIZE);
|
|
if (!i)
|
|
compiler->temp_id = id;
|
|
VKD3D_ASSERT(id == compiler->temp_id + i);
|
|
@@ -9938,18 +9931,18 @@ static void spirv_compiler_emit_bufinfo(struct spirv_compiler *compiler,
|
|
}
|
|
|
|
val_id = spirv_compiler_emit_swizzle(compiler, val_id, write_mask,
|
|
- VKD3D_SHADER_COMPONENT_UINT, src->swizzle, dst->write_mask);
|
|
+ VSIR_DATA_U32, src->swizzle, dst->write_mask);
|
|
spirv_compiler_emit_store_dst(compiler, dst, val_id);
|
|
}
|
|
|
|
static void spirv_compiler_emit_resinfo(struct spirv_compiler *compiler,
|
|
const struct vkd3d_shader_instruction *instruction)
|
|
{
|
|
- enum vkd3d_shader_component_type component_type = VKD3D_SHADER_COMPONENT_UINT;
|
|
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;
|
|
uint32_t type_id, lod_id, val_id, miplevel_count_id;
|
|
+ enum vsir_data_type data_type = VSIR_DATA_U32;
|
|
uint32_t constituents[VKD3D_VEC4_SIZE];
|
|
unsigned int i, size_component_count;
|
|
struct vkd3d_shader_image image;
|
|
@@ -9991,14 +9984,14 @@ static void spirv_compiler_emit_resinfo(struct spirv_compiler *compiler,
|
|
|
|
if (!(instruction->flags & VKD3DSI_RESINFO_UINT))
|
|
{
|
|
- component_type = VKD3D_SHADER_COMPONENT_FLOAT;
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_F32, VKD3D_VEC4_SIZE);
|
|
+ data_type = VSIR_DATA_F32;
|
|
+ type_id = spirv_get_type_id(builder, data_type, VKD3D_VEC4_SIZE);
|
|
val_id = vkd3d_spirv_build_op_convert_utof(builder, type_id, val_id);
|
|
if (instruction->flags & VKD3DSI_PRECISE_XYZW)
|
|
vkd3d_spirv_build_op_decorate(builder, val_id, SpvDecorationNoContraction, NULL, 0);
|
|
}
|
|
- val_id = spirv_compiler_emit_swizzle(compiler, val_id, VKD3DSP_WRITEMASK_ALL,
|
|
- component_type, src[1].swizzle, dst->write_mask);
|
|
+ val_id = spirv_compiler_emit_swizzle(compiler, val_id,
|
|
+ VKD3DSP_WRITEMASK_ALL, data_type, src[1].swizzle, dst->write_mask);
|
|
|
|
spirv_compiler_emit_store_dst(compiler, dst, val_id);
|
|
}
|
|
@@ -10030,10 +10023,10 @@ static uint32_t spirv_compiler_emit_query_sample_count(struct spirv_compiler *co
|
|
static void spirv_compiler_emit_sample_info(struct spirv_compiler *compiler,
|
|
const struct vkd3d_shader_instruction *instruction)
|
|
{
|
|
- enum vkd3d_shader_component_type component_type = VKD3D_SHADER_COMPONENT_UINT;
|
|
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;
|
|
+ enum vsir_data_type data_type = VSIR_DATA_U32;
|
|
uint32_t constituents[VKD3D_VEC4_SIZE];
|
|
uint32_t type_id, val_id;
|
|
unsigned int i;
|
|
@@ -10054,14 +10047,14 @@ static void spirv_compiler_emit_sample_info(struct spirv_compiler *compiler,
|
|
|
|
if (!(instruction->flags & VKD3DSI_SAMPLE_INFO_UINT))
|
|
{
|
|
- component_type = VKD3D_SHADER_COMPONENT_FLOAT;
|
|
- type_id = spirv_get_type_id(builder, VSIR_DATA_F32, VKD3D_VEC4_SIZE);
|
|
+ data_type = VSIR_DATA_F32;
|
|
+ type_id = spirv_get_type_id(builder, data_type, VKD3D_VEC4_SIZE);
|
|
val_id = vkd3d_spirv_build_op_convert_utof(builder, type_id, val_id);
|
|
if (instruction->flags & VKD3DSI_PRECISE_XYZW)
|
|
vkd3d_spirv_build_op_decorate(builder, val_id, SpvDecorationNoContraction, NULL, 0);
|
|
}
|
|
- val_id = spirv_compiler_emit_swizzle(compiler, val_id, VKD3DSP_WRITEMASK_ALL,
|
|
- component_type, src->swizzle, dst->write_mask);
|
|
+ val_id = spirv_compiler_emit_swizzle(compiler, val_id,
|
|
+ VKD3DSP_WRITEMASK_ALL, data_type, src->swizzle, dst->write_mask);
|
|
|
|
spirv_compiler_emit_store_dst(compiler, dst, val_id);
|
|
}
|
|
@@ -10158,7 +10151,7 @@ static void spirv_compiler_emit_sample_position(struct spirv_compiler *compiler,
|
|
id = vkd3d_spirv_build_op_load(builder, type_id, id, SpvMemoryAccessMaskNone);
|
|
|
|
id = spirv_compiler_emit_swizzle(compiler, id, VKD3DSP_WRITEMASK_0 | VKD3DSP_WRITEMASK_1,
|
|
- VKD3D_SHADER_COMPONENT_FLOAT, instruction->src[0].swizzle, dst->write_mask);
|
|
+ VSIR_DATA_F32, instruction->src[0].swizzle, dst->write_mask);
|
|
spirv_compiler_emit_store_dst(compiler, dst, id);
|
|
}
|
|
|
|
@@ -10205,7 +10198,7 @@ static void spirv_compiler_emit_eval_attrib(struct spirv_compiler *compiler,
|
|
val_id = vkd3d_spirv_build_op_ext_inst(builder, type_id, instr_set_id, op, src_ids, src_count);
|
|
|
|
val_id = spirv_compiler_emit_swizzle(compiler, val_id, register_info.write_mask,
|
|
- VKD3D_SHADER_COMPONENT_FLOAT, src[0].swizzle, dst->write_mask);
|
|
+ VSIR_DATA_F32, src[0].swizzle, dst->write_mask);
|
|
|
|
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 c6d239847c8..4798a75ce90 100644
|
|
--- a/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
|
+++ b/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
|
@@ -3874,8 +3874,11 @@ static void tpf_dcl_texture(const struct tpf_compiler *tpf, const struct vkd3d_s
|
|
|
|
if (ins->opcode == VSIR_OP_DCL || ins->opcode == VSIR_OP_DCL_UAV_TYPED)
|
|
{
|
|
+ enum vkd3d_sm4_resource_type resource_type = sm4_resource_dimension(ins->declaration.semantic.resource_type);
|
|
+
|
|
instr.idx[0] = pack_resource_data_type(ins->declaration.semantic.resource_data_type);
|
|
instr.idx_count = 1;
|
|
+ instr.extra_bits |= resource_type << VKD3D_SM4_RESOURCE_TYPE_SHIFT;
|
|
instr.extra_bits |= ins->declaration.semantic.sample_count << VKD3D_SM4_RESOURCE_SAMPLE_COUNT_SHIFT;
|
|
resource = &ins->declaration.semantic.resource;
|
|
}
|
|
@@ -3910,8 +3913,6 @@ static void tpf_dcl_texture(const struct tpf_compiler *tpf, const struct vkd3d_s
|
|
if (uav)
|
|
instr.extra_bits |= ins->flags << VKD3D_SM5_UAV_FLAGS_SHIFT;
|
|
|
|
- instr.extra_bits |= (sm4_resource_dimension(ins->resource_type) << VKD3D_SM4_RESOURCE_TYPE_SHIFT);
|
|
-
|
|
write_sm4_instruction(tpf, &instr);
|
|
}
|
|
|
|
@@ -4169,6 +4170,9 @@ static void tpf_handle_instruction(struct tpf_compiler *tpf, const struct vkd3d_
|
|
{
|
|
switch (ins->opcode)
|
|
{
|
|
+ case VSIR_OP_NOP:
|
|
+ break;
|
|
+
|
|
case VSIR_OP_DCL_CONSTANT_BUFFER:
|
|
tpf_dcl_constant_buffer(tpf, ins);
|
|
break;
|
|
@@ -4519,7 +4523,8 @@ static void tpf_write_section(struct tpf_compiler *tpf, uint32_t tag, const stru
|
|
add_section(tpf, tag, &buffer);
|
|
}
|
|
|
|
-int tpf_compile(struct vsir_program *program, uint64_t config_flags, const struct vkd3d_shader_code *rdef,
|
|
+int tpf_compile(struct vsir_program *program, uint64_t config_flags,
|
|
+ const struct vkd3d_shader_compile_info *compile_info, const struct vkd3d_shader_code *rdef,
|
|
struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context)
|
|
{
|
|
enum vkd3d_shader_type shader_type = program->shader_version.type;
|
|
@@ -4528,6 +4533,9 @@ int tpf_compile(struct vsir_program *program, uint64_t config_flags, const struc
|
|
size_t i;
|
|
int ret;
|
|
|
|
+ if ((ret = vsir_program_optimize(program, config_flags, compile_info, message_context)))
|
|
+ return ret;
|
|
+
|
|
if ((ret = vsir_allocate_temp_registers(program, message_context)))
|
|
return ret;
|
|
|
|
diff --git a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c
|
|
index 6087df80970..2b5badb8871 100644
|
|
--- a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c
|
|
+++ b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c
|
|
@@ -1874,7 +1874,7 @@ static int vsir_program_compile(struct vsir_program *program, const struct vkd3d
|
|
case VKD3D_SHADER_TARGET_DXBC_TPF:
|
|
if ((ret = vsir_program_scan(program, &scan_info, message_context, true)) < 0)
|
|
return ret;
|
|
- ret = tpf_compile(program, config_flags, reflection_data, out, message_context);
|
|
+ ret = tpf_compile(program, config_flags, compile_info, reflection_data, out, message_context);
|
|
break;
|
|
|
|
case VKD3D_SHADER_TARGET_GLSL:
|
|
diff --git a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
|
index 3637aa4fdb9..df0eb2ff789 100644
|
|
--- a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
|
+++ b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
|
@@ -1645,6 +1645,8 @@ bool vsir_program_init(struct vsir_program *program, const struct vkd3d_shader_c
|
|
enum vsir_normalisation_level normalisation_level);
|
|
enum vkd3d_result vsir_program_lower_d3dbc(struct vsir_program *program, uint64_t config_flags,
|
|
const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_message_context *message_context);
|
|
+enum vkd3d_result vsir_program_optimize(struct vsir_program *program, uint64_t config_flags,
|
|
+ const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_message_context *message_context);
|
|
enum vkd3d_result vsir_program_transform(struct vsir_program *program, uint64_t config_flags,
|
|
const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_message_context *message_context);
|
|
enum vkd3d_result vsir_program_transform_early(struct vsir_program *program, uint64_t config_flags,
|
|
@@ -1860,7 +1862,8 @@ int msl_compile(struct vsir_program *program, uint64_t config_flags,
|
|
const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_code *out,
|
|
struct vkd3d_shader_message_context *message_context);
|
|
|
|
-int tpf_compile(struct vsir_program *program, uint64_t config_flags, const struct vkd3d_shader_code *rdef,
|
|
+int tpf_compile(struct vsir_program *program, uint64_t config_flags,
|
|
+ const struct vkd3d_shader_compile_info *compile_info, const struct vkd3d_shader_code *rdef,
|
|
struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context);
|
|
|
|
enum vkd3d_md5_variant
|
|
--
|
|
2.51.0
|
|
|