vkd3d-shader: Implement scanning hull shader tessellation information.

This commit is contained in:
Shaun Ren 2024-10-22 22:30:13 -04:00 committed by Henri Verbeet
parent 1f4d17a4a2
commit e20b63c55e
Notes: Henri Verbeet 2024-11-21 19:34:41 +01:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1217
2 changed files with 43 additions and 0 deletions

View File

@ -112,6 +112,11 @@ enum vkd3d_shader_structure_type
* \since 1.13
*/
VKD3D_SHADER_STRUCTURE_TYPE_PARAMETER_INFO,
/**
* The structure is a vkd3d_shader_scan_hull_shader_tessellation_info structure.
* \since 1.15
*/
VKD3D_SHADER_STRUCTURE_TYPE_SCAN_HULL_SHADER_TESSELLATION_INFO,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_STRUCTURE_TYPE),
};
@ -2040,6 +2045,26 @@ struct vkd3d_shader_scan_combined_resource_sampler_info
unsigned int combined_sampler_count;
};
/**
* A chained structure describing the tessellation information in a hull shader.
*
* This structure extends vkd3d_shader_compile_info.
*
* \since 1.15
*/
struct vkd3d_shader_scan_hull_shader_tessellation_info
{
/** Must be set to VKD3D_SHADER_STRUCTURE_TYPE_SCAN_HULL_SHADER_TESSELLATION_INFO. */
enum vkd3d_shader_structure_type type;
/** Optional pointer to a structure containing further parameters. */
const void *next;
/** The tessellation output primitive. */
enum vkd3d_shader_tessellator_output_primitive output_primitive;
/** The tessellation partitioning mode. */
enum vkd3d_shader_tessellator_partitioning partitioning;
};
/**
* Data type of a shader varying, returned as part of struct
* vkd3d_shader_signature_element.

View File

@ -807,6 +807,9 @@ struct vkd3d_shader_scan_context
struct vkd3d_shader_scan_combined_resource_sampler_info *combined_sampler_info;
size_t combined_samplers_size;
enum vkd3d_shader_tessellator_output_primitive output_primitive;
enum vkd3d_shader_tessellator_partitioning partitioning;
};
static VKD3D_PRINTF_FUNC(3, 4) void vkd3d_shader_scan_error(struct vkd3d_shader_scan_context *context,
@ -1264,6 +1267,12 @@ static int vkd3d_shader_scan_instruction(struct vkd3d_shader_scan_context *conte
VKD3D_SHADER_RESOURCE_BUFFER, VKD3D_SHADER_RESOURCE_DATA_UINT, 0,
instruction->declaration.structured_resource.byte_stride, false, instruction->flags);
break;
case VKD3DSIH_DCL_TESSELLATOR_OUTPUT_PRIMITIVE:
context->output_primitive = instruction->declaration.tessellator_output_primitive;
break;
case VKD3DSIH_DCL_TESSELLATOR_PARTITIONING:
context->partitioning = instruction->declaration.tessellator_partitioning;
break;
case VKD3DSIH_IF:
case VKD3DSIH_IFC:
cf_info = vkd3d_shader_scan_push_cf_info(context);
@ -1504,6 +1513,7 @@ static int vsir_program_scan(struct vsir_program *program, const struct vkd3d_sh
struct vkd3d_shader_scan_descriptor_info1 *descriptor_info1)
{
struct vkd3d_shader_scan_combined_resource_sampler_info *combined_sampler_info;
struct vkd3d_shader_scan_hull_shader_tessellation_info *tessellation_info;
struct vkd3d_shader_scan_descriptor_info1 local_descriptor_info1 = {0};
struct vkd3d_shader_scan_descriptor_info *descriptor_info;
struct vkd3d_shader_scan_signature_info *signature_info;
@ -1532,6 +1542,8 @@ static int vsir_program_scan(struct vsir_program *program, const struct vkd3d_sh
descriptor_info1 = &local_descriptor_info1;
}
tessellation_info = vkd3d_find_struct(compile_info->next, SCAN_HULL_SHADER_TESSELLATION_INFO);
vkd3d_shader_scan_context_init(&context, &program->shader_version, compile_info,
descriptor_info1, combined_sampler_info, message_context);
@ -1575,6 +1587,12 @@ static int vsir_program_scan(struct vsir_program *program, const struct vkd3d_sh
if (!ret && descriptor_info)
ret = convert_descriptor_info(descriptor_info, descriptor_info1);
if (!ret && tessellation_info)
{
tessellation_info->output_primitive = context.output_primitive;
tessellation_info->partitioning = context.partitioning;
}
if (ret < 0)
{
if (combined_sampler_info)