cogl/offscreen: Pass ColgOffscreenFlag when allocating
So that the allocation functions don't need to peek at the cached flag struct field. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
This commit is contained in:
parent
cac5938238
commit
c7ea0b3d54
@ -32,7 +32,7 @@
|
|||||||
#define __COGL_DRIVER_H
|
#define __COGL_DRIVER_H
|
||||||
|
|
||||||
#include "cogl-context.h"
|
#include "cogl-context.h"
|
||||||
#include "cogl-offscreen.h"
|
#include "cogl-offscreen-private.h"
|
||||||
#include "cogl-framebuffer-private.h"
|
#include "cogl-framebuffer-private.h"
|
||||||
#include "cogl-attribute-private.h"
|
#include "cogl-attribute-private.h"
|
||||||
#include "cogl-sampler-cache-private.h"
|
#include "cogl-sampler-cache-private.h"
|
||||||
@ -75,6 +75,7 @@ struct _CoglDriverVtable
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
(* offscreen_allocate) (CoglOffscreen *offscreen,
|
(* offscreen_allocate) (CoglOffscreen *offscreen,
|
||||||
|
CoglOffscreenFlags flags,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -106,7 +106,9 @@ cogl_offscreen_allocate (CoglFramebuffer *framebuffer,
|
|||||||
texture_format = _cogl_texture_get_format (offscreen->texture);
|
texture_format = _cogl_texture_get_format (offscreen->texture);
|
||||||
_cogl_framebuffer_set_internal_format (framebuffer, texture_format);
|
_cogl_framebuffer_set_internal_format (framebuffer, texture_format);
|
||||||
|
|
||||||
if (!ctx->driver_vtable->offscreen_allocate (offscreen, error))
|
if (!ctx->driver_vtable->offscreen_allocate (offscreen,
|
||||||
|
offscreen->create_flags,
|
||||||
|
error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -41,6 +41,7 @@ G_DECLARE_FINAL_TYPE (CoglGlFramebuffer, cogl_gl_framebuffer,
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
|
_cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
|
||||||
|
CoglOffscreenFlags flags,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -708,6 +708,7 @@ try_creating_fbo (CoglContext *ctx,
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
|
_cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
|
||||||
|
CoglOffscreenFlags flags,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (offscreen);
|
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (offscreen);
|
||||||
@ -747,7 +748,7 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
|
|||||||
gl_framebuffer = ensure_gl_framebuffer (framebuffer);
|
gl_framebuffer = ensure_gl_framebuffer (framebuffer);
|
||||||
gl_fbo = &gl_framebuffer->gl_fbo;
|
gl_fbo = &gl_framebuffer->gl_fbo;
|
||||||
|
|
||||||
if (((offscreen->create_flags & COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL) &&
|
if (((flags & COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL) &&
|
||||||
try_creating_fbo (ctx,
|
try_creating_fbo (ctx,
|
||||||
offscreen->texture,
|
offscreen->texture,
|
||||||
offscreen->texture_level,
|
offscreen->texture_level,
|
||||||
@ -823,7 +824,7 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
|
|||||||
cogl_framebuffer_update_samples_per_pixel (framebuffer,
|
cogl_framebuffer_update_samples_per_pixel (framebuffer,
|
||||||
gl_fbo->samples_per_pixel);
|
gl_fbo->samples_per_pixel);
|
||||||
|
|
||||||
if (!(offscreen->create_flags & COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL))
|
if (!(flags & COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL))
|
||||||
{
|
{
|
||||||
/* Record that the last set of flags succeeded so that we can
|
/* Record that the last set of flags succeeded so that we can
|
||||||
try that set first next time */
|
try that set first next time */
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_offscreen_nop_allocate (CoglOffscreen *offscreen,
|
_cogl_offscreen_nop_allocate (CoglOffscreen *offscreen,
|
||||||
|
CoglOffscreenFlags flags,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -44,6 +44,7 @@ _cogl_framebuffer_nop_flush_state (CoglFramebuffer *draw_buffer,
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_offscreen_nop_allocate (CoglOffscreen *offscreen,
|
_cogl_offscreen_nop_allocate (CoglOffscreen *offscreen,
|
||||||
|
CoglOffscreenFlags flags,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user