From c37171f4d64e76a03e587a9d39a0efc61f70b88d Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 11 May 2023 21:36:44 +0200 Subject: [PATCH] vulkan: Pass values to push directly Don't require a GskVulkanPushConstants there. --- gsk/vulkan/gskvulkanpushconstants.c | 18 ++++++++++-------- gsk/vulkan/gskvulkanpushconstantsprivate.h | 7 ++++--- gsk/vulkan/gskvulkanrenderpass.c | 8 +++++--- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/gsk/vulkan/gskvulkanpushconstants.c b/gsk/vulkan/gskvulkanpushconstants.c index 0bf5ca71b0..e288900137 100644 --- a/gsk/vulkan/gskvulkanpushconstants.c +++ b/gsk/vulkan/gskvulkanpushconstants.c @@ -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, diff --git a/gsk/vulkan/gskvulkanpushconstantsprivate.h b/gsk/vulkan/gskvulkanpushconstantsprivate.h index a52a6fe689..a514e4f50b 100644 --- a/gsk/vulkan/gskvulkanpushconstantsprivate.h +++ b/gsk/vulkan/gskvulkanpushconstantsprivate.h @@ -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 diff --git a/gsk/vulkan/gskvulkanrenderpass.c b/gsk/vulkan/gskvulkanrenderpass.c index 0969dd5cad..073009318b 100644 --- a/gsk/vulkan/gskvulkanrenderpass.c +++ b/gsk/vulkan/gskvulkanrenderpass.c @@ -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: