vkd3d-shader/ir: Add an is_pre_rasterization_shader() helper.

This commit is contained in:
Elizabeth Figura 2024-10-23 15:46:04 -05:00 committed by Henri Verbeet
parent 4290d85397
commit fb8660c196
Notes: Henri Verbeet 2024-11-05 20:06:43 +01:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1248

View File

@ -6219,6 +6219,14 @@ static enum vkd3d_result vsir_program_insert_clip_planes(struct vsir_program *pr
return VKD3D_OK; return VKD3D_OK;
} }
static bool is_pre_rasterization_shader(enum vkd3d_shader_type type)
{
return type == VKD3D_SHADER_TYPE_VERTEX
|| type == VKD3D_SHADER_TYPE_HULL
|| type == VKD3D_SHADER_TYPE_DOMAIN
|| type == VKD3D_SHADER_TYPE_GEOMETRY;
}
static enum vkd3d_result insert_point_size_before_ret(struct vsir_program *program, static enum vkd3d_result insert_point_size_before_ret(struct vsir_program *program,
const struct vkd3d_shader_instruction *ret, size_t *ret_pos) const struct vkd3d_shader_instruction *ret, size_t *ret_pos)
{ {
@ -6249,10 +6257,7 @@ static enum vkd3d_result vsir_program_insert_point_size(struct vsir_program *pro
if (program->has_point_size) if (program->has_point_size)
return VKD3D_OK; return VKD3D_OK;
if (program->shader_version.type != VKD3D_SHADER_TYPE_VERTEX if (!is_pre_rasterization_shader(program->shader_version.type))
&& program->shader_version.type != VKD3D_SHADER_TYPE_GEOMETRY
&& program->shader_version.type != VKD3D_SHADER_TYPE_HULL
&& program->shader_version.type != VKD3D_SHADER_TYPE_DOMAIN)
return VKD3D_OK; return VKD3D_OK;
for (unsigned int i = 0; i < program->parameter_count; ++i) for (unsigned int i = 0; i < program->parameter_count; ++i)
@ -6303,10 +6308,7 @@ static enum vkd3d_result vsir_program_insert_point_size_clamp(struct vsir_progra
if (!program->has_point_size) if (!program->has_point_size)
return VKD3D_OK; return VKD3D_OK;
if (program->shader_version.type != VKD3D_SHADER_TYPE_VERTEX if (!is_pre_rasterization_shader(program->shader_version.type))
&& program->shader_version.type != VKD3D_SHADER_TYPE_GEOMETRY
&& program->shader_version.type != VKD3D_SHADER_TYPE_HULL
&& program->shader_version.type != VKD3D_SHADER_TYPE_DOMAIN)
return VKD3D_OK; return VKD3D_OK;
for (unsigned int i = 0; i < program->parameter_count; ++i) for (unsigned int i = 0; i < program->parameter_count; ++i)