[gtk/matthiasc/color-profiles] ngl: Allow switching intermediate formats
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/color-profiles] ngl: Allow switching intermediate formats
- Date: Fri, 1 Oct 2021 12:57:30 +0000 (UTC)
commit 697e8b9857a9e927f75066641a93773794bac5ad
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Oct 1 08:48:43 2021 -0400
ngl: Allow switching intermediate formats
Keep the format we use for intermediate textures
in a single place, so we can easily change it by
passing a 'hdr' boolean when creating the render job.
Update callers to pass FALSE for now.
gsk/ngl/gsknglrenderer.c | 4 ++--
gsk/ngl/gsknglrenderjob.c | 21 +++++++++++++--------
gsk/ngl/gsknglrenderjobprivate.h | 3 ++-
3 files changed, 17 insertions(+), 11 deletions(-)
---
diff --git a/gsk/ngl/gsknglrenderer.c b/gsk/ngl/gsknglrenderer.c
index 7263d0b1e4..afe9e761f6 100644
--- a/gsk/ngl/gsknglrenderer.c
+++ b/gsk/ngl/gsknglrenderer.c
@@ -207,7 +207,7 @@ gsk_ngl_renderer_render (GskRenderer *renderer,
render_region = get_render_region (surface, self->context);
gsk_ngl_driver_begin_frame (self->driver, self->command_queue);
- job = gsk_ngl_render_job_new (self->driver, &viewport, scale_factor, render_region, 0);
+ job = gsk_ngl_render_job_new (self->driver, &viewport, scale_factor, render_region, 0, FALSE);
#ifdef G_ENABLE_DEBUG
if (GSK_RENDERER_DEBUG_CHECK (GSK_RENDERER (self), FALLBACK))
gsk_ngl_render_job_set_debug_fallback (job, TRUE);
@@ -250,7 +250,7 @@ gsk_ngl_renderer_render_texture (GskRenderer *renderer,
&render_target))
{
gsk_ngl_driver_begin_frame (self->driver, self->command_queue);
- job = gsk_ngl_render_job_new (self->driver, viewport, 1, NULL, render_target->framebuffer_id);
+ job = gsk_ngl_render_job_new (self->driver, viewport, 1, NULL, render_target->framebuffer_id, FALSE);
#ifdef G_ENABLE_DEBUG
if (GSK_RENDERER_DEBUG_CHECK (GSK_RENDERER (self), FALLBACK))
gsk_ngl_render_job_set_debug_fallback (job, TRUE);
diff --git a/gsk/ngl/gsknglrenderjob.c b/gsk/ngl/gsknglrenderjob.c
index ff13fce842..81d63af897 100644
--- a/gsk/ngl/gsknglrenderjob.c
+++ b/gsk/ngl/gsknglrenderjob.c
@@ -164,6 +164,9 @@ struct _GskNglRenderJob
/* If we should be rendering red zones over fallback nodes */
guint debug_fallback : 1;
+
+ /* Format to use for intermediate textures */
+ int format;
};
typedef struct _GskNglRenderOffscreen
@@ -1276,7 +1279,7 @@ blur_offscreen (GskNglRenderJob *job,
if (!gsk_ngl_driver_create_render_target (job->driver,
MAX (texture_to_blur_width, 1),
MAX (texture_to_blur_height, 1),
- GL_RGBA8,
+ job->format,
GL_NEAREST, GL_NEAREST,
&pass1))
return 0;
@@ -1287,7 +1290,7 @@ blur_offscreen (GskNglRenderJob *job,
if (!gsk_ngl_driver_create_render_target (job->driver,
texture_to_blur_width,
texture_to_blur_height,
- GL_RGBA8,
+ job->format,
GL_NEAREST, GL_NEAREST,
&pass2))
return gsk_ngl_driver_release_render_target (job->driver, pass1, FALSE);
@@ -2199,7 +2202,7 @@ gsk_ngl_render_job_visit_blurred_inset_shadow_node (GskNglRenderJob *job,
if (!gsk_ngl_driver_create_render_target (job->driver,
texture_width, texture_height,
- GL_RGBA8,
+ job->format,
GL_NEAREST, GL_NEAREST,
&render_target))
g_assert_not_reached ();
@@ -2470,7 +2473,7 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
gsk_ngl_driver_create_render_target (job->driver,
texture_width, texture_height,
- GL_RGBA8,
+ job->format,
GL_NEAREST, GL_NEAREST,
&render_target);
@@ -3879,7 +3882,7 @@ gsk_ngl_render_job_visit_node_with_offscreen (GskNglRenderJob *job,
if (!gsk_ngl_driver_create_render_target (job->driver,
scaled_width, scaled_height,
- GL_RGBA8,
+ job->format,
filter, filter,
&render_target))
g_assert_not_reached ();
@@ -3978,7 +3981,7 @@ gsk_ngl_render_job_render_flipped (GskNglRenderJob *job,
if (!gsk_ngl_command_queue_create_render_target (job->command_queue,
MAX (1, job->viewport.size.width),
MAX (1, job->viewport.size.height),
- GL_RGBA8,
+ job->format,
GL_NEAREST, GL_NEAREST,
&framebuffer_id, &texture_id))
return;
@@ -4050,7 +4053,7 @@ gsk_ngl_render_job_render (GskNglRenderJob *job,
gsk_ngl_driver_create_render_target (job->driver,
job->viewport.size.width,
job->viewport.size.height,
- GL_RGBA8,
+ job->format,
GL_NEAREST,
GL_NEAREST,
&render_target);
@@ -4103,7 +4106,8 @@ gsk_ngl_render_job_new (GskNglDriver *driver,
const graphene_rect_t *viewport,
float scale_factor,
const cairo_region_t *region,
- guint framebuffer)
+ guint framebuffer,
+ gboolean hdr)
{
const graphene_rect_t *clip_rect = viewport;
graphene_rect_t transformed_extents;
@@ -4124,6 +4128,7 @@ gsk_ngl_render_job_new (GskNglDriver *driver,
job->scale_x = scale_factor;
job->scale_y = scale_factor;
job->viewport = *viewport;
+ job->format = hdr ? GL_RGBA16F : GL_RGBA8;
gsk_ngl_render_job_set_alpha (job, 1.0f);
gsk_ngl_render_job_set_projection_from_rect (job, viewport, NULL);
diff --git a/gsk/ngl/gsknglrenderjobprivate.h b/gsk/ngl/gsknglrenderjobprivate.h
index ba3f3e49b7..44d37c7151 100644
--- a/gsk/ngl/gsknglrenderjobprivate.h
+++ b/gsk/ngl/gsknglrenderjobprivate.h
@@ -27,7 +27,8 @@ GskNglRenderJob *gsk_ngl_render_job_new (GskNglDriver *d
const graphene_rect_t *viewport,
float scale_factor,
const cairo_region_t *region,
- guint framebuffer);
+ guint framebuffer,
+ gboolean hdr);
void gsk_ngl_render_job_free (GskNglRenderJob *job);
void gsk_ngl_render_job_render (GskNglRenderJob *job,
GskRenderNode *root);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]