mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-12 13:30:19 +00:00
vulkan: Stop keeping the context around
These days, we can query it with gsk_vulkan_render_get_context(). Makes quite a few functions require one less argument. And it also makes the GskVulkanRenderPass empty. Gotta figure out what to do with it.
This commit is contained in:
parent
67a3929583
commit
492507af11
@ -496,7 +496,6 @@ gsk_vulkan_render_add_node (GskVulkanRender *self,
|
||||
graphene_vec2_init (&scale, self->scale, self->scale);
|
||||
|
||||
gsk_vulkan_render_pass_op (self,
|
||||
self->vulkan,
|
||||
g_object_ref (self->target),
|
||||
self->clip,
|
||||
&scale,
|
||||
|
@ -42,7 +42,7 @@ typedef struct _GskVulkanParseState GskVulkanParseState;
|
||||
|
||||
struct _GskVulkanRenderPass
|
||||
{
|
||||
GdkVulkanContext *vulkan;
|
||||
int empty;
|
||||
};
|
||||
|
||||
struct _GskVulkanParseState
|
||||
@ -56,12 +56,11 @@ struct _GskVulkanParseState
|
||||
};
|
||||
|
||||
GskVulkanRenderPass *
|
||||
gsk_vulkan_render_pass_new (GdkVulkanContext *context)
|
||||
gsk_vulkan_render_pass_new (void)
|
||||
{
|
||||
GskVulkanRenderPass *self;
|
||||
|
||||
self = g_new0 (GskVulkanRenderPass, 1);
|
||||
self->vulkan = g_object_ref (context);
|
||||
|
||||
return self;
|
||||
}
|
||||
@ -69,8 +68,6 @@ gsk_vulkan_render_pass_new (GdkVulkanContext *context)
|
||||
void
|
||||
gsk_vulkan_render_pass_free (GskVulkanRenderPass *self)
|
||||
{
|
||||
g_object_unref (self->vulkan);
|
||||
|
||||
g_free (self);
|
||||
}
|
||||
|
||||
@ -161,7 +158,7 @@ gsk_vulkan_render_pass_get_node_as_image (GskVulkanRenderPass *self,
|
||||
result = gsk_vulkan_renderer_get_texture_image (renderer, texture);
|
||||
if (result == NULL)
|
||||
{
|
||||
result = gsk_vulkan_upload_texture_op (render, self->vulkan, texture);
|
||||
result = gsk_vulkan_upload_texture_op (render, texture);
|
||||
gsk_vulkan_renderer_add_texture_image (renderer, texture, result);
|
||||
}
|
||||
|
||||
@ -180,7 +177,6 @@ gsk_vulkan_render_pass_get_node_as_image (GskVulkanRenderPass *self,
|
||||
return NULL;
|
||||
|
||||
result = gsk_vulkan_upload_cairo_op (render,
|
||||
self->vulkan,
|
||||
node,
|
||||
&state->scale,
|
||||
&clipped);
|
||||
@ -205,7 +201,6 @@ gsk_vulkan_render_pass_get_node_as_image (GskVulkanRenderPass *self,
|
||||
*tex_bounds = clipped;
|
||||
|
||||
result = gsk_vulkan_render_pass_op_offscreen (render,
|
||||
self->vulkan,
|
||||
&state->scale,
|
||||
&clipped,
|
||||
node);
|
||||
@ -237,7 +232,6 @@ gsk_vulkan_render_pass_add_fallback_node (GskVulkanRenderPass *self,
|
||||
return TRUE;
|
||||
|
||||
image = gsk_vulkan_upload_cairo_op (render,
|
||||
self->vulkan,
|
||||
node,
|
||||
&state->scale,
|
||||
&clipped);
|
||||
@ -439,7 +433,7 @@ gsk_vulkan_render_pass_add_texture_node (GskVulkanRenderPass *self,
|
||||
image = gsk_vulkan_renderer_get_texture_image (renderer, texture);
|
||||
if (image == NULL)
|
||||
{
|
||||
image = gsk_vulkan_upload_texture_op (render, self->vulkan, texture);
|
||||
image = gsk_vulkan_upload_texture_op (render, texture);
|
||||
gsk_vulkan_renderer_add_texture_image (renderer, texture, image);
|
||||
}
|
||||
|
||||
@ -482,7 +476,7 @@ gsk_vulkan_render_pass_add_texture_scale_node (GskVulkanRenderPass *self,
|
||||
image = gsk_vulkan_renderer_get_texture_image (renderer, texture);
|
||||
if (image == NULL)
|
||||
{
|
||||
image = gsk_vulkan_upload_texture_op (render, self->vulkan, texture);
|
||||
image = gsk_vulkan_upload_texture_op (render, texture);
|
||||
gsk_vulkan_renderer_add_texture_image (renderer, texture, image);
|
||||
}
|
||||
|
||||
@ -869,7 +863,6 @@ gsk_vulkan_render_pass_add_repeat_node (GskVulkanRenderPass *self,
|
||||
return TRUE;
|
||||
|
||||
image = gsk_vulkan_render_pass_op_offscreen (render,
|
||||
self->vulkan,
|
||||
&state->scale,
|
||||
child_bounds,
|
||||
gsk_repeat_node_get_child (node));
|
||||
|
@ -244,7 +244,6 @@ static const GskVulkanOpClass GSK_VULKAN_RENDER_PASS_END_OP_CLASS = {
|
||||
|
||||
void
|
||||
gsk_vulkan_render_pass_op (GskVulkanRender *render,
|
||||
GdkVulkanContext *context,
|
||||
GskVulkanImage *image,
|
||||
cairo_region_t *clip,
|
||||
const graphene_vec2_t *scale,
|
||||
@ -264,7 +263,7 @@ gsk_vulkan_render_pass_op (GskVulkanRender *render,
|
||||
cairo_region_get_extents (clip, &self->area);
|
||||
self->viewport_size = viewport->size;
|
||||
|
||||
self->render_pass = gsk_vulkan_render_pass_new (context);
|
||||
self->render_pass = gsk_vulkan_render_pass_new ();
|
||||
|
||||
/* This invalidates the self pointer */
|
||||
gsk_vulkan_render_pass_add (self->render_pass,
|
||||
@ -282,11 +281,11 @@ gsk_vulkan_render_pass_op (GskVulkanRender *render,
|
||||
|
||||
GskVulkanImage *
|
||||
gsk_vulkan_render_pass_op_offscreen (GskVulkanRender *render,
|
||||
GdkVulkanContext *context,
|
||||
const graphene_vec2_t *scale,
|
||||
const graphene_rect_t *viewport,
|
||||
GskRenderNode *node)
|
||||
{
|
||||
GdkVulkanContext *context;
|
||||
graphene_rect_t view;
|
||||
GskVulkanImage *image;
|
||||
cairo_region_t *clip;
|
||||
@ -299,6 +298,7 @@ gsk_vulkan_render_pass_op_offscreen (GskVulkanRender *render,
|
||||
ceil (scale_x * viewport->size.width),
|
||||
ceil (scale_y * viewport->size.height));
|
||||
|
||||
context = gsk_vulkan_render_get_context (render);
|
||||
image = gsk_vulkan_image_new_for_offscreen (context,
|
||||
gdk_vulkan_context_get_offscreen_format (context,
|
||||
gsk_render_node_get_preferred_depth (node)),
|
||||
@ -311,7 +311,6 @@ gsk_vulkan_render_pass_op_offscreen (GskVulkanRender *render,
|
||||
});
|
||||
|
||||
gsk_vulkan_render_pass_op (render,
|
||||
context,
|
||||
image,
|
||||
clip,
|
||||
scale,
|
||||
|
@ -5,7 +5,6 @@
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void gsk_vulkan_render_pass_op (GskVulkanRender *render,
|
||||
GdkVulkanContext *context,
|
||||
GskVulkanImage *image,
|
||||
cairo_region_t *clip,
|
||||
const graphene_vec2_t *scale,
|
||||
@ -14,7 +13,6 @@ void gsk_vulkan_render_pass_op (GskVulk
|
||||
VkImageLayout initial_layout,
|
||||
VkImageLayout final_layout);
|
||||
GskVulkanImage * gsk_vulkan_render_pass_op_offscreen (GskVulkanRender *render,
|
||||
GdkVulkanContext *context,
|
||||
const graphene_vec2_t *scale,
|
||||
const graphene_rect_t *viewport,
|
||||
GskRenderNode *node);
|
||||
|
@ -10,7 +10,7 @@
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
GskVulkanRenderPass * gsk_vulkan_render_pass_new (GdkVulkanContext *context);
|
||||
GskVulkanRenderPass * gsk_vulkan_render_pass_new (void);
|
||||
|
||||
void gsk_vulkan_render_pass_free (GskVulkanRenderPass *self);
|
||||
|
||||
|
@ -214,7 +214,6 @@ static const GskVulkanOpClass GSK_VULKAN_UPLOAD_TEXTURE_OP_CLASS = {
|
||||
|
||||
GskVulkanImage *
|
||||
gsk_vulkan_upload_texture_op (GskVulkanRender *render,
|
||||
GdkVulkanContext *context,
|
||||
GdkTexture *texture)
|
||||
{
|
||||
GskVulkanUploadTextureOp *self;
|
||||
@ -222,7 +221,7 @@ gsk_vulkan_upload_texture_op (GskVulkanRender *render,
|
||||
self = (GskVulkanUploadTextureOp *) gsk_vulkan_op_alloc (render, &GSK_VULKAN_UPLOAD_TEXTURE_OP_CLASS);
|
||||
|
||||
self->texture = g_object_ref (texture);
|
||||
self->image = gsk_vulkan_image_new_for_upload (context,
|
||||
self->image = gsk_vulkan_image_new_for_upload (gsk_vulkan_render_get_context (render),
|
||||
gdk_texture_get_format (texture),
|
||||
gdk_texture_get_width (texture),
|
||||
gdk_texture_get_height (texture));
|
||||
@ -327,7 +326,6 @@ static const GskVulkanOpClass GSK_VULKAN_UPLOAD_CAIRO_OP_CLASS = {
|
||||
|
||||
GskVulkanImage *
|
||||
gsk_vulkan_upload_cairo_op (GskVulkanRender *render,
|
||||
GdkVulkanContext *context,
|
||||
GskRenderNode *node,
|
||||
const graphene_vec2_t *scale,
|
||||
const graphene_rect_t *viewport)
|
||||
@ -337,7 +335,7 @@ gsk_vulkan_upload_cairo_op (GskVulkanRender *render,
|
||||
self = (GskVulkanUploadCairoOp *) gsk_vulkan_op_alloc (render, &GSK_VULKAN_UPLOAD_CAIRO_OP_CLASS);
|
||||
|
||||
self->node = gsk_render_node_ref (node);
|
||||
self->image = gsk_vulkan_image_new_for_upload (context,
|
||||
self->image = gsk_vulkan_image_new_for_upload (gsk_vulkan_render_get_context (render),
|
||||
GDK_MEMORY_DEFAULT,
|
||||
ceil (graphene_vec2_get_x (scale) * viewport->size.width),
|
||||
ceil (graphene_vec2_get_y (scale) * viewport->size.height));
|
||||
|
@ -5,11 +5,9 @@
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GskVulkanImage * gsk_vulkan_upload_texture_op (GskVulkanRender *render,
|
||||
GdkVulkanContext *context,
|
||||
GdkTexture *texture);
|
||||
|
||||
GskVulkanImage * gsk_vulkan_upload_cairo_op (GskVulkanRender *render,
|
||||
GdkVulkanContext *context,
|
||||
GskRenderNode *node,
|
||||
const graphene_vec2_t *scale,
|
||||
const graphene_rect_t *viewport);
|
||||
|
Loading…
Reference in New Issue
Block a user