mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-01 00:11:29 +00:00
Merge branch 'wip/otte/for-main' into 'main'
gpu: Fix color convert path to not crash See merge request GNOME/gtk!7450
This commit is contained in:
commit
c7fcaaf443
@ -30,6 +30,9 @@ gsk_gpu_blend_op_print (GskGpuOp *op,
|
||||
gsk_gpu_print_op (string, indent, "blend");
|
||||
switch (self->blend)
|
||||
{
|
||||
case GSK_GPU_BLEND_NONE:
|
||||
gsk_gpu_print_string (string, "none");
|
||||
break;
|
||||
case GSK_GPU_BLEND_OVER:
|
||||
gsk_gpu_print_string (string, "over");
|
||||
break;
|
||||
@ -69,15 +72,25 @@ gsk_gpu_blend_op_gl_command (GskGpuOp *op,
|
||||
|
||||
switch (self->blend)
|
||||
{
|
||||
case GSK_GPU_BLEND_NONE:
|
||||
glDisable (GL_BLEND);
|
||||
break;
|
||||
|
||||
case GSK_GPU_BLEND_OVER:
|
||||
glEnable (GL_BLEND);
|
||||
glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
break;
|
||||
|
||||
case GSK_GPU_BLEND_ADD:
|
||||
glEnable (GL_BLEND);
|
||||
glBlendFunc (GL_ONE, GL_ONE);
|
||||
break;
|
||||
|
||||
case GSK_GPU_BLEND_CLEAR:
|
||||
glEnable (GL_BLEND);
|
||||
glBlendFunc (GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
|
@ -693,13 +693,14 @@ gsk_gpu_copy_image (GskGpuFrame *frame,
|
||||
&(cairo_rectangle_int_t) { 0, 0, width, height },
|
||||
&rect);
|
||||
|
||||
/* FIXME: With blend mode SOURCE/OFF we wouldn't need the clear here */
|
||||
gsk_gpu_render_pass_begin_op (other.frame,
|
||||
copy,
|
||||
&(cairo_rectangle_int_t) { 0, 0, width, height },
|
||||
GSK_VEC4_TRANSPARENT,
|
||||
NULL,
|
||||
GSK_RENDER_PASS_OFFSCREEN);
|
||||
|
||||
other.blend = GSK_GPU_BLEND_NONE;
|
||||
other.pending_globals |= GSK_GPU_GLOBAL_BLEND;
|
||||
gsk_gpu_node_processor_sync_globals (&other, 0);
|
||||
|
||||
gsk_gpu_node_processor_image_op (&other,
|
||||
@ -3928,6 +3929,10 @@ gsk_gpu_node_processor_process (GskGpuFrame *frame,
|
||||
|
||||
gsk_gpu_node_processor_add_node (&self, node);
|
||||
}
|
||||
|
||||
gsk_gpu_render_pass_end_op (frame,
|
||||
target,
|
||||
pass_type);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3951,7 +3956,13 @@ gsk_gpu_node_processor_process (GskGpuFrame *frame,
|
||||
|
||||
if (image != NULL)
|
||||
{
|
||||
self.blend = GSK_GPU_BLEND_ADD;
|
||||
gsk_gpu_render_pass_begin_op (frame,
|
||||
target,
|
||||
clip,
|
||||
NULL,
|
||||
pass_type);
|
||||
|
||||
self.blend = GSK_GPU_BLEND_NONE;
|
||||
self.pending_globals |= GSK_GPU_GLOBAL_BLEND;
|
||||
gsk_gpu_node_processor_sync_globals (&self, 0);
|
||||
|
||||
@ -3966,15 +3977,15 @@ gsk_gpu_node_processor_process (GskGpuFrame *frame,
|
||||
&node->bounds,
|
||||
&self.offset,
|
||||
&tex_rect);
|
||||
|
||||
gsk_gpu_render_pass_end_op (frame,
|
||||
target,
|
||||
pass_type);
|
||||
|
||||
g_object_unref (image);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
gsk_gpu_render_pass_end_op (frame,
|
||||
target,
|
||||
pass_type);
|
||||
|
||||
gsk_gpu_node_processor_finish (&self);
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,7 @@ typedef enum {
|
||||
} GskGpuShaderClip;
|
||||
|
||||
typedef enum {
|
||||
GSK_GPU_BLEND_NONE,
|
||||
GSK_GPU_BLEND_OVER,
|
||||
GSK_GPU_BLEND_ADD,
|
||||
GSK_GPU_BLEND_CLEAR
|
||||
|
@ -911,7 +911,14 @@ struct _GskVulkanShaderSpecialization
|
||||
guint32 variation;
|
||||
};
|
||||
|
||||
static VkPipelineColorBlendAttachmentState blend_attachment_states[3] = {
|
||||
static VkPipelineColorBlendAttachmentState blend_attachment_states[4] = {
|
||||
[GSK_GPU_BLEND_NONE] = {
|
||||
.blendEnable = VK_FALSE,
|
||||
.colorWriteMask = VK_COLOR_COMPONENT_A_BIT
|
||||
| VK_COLOR_COMPONENT_R_BIT
|
||||
| VK_COLOR_COMPONENT_G_BIT
|
||||
| VK_COLOR_COMPONENT_B_BIT
|
||||
},
|
||||
[GSK_GPU_BLEND_OVER] = {
|
||||
.blendEnable = VK_TRUE,
|
||||
.colorBlendOp = VK_BLEND_OP_ADD,
|
||||
|
Loading…
Reference in New Issue
Block a user