vulkan: Pass values to push directly

Don't require a GskVulkanPushConstants there.
This commit is contained in:
Benjamin Otte 2023-05-11 21:36:44 +02:00
parent c479f93372
commit c37171f4d6
3 changed files with 19 additions and 14 deletions

View File

@ -80,21 +80,23 @@ gsk_vulkan_push_constants_intersect_rounded (GskVulkanPushConstants *self,
}
static void
gsk_vulkan_push_constants_wire_init (GskVulkanPushConstantsWire *wire,
const GskVulkanPushConstants *self)
gsk_vulkan_push_constants_wire_init (GskVulkanPushConstantsWire *wire,
const graphene_matrix_t *mvp,
const GskRoundedRect *clip)
{
graphene_matrix_to_float (&self->mvp, wire->common.mvp);
gsk_rounded_rect_to_float (&self->clip.rect, graphene_point_zero (), wire->common.clip);
graphene_matrix_to_float (mvp, wire->common.mvp);
gsk_rounded_rect_to_float (clip, graphene_point_zero (), wire->common.clip);
}
void
gsk_vulkan_push_constants_push (const GskVulkanPushConstants *self,
VkCommandBuffer command_buffer,
VkPipelineLayout pipeline_layout)
gsk_vulkan_push_constants_push (VkCommandBuffer command_buffer,
VkPipelineLayout pipeline_layout,
const graphene_matrix_t *mvp,
const GskRoundedRect *clip)
{
GskVulkanPushConstantsWire wire;
gsk_vulkan_push_constants_wire_init (&wire, self);
gsk_vulkan_push_constants_wire_init (&wire, mvp, clip);
vkCmdPushConstants (command_buffer,
pipeline_layout,

View File

@ -35,9 +35,10 @@ gboolean gsk_vulkan_push_constants_intersect_rounded (GskVulk
const GskVulkanPushConstants *src,
const GskRoundedRect *rect);
void gsk_vulkan_push_constants_push (const GskVulkanPushConstants *self,
VkCommandBuffer command_buffer,
VkPipelineLayout pipeline_layout);
void gsk_vulkan_push_constants_push (VkCommandBuffer command_buffer,
VkPipelineLayout pipeline_layout,
const graphene_matrix_t *mvp,
const GskRoundedRect *clip);
G_END_DECLS

View File

@ -2253,9 +2253,11 @@ gsk_vulkan_render_pass_draw_rect (GskVulkanRenderPass *self,
case GSK_VULKAN_OP_PUSH_VERTEX_CONSTANTS:
for (int j = 0; j < layout_count; j++)
gsk_vulkan_push_constants_push (&op->constants.constants,
command_buffer,
pipeline_layout[j]);
gsk_vulkan_push_constants_push (command_buffer,
pipeline_layout[j],
&op->constants.constants.mvp,
&op->constants.constants.clip.rect);
break;
case GSK_VULKAN_OP_CROSS_FADE: