diff options
-rw-r--r-- | gsk/ngl/fp16private.h | 2 | ||||
-rw-r--r-- | gsk/ngl/gsknglrenderjob.c | 184 |
2 files changed, 105 insertions, 81 deletions
diff --git a/gsk/ngl/fp16private.h b/gsk/ngl/fp16private.h index 3f74605288..f54f7307a6 100644 --- a/gsk/ngl/fp16private.h +++ b/gsk/ngl/fp16private.h @@ -30,6 +30,8 @@ G_BEGIN_DECLS +#define FP16_ZERO ((guint16)0) +#define FP16_ONE ((guint16)15360) #define FP16_MINUS_ONE ((guint16)48128) #ifdef GRAPHENE_USE_SSE diff --git a/gsk/ngl/gsknglrenderjob.c b/gsk/ngl/gsknglrenderjob.c index 56832efeea..b1bda44790 100644 --- a/gsk/ngl/gsknglrenderjob.c +++ b/gsk/ngl/gsknglrenderjob.c @@ -886,10 +886,10 @@ gsk_ngl_render_job_update_clip (GskNglRenderJob *job, } static inline void -rgba_to_half (const GdkRGBA *c, +rgba_to_half (const GdkRGBA *rgba, guint16 h[4]) { - float_to_half4 ((const float *)c, h); + float_to_half4 ((const float *)rgba, h); } /* fill_vertex_data */ @@ -903,12 +903,9 @@ gsk_ngl_render_job_draw_coords (GskNglRenderJob *job, float min_v, float max_u, float max_v, - const GdkRGBA *color) + guint16 c[4]) { GskNglDrawVertex *vertices = gsk_ngl_command_queue_add_vertices (job->command_queue); - guint16 c[4]; - - rgba_to_half (color, c); vertices[0] = (GskNglDrawVertex) { .position = { min_x, min_y }, .uv = { min_u, min_v }, .color = { c[0], c[1], c[2], c[3] } }; vertices[1] = (GskNglDrawVertex) { .position = { min_x, max_y }, .uv = { min_u, max_v }, .color = { c[0], c[1], c[2], c[3] } }; @@ -923,7 +920,7 @@ static inline void gsk_ngl_render_job_draw_offscreen_with_color (GskNglRenderJob *job, const graphene_rect_t *bounds, const GskNglRenderOffscreen *offscreen, - const GdkRGBA *color) + guint16 color[4]) { float min_x = job->offset_x + bounds->origin.x; float min_y = job->offset_y + bounds->origin.y; @@ -943,7 +940,8 @@ gsk_ngl_render_job_draw_offscreen (GskNglRenderJob *job, const graphene_rect_t *bounds, const GskNglRenderOffscreen *offscreen) { - gsk_ngl_render_job_draw_offscreen_with_color (job, bounds, offscreen, &(GdkRGBA) { 0.f, 0.f, 0.f, 0.f }); + gsk_ngl_render_job_draw_offscreen_with_color (job, bounds, offscreen, + (guint16[]) { FP16_ZERO, FP16_ZERO, FP16_ZERO, FP16_ZERO }); } /* load_float_vertex_data */ @@ -953,7 +951,7 @@ gsk_ngl_render_job_draw_with_color (GskNglRenderJob *job, float y, float width, float height, - const GdkRGBA *color) + guint16 color[4]) { float min_x = job->offset_x + x; float min_y = job->offset_y + y; @@ -970,14 +968,15 @@ gsk_ngl_render_job_draw (GskNglRenderJob *job, float width, float height) { - gsk_ngl_render_job_draw_with_color (job, x, y, width, height, &(GdkRGBA) { 0.f, 0.f, 0.f, 0.f }); + gsk_ngl_render_job_draw_with_color (job, x, y, width, height, + (guint16[]) { FP_ZERO, FP_ZERO, FP_ZERO, FP_ZERO }); } /* load_vertex_data */ static inline void gsk_ngl_render_job_draw_rect_with_color (GskNglRenderJob *job, const graphene_rect_t *bounds, - const GdkRGBA *color) + guint16 color[4]) { gsk_ngl_render_job_draw_with_color (job, bounds->origin.x, @@ -1006,11 +1005,12 @@ gsk_ngl_render_job_draw_offscreen_rect (GskNglRenderJob *job, float min_y = job->offset_y + bounds->origin.y; float max_x = min_x + bounds->size.width; float max_y = min_y + bounds->size.height; + guint16 color[4] = { FP16_ZERO, FP16_ZERO, FP16_ZERO, FP16_ZERO }; gsk_ngl_render_job_draw_coords (job, min_x, min_y, max_x, max_y, 0, 1, 1, 0, - &(GdkRGBA) { 0.f, 0.f, 0.f, 0.f } ); + color); } static inline void @@ -1264,7 +1264,7 @@ blur_offscreen (GskNglRenderJob *job, gsk_ngl_render_job_draw_coords (job, 0, 0, texture_to_blur_width, texture_to_blur_height, 0, 1, 1, 0, - &(GdkRGBA) { 0.f, 0.f, 0.f, 0.f }); + (guint16[]) { FP16_ZERO, FP16_ZERO, FP16_ZERO, FP16_ZERO }); gsk_ngl_render_job_end_draw (job); /* Bind second pass framebuffer and clear it */ @@ -1291,7 +1291,7 @@ blur_offscreen (GskNglRenderJob *job, gsk_ngl_render_job_draw_coords (job, 0, 0, texture_to_blur_width, texture_to_blur_height, 0, 1, 1, 0, - &(GdkRGBA) { 0.f, 0.f, 0.f, 0.f }); + (guint16[]) { FP16_ZERO, FP16_ZERO, FP16_ZERO, FP16_ZERO }); gsk_ngl_render_job_end_draw (job); gsk_ngl_render_job_pop_modelview (job); @@ -1364,10 +1364,11 @@ static inline void gsk_ngl_render_job_visit_color_node (GskNglRenderJob *job, const GskRenderNode *node) { + guint16 color[4]; + + rgba_to_half (gsk_color_node_get_color (node), color); gsk_ngl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, color)); - gsk_ngl_render_job_draw_rect_with_color (job, - &node->bounds, - gsk_color_node_get_color (node)); + gsk_ngl_render_job_draw_rect_with_color (job, &node->bounds, color); gsk_ngl_render_job_end_draw (job); } @@ -1638,28 +1639,41 @@ gsk_ngl_render_job_visit_rect_border_node (GskNglRenderJob *job, const float *widths = gsk_border_node_get_widths (node); const graphene_point_t *origin = &node->bounds.origin; const graphene_size_t *size = &node->bounds.size; + guint16 color[4]; gsk_ngl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, color)); if (widths[0] > 0) - gsk_ngl_render_job_draw_rect_with_color (job, - &GRAPHENE_RECT_INIT (origin->x, origin->y, size->width - widths[1], widths[0]), - &colors[0]); + { + rgba_to_half (&colors[0], color); + gsk_ngl_render_job_draw_rect_with_color (job, + &GRAPHENE_RECT_INIT (origin->x, origin->y, size->width - widths[1], widths[0]), + color); + } if (widths[1] > 0) - gsk_ngl_render_job_draw_rect_with_color (job, - &GRAPHENE_RECT_INIT (origin->x + size->width - widths[1], origin->y, widths[1], size->height - widths[2]), - &colors[0]); + { + rgba_to_half (&colors[1], color); + gsk_ngl_render_job_draw_rect_with_color (job, + &GRAPHENE_RECT_INIT (origin->x + size->width - widths[1], origin->y, widths[1], size->height - widths[2]), + color); + } if (widths[2] > 0) - gsk_ngl_render_job_draw_rect_with_color (job, - &GRAPHENE_RECT_INIT (origin->x + widths[3], origin->y + size->height - widths[2], size->width - widths[1], widths[2]), - &colors[0]); + { + rgba_to_half (&colors[2], color); + gsk_ngl_render_job_draw_rect_with_color (job, + &GRAPHENE_RECT_INIT (origin->x + widths[3], origin->y + size->height - widths[2], size->width - widths[1], widths[2]), + color); + } if (widths[3] > 0) - gsk_ngl_render_job_draw_rect_with_color (job, - &GRAPHENE_RECT_INIT (origin->x, origin->y + widths[0], widths[3], size->height - widths[0]), - &colors[0]); + { + rgba_to_half (&colors[3], color); + gsk_ngl_render_job_draw_rect_with_color (job, + &GRAPHENE_RECT_INIT (origin->x, origin->y + widths[0], widths[3], size->height - widths[0]), + color); + } gsk_ngl_render_job_end_draw (job); } @@ -1680,7 +1694,7 @@ gsk_ngl_render_job_visit_border_node (GskNglRenderJob *job, float max_x = min_x + node->bounds.size.width; float max_y = min_y + node->bounds.size.height; GskRoundedRect outline; - guint16 c[4]; + guint16 color[4]; memset (sizes, 0, sizeof sizes); @@ -1724,60 +1738,60 @@ gsk_ngl_render_job_visit_border_node (GskNglRenderJob *job, { GskNglDrawVertex *vertices = gsk_ngl_command_queue_add_vertices (job->command_queue); - rgba_to_half (&colors[0], c); + rgba_to_half (&colors[0], color); - vertices[0] = (GskNglDrawVertex) { .position = { min_x, min_y }, .uv = { 0, 1 }, .color = { c[0], c[1], c[2], c[3] } }; - vertices[1] = (GskNglDrawVertex) { .position = { min_x + sizes[0].w, min_y + sizes[0].h }, .uv = { 0, 0 }, .color = { c[0], c[1], c[2], c[3] } }; - vertices[2] = (GskNglDrawVertex) { .position = { max_x, min_y }, .uv = { 1, 1 }, .color = { c[0], c[1], c[2], c[3] } }; + vertices[0] = (GskNglDrawVertex) { .position = { min_x, min_y }, .uv = { 0, 1 }, .color = { color[0], color[1], color[2], color[3] } }; + vertices[1] = (GskNglDrawVertex) { .position = { min_x + sizes[0].w, min_y + sizes[0].h }, .uv = { 0, 0 }, .color = { color[0], color[1], color[2], color[3] } }; + vertices[2] = (GskNglDrawVertex) { .position = { max_x, min_y }, .uv = { 1, 1 }, .color = { color[0], color[1], color[2], color[3] } }; - vertices[3] = (GskNglDrawVertex) { .position = { max_x - sizes[1].w, min_y + sizes[1].h }, .uv = { 1, 0 }, .color = { c[0], c[1], c[2], c[3] } }; - vertices[4] = (GskNglDrawVertex) { .position = { min_x + sizes[0].w, min_y + sizes[0].h }, .uv = { 0, 0 }, .color = { c[0], c[1], c[2], c[3] } }; - vertices[5] = (GskNglDrawVertex) { .position = { max_x, min_y }, .uv = { 1, 1 }, .color = { c[0], c[1], c[2], c[3] } }; + vertices[3] = (GskNglDrawVertex) { .position = { max_x - sizes[1].w, min_y + sizes[1].h }, .uv = { 1, 0 }, .color = { color[0], color[1], color[2], color[3] } }; + vertices[4] = (GskNglDrawVertex) { .position = { min_x + sizes[0].w, min_y + sizes[0].h }, .uv = { 0, 0 }, .color = { color[0], color[1], color[2], color[3] } }; + vertices[5] = (GskNglDrawVertex) { .position = { max_x, min_y }, .uv = { 1, 1 }, .color = { color[0], color[1], color[2], color[3] } }; } if (widths[1] > 0) { GskNglDrawVertex *vertices = gsk_ngl_command_queue_add_vertices (job->command_queue); - rgba_to_half (&colors[1], c); + rgba_to_half (&colors[1], color); - vertices[0] = (GskNglDrawVertex) { .position = { max_x - sizes[1].w, min_y + sizes[1].h }, .uv = { 0, 1 }, .color = { c[0], c[1], c[2], c[3] } }; - vertices[1] = (GskNglDrawVertex) { .position = { max_x - sizes[2].w, max_y - sizes[2].h }, .uv = { 0, 0 }, .color = { c[0], c[1], c[2], c[3] } }; - vertices[2] = (GskNglDrawVertex) { .position = { max_x, min_y }, .uv = { 1, 1 }, .color = { c[0], c[1], c[2], c[3] } }; + vertices[0] = (GskNglDrawVertex) { .position = { max_x - sizes[1].w, min_y + sizes[1].h }, .uv = { 0, 1 }, .color = { color[0], color[1], color[2], color[3] } }; + vertices[1] = (GskNglDrawVertex) { .position = { max_x - sizes[2].w, max_y - sizes[2].h }, .uv = { 0, 0 }, .color = { color[0], color[1], color[2], color[3] } }; + vertices[2] = (GskNglDrawVertex) { .position = { max_x, min_y }, .uv = { 1, 1 }, .color = { color[0], color[1], color[2], color[3] } }; - vertices[3] = (GskNglDrawVertex) { .position = { max_x, max_y }, .uv = { 1, 0 }, .color = { c[0], c[1], c[2], c[3] } }; - vertices[4] = (GskNglDrawVertex) { .position = { max_x - sizes[2].w, max_y - sizes[2].h }, .uv = { 0, 0 }, .color = { c[0], c[1], c[2], c[3] } }; - vertices[5] = (GskNglDrawVertex) { .position = { max_x, min_y }, .uv = { 1, 1 }, .color = { c[0], c[1], c[2], c[3] } }; + vertices[3] = (GskNglDrawVertex) { .position = { max_x, max_y }, .uv = { 1, 0 }, .color = { color[0], color[1], color[2], color[3] } }; + vertices[4] = (GskNglDrawVertex) { .position = { max_x - sizes[2].w, max_y - sizes[2].h }, .uv = { 0, 0 }, .color = { color[0], color[1], color[2], color[3] } }; + vertices[5] = (GskNglDrawVertex) { .position = { max_x, min_y }, .uv = { 1, 1 }, .color = { color[0], color[1], color[2], color[3] } }; } if (widths[2] > 0) { GskNglDrawVertex *vertices = gsk_ngl_command_queue_add_vertices (job->command_queue); - rgba_to_half (&colors[2], c); + rgba_to_half (&colors[2], color); - vertices[0] = (GskNglDrawVertex) { .position = { min_x + sizes[3].w, max_y - sizes[3].h }, .uv = { 0, 1 }, .color = { c[0], c[1], c[2], c[3] } }; - vertices[1] = (GskNglDrawVertex) { .position = { min_x, max_y }, .uv = { 0, 0 }, .color = { c[0], c[1], c[2], c[3] } }; - vertices[2] = (GskNglDrawVertex) { .position = { max_x - sizes[2].w, max_y - sizes[2].h }, .uv = { 1, 1 }, .color = { c[0], c[1], c[2], c[3] } }; + vertices[0] = (GskNglDrawVertex) { .position = { min_x + sizes[3].w, max_y - sizes[3].h }, .uv = { 0, 1 }, .color = { color[0], color[1], color[2], color[3] } }; + vertices[1] = (GskNglDrawVertex) { .position = { min_x, max_y }, .uv = { 0, 0 }, .color = { color[0], color[1], color[2], color[3] } }; + vertices[2] = (GskNglDrawVertex) { .position = { max_x - sizes[2].w, max_y - sizes[2].h }, .uv = { 1, 1 }, .color = { color[0], color[1], color[2], color[3] } }; - vertices[3] = (GskNglDrawVertex) { .position = { max_x, max_y }, .uv = { 1, 0 }, .color = { c[0], c[1], c[2], c[3] } }; - vertices[4] = (GskNglDrawVertex) { .position = { min_x , max_y }, .uv = { 0, 0 }, .color = { c[0], c[1], c[2], c[3] } }; - vertices[5] = (GskNglDrawVertex) { .position = { max_x - sizes[2].w, max_y - sizes[2].h }, .uv = { 1, 1 }, .color = { c[0], c[1], c[2], c[3] } }; + vertices[3] = (GskNglDrawVertex) { .position = { max_x, max_y }, .uv = { 1, 0 }, .color = { color[0], color[1], color[2], color[3] } }; + vertices[4] = (GskNglDrawVertex) { .position = { min_x , max_y }, .uv = { 0, 0 }, .color = { color[0], color[1], color[2], color[3] } }; + vertices[5] = (GskNglDrawVertex) { .position = { max_x - sizes[2].w, max_y - sizes[2].h }, .uv = { 1, 1 }, .color = { color[0], color[1], color[2], color[3] } }; } if (widths[3] > 0) { GskNglDrawVertex *vertices = gsk_ngl_command_queue_add_vertices (job->command_queue); - rgba_to_half (&colors[3], c); + rgba_to_half (&colors[3], color); - vertices[0] = (GskNglDrawVertex) { .position = { min_x, min_y }, .uv = { 0, 1 }, .color = { c[0], c[1], c[2], c[3] } }; - vertices[1] = (GskNglDrawVertex) { .position = { min_x, max_y }, .uv = { 0, 0 }, .color = { c[0], c[1], c[2], c[3] } }; - vertices[2] = (GskNglDrawVertex) { .position = { min_x + sizes[0].w, min_y + sizes[0].h }, .uv = { 1, 1 }, .color = { c[0], c[1], c[2], c[3] } }; + vertices[0] = (GskNglDrawVertex) { .position = { min_x, min_y }, .uv = { 0, 1 }, .color = { color[0], color[1], color[2], color[3] } }; + vertices[1] = (GskNglDrawVertex) { .position = { min_x, max_y }, .uv = { 0, 0 }, .color = { color[0], color[1], color[2], color[3] } }; + vertices[2] = (GskNglDrawVertex) { .position = { min_x + sizes[0].w, min_y + sizes[0].h }, .uv = { 1, 1 }, .color = { color[0], color[1], color[2], color[3] } }; - vertices[3] = (GskNglDrawVertex) { .position = { min_x + sizes[3].w, max_y - sizes[3].h }, .uv = { 1, 0 }, .color = { c[0], c[1], c[2], c[3] } }; - vertices[4] = (GskNglDrawVertex) { .position = { min_x, max_y }, .uv = { 0, 0 }, .color = { c[0], c[1], c[2], c[3] } }; - vertices[5] = (GskNglDrawVertex) { .position = { min_x + sizes[0].w, min_y + sizes[0].h }, .uv = { 1, 1 }, .color = { c[0], c[1], c[2], c[3] } }; + vertices[3] = (GskNglDrawVertex) { .position = { min_x + sizes[3].w, max_y - sizes[3].h }, .uv = { 1, 0 }, .color = { color[0], color[1], color[2], color[3] } }; + vertices[4] = (GskNglDrawVertex) { .position = { min_x, max_y }, .uv = { 0, 0 }, .color = { color[0], color[1], color[2], color[3] } }; + vertices[5] = (GskNglDrawVertex) { .position = { min_x + sizes[0].w, min_y + sizes[0].h }, .uv = { 1, 1 }, .color = { color[0], color[1], color[2], color[3] } }; } gsk_ngl_render_job_end_draw (job); @@ -1795,8 +1809,6 @@ gsk_ngl_render_job_visit_css_background (GskNglRenderJob *job, const GskRenderNode *node2) { const GskRenderNode *child = gsk_rounded_clip_node_get_child (node); - const GdkRGBA *color = gsk_border_node_get_colors (node2); - const GdkRGBA *color2 = gsk_color_node_get_color (child); const GskRoundedRect *rounded_outline = gsk_border_node_get_outline (node2); const float *widths = gsk_border_node_get_widths (node2); float min_x = job->offset_x + node2->bounds.origin.x; @@ -1805,13 +1817,14 @@ gsk_ngl_render_job_visit_css_background (GskNglRenderJob *job, float max_y = min_y + node2->bounds.size.height; GskRoundedRect outline; GskNglDrawVertex *vertices; - guint16 c[4], c2[4]; + guint16 color[4]; + guint16 color2[4]; if (node_is_invisible (node2)) return; - rgba_to_half (&color[0], c); - rgba_to_half (color2, c2); + rgba_to_half (&gsk_border_node_get_colors (node2)[0], color); + rgba_to_half (gsk_color_node_get_color (child), color2); gsk_ngl_render_job_transform_rounded_rect (job, rounded_outline, &outline); @@ -1827,12 +1840,12 @@ gsk_ngl_render_job_visit_css_background (GskNglRenderJob *job, vertices = gsk_ngl_command_queue_add_vertices (job->command_queue); - vertices[0] = (GskNglDrawVertex) { .position = { min_x, min_y }, .color = { c[0], c[1], c[2], c[3] }, .color2 = { c2[0], c2[1], c2[2], c2[3] } }; - vertices[1] = (GskNglDrawVertex) { .position = { min_x, max_y }, .color = { c[0], c[1], c[2], c[3] }, .color2 = { c2[0], c2[1], c2[2], c2[3] } }; - vertices[2] = (GskNglDrawVertex) { .position = { max_x, min_y }, .color = { c[0], c[1], c[2], c[3] }, .color2 = { c2[0], c2[1], c2[2], c2[3] } }; - vertices[3] = (GskNglDrawVertex) { .position = { max_x, max_y }, .color = { c[0], c[1], c[2], c[3] }, .color2 = { c2[0], c2[1], c2[2], c2[3] } }; - vertices[4] = (GskNglDrawVertex) { .position = { min_x, max_y }, .color = { c[0], c[1], c[2], c[3] }, .color2 = { c2[0], c2[1], c2[2], c2[3] } }; - vertices[5] = (GskNglDrawVertex) { .position = { max_x, min_y }, .color = { c[0], c[1], c[2], c[3] }, .color2 = { c2[0], c2[1], c2[2], c2[3] } }; + vertices[0] = (GskNglDrawVertex) { .position = { min_x, min_y }, .color = { color[0], color[1], color[2], color[3] }, .color2 = { color2[0], color2[1], color2[2], color2[3] } }; + vertices[1] = (GskNglDrawVertex) { .position = { min_x, max_y }, .color = { color[0], color[1], color[2], color[3] }, .color2 = { color2[0], color2[1], color2[2], color2[3] } }; + vertices[2] = (GskNglDrawVertex) { .position = { max_x, min_y }, .color = { color[0], color[1], color[2], color[3] }, .color2 = { color2[0], color2[1], color2[2], color2[3] } }; + vertices[3] = (GskNglDrawVertex) { .position = { max_x, max_y }, .color = { color[0], color[1], color[2], color[3] }, .color2 = { color2[0], color2[1], color2[2], color2[3] } }; + vertices[4] = (GskNglDrawVertex) { .position = { min_x, max_y }, .color = { color[0], color[1], color[2], color[3] }, .color2 = { color2[0], color2[1], color2[2], color2[3] } }; + vertices[5] = (GskNglDrawVertex) { .position = { max_x, min_y }, .color = { color[0], color[1], color[2], color[3] }, .color2 = { color2[0], color2[1], color2[2], color2[3] } }; gsk_ngl_render_job_end_draw (job); } @@ -1957,6 +1970,7 @@ gsk_ngl_render_job_visit_unblurred_inset_shadow_node (GskNglRenderJob *job, { const GskRoundedRect *outline = gsk_inset_shadow_node_get_outline (node); GskRoundedRect transformed_outline; + guint16 color[4]; gsk_ngl_render_job_transform_rounded_rect (job, outline, &transformed_outline); @@ -1971,7 +1985,8 @@ gsk_ngl_render_job_visit_unblurred_inset_shadow_node (GskNglRenderJob *job, UNIFORM_INSET_SHADOW_OFFSET, 0, gsk_inset_shadow_node_get_dx (node), gsk_inset_shadow_node_get_dy (node)); - gsk_ngl_render_job_draw_rect_with_color (job, &node->bounds, gsk_inset_shadow_node_get_color (node)); + rgba_to_half (gsk_inset_shadow_node_get_color (node), color); + gsk_ngl_render_job_draw_rect_with_color (job, &node->bounds, color); gsk_ngl_render_job_end_draw (job); } @@ -1992,6 +2007,7 @@ gsk_ngl_render_job_visit_blurred_inset_shadow_node (GskNglRenderJob *job, int blurred_texture_id; GskTextureKey key; GskNglRenderOffscreen offscreen = {0}; + guint16 color[4]; g_assert (blur_radius > 0); @@ -2071,9 +2087,10 @@ gsk_ngl_render_job_visit_blurred_inset_shadow_node (GskNglRenderJob *job, UNIFORM_INSET_SHADOW_OFFSET, 0, offset_x * scale_x, offset_y * scale_y); + rgba_to_half (gsk_inset_shadow_node_get_color (node), color); gsk_ngl_render_job_draw_with_color (job, 0, 0, texture_width, texture_height, - gsk_inset_shadow_node_get_color (node)); + color); gsk_ngl_render_job_end_draw (job); gsk_ngl_render_job_pop_modelview (job); @@ -2156,7 +2173,7 @@ gsk_ngl_render_job_visit_unblurred_outset_shadow_node (GskNglRenderJob *job, float spread = gsk_outset_shadow_node_get_spread (node); float dx = gsk_outset_shadow_node_get_dx (node); float dy = gsk_outset_shadow_node_get_dy (node); - const GdkRGBA *color = gsk_outset_shadow_node_get_color (node); + guint16 color[4]; const float edge_sizes[] = { // Top, right, bottom, left spread - dy, spread + dx, spread + dy, spread - dx }; @@ -2167,6 +2184,8 @@ gsk_ngl_render_job_visit_unblurred_outset_shadow_node (GskNglRenderJob *job, { outline->corner[3].width + spread - dx, outline->corner[3].height + spread + dy }, }; + rgba_to_half (gsk_outset_shadow_node_get_color (node), color); + gsk_ngl_render_job_transform_rounded_rect (job, outline, &transformed_outline); gsk_ngl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, unblurred_outset_shadow)); @@ -2229,10 +2248,7 @@ static inline void gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job, const GskRenderNode *node) { - static const GdkRGBA white = { 1, 1, 1, 1 }; - const GskRoundedRect *outline = gsk_outset_shadow_node_get_outline (node); - const GdkRGBA *color = gsk_outset_shadow_node_get_color (node); float scale_x = job->scale_x; float scale_y = job->scale_y; float blur_radius = gsk_outset_shadow_node_get_blur_radius (node); @@ -2249,6 +2265,9 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job, int blurred_texture_id; int cached_tid; gboolean do_slicing; + guint16 color[4]; + + rgba_to_half (gsk_outset_shadow_node_get_color (node), color); /* scaled_outline is the minimal outline we need to draw the given drop shadow, * enlarged by the spread and offset by the blur radius. */ @@ -2330,7 +2349,8 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job, /* Draw the outline using color program */ gsk_ngl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, color)); - gsk_ngl_render_job_draw_with_color (job, 0, 0, texture_width, texture_height, &white); + gsk_ngl_render_job_draw_with_color (job, 0, 0, texture_width, texture_height, + (guint16[]){ FP16_ONE, FP16_ONE, FP16_ONE, FP16_ONE }); gsk_ngl_render_job_end_draw (job); /* Reset state from offscreen */ @@ -2844,6 +2864,7 @@ gsk_ngl_render_job_visit_shadow_node (GskNglRenderJob *job, const float dy = shadow->dy; GskNglRenderOffscreen offscreen = {0}; graphene_rect_t bounds; + guint16 color[4]; if (shadow->radius == 0 && gsk_render_node_get_node_type (shadow_child) == GSK_TEXT_NODE) @@ -2906,7 +2927,8 @@ gsk_ngl_render_job_visit_shadow_node (GskNglRenderJob *job, GL_TEXTURE_2D, GL_TEXTURE0, offscreen.texture_id); - gsk_ngl_render_job_draw_offscreen_with_color (job, &bounds, &offscreen, &shadow->color); + rgba_to_half (&shadow->color, color); + gsk_ngl_render_job_draw_offscreen_with_color (job, &bounds, &offscreen, color); gsk_ngl_render_job_end_draw (job); gsk_ngl_render_job_offset (job, -dx, -dy); } @@ -2963,7 +2985,7 @@ gsk_ngl_render_job_visit_blur_node (GskNglRenderJob *job, gsk_ngl_render_job_draw_coords (job, min_x, min_y, max_x, max_y, 0, 1, 1, 0, - &(GdkRGBA) { 0.f, 0.f, 0.f, 0.f } ); + (guint16[]) { FP16_ZERO, FP16_ZERO, FP16_ZERO, FP16_ZERO } ); gsk_ngl_render_job_end_draw (job); } @@ -3069,10 +3091,10 @@ static inline void gsk_ngl_render_job_visit_gl_shader_node_fallback (GskNglRenderJob *job, const GskRenderNode *node) { - static const GdkRGBA pink = { 255 / 255., 105 / 255., 180 / 255., 1.0 }; + guint16 pink[4] = { 15360, 13975, 14758, 15360 }; /* 255 105 180 */ gsk_ngl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, color)); - gsk_ngl_render_job_draw_rect_with_color (job, &node->bounds, &pink); + gsk_ngl_render_job_draw_rect_with_color (job, &node->bounds, pink); gsk_ngl_render_job_end_draw (job); } @@ -3278,7 +3300,7 @@ gsk_ngl_render_job_visit_texture_node (GskNglRenderJob *job, gsk_ngl_render_job_draw_coords (job, x1, y1, x2, y2, 0, 0, 1, 1, - &(GdkRGBA) { 0.f, 0.f, 0.f, 0.f }); + (guint16[]) { FP16_ZERO, FP16_ZERO, FP16_ZERO, FP16_ZERO }); } gsk_ngl_render_job_end_draw (job); |