gsk_vulkan_color_matrix_op_command
};
-gsize
-gsk_vulkan_color_matrix_op_size (void)
-{
- return GSK_VULKAN_COLOR_MATRIX_OP_CLASS.size;
-}
-
void
-gsk_vulkan_color_matrix_op_init (GskVulkanOp *op,
- GskVulkanPipeline *pipeline,
- GskVulkanImage *image,
- const graphene_rect_t *rect,
- const graphene_point_t *offset,
- const graphene_rect_t *tex_rect,
- const graphene_matrix_t *color_matrix,
- const graphene_vec4_t *color_offset)
+gsk_vulkan_color_matrix_op (GskVulkanRenderPass *render_pass,
+ GskVulkanPipeline *pipeline,
+ GskVulkanImage *image,
+ const graphene_rect_t *rect,
+ const graphene_point_t *offset,
+ const graphene_rect_t *tex_rect,
+ const graphene_matrix_t *color_matrix,
+ const graphene_vec4_t *color_offset)
{
- GskVulkanColorMatrixOp *self = (GskVulkanColorMatrixOp *) op;
+ GskVulkanColorMatrixOp *self;
- gsk_vulkan_op_init (op, &GSK_VULKAN_COLOR_MATRIX_OP_CLASS);
+ self = (GskVulkanColorMatrixOp *) gsk_vulkan_op_alloc (render_pass, &GSK_VULKAN_COLOR_MATRIX_OP_CLASS);
self->pipeline = pipeline;
self->image = g_object_ref (image);
G_BEGIN_DECLS
-gsize gsk_vulkan_color_matrix_op_size (void) G_GNUC_CONST;
-
-void gsk_vulkan_color_matrix_op_init (GskVulkanOp *op,
+void gsk_vulkan_color_matrix_op (GskVulkanRenderPass *render_pass,
GskVulkanPipeline *pipeline,
GskVulkanImage *image,
const graphene_rect_t *rect,
gsk_vulkan_offscreen_op_command
};
-gsize
-gsk_vulkan_offscreen_op_size (void)
-{
- return GSK_VULKAN_OFFSCREEN_OP_CLASS.size;
-}
-
GskVulkanImage *
-gsk_vulkan_offscreen_op_init (GskVulkanOp *op,
- GdkVulkanContext *context,
- GskVulkanRender *render,
- const graphene_vec2_t *scale,
- const graphene_rect_t *viewport,
- VkSemaphore signal_semaphore,
- GskRenderNode *node)
+gsk_vulkan_offscreen_op (GskVulkanRenderPass *render_pass,
+ GdkVulkanContext *context,
+ GskVulkanRender *render,
+ const graphene_vec2_t *scale,
+ const graphene_rect_t *viewport,
+ VkSemaphore signal_semaphore,
+ GskRenderNode *node)
{
- GskVulkanOffscreenOp *self = (GskVulkanOffscreenOp *) op;
+ GskVulkanOffscreenOp *self;
graphene_rect_t view;
cairo_region_t *clip;
float scale_x, scale_y;
ceil (scale_x * viewport->size.width),
ceil (scale_y * viewport->size.height));
- gsk_vulkan_op_init (op, &GSK_VULKAN_OFFSCREEN_OP_CLASS);
+ self = (GskVulkanOffscreenOp *) gsk_vulkan_op_alloc (render_pass, &GSK_VULKAN_OFFSCREEN_OP_CLASS);
self->image = gsk_vulkan_image_new_for_offscreen (context,
gdk_vulkan_context_get_offscreen_format (context,
G_BEGIN_DECLS
-gsize gsk_vulkan_offscreen_op_size (void) G_GNUC_CONST;
-
-GskVulkanImage * gsk_vulkan_offscreen_op_init (GskVulkanOp *op,
+GskVulkanImage * gsk_vulkan_offscreen_op (GskVulkanRenderPass *render_pass,
GdkVulkanContext *context,
GskVulkanRender *render,
const graphene_vec2_t *scale,
#include "gskvulkanopprivate.h"
-void
-gsk_vulkan_op_init (GskVulkanOp *op,
- const GskVulkanOpClass *op_class)
+GskVulkanOp *
+gsk_vulkan_op_alloc (GskVulkanRenderPass *render_pass,
+ const GskVulkanOpClass *op_class)
{
+ GskVulkanOp *op;
+
+ op = gsk_vulkan_render_pass_alloc_op (render_pass,
+ op_class->size);
op->op_class = op_class;
+
+ return op;
}
void
struct _GskVulkanOp
{
const GskVulkanOpClass *op_class;
+
+ VkPipeline pipeline;
};
struct _GskVulkanOpClass
/* ensures alignment of ops to multipes of 16 bytes - and that makes graphene happy */
#define GSK_VULKAN_OP_SIZE(struct_name) ((sizeof(struct_name) + 15) & ~15)
-void gsk_vulkan_op_init (GskVulkanOp *op,
+GskVulkanOp * gsk_vulkan_op_alloc (GskVulkanRenderPass *render_pass,
const GskVulkanOpClass *op_class);
void gsk_vulkan_op_finish (GskVulkanOp *op);
return (number + divisor - 1) / divisor * divisor;
}
-static gpointer
+gpointer
gsk_vulkan_render_pass_alloc_op (GskVulkanRenderPass *self,
gsize size)
{
GskRenderNode *node,
const GskVulkanParseState *state)
{
- gsk_vulkan_scissor_op_init (gsk_vulkan_render_pass_alloc_op (self, gsk_vulkan_scissor_op_size ()),
- &state->scissor);
+ gsk_vulkan_scissor_op (self, &state->scissor);
}
static void
result = gsk_vulkan_renderer_get_texture_image (renderer, texture);
if (result == NULL)
{
- result = gsk_vulkan_upload_op_init_texture (gsk_vulkan_render_pass_alloc_op (self, gsk_vulkan_upload_op_size ()),
- self->vulkan,
- texture);
+ result = gsk_vulkan_upload_op (self, self->vulkan, texture);
gsk_vulkan_renderer_add_texture_image (renderer, texture, result);
}
if (clipped.size.width == 0 || clipped.size.height == 0)
return NULL;
- result = gsk_vulkan_upload_cairo_op_init (gsk_vulkan_render_pass_alloc_op (self, gsk_vulkan_upload_cairo_op_size ()),
- self->vulkan,
- node,
- &state->scale,
- &clipped);
+ result = gsk_vulkan_upload_cairo_op (self,
+ self->vulkan,
+ node,
+ &state->scale,
+ &clipped);
*tex_bounds = clipped;
return result;
&semaphore);
g_array_append_val (self->wait_semaphores, semaphore);
- result = gsk_vulkan_offscreen_op_init (gsk_vulkan_render_pass_alloc_op (self, gsk_vulkan_offscreen_op_size ()),
- self->vulkan,
- render,
- &state->scale,
- &clipped,
- semaphore,
- node);
+ result = gsk_vulkan_offscreen_op (self,
+ self->vulkan,
+ render,
+ &state->scale,
+ &clipped,
+ semaphore,
+ node);
return result;
}
if (clipped.size.width == 0 || clipped.size.height == 0)
return TRUE;
- image = gsk_vulkan_upload_cairo_op_init (gsk_vulkan_render_pass_alloc_op (self, gsk_vulkan_upload_cairo_op_size ()),
- self->vulkan,
- node,
- &state->scale,
- &clipped);
+ image = gsk_vulkan_upload_cairo_op (self,
+ self->vulkan,
+ node,
+ &state->scale,
+ &clipped);
if (gsk_vulkan_clip_contains_rect (&state->clip, &state->offset, &node->bounds))
pipeline_type = GSK_VULKAN_PIPELINE_TEXTURE;
else
pipeline_type = GSK_VULKAN_PIPELINE_TEXTURE_CLIP_ROUNDED;
- gsk_vulkan_texture_op_init (gsk_vulkan_render_pass_alloc_op (self, gsk_vulkan_texture_op_size ()),
- gsk_vulkan_render_pass_get_pipeline (self, render, pipeline_type),
- image,
- GSK_VULKAN_SAMPLER_DEFAULT,
- &node->bounds,
- &state->offset,
- &clipped);
+ gsk_vulkan_texture_op (self,
+ gsk_vulkan_render_pass_get_pipeline (self, render, pipeline_type),
+ image,
+ GSK_VULKAN_SAMPLER_DEFAULT,
+ &node->bounds,
+ &state->offset,
+ &clipped);
return TRUE;
}
image = gsk_vulkan_renderer_get_texture_image (renderer, texture);
if (image == NULL)
{
- image = gsk_vulkan_upload_op_init_texture (gsk_vulkan_render_pass_alloc_op (self, gsk_vulkan_upload_op_size ()),
- self->vulkan,
- texture);
+ image = gsk_vulkan_upload_op (self, self->vulkan, texture);
gsk_vulkan_renderer_add_texture_image (renderer, texture, image);
}
- gsk_vulkan_texture_op_init (gsk_vulkan_render_pass_alloc_op (self, gsk_vulkan_texture_op_size ()),
- gsk_vulkan_render_pass_get_pipeline (self, render, pipeline_type),
- image,
- GSK_VULKAN_SAMPLER_DEFAULT,
- &node->bounds,
- &state->offset,
- &node->bounds);
+ gsk_vulkan_texture_op (self,
+ gsk_vulkan_render_pass_get_pipeline (self, render, pipeline_type),
+ image,
+ GSK_VULKAN_SAMPLER_DEFAULT,
+ &node->bounds,
+ &state->offset,
+ &node->bounds);
return TRUE;
}
image = gsk_vulkan_renderer_get_texture_image (renderer, texture);
if (image == NULL)
{
- image = gsk_vulkan_upload_op_init_texture (gsk_vulkan_render_pass_alloc_op (self, gsk_vulkan_upload_op_size ()),
- self->vulkan,
- texture);
+ image = gsk_vulkan_upload_op (self, self->vulkan, texture);
gsk_vulkan_renderer_add_texture_image (renderer, texture, image);
}
- gsk_vulkan_texture_op_init (gsk_vulkan_render_pass_alloc_op (self, gsk_vulkan_texture_op_size ()),
- gsk_vulkan_render_pass_get_pipeline (self, render, pipeline_type),
- image,
- sampler,
- &node->bounds,
- &state->offset,
- &node->bounds);
+ gsk_vulkan_texture_op (self,
+ gsk_vulkan_render_pass_get_pipeline (self, render, pipeline_type),
+ image,
+ sampler,
+ &node->bounds,
+ &state->offset,
+ &node->bounds);
return TRUE;
}
});
graphene_vec4_init (&color_offset, 0.0, 0.0, 0.0, 0.0);
- gsk_vulkan_color_matrix_op_init (gsk_vulkan_render_pass_alloc_op (self, gsk_vulkan_color_matrix_op_size ()),
- gsk_vulkan_render_pass_get_pipeline (self, render, pipeline_type),
- image,
- &node->bounds,
- &state->offset,
- &tex_rect,
- &color_matrix,
- &color_offset);
+ gsk_vulkan_color_matrix_op (self,
+ gsk_vulkan_render_pass_get_pipeline (self, render, pipeline_type),
+ image,
+ &node->bounds,
+ &state->offset,
+ &tex_rect,
+ &color_matrix,
+ &color_offset);
return TRUE;
}
else
pipeline_type = GSK_VULKAN_PIPELINE_COLOR_MATRIX_CLIP_ROUNDED;
- gsk_vulkan_color_matrix_op_init (gsk_vulkan_render_pass_alloc_op (self, gsk_vulkan_color_matrix_op_size ()),
- gsk_vulkan_render_pass_get_pipeline (self, render, pipeline_type),
- image,
- &node->bounds,
- &state->offset,
- &tex_rect,
- gsk_color_matrix_node_get_color_matrix (node),
- gsk_color_matrix_node_get_color_offset (node));
+ gsk_vulkan_color_matrix_op (self,
+ gsk_vulkan_render_pass_get_pipeline (self, render, pipeline_type),
+ image,
+ &node->bounds,
+ &state->offset,
+ &tex_rect,
+ gsk_color_matrix_node_get_color_matrix (node),
+ gsk_color_matrix_node_get_color_offset (node));
return TRUE;
}
g_array_append_val (self->wait_semaphores, semaphore);
- image = gsk_vulkan_offscreen_op_init (gsk_vulkan_render_pass_alloc_op (self, gsk_vulkan_offscreen_op_size ()),
- self->vulkan,
- render,
- &state->scale,
- child_bounds,
- semaphore,
- gsk_repeat_node_get_child (node));
+ image = gsk_vulkan_offscreen_op (self,
+ self->vulkan,
+ render,
+ &state->scale,
+ child_bounds,
+ semaphore,
+ gsk_repeat_node_get_child (node));
if (gsk_vulkan_clip_contains_rect (&state->clip, &state->offset, &node->bounds))
pipeline_type = GSK_VULKAN_PIPELINE_TEXTURE;
else
pipeline_type = GSK_VULKAN_PIPELINE_TEXTURE_CLIP_ROUNDED;
- gsk_vulkan_texture_op_init (gsk_vulkan_render_pass_alloc_op (self, gsk_vulkan_texture_op_size ()),
- gsk_vulkan_render_pass_get_pipeline (self, render, pipeline_type),
- image,
- GSK_VULKAN_SAMPLER_REPEAT,
- &node->bounds,
- &state->offset,
- child_bounds);
+ gsk_vulkan_texture_op (self,
+ gsk_vulkan_render_pass_get_pipeline (self, render, pipeline_type),
+ image,
+ GSK_VULKAN_SAMPLER_REPEAT,
+ &node->bounds,
+ &state->offset,
+ child_bounds);
return TRUE;
}
GskVulkanRender *render,
GskRenderNode *node);
+gpointer gsk_vulkan_render_pass_alloc_op (GskVulkanRenderPass *self,
+ gsize size);
+
void gsk_vulkan_render_pass_upload (GskVulkanRenderPass *self,
GskVulkanRender *render,
GskVulkanUploader *uploader);
gsk_vulkan_scissor_op_command
};
-gsize
-gsk_vulkan_scissor_op_size (void)
-{
- return GSK_VULKAN_SCISSOR_OP_CLASS.size;
-}
-
void
-gsk_vulkan_scissor_op_init (GskVulkanOp *op,
- const cairo_rectangle_int_t *rect)
+gsk_vulkan_scissor_op (GskVulkanRenderPass *render_pass,
+ const cairo_rectangle_int_t *rect)
{
- GskVulkanScissorOp *self = (GskVulkanScissorOp *) op;
+ GskVulkanScissorOp *self;
- gsk_vulkan_op_init (op, &GSK_VULKAN_SCISSOR_OP_CLASS);
+ self = (GskVulkanScissorOp *) gsk_vulkan_op_alloc (render_pass, &GSK_VULKAN_SCISSOR_OP_CLASS);
self->rect = *rect;
}
G_BEGIN_DECLS
-gsize gsk_vulkan_scissor_op_size (void) G_GNUC_CONST;
-
-void gsk_vulkan_scissor_op_init (GskVulkanOp *op,
+void gsk_vulkan_scissor_op (GskVulkanRenderPass *render_pass,
const cairo_rectangle_int_t *rect);
gsk_vulkan_texture_op_command
};
-gsize
-gsk_vulkan_texture_op_size (void)
-{
- return GSK_VULKAN_TEXTURE_OP_CLASS.size;
-}
-
void
-gsk_vulkan_texture_op_init (GskVulkanOp *op,
- GskVulkanPipeline *pipeline,
- GskVulkanImage *image,
- GskVulkanRenderSampler sampler,
- const graphene_rect_t *rect,
- const graphene_point_t *offset,
- const graphene_rect_t *tex_rect)
+gsk_vulkan_texture_op (GskVulkanRenderPass *render_pass,
+ GskVulkanPipeline *pipeline,
+ GskVulkanImage *image,
+ GskVulkanRenderSampler sampler,
+ const graphene_rect_t *rect,
+ const graphene_point_t *offset,
+ const graphene_rect_t *tex_rect)
{
- GskVulkanTextureOp *self = (GskVulkanTextureOp *) op;
+ GskVulkanTextureOp *self;
- gsk_vulkan_op_init (op, &GSK_VULKAN_TEXTURE_OP_CLASS);
+ self = (GskVulkanTextureOp *) gsk_vulkan_op_alloc (render_pass, &GSK_VULKAN_TEXTURE_OP_CLASS);
self->pipeline = pipeline;
self->image = g_object_ref (image);
G_BEGIN_DECLS
-gsize gsk_vulkan_texture_op_size (void) G_GNUC_CONST;
-
-void gsk_vulkan_texture_op_init (GskVulkanOp *op,
+void gsk_vulkan_texture_op (GskVulkanRenderPass *render_pass,
GskVulkanPipeline *pipeline,
GskVulkanImage *image,
GskVulkanRenderSampler sampler,
gsk_vulkan_upload_cairo_op_command
};
-gsize
-gsk_vulkan_upload_cairo_op_size (void)
-{
- return GSK_VULKAN_UPLOAD_CAIRO_OP_CLASS.size;
-}
-
GskVulkanImage *
-gsk_vulkan_upload_cairo_op_init (GskVulkanOp *op,
- GdkVulkanContext *context,
- GskRenderNode *node,
- const graphene_vec2_t *scale,
- const graphene_rect_t *viewport)
+gsk_vulkan_upload_cairo_op (GskVulkanRenderPass *render_pass,
+ GdkVulkanContext *context,
+ GskRenderNode *node,
+ const graphene_vec2_t *scale,
+ const graphene_rect_t *viewport)
{
- GskVulkanUploadCairoOp *self = (GskVulkanUploadCairoOp *) op;
+ GskVulkanUploadCairoOp *self;
- gsk_vulkan_op_init (op, &GSK_VULKAN_UPLOAD_CAIRO_OP_CLASS);
+ self = (GskVulkanUploadCairoOp *) gsk_vulkan_op_alloc (render_pass, &GSK_VULKAN_UPLOAD_CAIRO_OP_CLASS);
self->node = gsk_render_node_ref (node);
self->image = gsk_vulkan_image_new_for_upload (context,
G_BEGIN_DECLS
-gsize gsk_vulkan_upload_cairo_op_size (void) G_GNUC_CONST;
-
-GskVulkanImage * gsk_vulkan_upload_cairo_op_init (GskVulkanOp *op,
+GskVulkanImage * gsk_vulkan_upload_cairo_op (GskVulkanRenderPass *render_pass,
GdkVulkanContext *context,
GskRenderNode *node,
const graphene_vec2_t *scale,
gsk_vulkan_upload_op_command
};
-gsize
-gsk_vulkan_upload_op_size (void)
-{
- return GSK_VULKAN_UPLOAD_OP_CLASS.size;
-}
-
GskVulkanImage *
-gsk_vulkan_upload_op_init_texture (GskVulkanOp *op,
- GdkVulkanContext *context,
- GdkTexture *texture)
+gsk_vulkan_upload_op (GskVulkanRenderPass *render_pass,
+ GdkVulkanContext *context,
+ GdkTexture *texture)
{
- GskVulkanUploadOp *self = (GskVulkanUploadOp *) op;
+ GskVulkanUploadOp *self;
- gsk_vulkan_op_init (op, &GSK_VULKAN_UPLOAD_OP_CLASS);
+ self = (GskVulkanUploadOp *) gsk_vulkan_op_alloc (render_pass, &GSK_VULKAN_UPLOAD_OP_CLASS);
self->texture = g_object_ref (texture);
self->image = gsk_vulkan_image_new_for_upload (context,
G_BEGIN_DECLS
-gsize gsk_vulkan_upload_op_size (void) G_GNUC_CONST;
-
-GskVulkanImage * gsk_vulkan_upload_op_init_texture (GskVulkanOp *op,
+GskVulkanImage * gsk_vulkan_upload_op (GskVulkanRenderPass *render_pass,
GdkVulkanContext *context,
GdkTexture *texture);