From 7b4846bc25ed7003a1b6f7060d6bd3608fc8346c Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 14 Jun 2023 21:32:26 +0200 Subject: [PATCH] vulkan: Pass format to offscreen creation function That way, the offscreen can create images of different types. Its not used in this commit, but will come in handy when we want to support high bit depth. --- gsk/vulkan/gskvulkanimage.c | 3 ++- gsk/vulkan/gskvulkanimageprivate.h | 1 + gsk/vulkan/gskvulkanrenderer.c | 1 + gsk/vulkan/gskvulkanrenderpass.c | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gsk/vulkan/gskvulkanimage.c b/gsk/vulkan/gskvulkanimage.c index d289f7834f..a209f16a52 100644 --- a/gsk/vulkan/gskvulkanimage.c +++ b/gsk/vulkan/gskvulkanimage.c @@ -766,13 +766,14 @@ gsk_vulkan_image_new_for_atlas (GdkVulkanContext *context, GskVulkanImage * gsk_vulkan_image_new_for_offscreen (GdkVulkanContext *context, + GdkMemoryFormat preferred_format, gsize width, gsize height) { GskVulkanImage *self; self = gsk_vulkan_image_new (context, - GDK_MEMORY_DEFAULT, + preferred_format, width, height, VK_IMAGE_TILING_OPTIMAL, diff --git a/gsk/vulkan/gskvulkanimageprivate.h b/gsk/vulkan/gskvulkanimageprivate.h index cb87e93bdb..c7e66ccd3d 100644 --- a/gsk/vulkan/gskvulkanimageprivate.h +++ b/gsk/vulkan/gskvulkanimageprivate.h @@ -44,6 +44,7 @@ GskVulkanImage * gsk_vulkan_image_new_for_atlas (GdkVulk gsize width, gsize height); GskVulkanImage * gsk_vulkan_image_new_for_offscreen (GdkVulkanContext *context, + GdkMemoryFormat preferred_format, gsize width, gsize height); diff --git a/gsk/vulkan/gskvulkanrenderer.c b/gsk/vulkan/gskvulkanrenderer.c index a163e25350..c51fd81ac3 100644 --- a/gsk/vulkan/gskvulkanrenderer.c +++ b/gsk/vulkan/gskvulkanrenderer.c @@ -285,6 +285,7 @@ gsk_vulkan_renderer_render_texture (GskRenderer *renderer, ceil (viewport->size.width), ceil (viewport->size.height)); image = gsk_vulkan_image_new_for_offscreen (self->vulkan, + GDK_MEMORY_DEFAULT, rounded_viewport.size.width, rounded_viewport.size.height); diff --git a/gsk/vulkan/gskvulkanrenderpass.c b/gsk/vulkan/gskvulkanrenderpass.c index 0a641b6238..9b9054f88b 100644 --- a/gsk/vulkan/gskvulkanrenderpass.c +++ b/gsk/vulkan/gskvulkanrenderpass.c @@ -1249,6 +1249,7 @@ gsk_vulkan_render_pass_render_offscreen (GdkVulkanContext *vulkan, ceil (scale_y * viewport->size.height)); result = gsk_vulkan_image_new_for_offscreen (vulkan, + GDK_MEMORY_DEFAULT, view.size.width, view.size.height); #ifdef G_ENABLE_DEBUG