cogl: Remove samples_per_pixel config
It is only set through an undocumented env variable Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3915>
This commit is contained in:
parent
4ddd83c51e
commit
a1828e7212
@ -54,7 +54,6 @@ typedef struct _CoglFramebufferDriverConfig
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
gboolean need_stencil;
|
gboolean need_stencil;
|
||||||
int samples_per_pixel;
|
|
||||||
gboolean stereo_enabled;
|
gboolean stereo_enabled;
|
||||||
} CoglFramebufferConfig;
|
} CoglFramebufferConfig;
|
||||||
|
|
||||||
@ -121,10 +120,6 @@ cogl_framebuffer_init_config (CoglFramebuffer *framebuffer,
|
|||||||
const CoglFramebufferConfig *
|
const CoglFramebufferConfig *
|
||||||
cogl_framebuffer_get_config (CoglFramebuffer *framebuffer);
|
cogl_framebuffer_get_config (CoglFramebuffer *framebuffer);
|
||||||
|
|
||||||
void
|
|
||||||
cogl_framebuffer_update_samples_per_pixel (CoglFramebuffer *framebuffer,
|
|
||||||
int samples_per_pixel);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_framebuffer_update_size (CoglFramebuffer *framebuffer,
|
cogl_framebuffer_update_size (CoglFramebuffer *framebuffer,
|
||||||
int width,
|
int width,
|
||||||
|
@ -134,8 +134,6 @@ typedef struct _CoglFramebufferPrivate
|
|||||||
int clear_clip_y1;
|
int clear_clip_y1;
|
||||||
gboolean clear_clip_dirty;
|
gboolean clear_clip_dirty;
|
||||||
|
|
||||||
int samples_per_pixel;
|
|
||||||
|
|
||||||
/* Whether the depth buffer was enabled for this framebuffer,
|
/* Whether the depth buffer was enabled for this framebuffer,
|
||||||
* usually means it needs to be cleared before being reused next.
|
* usually means it needs to be cleared before being reused next.
|
||||||
*/
|
*/
|
||||||
@ -235,8 +233,6 @@ cogl_framebuffer_constructed (GObject *object)
|
|||||||
priv->modelview_stack = cogl_matrix_stack_new (priv->context);
|
priv->modelview_stack = cogl_matrix_stack_new (priv->context);
|
||||||
priv->projection_stack = cogl_matrix_stack_new (priv->context);
|
priv->projection_stack = cogl_matrix_stack_new (priv->context);
|
||||||
|
|
||||||
priv->samples_per_pixel = 0;
|
|
||||||
|
|
||||||
priv->clip_stack = NULL;
|
priv->clip_stack = NULL;
|
||||||
|
|
||||||
priv->journal = _cogl_journal_new (framebuffer);
|
priv->journal = _cogl_journal_new (framebuffer);
|
||||||
@ -1191,15 +1187,6 @@ cogl_framebuffer_set_dither_enabled (CoglFramebuffer *framebuffer,
|
|||||||
priv->dither_enabled = dither_enabled;
|
priv->dither_enabled = dither_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
cogl_framebuffer_update_samples_per_pixel (CoglFramebuffer *framebuffer,
|
|
||||||
int samples_per_pixel)
|
|
||||||
{
|
|
||||||
CoglFramebufferPrivate *priv =
|
|
||||||
cogl_framebuffer_get_instance_private (framebuffer);
|
|
||||||
|
|
||||||
priv->samples_per_pixel = samples_per_pixel;
|
|
||||||
}
|
|
||||||
|
|
||||||
CoglContext *
|
CoglContext *
|
||||||
cogl_framebuffer_get_context (CoglFramebuffer *framebuffer)
|
cogl_framebuffer_get_context (CoglFramebuffer *framebuffer)
|
||||||
|
@ -52,19 +52,8 @@ CoglOnscreenTemplate *
|
|||||||
cogl_onscreen_template_new (void)
|
cogl_onscreen_template_new (void)
|
||||||
{
|
{
|
||||||
CoglOnscreenTemplate *onscreen_template = g_object_new (COGL_TYPE_ONSCREEN_TEMPLATE, NULL);
|
CoglOnscreenTemplate *onscreen_template = g_object_new (COGL_TYPE_ONSCREEN_TEMPLATE, NULL);
|
||||||
char *user_config;
|
|
||||||
|
|
||||||
onscreen_template->config.need_stencil = TRUE;
|
onscreen_template->config.need_stencil = TRUE;
|
||||||
onscreen_template->config.samples_per_pixel = 0;
|
|
||||||
|
|
||||||
user_config = getenv ("COGL_POINT_SAMPLES_PER_PIXEL");
|
|
||||||
if (user_config)
|
|
||||||
{
|
|
||||||
unsigned long samples_per_pixel = strtoul (user_config, NULL, 10);
|
|
||||||
if (samples_per_pixel != ULONG_MAX)
|
|
||||||
onscreen_template->config.samples_per_pixel =
|
|
||||||
samples_per_pixel;
|
|
||||||
}
|
|
||||||
|
|
||||||
return onscreen_template;
|
return onscreen_template;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,6 @@ typedef struct _CoglGlFbo
|
|||||||
{
|
{
|
||||||
GLuint fbo_handle;
|
GLuint fbo_handle;
|
||||||
GList *renderbuffers;
|
GList *renderbuffers;
|
||||||
int samples_per_pixel;
|
|
||||||
} CoglGlFbo;
|
} CoglGlFbo;
|
||||||
|
|
||||||
struct _CoglGlFramebufferFbo
|
struct _CoglGlFramebufferFbo
|
||||||
@ -210,8 +209,7 @@ static GList *
|
|||||||
try_creating_renderbuffers (CoglContext *ctx,
|
try_creating_renderbuffers (CoglContext *ctx,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
CoglOffscreenAllocateFlags flags,
|
CoglOffscreenAllocateFlags flags)
|
||||||
int n_samples)
|
|
||||||
{
|
{
|
||||||
GList *renderbuffers = NULL;
|
GList *renderbuffers = NULL;
|
||||||
GLuint gl_depth_stencil_handle;
|
GLuint gl_depth_stencil_handle;
|
||||||
@ -242,14 +240,8 @@ try_creating_renderbuffers (CoglContext *ctx,
|
|||||||
/* Create a renderbuffer for depth and stenciling */
|
/* Create a renderbuffer for depth and stenciling */
|
||||||
GE (ctx, glGenRenderbuffers (1, &gl_depth_stencil_handle));
|
GE (ctx, glGenRenderbuffers (1, &gl_depth_stencil_handle));
|
||||||
GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, gl_depth_stencil_handle));
|
GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, gl_depth_stencil_handle));
|
||||||
if (n_samples)
|
GE (ctx, glRenderbufferStorage (GL_RENDERBUFFER, format,
|
||||||
GE (ctx, glRenderbufferStorageMultisampleIMG (GL_RENDERBUFFER,
|
width, height));
|
||||||
n_samples,
|
|
||||||
format,
|
|
||||||
width, height));
|
|
||||||
else
|
|
||||||
GE (ctx, glRenderbufferStorage (GL_RENDERBUFFER, format,
|
|
||||||
width, height));
|
|
||||||
GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, 0));
|
GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, 0));
|
||||||
|
|
||||||
|
|
||||||
@ -274,14 +266,8 @@ try_creating_renderbuffers (CoglContext *ctx,
|
|||||||
GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, gl_depth_handle));
|
GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, gl_depth_handle));
|
||||||
/* For now we just ask for GL_DEPTH_COMPONENT16 since this is all that's
|
/* For now we just ask for GL_DEPTH_COMPONENT16 since this is all that's
|
||||||
* available under GLES */
|
* available under GLES */
|
||||||
if (n_samples)
|
GE (ctx, glRenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT16,
|
||||||
GE (ctx, glRenderbufferStorageMultisampleIMG (GL_RENDERBUFFER,
|
width, height));
|
||||||
n_samples,
|
|
||||||
GL_DEPTH_COMPONENT16,
|
|
||||||
width, height));
|
|
||||||
else
|
|
||||||
GE (ctx, glRenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT16,
|
|
||||||
width, height));
|
|
||||||
GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, 0));
|
GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, 0));
|
||||||
GE (ctx, glFramebufferRenderbuffer (GL_FRAMEBUFFER,
|
GE (ctx, glFramebufferRenderbuffer (GL_FRAMEBUFFER,
|
||||||
GL_DEPTH_ATTACHMENT,
|
GL_DEPTH_ATTACHMENT,
|
||||||
@ -296,14 +282,8 @@ try_creating_renderbuffers (CoglContext *ctx,
|
|||||||
|
|
||||||
GE (ctx, glGenRenderbuffers (1, &gl_stencil_handle));
|
GE (ctx, glGenRenderbuffers (1, &gl_stencil_handle));
|
||||||
GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, gl_stencil_handle));
|
GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, gl_stencil_handle));
|
||||||
if (n_samples)
|
GE (ctx, glRenderbufferStorage (GL_RENDERBUFFER, GL_STENCIL_INDEX8,
|
||||||
GE (ctx, glRenderbufferStorageMultisampleIMG (GL_RENDERBUFFER,
|
width, height));
|
||||||
n_samples,
|
|
||||||
GL_STENCIL_INDEX8,
|
|
||||||
width, height));
|
|
||||||
else
|
|
||||||
GE (ctx, glRenderbufferStorage (GL_RENDERBUFFER, GL_STENCIL_INDEX8,
|
|
||||||
width, height));
|
|
||||||
GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, 0));
|
GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, 0));
|
||||||
GE (ctx, glFramebufferRenderbuffer (GL_FRAMEBUFFER,
|
GE (ctx, glFramebufferRenderbuffer (GL_FRAMEBUFFER,
|
||||||
GL_STENCIL_ATTACHMENT,
|
GL_STENCIL_ATTACHMENT,
|
||||||
@ -349,7 +329,6 @@ try_creating_fbo (CoglContext *ctx,
|
|||||||
GLuint tex_gl_handle;
|
GLuint tex_gl_handle;
|
||||||
GLenum tex_gl_target;
|
GLenum tex_gl_target;
|
||||||
GLenum status;
|
GLenum status;
|
||||||
int n_samples;
|
|
||||||
|
|
||||||
if (!cogl_texture_get_gl_texture (texture, &tex_gl_handle, &tex_gl_target))
|
if (!cogl_texture_get_gl_texture (texture, &tex_gl_handle, &tex_gl_target))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -361,15 +340,6 @@ try_creating_fbo (CoglContext *ctx,
|
|||||||
)
|
)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (config->samples_per_pixel)
|
|
||||||
{
|
|
||||||
if (!ctx->glFramebufferTexture2DMultisampleIMG)
|
|
||||||
return FALSE;
|
|
||||||
n_samples = config->samples_per_pixel;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
n_samples = 0;
|
|
||||||
|
|
||||||
/* We are about to generate and bind a new fbo, so we pretend to
|
/* We are about to generate and bind a new fbo, so we pretend to
|
||||||
* change framebuffer state so that the old framebuffer will be
|
* change framebuffer state so that the old framebuffer will be
|
||||||
* rebound again before drawing. */
|
* rebound again before drawing. */
|
||||||
@ -379,18 +349,10 @@ try_creating_fbo (CoglContext *ctx,
|
|||||||
ctx->glGenFramebuffers (1, &gl_fbo->fbo_handle);
|
ctx->glGenFramebuffers (1, &gl_fbo->fbo_handle);
|
||||||
GE (ctx, glBindFramebuffer (GL_FRAMEBUFFER, gl_fbo->fbo_handle));
|
GE (ctx, glBindFramebuffer (GL_FRAMEBUFFER, gl_fbo->fbo_handle));
|
||||||
|
|
||||||
if (n_samples)
|
|
||||||
{
|
GE (ctx, glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||||
GE (ctx, glFramebufferTexture2DMultisampleIMG (GL_FRAMEBUFFER,
|
tex_gl_target, tex_gl_handle,
|
||||||
GL_COLOR_ATTACHMENT0,
|
texture_level));
|
||||||
tex_gl_target, tex_gl_handle,
|
|
||||||
n_samples,
|
|
||||||
texture_level));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
GE (ctx, glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
|
||||||
tex_gl_target, tex_gl_handle,
|
|
||||||
texture_level));
|
|
||||||
|
|
||||||
if (flags)
|
if (flags)
|
||||||
{
|
{
|
||||||
@ -398,8 +360,7 @@ try_creating_fbo (CoglContext *ctx,
|
|||||||
try_creating_renderbuffers (ctx,
|
try_creating_renderbuffers (ctx,
|
||||||
texture_level_width,
|
texture_level_width,
|
||||||
texture_level_height,
|
texture_level_height,
|
||||||
flags,
|
flags);
|
||||||
n_samples);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure it's complete */
|
/* Make sure it's complete */
|
||||||
@ -415,21 +376,6 @@ try_creating_fbo (CoglContext *ctx,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update the real number of samples_per_pixel now that we have a
|
|
||||||
* complete framebuffer */
|
|
||||||
if (n_samples)
|
|
||||||
{
|
|
||||||
GLenum attachment = GL_COLOR_ATTACHMENT0;
|
|
||||||
GLenum pname = GL_TEXTURE_SAMPLES_IMG;
|
|
||||||
int texture_samples;
|
|
||||||
|
|
||||||
GE( ctx, glGetFramebufferAttachmentParameteriv (GL_FRAMEBUFFER,
|
|
||||||
attachment,
|
|
||||||
pname,
|
|
||||||
&texture_samples) );
|
|
||||||
gl_fbo->samples_per_pixel = texture_samples;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -562,9 +508,6 @@ cogl_gl_framebuffer_fbo_new (CoglFramebuffer *framebuffer,
|
|||||||
allocate_flags = 0,
|
allocate_flags = 0,
|
||||||
gl_fbo))
|
gl_fbo))
|
||||||
{
|
{
|
||||||
cogl_framebuffer_update_samples_per_pixel (framebuffer,
|
|
||||||
gl_fbo->samples_per_pixel);
|
|
||||||
|
|
||||||
if (!driver_config->disable_depth_and_stencil)
|
if (!driver_config->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
|
||||||
|
@ -75,16 +75,6 @@ cogl_onscreen_egl_choose_config (CoglOnscreenEgl *onscreen_egl,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config->samples_per_pixel)
|
|
||||||
{
|
|
||||||
EGLint samples;
|
|
||||||
status = eglGetConfigAttrib (egl_renderer->edpy,
|
|
||||||
egl_config,
|
|
||||||
EGL_SAMPLES, &samples);
|
|
||||||
g_return_val_if_fail (status == EGL_TRUE, TRUE);
|
|
||||||
cogl_framebuffer_update_samples_per_pixel (framebuffer, samples);
|
|
||||||
}
|
|
||||||
|
|
||||||
*out_egl_config = egl_config;
|
*out_egl_config = egl_config;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -95,19 +95,6 @@ cogl_onscreen_glx_allocate (CoglFramebuffer *framebuffer,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update the real number of samples_per_pixel now that we have
|
|
||||||
* found an fbconfig... */
|
|
||||||
if (config->samples_per_pixel)
|
|
||||||
{
|
|
||||||
int samples;
|
|
||||||
int status = glx_renderer->glXGetFBConfigAttrib (xlib_renderer->xdpy,
|
|
||||||
fbconfig,
|
|
||||||
GLX_SAMPLES,
|
|
||||||
&samples);
|
|
||||||
g_return_val_if_fail (status == Success, TRUE);
|
|
||||||
cogl_framebuffer_update_samples_per_pixel (framebuffer, samples);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: We need to explicitly Select for ConfigureNotify events.
|
/* FIXME: We need to explicitly Select for ConfigureNotify events.
|
||||||
* We need to document that for windows we create then toolkits
|
* We need to document that for windows we create then toolkits
|
||||||
* must be careful not to clear event mask bits that we select.
|
* must be careful not to clear event mask bits that we select.
|
||||||
|
@ -231,14 +231,6 @@ cogl_display_egl_determine_attributes (CoglDisplay *display,
|
|||||||
EGL_OPENGL_BIT :
|
EGL_OPENGL_BIT :
|
||||||
EGL_OPENGL_ES2_BIT);
|
EGL_OPENGL_ES2_BIT);
|
||||||
|
|
||||||
if (config->samples_per_pixel)
|
|
||||||
{
|
|
||||||
attributes[i++] = EGL_SAMPLE_BUFFERS;
|
|
||||||
attributes[i++] = 1;
|
|
||||||
attributes[i++] = EGL_SAMPLES;
|
|
||||||
attributes[i++] = config->samples_per_pixel;
|
|
||||||
}
|
|
||||||
|
|
||||||
attributes[i++] = EGL_NONE;
|
attributes[i++] = EGL_NONE;
|
||||||
|
|
||||||
g_assert (i < MAX_EGL_CONFIG_ATTRIBS);
|
g_assert (i < MAX_EGL_CONFIG_ATTRIBS);
|
||||||
|
@ -498,7 +498,6 @@ glx_attributes_from_framebuffer_config (CoglDisplay *display,
|
|||||||
const CoglFramebufferConfig *config,
|
const CoglFramebufferConfig *config,
|
||||||
int *attributes)
|
int *attributes)
|
||||||
{
|
{
|
||||||
CoglGLXRenderer *glx_renderer = display->renderer->winsys;
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
attributes[i++] = GLX_DRAWABLE_TYPE;
|
attributes[i++] = GLX_DRAWABLE_TYPE;
|
||||||
@ -528,15 +527,6 @@ glx_attributes_from_framebuffer_config (CoglDisplay *display,
|
|||||||
attributes[i++] = TRUE;
|
attributes[i++] = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (glx_renderer->glx_major == 1 && glx_renderer->glx_minor >= 4 &&
|
|
||||||
config->samples_per_pixel)
|
|
||||||
{
|
|
||||||
attributes[i++] = GLX_SAMPLE_BUFFERS;
|
|
||||||
attributes[i++] = 1;
|
|
||||||
attributes[i++] = GLX_SAMPLES;
|
|
||||||
attributes[i++] = config->samples_per_pixel;
|
|
||||||
}
|
|
||||||
|
|
||||||
attributes[i++] = None;
|
attributes[i++] = None;
|
||||||
|
|
||||||
g_assert (i < MAX_GLX_CONFIG_ATTRIBS);
|
g_assert (i < MAX_GLX_CONFIG_ATTRIBS);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user