mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 05:50:10 +00:00
vulkan: Rename offscreenp to renderpassop
They should be used for all renderpasses, not just offscreens.
This commit is contained in:
parent
2aba50efa0
commit
0bf16d738e
@ -123,13 +123,13 @@ if have_vulkan
|
||||
'vulkan/gskvulkanlineargradientop.c',
|
||||
'vulkan/gskvulkanmaskop.c',
|
||||
'vulkan/gskvulkanmemory.c',
|
||||
'vulkan/gskvulkanoffscreenop.c',
|
||||
'vulkan/gskvulkanop.c',
|
||||
'vulkan/gskvulkanoutsetshadowop.c',
|
||||
'vulkan/gskvulkanpushconstantsop.c',
|
||||
'vulkan/gskvulkanrender.c',
|
||||
'vulkan/gskvulkanrenderer.c',
|
||||
'vulkan/gskvulkanrenderpass.c',
|
||||
'vulkan/gskvulkanrenderpassop.c',
|
||||
'vulkan/gskvulkanscissorop.c',
|
||||
'vulkan/gskvulkantextureop.c',
|
||||
'vulkan/gskvulkanuploadcairoop.c',
|
||||
|
@ -1,228 +0,0 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gskvulkanoffscreenopprivate.h"
|
||||
|
||||
#include "gskrendernodeprivate.h"
|
||||
#include "gskvulkanprivate.h"
|
||||
|
||||
#include "gdk/gdkvulkancontextprivate.h"
|
||||
|
||||
typedef struct _GskVulkanOffscreenOp GskVulkanOffscreenOp;
|
||||
|
||||
struct _GskVulkanOffscreenOp
|
||||
{
|
||||
GskVulkanOp op;
|
||||
|
||||
GskVulkanImage *image;
|
||||
GskVulkanRenderPass *render_pass;
|
||||
};
|
||||
|
||||
static void
|
||||
gsk_vulkan_offscreen_op_finish (GskVulkanOp *op)
|
||||
{
|
||||
GskVulkanOffscreenOp *self = (GskVulkanOffscreenOp *) op;
|
||||
|
||||
g_object_unref (self->image);
|
||||
gsk_vulkan_render_pass_free (self->render_pass);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_offscreen_op_print (GskVulkanOp *op,
|
||||
GString *string,
|
||||
guint indent)
|
||||
{
|
||||
GskVulkanOffscreenOp *self = (GskVulkanOffscreenOp *) op;
|
||||
|
||||
print_indent (string, indent);
|
||||
g_string_append_printf (string, "offscreen %zux%zu ",
|
||||
gsk_vulkan_image_get_width (self->image),
|
||||
gsk_vulkan_image_get_height (self->image));
|
||||
print_newline (string);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_offscreen_op_upload (GskVulkanOp *op,
|
||||
GskVulkanUploader *uploader)
|
||||
{
|
||||
}
|
||||
|
||||
static gsize
|
||||
gsk_vulkan_offscreen_op_count_vertex_data (GskVulkanOp *op,
|
||||
gsize n_bytes)
|
||||
{
|
||||
return n_bytes;
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_offscreen_op_collect_vertex_data (GskVulkanOp *op,
|
||||
guchar *data)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_offscreen_op_reserve_descriptor_sets (GskVulkanOp *op,
|
||||
GskVulkanRender *render)
|
||||
{
|
||||
}
|
||||
|
||||
static GskVulkanOp *
|
||||
gsk_vulkan_offscreen_op_command (GskVulkanOp *op,
|
||||
GskVulkanRender *render,
|
||||
VkPipelineLayout pipeline_layout,
|
||||
VkCommandBuffer command_buffer)
|
||||
{
|
||||
GskVulkanOffscreenOp *self = (GskVulkanOffscreenOp *) op;
|
||||
|
||||
return gsk_vulkan_render_draw_pass (render, self->render_pass, op->next);
|
||||
}
|
||||
|
||||
static const GskVulkanOpClass GSK_VULKAN_OFFSCREEN_OP_CLASS = {
|
||||
GSK_VULKAN_OP_SIZE (GskVulkanOffscreenOp),
|
||||
GSK_VULKAN_STAGE_BEGIN_PASS,
|
||||
NULL,
|
||||
NULL,
|
||||
gsk_vulkan_offscreen_op_finish,
|
||||
gsk_vulkan_offscreen_op_print,
|
||||
gsk_vulkan_offscreen_op_upload,
|
||||
gsk_vulkan_offscreen_op_count_vertex_data,
|
||||
gsk_vulkan_offscreen_op_collect_vertex_data,
|
||||
gsk_vulkan_offscreen_op_reserve_descriptor_sets,
|
||||
gsk_vulkan_offscreen_op_command
|
||||
};
|
||||
|
||||
typedef struct _GskVulkanOffscreenEndOp GskVulkanOffscreenEndOp;
|
||||
|
||||
struct _GskVulkanOffscreenEndOp
|
||||
{
|
||||
GskVulkanOp op;
|
||||
|
||||
GskVulkanImage *image;
|
||||
};
|
||||
|
||||
static void
|
||||
gsk_vulkan_offscreen_end_op_finish (GskVulkanOp *op)
|
||||
{
|
||||
GskVulkanOffscreenEndOp *self = (GskVulkanOffscreenEndOp *) op;
|
||||
|
||||
g_object_unref (self->image);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_offscreen_end_op_print (GskVulkanOp *op,
|
||||
GString *string,
|
||||
guint indent)
|
||||
{
|
||||
GskVulkanOffscreenEndOp *self = (GskVulkanOffscreenEndOp *) op;
|
||||
|
||||
print_indent (string, indent);
|
||||
g_string_append_printf (string, "end offscreen ");
|
||||
print_image (string, self->image);
|
||||
print_newline (string);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_offscreen_end_op_upload (GskVulkanOp *op,
|
||||
GskVulkanUploader *uploader)
|
||||
{
|
||||
}
|
||||
|
||||
static gsize
|
||||
gsk_vulkan_offscreen_end_op_count_vertex_data (GskVulkanOp *op,
|
||||
gsize n_bytes)
|
||||
{
|
||||
return n_bytes;
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_offscreen_end_op_collect_vertex_data (GskVulkanOp *op,
|
||||
guchar *data)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_offscreen_end_op_reserve_descriptor_sets (GskVulkanOp *op,
|
||||
GskVulkanRender *render)
|
||||
{
|
||||
}
|
||||
|
||||
static GskVulkanOp *
|
||||
gsk_vulkan_offscreen_end_op_command (GskVulkanOp *op,
|
||||
GskVulkanRender *render,
|
||||
VkPipelineLayout pipeline_layout,
|
||||
VkCommandBuffer command_buffer)
|
||||
{
|
||||
vkCmdEndRenderPass (command_buffer);
|
||||
|
||||
return op->next;
|
||||
}
|
||||
|
||||
static const GskVulkanOpClass GSK_VULKAN_OFFSCREEN_END_OP_CLASS = {
|
||||
GSK_VULKAN_OP_SIZE (GskVulkanOffscreenEndOp),
|
||||
GSK_VULKAN_STAGE_END_PASS,
|
||||
NULL,
|
||||
NULL,
|
||||
gsk_vulkan_offscreen_end_op_finish,
|
||||
gsk_vulkan_offscreen_end_op_print,
|
||||
gsk_vulkan_offscreen_end_op_upload,
|
||||
gsk_vulkan_offscreen_end_op_count_vertex_data,
|
||||
gsk_vulkan_offscreen_end_op_collect_vertex_data,
|
||||
gsk_vulkan_offscreen_end_op_reserve_descriptor_sets,
|
||||
gsk_vulkan_offscreen_end_op_command
|
||||
};
|
||||
|
||||
GskVulkanImage *
|
||||
gsk_vulkan_offscreen_op (GskVulkanRender *render,
|
||||
GdkVulkanContext *context,
|
||||
const graphene_vec2_t *scale,
|
||||
const graphene_rect_t *viewport,
|
||||
GskRenderNode *node)
|
||||
{
|
||||
GskVulkanOffscreenOp *self;
|
||||
GskVulkanOffscreenEndOp *end;
|
||||
GskVulkanImage *image;
|
||||
graphene_rect_t view;
|
||||
cairo_region_t *clip;
|
||||
float scale_x, scale_y;
|
||||
|
||||
scale_x = graphene_vec2_get_x (scale);
|
||||
scale_y = graphene_vec2_get_y (scale);
|
||||
view = GRAPHENE_RECT_INIT (scale_x * viewport->origin.x,
|
||||
scale_y * viewport->origin.y,
|
||||
ceil (scale_x * viewport->size.width),
|
||||
ceil (scale_y * viewport->size.height));
|
||||
|
||||
image = gsk_vulkan_image_new_for_offscreen (context,
|
||||
gdk_vulkan_context_get_offscreen_format (context,
|
||||
gsk_render_node_get_preferred_depth (node)),
|
||||
view.size.width, view.size.height);
|
||||
|
||||
self = (GskVulkanOffscreenOp *) gsk_vulkan_op_alloc (render, &GSK_VULKAN_OFFSCREEN_OP_CLASS);
|
||||
|
||||
self->image = image;
|
||||
|
||||
clip = cairo_region_create_rectangle (&(cairo_rectangle_int_t) {
|
||||
0, 0,
|
||||
gsk_vulkan_image_get_width (self->image),
|
||||
gsk_vulkan_image_get_height (self->image)
|
||||
});
|
||||
|
||||
self->render_pass = gsk_vulkan_render_pass_new (context,
|
||||
render,
|
||||
self->image,
|
||||
scale,
|
||||
&view,
|
||||
clip,
|
||||
node,
|
||||
FALSE);
|
||||
|
||||
cairo_region_destroy (clip);
|
||||
|
||||
/* This invalidates the self pointer */
|
||||
gsk_vulkan_render_pass_add (self->render_pass, render, node);
|
||||
|
||||
end = (GskVulkanOffscreenEndOp *) gsk_vulkan_op_alloc (render, &GSK_VULKAN_OFFSCREEN_END_OP_CLASS);
|
||||
|
||||
end->image = g_object_ref (image);
|
||||
|
||||
return self->image;
|
||||
}
|
@ -24,7 +24,7 @@
|
||||
#include "gskvulkanprivate.h"
|
||||
#include "gskvulkanrendererprivate.h"
|
||||
#include "gskvulkanimageprivate.h"
|
||||
#include "gskvulkanoffscreenopprivate.h"
|
||||
#include "gskvulkanrenderpassopprivate.h"
|
||||
#include "gskvulkanoutsetshadowopprivate.h"
|
||||
#include "gskvulkanpushconstantsopprivate.h"
|
||||
#include "gskvulkanscissoropprivate.h"
|
||||
@ -218,11 +218,11 @@ gsk_vulkan_render_pass_get_node_as_image (GskVulkanRenderPass *self,
|
||||
*/
|
||||
*tex_bounds = clipped;
|
||||
|
||||
result = gsk_vulkan_offscreen_op (render,
|
||||
self->vulkan,
|
||||
&state->scale,
|
||||
&clipped,
|
||||
node);
|
||||
result = gsk_vulkan_render_pass_op_offscreen (render,
|
||||
self->vulkan,
|
||||
&state->scale,
|
||||
&clipped,
|
||||
node);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -836,11 +836,11 @@ gsk_vulkan_render_pass_add_repeat_node (GskVulkanRenderPass *self,
|
||||
if (graphene_rect_get_area (child_bounds) == 0)
|
||||
return TRUE;
|
||||
|
||||
image = gsk_vulkan_offscreen_op (render,
|
||||
self->vulkan,
|
||||
&state->scale,
|
||||
child_bounds,
|
||||
gsk_repeat_node_get_child (node));
|
||||
image = gsk_vulkan_render_pass_op_offscreen (render,
|
||||
self->vulkan,
|
||||
&state->scale,
|
||||
child_bounds,
|
||||
gsk_repeat_node_get_child (node));
|
||||
|
||||
gsk_vulkan_texture_op (render,
|
||||
gsk_vulkan_clip_get_clip_type (&state->clip, &state->offset, &node->bounds),
|
||||
|
228
gsk/vulkan/gskvulkanrenderpassop.c
Normal file
228
gsk/vulkan/gskvulkanrenderpassop.c
Normal file
@ -0,0 +1,228 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gskvulkanrenderpassopprivate.h"
|
||||
|
||||
#include "gskrendernodeprivate.h"
|
||||
#include "gskvulkanprivate.h"
|
||||
|
||||
#include "gdk/gdkvulkancontextprivate.h"
|
||||
|
||||
typedef struct _GskVulkanRenderPassOp GskVulkanRenderPassOp;
|
||||
|
||||
struct _GskVulkanRenderPassOp
|
||||
{
|
||||
GskVulkanOp op;
|
||||
|
||||
GskVulkanImage *image;
|
||||
GskVulkanRenderPass *render_pass;
|
||||
};
|
||||
|
||||
static void
|
||||
gsk_vulkan_render_pass_op_finish (GskVulkanOp *op)
|
||||
{
|
||||
GskVulkanRenderPassOp *self = (GskVulkanRenderPassOp *) op;
|
||||
|
||||
g_object_unref (self->image);
|
||||
gsk_vulkan_render_pass_free (self->render_pass);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_render_pass_op_print (GskVulkanOp *op,
|
||||
GString *string,
|
||||
guint indent)
|
||||
{
|
||||
GskVulkanRenderPassOp *self = (GskVulkanRenderPassOp *) op;
|
||||
|
||||
print_indent (string, indent);
|
||||
g_string_append_printf (string, "begin-render-pass %zux%zu ",
|
||||
gsk_vulkan_image_get_width (self->image),
|
||||
gsk_vulkan_image_get_height (self->image));
|
||||
print_newline (string);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_render_pass_op_upload (GskVulkanOp *op,
|
||||
GskVulkanUploader *uploader)
|
||||
{
|
||||
}
|
||||
|
||||
static gsize
|
||||
gsk_vulkan_render_pass_op_count_vertex_data (GskVulkanOp *op,
|
||||
gsize n_bytes)
|
||||
{
|
||||
return n_bytes;
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_render_pass_op_collect_vertex_data (GskVulkanOp *op,
|
||||
guchar *data)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_render_pass_op_reserve_descriptor_sets (GskVulkanOp *op,
|
||||
GskVulkanRender *render)
|
||||
{
|
||||
}
|
||||
|
||||
static GskVulkanOp *
|
||||
gsk_vulkan_render_pass_op_command (GskVulkanOp *op,
|
||||
GskVulkanRender *render,
|
||||
VkPipelineLayout pipeline_layout,
|
||||
VkCommandBuffer command_buffer)
|
||||
{
|
||||
GskVulkanRenderPassOp *self = (GskVulkanRenderPassOp *) op;
|
||||
|
||||
return gsk_vulkan_render_draw_pass (render, self->render_pass, op->next);
|
||||
}
|
||||
|
||||
static const GskVulkanOpClass GSK_VULKAN_RENDER_PASS_OP_CLASS = {
|
||||
GSK_VULKAN_OP_SIZE (GskVulkanRenderPassOp),
|
||||
GSK_VULKAN_STAGE_BEGIN_PASS,
|
||||
NULL,
|
||||
NULL,
|
||||
gsk_vulkan_render_pass_op_finish,
|
||||
gsk_vulkan_render_pass_op_print,
|
||||
gsk_vulkan_render_pass_op_upload,
|
||||
gsk_vulkan_render_pass_op_count_vertex_data,
|
||||
gsk_vulkan_render_pass_op_collect_vertex_data,
|
||||
gsk_vulkan_render_pass_op_reserve_descriptor_sets,
|
||||
gsk_vulkan_render_pass_op_command
|
||||
};
|
||||
|
||||
typedef struct _GskVulkanRenderPassEndOp GskVulkanRenderPassEndOp;
|
||||
|
||||
struct _GskVulkanRenderPassEndOp
|
||||
{
|
||||
GskVulkanOp op;
|
||||
|
||||
GskVulkanImage *image;
|
||||
};
|
||||
|
||||
static void
|
||||
gsk_vulkan_render_pass_end_op_finish (GskVulkanOp *op)
|
||||
{
|
||||
GskVulkanRenderPassEndOp *self = (GskVulkanRenderPassEndOp *) op;
|
||||
|
||||
g_object_unref (self->image);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_render_pass_end_op_print (GskVulkanOp *op,
|
||||
GString *string,
|
||||
guint indent)
|
||||
{
|
||||
GskVulkanRenderPassEndOp *self = (GskVulkanRenderPassEndOp *) op;
|
||||
|
||||
print_indent (string, indent);
|
||||
g_string_append_printf (string, "end-render-pass ");
|
||||
print_image (string, self->image);
|
||||
print_newline (string);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_render_pass_end_op_upload (GskVulkanOp *op,
|
||||
GskVulkanUploader *uploader)
|
||||
{
|
||||
}
|
||||
|
||||
static gsize
|
||||
gsk_vulkan_render_pass_end_op_count_vertex_data (GskVulkanOp *op,
|
||||
gsize n_bytes)
|
||||
{
|
||||
return n_bytes;
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_render_pass_end_op_collect_vertex_data (GskVulkanOp *op,
|
||||
guchar *data)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_render_pass_end_op_reserve_descriptor_sets (GskVulkanOp *op,
|
||||
GskVulkanRender *render)
|
||||
{
|
||||
}
|
||||
|
||||
static GskVulkanOp *
|
||||
gsk_vulkan_render_pass_end_op_command (GskVulkanOp *op,
|
||||
GskVulkanRender *render,
|
||||
VkPipelineLayout pipeline_layout,
|
||||
VkCommandBuffer command_buffer)
|
||||
{
|
||||
vkCmdEndRenderPass (command_buffer);
|
||||
|
||||
return op->next;
|
||||
}
|
||||
|
||||
static const GskVulkanOpClass GSK_VULKAN_RENDER_PASS_END_OP_CLASS = {
|
||||
GSK_VULKAN_OP_SIZE (GskVulkanRenderPassEndOp),
|
||||
GSK_VULKAN_STAGE_END_PASS,
|
||||
NULL,
|
||||
NULL,
|
||||
gsk_vulkan_render_pass_end_op_finish,
|
||||
gsk_vulkan_render_pass_end_op_print,
|
||||
gsk_vulkan_render_pass_end_op_upload,
|
||||
gsk_vulkan_render_pass_end_op_count_vertex_data,
|
||||
gsk_vulkan_render_pass_end_op_collect_vertex_data,
|
||||
gsk_vulkan_render_pass_end_op_reserve_descriptor_sets,
|
||||
gsk_vulkan_render_pass_end_op_command
|
||||
};
|
||||
|
||||
GskVulkanImage *
|
||||
gsk_vulkan_render_pass_op_offscreen (GskVulkanRender *render,
|
||||
GdkVulkanContext *context,
|
||||
const graphene_vec2_t *scale,
|
||||
const graphene_rect_t *viewport,
|
||||
GskRenderNode *node)
|
||||
{
|
||||
GskVulkanRenderPassOp *self;
|
||||
GskVulkanRenderPassEndOp *end;
|
||||
GskVulkanImage *image;
|
||||
graphene_rect_t view;
|
||||
cairo_region_t *clip;
|
||||
float scale_x, scale_y;
|
||||
|
||||
scale_x = graphene_vec2_get_x (scale);
|
||||
scale_y = graphene_vec2_get_y (scale);
|
||||
view = GRAPHENE_RECT_INIT (scale_x * viewport->origin.x,
|
||||
scale_y * viewport->origin.y,
|
||||
ceil (scale_x * viewport->size.width),
|
||||
ceil (scale_y * viewport->size.height));
|
||||
|
||||
image = gsk_vulkan_image_new_for_offscreen (context,
|
||||
gdk_vulkan_context_get_offscreen_format (context,
|
||||
gsk_render_node_get_preferred_depth (node)),
|
||||
view.size.width, view.size.height);
|
||||
|
||||
self = (GskVulkanRenderPassOp *) gsk_vulkan_op_alloc (render, &GSK_VULKAN_RENDER_PASS_OP_CLASS);
|
||||
|
||||
self->image = image;
|
||||
|
||||
clip = cairo_region_create_rectangle (&(cairo_rectangle_int_t) {
|
||||
0, 0,
|
||||
gsk_vulkan_image_get_width (self->image),
|
||||
gsk_vulkan_image_get_height (self->image)
|
||||
});
|
||||
|
||||
self->render_pass = gsk_vulkan_render_pass_new (context,
|
||||
render,
|
||||
self->image,
|
||||
scale,
|
||||
&view,
|
||||
clip,
|
||||
node,
|
||||
FALSE);
|
||||
|
||||
cairo_region_destroy (clip);
|
||||
|
||||
/* This invalidates the self pointer */
|
||||
gsk_vulkan_render_pass_add (self->render_pass, render, node);
|
||||
|
||||
end = (GskVulkanRenderPassEndOp *) gsk_vulkan_op_alloc (render, &GSK_VULKAN_RENDER_PASS_END_OP_CLASS);
|
||||
|
||||
end->image = g_object_ref (image);
|
||||
|
||||
return self->image;
|
||||
}
|
@ -4,7 +4,7 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GskVulkanImage * gsk_vulkan_offscreen_op (GskVulkanRender *render,
|
||||
GskVulkanImage * gsk_vulkan_render_pass_op_offscreen (GskVulkanRender *render,
|
||||
GdkVulkanContext *context,
|
||||
const graphene_vec2_t *scale,
|
||||
const graphene_rect_t *viewport,
|
Loading…
Reference in New Issue
Block a user