mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/ir: Keep track of hull shader phases.
This commit is contained in:
committed by
Alexandre Julliard
parent
5768c019c1
commit
0f4bda9c9d
Notes:
Alexandre Julliard
2023-11-10 00:10:44 +01:00
Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/462
@@ -1472,6 +1472,7 @@ struct validation_context
|
|||||||
struct vkd3d_shader_parser *parser;
|
struct vkd3d_shader_parser *parser;
|
||||||
size_t instruction_idx;
|
size_t instruction_idx;
|
||||||
bool dcl_temps_found;
|
bool dcl_temps_found;
|
||||||
|
enum vkd3d_shader_opcode phase;
|
||||||
|
|
||||||
enum vkd3d_shader_opcode *blocks;
|
enum vkd3d_shader_opcode *blocks;
|
||||||
size_t depth;
|
size_t depth;
|
||||||
@@ -1620,6 +1621,32 @@ static void vsir_validate_instruction(struct validation_context *ctx)
|
|||||||
instruction->handler_idx);
|
instruction->handler_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (instruction->handler_idx)
|
||||||
|
{
|
||||||
|
case VKD3DSIH_HS_DECLS:
|
||||||
|
case VKD3DSIH_HS_CONTROL_POINT_PHASE:
|
||||||
|
case VKD3DSIH_HS_FORK_PHASE:
|
||||||
|
case VKD3DSIH_HS_JOIN_PHASE:
|
||||||
|
vsir_validate_dst_count(ctx, instruction, 0);
|
||||||
|
vsir_validate_src_count(ctx, instruction, 0);
|
||||||
|
if (ctx->parser->shader_version.type != VKD3D_SHADER_TYPE_HULL)
|
||||||
|
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_HANDLER, "Phase instruction %#x is only valid in a hull shader.",
|
||||||
|
instruction->handler_idx);
|
||||||
|
if (ctx->depth != 0)
|
||||||
|
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INSTRUCTION_NESTING, "Phase instruction %#x must appear to top level.",
|
||||||
|
instruction->handler_idx);
|
||||||
|
ctx->phase = instruction->handler_idx;
|
||||||
|
return;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctx->parser->shader_version.type == VKD3D_SHADER_TYPE_HULL &&
|
||||||
|
ctx->phase == VKD3DSIH_INVALID)
|
||||||
|
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_HANDLER, "Instruction %#x appear before any phase instruction in a hull shader.",
|
||||||
|
instruction->handler_idx);
|
||||||
|
|
||||||
switch (instruction->handler_idx)
|
switch (instruction->handler_idx)
|
||||||
{
|
{
|
||||||
case VKD3DSIH_DCL_TEMPS:
|
case VKD3DSIH_DCL_TEMPS:
|
||||||
@@ -1720,7 +1747,11 @@ static void vsir_validate_instruction(struct validation_context *ctx)
|
|||||||
|
|
||||||
void vsir_validate(struct vkd3d_shader_parser *parser)
|
void vsir_validate(struct vkd3d_shader_parser *parser)
|
||||||
{
|
{
|
||||||
struct validation_context ctx = { .parser = parser };
|
struct validation_context ctx =
|
||||||
|
{
|
||||||
|
.parser = parser,
|
||||||
|
.phase = VKD3DSIH_INVALID,
|
||||||
|
};
|
||||||
|
|
||||||
if (!(parser->config_flags & VKD3D_SHADER_CONFIG_FLAG_FORCE_VALIDATION))
|
if (!(parser->config_flags & VKD3D_SHADER_CONFIG_FLAG_FORCE_VALIDATION))
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user