gpu: Convert values to float[4] from GdkRGBA

We need to make sure our clear values are in the right colorstate, not
in sRGB.

The occluision culling managed to sneak through the big transition for
that.
This commit is contained in:
Benjamin Otte 2024-07-13 02:05:41 +02:00
parent 761346ed5a
commit d54b68b93c
4 changed files with 10 additions and 7 deletions

View File

@ -384,7 +384,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_VEC4_TRANSPARENT,
GSK_RENDER_PASS_OFFSCREEN); GSK_RENDER_PASS_OFFSCREEN);
return image; return image;
@ -697,7 +697,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_VEC4_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);
@ -1627,6 +1627,7 @@ gsk_gpu_node_processor_add_first_color_node (GskGpuNodeProcessor *self,
GskRenderNode *node) GskRenderNode *node)
{ {
graphene_rect_t clip_bounds; graphene_rect_t clip_bounds;
float color[4];
if (!node->fully_opaque) if (!node->fully_opaque)
return FALSE; return FALSE;
@ -1635,10 +1636,11 @@ gsk_gpu_node_processor_add_first_color_node (GskGpuNodeProcessor *self,
if (!gsk_rect_contains_rect (&node->bounds, &clip_bounds)) if (!gsk_rect_contains_rect (&node->bounds, &clip_bounds))
return FALSE; return FALSE;
gdk_color_state_from_rgba (self->ccs, gsk_color_node_get_color (node), color);
gsk_gpu_render_pass_begin_op (self->frame, gsk_gpu_render_pass_begin_op (self->frame,
target, target,
clip, clip,
gsk_color_node_get_color (node), color,
pass_type); pass_type);
return TRUE; return TRUE;
@ -3921,7 +3923,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_VEC4_TRANSPARENT,
pass_type); pass_type);
gsk_gpu_node_processor_add_node (&self, node); gsk_gpu_node_processor_add_node (&self, node);

View File

@ -330,7 +330,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 *clear_color_or_null, float clear_color_or_null[4],
GskRenderPassType pass_type) GskRenderPassType pass_type)
{ {
GskGpuRenderPassOp *self; GskGpuRenderPassOp *self;
@ -341,7 +341,7 @@ gsk_gpu_render_pass_begin_op (GskGpuFrame *frame,
self->area = *area; self->area = *area;
self->clear = clear_color_or_null != NULL; self->clear = clear_color_or_null != NULL;
if (clear_color_or_null) if (clear_color_or_null)
gsk_gpu_rgba_to_float (clear_color_or_null, self->clear_color); gsk_gpu_color_to_float (clear_color_or_null, self->clear_color);
self->pass_type = pass_type; self->pass_type = pass_type;
} }

View File

@ -11,7 +11,7 @@ G_BEGIN_DECLS
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 *clear_color_or_null, float clear_color_or_null[4],
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,

View File

@ -68,6 +68,7 @@ GskGpuOp * gsk_gpu_shader_op_gl_command (GskGpuO
#define GSK_RGBA_TO_VEC4(_color) (float[4]) { (_color)->red, (_color)->green, (_color)->blue, (_color)->alpha } #define GSK_RGBA_TO_VEC4(_color) (float[4]) { (_color)->red, (_color)->green, (_color)->blue, (_color)->alpha }
#define GSK_RGBA_TO_VEC4_ALPHA(_color, _alpha) (float[4]) { (_color)->red, (_color)->green, (_color)->blue, (_color)->alpha * (_alpha) } #define GSK_RGBA_TO_VEC4_ALPHA(_color, _alpha) (float[4]) { (_color)->red, (_color)->green, (_color)->blue, (_color)->alpha * (_alpha) }
#define GSK_VEC4_TRANSPARENT (float[4]) { 0.0f, 0.0f, 0.0f, 0.0f }
static inline void static inline void
gsk_gpu_color_to_float (const float color[4], gsk_gpu_color_to_float (const float color[4],