mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-09-13 09:16:14 -07:00
vkd3d-shader/hlsl: Implement the "earlydepthstencil" attribute.
This commit is contained in:
parent
fe8a2f820b
commit
e61046fb23
Notes:
Henri Verbeet
2024-09-12 18:57:32 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1063
@ -603,6 +603,8 @@ struct hlsl_ir_function_decl
|
|||||||
unsigned int attr_count;
|
unsigned int attr_count;
|
||||||
const struct hlsl_attribute *const *attrs;
|
const struct hlsl_attribute *const *attrs;
|
||||||
|
|
||||||
|
bool early_depth_test;
|
||||||
|
|
||||||
/* Synthetic boolean variable marking whether a return statement has been
|
/* Synthetic boolean variable marking whether a return statement has been
|
||||||
* executed. Needed to deal with return statements in non-uniform control
|
* executed. Needed to deal with return statements in non-uniform control
|
||||||
* flow, since some backends can't handle them. */
|
* flow, since some backends can't handle them. */
|
||||||
|
@ -6027,7 +6027,7 @@ static void parse_patchconstantfunc_attribute(struct hlsl_ctx *ctx, const struct
|
|||||||
"Patch constant function \"%s\" is not defined.", name);
|
"Patch constant function \"%s\" is not defined.", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void parse_entry_function_attributes(struct hlsl_ctx *ctx, const struct hlsl_ir_function_decl *entry_func)
|
static void parse_entry_function_attributes(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_func)
|
||||||
{
|
{
|
||||||
const struct hlsl_profile_info *profile = ctx->profile;
|
const struct hlsl_profile_info *profile = ctx->profile;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@ -6049,6 +6049,8 @@ static void parse_entry_function_attributes(struct hlsl_ctx *ctx, const struct h
|
|||||||
parse_partitioning_attribute(ctx, attr);
|
parse_partitioning_attribute(ctx, attr);
|
||||||
else if (!strcmp(attr->name, "patchconstantfunc") && profile->type == VKD3D_SHADER_TYPE_HULL)
|
else if (!strcmp(attr->name, "patchconstantfunc") && profile->type == VKD3D_SHADER_TYPE_HULL)
|
||||||
parse_patchconstantfunc_attribute(ctx, attr);
|
parse_patchconstantfunc_attribute(ctx, attr);
|
||||||
|
else if (!strcmp(attr->name, "earlydepthstencil") && profile->type == VKD3D_SHADER_TYPE_PIXEL)
|
||||||
|
entry_func->early_depth_test = true;
|
||||||
else
|
else
|
||||||
hlsl_warning(ctx, &entry_func->attrs[i]->loc, VKD3D_SHADER_WARNING_HLSL_UNKNOWN_ATTRIBUTE,
|
hlsl_warning(ctx, &entry_func->attrs[i]->loc, VKD3D_SHADER_WARNING_HLSL_UNKNOWN_ATTRIBUTE,
|
||||||
"Ignoring unknown attribute \"%s\".", entry_func->attrs[i]->name);
|
"Ignoring unknown attribute \"%s\".", entry_func->attrs[i]->name);
|
||||||
|
@ -4630,6 +4630,17 @@ static void write_sm4_dcl_thread_group(const struct tpf_writer *tpf, const uint3
|
|||||||
write_sm4_instruction(tpf, &instr);
|
write_sm4_instruction(tpf, &instr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void write_sm4_dcl_global_flags(const struct tpf_writer *tpf, uint32_t flags)
|
||||||
|
{
|
||||||
|
struct sm4_instruction instr =
|
||||||
|
{
|
||||||
|
.opcode = VKD3D_SM4_OP_DCL_GLOBAL_FLAGS,
|
||||||
|
.extra_bits = flags << VKD3D_SM4_GLOBAL_FLAGS_SHIFT,
|
||||||
|
};
|
||||||
|
|
||||||
|
write_sm4_instruction(tpf, &instr);
|
||||||
|
}
|
||||||
|
|
||||||
static void write_sm4_ret(const struct tpf_writer *tpf)
|
static void write_sm4_ret(const struct tpf_writer *tpf)
|
||||||
{
|
{
|
||||||
struct sm4_instruction instr =
|
struct sm4_instruction instr =
|
||||||
@ -6119,6 +6130,9 @@ static void write_sm4_shdr(struct hlsl_ctx *ctx, const struct hlsl_ir_function_d
|
|||||||
write_sm4_dcl_textures(&tpf, resource, true);
|
write_sm4_dcl_textures(&tpf, resource, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (entry_func->early_depth_test && profile->major_version >= 5)
|
||||||
|
write_sm4_dcl_global_flags(&tpf, VKD3DSGF_FORCE_EARLY_DEPTH_STENCIL);
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY(var, &ctx->extern_vars, struct hlsl_ir_var, extern_entry)
|
LIST_FOR_EACH_ENTRY(var, &ctx->extern_vars, struct hlsl_ir_var, extern_entry)
|
||||||
{
|
{
|
||||||
if ((var->is_input_semantic && var->last_read) || (var->is_output_semantic && var->first_write))
|
if ((var->is_input_semantic && var->last_read) || (var->is_output_semantic && var->first_write))
|
||||||
|
@ -38,7 +38,7 @@ clear rtv 0 0.0 0.0 0.0 0.0
|
|||||||
clear dsv 0.0
|
clear dsv 0.0
|
||||||
todo(glsl) draw quad
|
todo(glsl) draw quad
|
||||||
probe (0, 0) rgba(0, 0, 0, 0)
|
probe (0, 0) rgba(0, 0, 0, 0)
|
||||||
todo(sm<6) probe uav 1 (0) r(0.0)
|
probe uav 1 (0) r(0.0)
|
||||||
|
|
||||||
clear rtv 0 0.0 0.0 0.0 0.0
|
clear rtv 0 0.0 0.0 0.0 0.0
|
||||||
clear dsv 0.3
|
clear dsv 0.3
|
||||||
@ -62,4 +62,4 @@ clear rtv 0 0.0 0.0 0.0 0.0
|
|||||||
clear dsv 1.0
|
clear dsv 1.0
|
||||||
todo(glsl) draw quad
|
todo(glsl) draw quad
|
||||||
probe (0, 0) rgba(0, 0, 0, 0)
|
probe (0, 0) rgba(0, 0, 0, 0)
|
||||||
todo(sm<6) probe uav 1 (0) r(0.0)
|
probe uav 1 (0) r(0.0)
|
||||||
|
@ -28,4 +28,4 @@ clear rtv 0 0.0 0.0 0.0 0.0
|
|||||||
clear dsv 0.5
|
clear dsv 0.5
|
||||||
todo(glsl) draw quad
|
todo(glsl) draw quad
|
||||||
probe (0, 0) rgba(0, 0, 0, 0)
|
probe (0, 0) rgba(0, 0, 0, 0)
|
||||||
todo(sm<6) probe uav 1 (0) r(0.0)
|
probe uav 1 (0) r(0.0)
|
||||||
|
Loading…
Reference in New Issue
Block a user