mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-12 20:00:09 +00:00
gpu: Allow passing a background color to renderpasses
It's not used yet, everybody is passing GDK_RGBA_TRANSPARENT.
This commit is contained in:
parent
df3c85ea7f
commit
af9a9422c4
@ -346,6 +346,7 @@ gsk_gpu_node_processor_init_draw (GskGpuNodeProcessor *self,
|
|||||||
gsk_gpu_render_pass_begin_op (frame,
|
gsk_gpu_render_pass_begin_op (frame,
|
||||||
image,
|
image,
|
||||||
&area,
|
&area,
|
||||||
|
&GDK_RGBA_TRANSPARENT,
|
||||||
GSK_RENDER_PASS_OFFSCREEN);
|
GSK_RENDER_PASS_OFFSCREEN);
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
@ -381,6 +382,7 @@ gsk_gpu_node_processor_process (GskGpuFrame *frame,
|
|||||||
gsk_gpu_render_pass_begin_op (frame,
|
gsk_gpu_render_pass_begin_op (frame,
|
||||||
target,
|
target,
|
||||||
clip,
|
clip,
|
||||||
|
&GDK_RGBA_TRANSPARENT,
|
||||||
GSK_RENDER_PASS_PRESENT);
|
GSK_RENDER_PASS_PRESENT);
|
||||||
|
|
||||||
gsk_gpu_node_processor_add_node (&self, node);
|
gsk_gpu_node_processor_add_node (&self, node);
|
||||||
@ -669,6 +671,7 @@ gsk_gpu_copy_image (GskGpuFrame *frame,
|
|||||||
gsk_gpu_render_pass_begin_op (other.frame,
|
gsk_gpu_render_pass_begin_op (other.frame,
|
||||||
copy,
|
copy,
|
||||||
&(cairo_rectangle_int_t) { 0, 0, width, height },
|
&(cairo_rectangle_int_t) { 0, 0, width, height },
|
||||||
|
&GDK_RGBA_TRANSPARENT,
|
||||||
GSK_RENDER_PASS_OFFSCREEN);
|
GSK_RENDER_PASS_OFFSCREEN);
|
||||||
|
|
||||||
gsk_gpu_node_processor_sync_globals (&other, 0);
|
gsk_gpu_node_processor_sync_globals (&other, 0);
|
||||||
|
@ -22,6 +22,7 @@ struct _GskGpuRenderPassOp
|
|||||||
|
|
||||||
GskGpuImage *target;
|
GskGpuImage *target;
|
||||||
cairo_rectangle_int_t area;
|
cairo_rectangle_int_t area;
|
||||||
|
float background[4];
|
||||||
GskRenderPassType pass_type;
|
GskRenderPassType pass_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -43,6 +44,9 @@ gsk_gpu_render_pass_op_print (GskGpuOp *op,
|
|||||||
|
|
||||||
gsk_gpu_print_op (string, indent, "begin-render-pass");
|
gsk_gpu_print_op (string, indent, "begin-render-pass");
|
||||||
gsk_gpu_print_image (string, self->target);
|
gsk_gpu_print_image (string, self->target);
|
||||||
|
gsk_gpu_print_int_rect (string, &self->area);
|
||||||
|
if (self->background[3] > 0)
|
||||||
|
gsk_gpu_print_rgba (string, self->background);
|
||||||
gsk_gpu_print_newline (string);
|
gsk_gpu_print_newline (string);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +141,16 @@ gsk_gpu_render_pass_op_vk_command (GskGpuOp *op,
|
|||||||
},
|
},
|
||||||
.clearValueCount = 1,
|
.clearValueCount = 1,
|
||||||
.pClearValues = (VkClearValue [1]) {
|
.pClearValues = (VkClearValue [1]) {
|
||||||
{ .color = { .float32 = { 0.f, 0.f, 0.f, 0.f } } }
|
{
|
||||||
|
.color = {
|
||||||
|
.float32 = {
|
||||||
|
self->background[0],
|
||||||
|
self->background[1],
|
||||||
|
self->background[2],
|
||||||
|
self->background[3]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
VK_SUBPASS_CONTENTS_INLINE);
|
VK_SUBPASS_CONTENTS_INLINE);
|
||||||
@ -179,7 +192,7 @@ gsk_gpu_render_pass_op_gl_command (GskGpuOp *op,
|
|||||||
glScissor (self->area.x, state->flip_y - self->area.y - self->area.height, self->area.width, self->area.height);
|
glScissor (self->area.x, state->flip_y - self->area.y - self->area.height, self->area.width, self->area.height);
|
||||||
else
|
else
|
||||||
glScissor (self->area.x, self->area.y, self->area.width, self->area.height);
|
glScissor (self->area.x, self->area.y, self->area.width, self->area.height);
|
||||||
glClearColor (0, 0, 0, 0);
|
glClearColor (self->background[0], self->background[1], self->background[2], self->background[3]);
|
||||||
glClear (GL_COLOR_BUFFER_BIT);
|
glClear (GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
op = op->next;
|
op = op->next;
|
||||||
@ -311,6 +324,7 @@ void
|
|||||||
gsk_gpu_render_pass_begin_op (GskGpuFrame *frame,
|
gsk_gpu_render_pass_begin_op (GskGpuFrame *frame,
|
||||||
GskGpuImage *image,
|
GskGpuImage *image,
|
||||||
const cairo_rectangle_int_t *area,
|
const cairo_rectangle_int_t *area,
|
||||||
|
const GdkRGBA *background,
|
||||||
GskRenderPassType pass_type)
|
GskRenderPassType pass_type)
|
||||||
{
|
{
|
||||||
GskGpuRenderPassOp *self;
|
GskGpuRenderPassOp *self;
|
||||||
@ -319,6 +333,7 @@ gsk_gpu_render_pass_begin_op (GskGpuFrame *frame,
|
|||||||
|
|
||||||
self->target = g_object_ref (image);
|
self->target = g_object_ref (image);
|
||||||
self->area = *area;
|
self->area = *area;
|
||||||
|
gsk_gpu_rgba_to_float (background, self->background);
|
||||||
self->pass_type = pass_type;
|
self->pass_type = pass_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ typedef enum
|
|||||||
void gsk_gpu_render_pass_begin_op (GskGpuFrame *frame,
|
void gsk_gpu_render_pass_begin_op (GskGpuFrame *frame,
|
||||||
GskGpuImage *image,
|
GskGpuImage *image,
|
||||||
const cairo_rectangle_int_t *area,
|
const cairo_rectangle_int_t *area,
|
||||||
|
const GdkRGBA *background,
|
||||||
GskRenderPassType pass_type);
|
GskRenderPassType pass_type);
|
||||||
void gsk_gpu_render_pass_end_op (GskGpuFrame *frame,
|
void gsk_gpu_render_pass_end_op (GskGpuFrame *frame,
|
||||||
GskGpuImage *image,
|
GskGpuImage *image,
|
||||||
|
Loading…
Reference in New Issue
Block a user