gl renderer: add render ops for dumping the framebuffer

So offscreen rendering can be properly debugged.
This commit is contained in:
Timm Bäder 2018-12-02 08:12:09 +01:00
parent 3eb2cef421
commit 74dd05b45e
3 changed files with 31 additions and 0 deletions

View File

@ -2562,6 +2562,10 @@ gsk_gl_renderer_render_ops (GskGLRenderer *self,
glDrawArrays (GL_TRIANGLES, op->draw.vao_offset, op->draw.vao_size);
break;
case OP_DUMP_FRAMEBUFFER:
dump_framebuffer (op->dump.filename, op->dump.width, op->dump.height);
break;
default:
g_warn_if_reached ();
}

View File

@ -17,6 +17,23 @@ rgba_to_float (const GdkRGBA *c,
f[3] = c->alpha;
}
/* Debugging only! */
void
ops_dump_framebuffer (RenderOpBuilder *builder,
const char *filename,
int width,
int height)
{
RenderOp op;
op.op = OP_DUMP_FRAMEBUFFER;
op.dump.filename = g_strdup (filename);
op.dump.width = width;
op.dump.height = height;
g_array_append_val (builder->render_ops, op);
}
float
ops_get_scale (const RenderOpBuilder *builder)
{

View File

@ -54,6 +54,7 @@ enum {
OP_CHANGE_UNBLURRED_OUTSET_SHADOW = 19,
OP_CLEAR = 20,
OP_DRAW = 21,
OP_DUMP_FRAMEBUFFER = 22,
};
typedef struct
@ -207,6 +208,11 @@ typedef struct
float progress;
int source2;
} cross_fade;
struct {
char *filename;
int width;
int height;
} dump;
};
} RenderOp;
@ -258,6 +264,10 @@ typedef struct
} RenderOpBuilder;
void ops_dump_framebuffer (RenderOpBuilder *builder,
const char *filename,
int width,
int height);
void ops_finish (RenderOpBuilder *builder);
void ops_push_modelview (RenderOpBuilder *builder,