mirror of
https://github.com/brl/mutter.git
synced 2025-02-16 13:24:09 +00:00
cogl/offscreen: Move CoglGlFbo struct to GL driver
It was only used there, so put it in the driver private struct. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
This commit is contained in:
parent
e9e37dd0d1
commit
8910b3e7bc
@ -44,19 +44,10 @@ typedef enum
|
|||||||
COGL_OFFSCREEN_ALLOCATE_FLAG_STENCIL = 1 << 2,
|
COGL_OFFSCREEN_ALLOCATE_FLAG_STENCIL = 1 << 2,
|
||||||
} CoglOffscreenAllocateFlags;
|
} CoglOffscreenAllocateFlags;
|
||||||
|
|
||||||
typedef struct _CoglGLFramebuffer
|
|
||||||
{
|
|
||||||
GLuint fbo_handle;
|
|
||||||
GList *renderbuffers;
|
|
||||||
int samples_per_pixel;
|
|
||||||
} CoglGlFbo;
|
|
||||||
|
|
||||||
struct _CoglOffscreen
|
struct _CoglOffscreen
|
||||||
{
|
{
|
||||||
CoglFramebuffer parent;
|
CoglFramebuffer parent;
|
||||||
|
|
||||||
CoglGlFbo gl_fbo;
|
|
||||||
|
|
||||||
CoglTexture *texture;
|
CoglTexture *texture;
|
||||||
int texture_level;
|
int texture_level;
|
||||||
|
|
||||||
|
@ -128,10 +128,19 @@
|
|||||||
#define GL_STENCIL 0x1802
|
#define GL_STENCIL 0x1802
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef struct _CoglGlFbo
|
||||||
|
{
|
||||||
|
GLuint fbo_handle;
|
||||||
|
GList *renderbuffers;
|
||||||
|
int samples_per_pixel;
|
||||||
|
} CoglGlFbo;
|
||||||
|
|
||||||
struct _CoglGlFramebuffer
|
struct _CoglGlFramebuffer
|
||||||
{
|
{
|
||||||
GObject parent;
|
GObject parent;
|
||||||
|
|
||||||
|
CoglGlFbo gl_fbo;
|
||||||
|
|
||||||
gboolean dirty_bitmasks;
|
gboolean dirty_bitmasks;
|
||||||
CoglFramebufferBits bits;
|
CoglFramebufferBits bits;
|
||||||
};
|
};
|
||||||
@ -139,6 +148,9 @@ struct _CoglGlFramebuffer
|
|||||||
G_DEFINE_TYPE (CoglGlFramebuffer, cogl_gl_framebuffer,
|
G_DEFINE_TYPE (CoglGlFramebuffer, cogl_gl_framebuffer,
|
||||||
G_TYPE_OBJECT)
|
G_TYPE_OBJECT)
|
||||||
|
|
||||||
|
static CoglGlFramebuffer *
|
||||||
|
ensure_gl_framebuffer (CoglFramebuffer *framebuffer);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cogl_framebuffer_gl_flush_viewport_state (CoglFramebuffer *framebuffer)
|
_cogl_framebuffer_gl_flush_viewport_state (CoglFramebuffer *framebuffer)
|
||||||
{
|
{
|
||||||
@ -298,9 +310,11 @@ _cogl_framebuffer_gl_bind (CoglFramebuffer *framebuffer, GLenum target)
|
|||||||
|
|
||||||
if (COGL_IS_OFFSCREEN (framebuffer))
|
if (COGL_IS_OFFSCREEN (framebuffer))
|
||||||
{
|
{
|
||||||
CoglOffscreen *offscreen = COGL_OFFSCREEN (framebuffer);
|
CoglGlFramebuffer *gl_framebuffer;
|
||||||
|
|
||||||
|
gl_framebuffer = ensure_gl_framebuffer (framebuffer);
|
||||||
GE (ctx, glBindFramebuffer (target,
|
GE (ctx, glBindFramebuffer (target,
|
||||||
offscreen->gl_fbo.fbo_handle));
|
gl_framebuffer->gl_fbo.fbo_handle));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -762,7 +776,8 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
|
|||||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (offscreen);
|
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (offscreen);
|
||||||
CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
|
CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
|
||||||
CoglOffscreenAllocateFlags flags;
|
CoglOffscreenAllocateFlags flags;
|
||||||
CoglGlFbo *gl_fbo = &offscreen->gl_fbo;
|
CoglGlFramebuffer *gl_framebuffer;
|
||||||
|
CoglGlFbo *gl_fbo;
|
||||||
const CoglFramebufferConfig *config;
|
const CoglFramebufferConfig *config;
|
||||||
int level_width;
|
int level_width;
|
||||||
int level_height;
|
int level_height;
|
||||||
@ -792,6 +807,9 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
|
|||||||
|
|
||||||
config = cogl_framebuffer_get_config (framebuffer);
|
config = cogl_framebuffer_get_config (framebuffer);
|
||||||
|
|
||||||
|
gl_framebuffer = ensure_gl_framebuffer (framebuffer);
|
||||||
|
gl_fbo = &gl_framebuffer->gl_fbo;
|
||||||
|
|
||||||
if (((offscreen->create_flags & COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL) &&
|
if (((offscreen->create_flags & COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL) &&
|
||||||
try_creating_fbo (ctx,
|
try_creating_fbo (ctx,
|
||||||
offscreen->texture,
|
offscreen->texture,
|
||||||
@ -904,10 +922,13 @@ _cogl_offscreen_gl_free (CoglOffscreen *offscreen)
|
|||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (offscreen);
|
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (offscreen);
|
||||||
CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
|
CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
|
||||||
|
CoglGlFramebuffer *gl_framebuffer;
|
||||||
|
|
||||||
delete_renderbuffers (ctx, offscreen->gl_fbo.renderbuffers);
|
gl_framebuffer = ensure_gl_framebuffer (framebuffer);
|
||||||
|
|
||||||
GE (ctx, glDeleteFramebuffers (1, &offscreen->gl_fbo.fbo_handle));
|
delete_renderbuffers (ctx, gl_framebuffer->gl_fbo.renderbuffers);
|
||||||
|
|
||||||
|
GE (ctx, glDeleteFramebuffers (1, &gl_framebuffer->gl_fbo.fbo_handle));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user