mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/ir: Keep track of the tessellator domain in struct vsir_program.
This commit is contained in:
parent
49ec9add38
commit
1ed8d907b3
Notes:
Henri Verbeet
2024-11-21 19:36:02 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1266
@ -9717,6 +9717,7 @@ static void sm6_parser_emit_dcl_tessellator_domain(struct sm6_parser *sm6,
|
|||||||
|
|
||||||
ins = sm6_parser_add_instruction(sm6, VKD3DSIH_DCL_TESSELLATOR_DOMAIN);
|
ins = sm6_parser_add_instruction(sm6, VKD3DSIH_DCL_TESSELLATOR_DOMAIN);
|
||||||
ins->declaration.tessellator_domain = tessellator_domain;
|
ins->declaration.tessellator_domain = tessellator_domain;
|
||||||
|
sm6->p.program->tess_domain = tessellator_domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sm6_parser_validate_control_point_count(struct sm6_parser *sm6,
|
static void sm6_parser_validate_control_point_count(struct sm6_parser *sm6,
|
||||||
|
@ -743,6 +743,7 @@ static enum vkd3d_result vsir_program_lower_instructions(struct vsir_program *pr
|
|||||||
case VKD3DSIH_DCL_GLOBAL_FLAGS:
|
case VKD3DSIH_DCL_GLOBAL_FLAGS:
|
||||||
case VKD3DSIH_DCL_SAMPLER:
|
case VKD3DSIH_DCL_SAMPLER:
|
||||||
case VKD3DSIH_DCL_TEMPS:
|
case VKD3DSIH_DCL_TEMPS:
|
||||||
|
case VKD3DSIH_DCL_TESSELLATOR_DOMAIN:
|
||||||
case VKD3DSIH_DCL_THREAD_GROUP:
|
case VKD3DSIH_DCL_THREAD_GROUP:
|
||||||
case VKD3DSIH_DCL_UAV_TYPED:
|
case VKD3DSIH_DCL_UAV_TYPED:
|
||||||
vkd3d_shader_instruction_make_nop(ins);
|
vkd3d_shader_instruction_make_nop(ins);
|
||||||
@ -7846,6 +7847,11 @@ static void vsir_validate_dcl_tessellator_domain(struct validation_context *ctx,
|
|||||||
|| instruction->declaration.tessellator_domain >= VKD3D_TESSELLATOR_DOMAIN_COUNT)
|
|| instruction->declaration.tessellator_domain >= VKD3D_TESSELLATOR_DOMAIN_COUNT)
|
||||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_TESSELLATION,
|
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_TESSELLATION,
|
||||||
"Tessellator domain %#x is invalid.", instruction->declaration.tessellator_domain);
|
"Tessellator domain %#x is invalid.", instruction->declaration.tessellator_domain);
|
||||||
|
|
||||||
|
if (instruction->declaration.tessellator_domain != ctx->program->tess_domain)
|
||||||
|
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_TESSELLATION,
|
||||||
|
"DCL_TESSELLATOR_DOMAIN argument %#x doesn't match the shader tessellator domain %#x.",
|
||||||
|
instruction->declaration.tessellator_domain, ctx->program->tess_domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vsir_validate_dcl_tessellator_output_primitive(struct validation_context *ctx,
|
static void vsir_validate_dcl_tessellator_output_primitive(struct validation_context *ctx,
|
||||||
@ -8238,12 +8244,20 @@ enum vkd3d_result vsir_program_validate(struct vsir_program *program, uint64_t c
|
|||||||
{
|
{
|
||||||
case VKD3D_SHADER_TYPE_HULL:
|
case VKD3D_SHADER_TYPE_HULL:
|
||||||
case VKD3D_SHADER_TYPE_DOMAIN:
|
case VKD3D_SHADER_TYPE_DOMAIN:
|
||||||
|
if (program->tess_domain == VKD3D_TESSELLATOR_DOMAIN_INVALID
|
||||||
|
|| program->tess_domain >= VKD3D_TESSELLATOR_DOMAIN_COUNT)
|
||||||
|
validator_error(&ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_TESSELLATION,
|
||||||
|
"Invalid tessellation domain %#x.", program->tess_domain);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (program->patch_constant_signature.element_count != 0)
|
if (program->patch_constant_signature.element_count != 0)
|
||||||
validator_error(&ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_SIGNATURE,
|
validator_error(&ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_SIGNATURE,
|
||||||
"Patch constant signature is only valid for hull and domain shaders.");
|
"Patch constant signature is only valid for hull and domain shaders.");
|
||||||
|
|
||||||
|
if (program->tess_domain != VKD3D_TESSELLATOR_DOMAIN_INVALID)
|
||||||
|
validator_error(&ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_TESSELLATION,
|
||||||
|
"Invalid tessellation domain %#x.", program->tess_domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (program->shader_version.type)
|
switch (program->shader_version.type)
|
||||||
|
@ -6822,15 +6822,11 @@ static void spirv_compiler_emit_dcl_gs_instances(struct spirv_compiler *compiler
|
|||||||
compiler->spirv_builder.invocation_count = instruction->declaration.count;
|
compiler->spirv_builder.invocation_count = instruction->declaration.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void spirv_compiler_emit_dcl_tessellator_domain(struct spirv_compiler *compiler,
|
static void spirv_compiler_emit_tessellator_domain(struct spirv_compiler *compiler,
|
||||||
const struct vkd3d_shader_instruction *instruction)
|
enum vkd3d_tessellator_domain domain)
|
||||||
{
|
{
|
||||||
enum vkd3d_tessellator_domain domain = instruction->declaration.tessellator_domain;
|
|
||||||
SpvExecutionMode mode;
|
SpvExecutionMode mode;
|
||||||
|
|
||||||
if (compiler->shader_type == VKD3D_SHADER_TYPE_HULL && spirv_compiler_is_opengl_target(compiler))
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch (domain)
|
switch (domain)
|
||||||
{
|
{
|
||||||
case VKD3D_TESSELLATOR_DOMAIN_LINE:
|
case VKD3D_TESSELLATOR_DOMAIN_LINE:
|
||||||
@ -10239,9 +10235,6 @@ static int spirv_compiler_handle_instruction(struct spirv_compiler *compiler,
|
|||||||
case VKD3DSIH_DCL_OUTPUT_CONTROL_POINT_COUNT:
|
case VKD3DSIH_DCL_OUTPUT_CONTROL_POINT_COUNT:
|
||||||
spirv_compiler_emit_output_vertex_count(compiler, instruction);
|
spirv_compiler_emit_output_vertex_count(compiler, instruction);
|
||||||
break;
|
break;
|
||||||
case VKD3DSIH_DCL_TESSELLATOR_DOMAIN:
|
|
||||||
spirv_compiler_emit_dcl_tessellator_domain(compiler, instruction);
|
|
||||||
break;
|
|
||||||
case VKD3DSIH_DCL_TESSELLATOR_OUTPUT_PRIMITIVE:
|
case VKD3DSIH_DCL_TESSELLATOR_OUTPUT_PRIMITIVE:
|
||||||
spirv_compiler_emit_tessellator_output_primitive(compiler,
|
spirv_compiler_emit_tessellator_output_primitive(compiler,
|
||||||
instruction->declaration.tessellator_output_primitive);
|
instruction->declaration.tessellator_output_primitive);
|
||||||
@ -10743,6 +10736,9 @@ static int spirv_compiler_generate_spirv(struct spirv_compiler *compiler, struct
|
|||||||
compiler->input_control_point_count = program->input_control_point_count;
|
compiler->input_control_point_count = program->input_control_point_count;
|
||||||
compiler->output_control_point_count = program->output_control_point_count;
|
compiler->output_control_point_count = program->output_control_point_count;
|
||||||
|
|
||||||
|
if (program->shader_version.type == VKD3D_SHADER_TYPE_HULL && !spirv_compiler_is_opengl_target(compiler))
|
||||||
|
spirv_compiler_emit_tessellator_domain(compiler, program->tess_domain);
|
||||||
|
|
||||||
if (compiler->shader_type != VKD3D_SHADER_TYPE_HULL)
|
if (compiler->shader_type != VKD3D_SHADER_TYPE_HULL)
|
||||||
spirv_compiler_emit_shader_signature_outputs(compiler);
|
spirv_compiler_emit_shader_signature_outputs(compiler);
|
||||||
|
|
||||||
|
@ -1268,6 +1268,7 @@ static void shader_sm5_read_dcl_tessellator_domain(struct vkd3d_shader_instructi
|
|||||||
{
|
{
|
||||||
ins->declaration.tessellator_domain = (opcode_token & VKD3D_SM5_TESSELLATOR_MASK)
|
ins->declaration.tessellator_domain = (opcode_token & VKD3D_SM5_TESSELLATOR_MASK)
|
||||||
>> VKD3D_SM5_TESSELLATOR_SHIFT;
|
>> VKD3D_SM5_TESSELLATOR_SHIFT;
|
||||||
|
priv->p.program->tess_domain = ins->declaration.tessellator_domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shader_sm5_read_dcl_tessellator_partitioning(struct vkd3d_shader_instruction *ins, uint32_t opcode,
|
static void shader_sm5_read_dcl_tessellator_partitioning(struct vkd3d_shader_instruction *ins, uint32_t opcode,
|
||||||
|
@ -1431,6 +1431,7 @@ struct vsir_program
|
|||||||
uint8_t diffuse_written_mask;
|
uint8_t diffuse_written_mask;
|
||||||
enum vsir_control_flow_type cf_type;
|
enum vsir_control_flow_type cf_type;
|
||||||
enum vsir_normalisation_level normalisation_level;
|
enum vsir_normalisation_level normalisation_level;
|
||||||
|
enum vkd3d_tessellator_domain tess_domain;
|
||||||
|
|
||||||
const char **block_names;
|
const char **block_names;
|
||||||
size_t block_name_count;
|
size_t block_name_count;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user