1
0
Fork 0

cogl/offscreen: Move struct to C file

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
This commit is contained in:
Jonas Ådahl 2020-10-18 22:08:42 +02:00 committed by Robert Mader
parent ece714c5c6
commit 58eb1e87bf
4 changed files with 47 additions and 33 deletions

View file

@ -1636,8 +1636,9 @@ _cogl_journal_log_quad (CoglJournal *journal,
if (COGL_IS_OFFSCREEN (framebuffer))
{
CoglOffscreen *offscreen = COGL_OFFSCREEN (framebuffer);
CoglTexture *texture = cogl_offscreen_get_texture (offscreen);
_cogl_texture_2d_externally_modified (offscreen->texture);
_cogl_texture_2d_externally_modified (texture);
}
if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_SYNC_PRIMITIVE)))

View file

@ -44,19 +44,6 @@ typedef enum
COGL_OFFSCREEN_ALLOCATE_FLAG_STENCIL = 1 << 2,
} CoglOffscreenAllocateFlags;
struct _CoglOffscreen
{
CoglFramebuffer parent;
CoglTexture *texture;
int texture_level;
/* FIXME: _cogl_offscreen_new_with_texture_full should be made to use
* fb->config to configure if we want a depth or stencil buffer so
* we can get rid of these flags */
CoglOffscreenFlags create_flags;
};
/*
* _cogl_offscreen_new_with_texture_full:
* @texture: A #CoglTexture pointer
@ -75,4 +62,7 @@ _cogl_offscreen_new_with_texture_full (CoglTexture *texture,
CoglOffscreenFlags create_flags,
int level);
int
cogl_offscreen_get_texture_level (CoglOffscreen *offscreen);
#endif /* COGL_OFFSCREEN_PRIVATE_H */

View file

@ -32,6 +32,19 @@
#include "cogl-offscreen-private.h"
#include "cogl-texture-private.h"
struct _CoglOffscreen
{
CoglFramebuffer parent;
CoglTexture *texture;
int texture_level;
/* FIXME: _cogl_offscreen_new_with_texture_full should be made to use
* fb->config to configure if we want a depth or stencil buffer so
* we can get rid of these flags */
CoglOffscreenFlags create_flags;
};
G_DEFINE_TYPE (CoglOffscreen, cogl_offscreen,
COGL_TYPE_FRAMEBUFFER)
@ -77,6 +90,12 @@ cogl_offscreen_get_texture (CoglOffscreen *offscreen)
return offscreen->texture;
}
int
cogl_offscreen_get_texture_level (CoglOffscreen *offscreen)
{
return offscreen->texture_level;
}
static gboolean
cogl_offscreen_allocate (CoglFramebuffer *framebuffer,
GError **error)

View file

@ -645,15 +645,19 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
CoglGlFramebufferPrivate *priv;
CoglGlFbo *gl_fbo;
const CoglFramebufferConfig *config;
CoglTexture *texture;
int texture_level;
int level_width;
int level_height;
g_return_val_if_fail (offscreen->texture_level <
_cogl_texture_get_n_levels (offscreen->texture),
texture = cogl_offscreen_get_texture (offscreen);
texture_level = cogl_offscreen_get_texture_level (offscreen);
g_return_val_if_fail (texture_level < _cogl_texture_get_n_levels (texture),
FALSE);
_cogl_texture_get_level_size (offscreen->texture,
offscreen->texture_level,
_cogl_texture_get_level_size (texture,
texture_level,
&level_width,
&level_height,
NULL);
@ -668,7 +672,7 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
* the texture is actually used for rendering according to the filters set on
* the corresponding CoglPipeline.
*/
_cogl_texture_gl_flush_legacy_texobj_filters (offscreen->texture,
_cogl_texture_gl_flush_legacy_texobj_filters (texture,
GL_NEAREST, GL_NEAREST);
config = cogl_framebuffer_get_config (framebuffer);
@ -679,8 +683,8 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
if (((flags & COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL) &&
try_creating_fbo (ctx,
offscreen->texture,
offscreen->texture_level,
texture,
texture_level,
level_width,
level_height,
config,
@ -689,8 +693,8 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
(ctx->have_last_offscreen_allocate_flags &&
try_creating_fbo (ctx,
offscreen->texture,
offscreen->texture_level,
texture,
texture_level,
level_width,
level_height,
config,
@ -705,8 +709,8 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
_cogl_has_private_feature
(ctx, COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL)) &&
try_creating_fbo (ctx,
offscreen->texture,
offscreen->texture_level,
texture,
texture_level,
level_width,
level_height,
config,
@ -714,8 +718,8 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
gl_fbo)) ||
try_creating_fbo (ctx,
offscreen->texture,
offscreen->texture_level,
texture,
texture_level,
level_width,
level_height,
config,
@ -724,8 +728,8 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
gl_fbo) ||
try_creating_fbo (ctx,
offscreen->texture,
offscreen->texture_level,
texture,
texture_level,
level_width,
level_height,
config,
@ -733,8 +737,8 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
gl_fbo) ||
try_creating_fbo (ctx,
offscreen->texture,
offscreen->texture_level,
texture,
texture_level,
level_width,
level_height,
config,
@ -742,8 +746,8 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
gl_fbo) ||
try_creating_fbo (ctx,
offscreen->texture,
offscreen->texture_level,
texture,
texture_level,
level_width,
level_height,
config,