1
0
Fork 0

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:
Bilal Elmoussaoui 2024-07-31 15:31:16 +02:00 committed by Bilal Elmoussaoui
parent 4ddd83c51e
commit a1828e7212
8 changed files with 12 additions and 139 deletions

View file

@ -54,7 +54,6 @@ typedef struct _CoglFramebufferDriverConfig
typedef struct
{
gboolean need_stencil;
int samples_per_pixel;
gboolean stereo_enabled;
} CoglFramebufferConfig;
@ -121,10 +120,6 @@ cogl_framebuffer_init_config (CoglFramebuffer *framebuffer,
const CoglFramebufferConfig *
cogl_framebuffer_get_config (CoglFramebuffer *framebuffer);
void
cogl_framebuffer_update_samples_per_pixel (CoglFramebuffer *framebuffer,
int samples_per_pixel);
void
cogl_framebuffer_update_size (CoglFramebuffer *framebuffer,
int width,

View file

@ -134,8 +134,6 @@ typedef struct _CoglFramebufferPrivate
int clear_clip_y1;
gboolean clear_clip_dirty;
int samples_per_pixel;
/* Whether the depth buffer was enabled for this framebuffer,
* 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->projection_stack = cogl_matrix_stack_new (priv->context);
priv->samples_per_pixel = 0;
priv->clip_stack = NULL;
priv->journal = _cogl_journal_new (framebuffer);
@ -1191,15 +1187,6 @@ cogl_framebuffer_set_dither_enabled (CoglFramebuffer *framebuffer,
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 *
cogl_framebuffer_get_context (CoglFramebuffer *framebuffer)

View file

@ -52,19 +52,8 @@ CoglOnscreenTemplate *
cogl_onscreen_template_new (void)
{
CoglOnscreenTemplate *onscreen_template = g_object_new (COGL_TYPE_ONSCREEN_TEMPLATE, NULL);
char *user_config;
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;
}

View file

@ -41,7 +41,6 @@ typedef struct _CoglGlFbo
{
GLuint fbo_handle;
GList *renderbuffers;
int samples_per_pixel;
} CoglGlFbo;
struct _CoglGlFramebufferFbo
@ -210,8 +209,7 @@ static GList *
try_creating_renderbuffers (CoglContext *ctx,
int width,
int height,
CoglOffscreenAllocateFlags flags,
int n_samples)
CoglOffscreenAllocateFlags flags)
{
GList *renderbuffers = NULL;
GLuint gl_depth_stencil_handle;
@ -242,12 +240,6 @@ try_creating_renderbuffers (CoglContext *ctx,
/* Create a renderbuffer for depth and stenciling */
GE (ctx, glGenRenderbuffers (1, &gl_depth_stencil_handle));
GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, gl_depth_stencil_handle));
if (n_samples)
GE (ctx, glRenderbufferStorageMultisampleIMG (GL_RENDERBUFFER,
n_samples,
format,
width, height));
else
GE (ctx, glRenderbufferStorage (GL_RENDERBUFFER, format,
width, height));
GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, 0));
@ -274,12 +266,6 @@ try_creating_renderbuffers (CoglContext *ctx,
GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, gl_depth_handle));
/* For now we just ask for GL_DEPTH_COMPONENT16 since this is all that's
* available under GLES */
if (n_samples)
GE (ctx, glRenderbufferStorageMultisampleIMG (GL_RENDERBUFFER,
n_samples,
GL_DEPTH_COMPONENT16,
width, height));
else
GE (ctx, glRenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT16,
width, height));
GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, 0));
@ -296,12 +282,6 @@ try_creating_renderbuffers (CoglContext *ctx,
GE (ctx, glGenRenderbuffers (1, &gl_stencil_handle));
GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, gl_stencil_handle));
if (n_samples)
GE (ctx, glRenderbufferStorageMultisampleIMG (GL_RENDERBUFFER,
n_samples,
GL_STENCIL_INDEX8,
width, height));
else
GE (ctx, glRenderbufferStorage (GL_RENDERBUFFER, GL_STENCIL_INDEX8,
width, height));
GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, 0));
@ -349,7 +329,6 @@ try_creating_fbo (CoglContext *ctx,
GLuint tex_gl_handle;
GLenum tex_gl_target;
GLenum status;
int n_samples;
if (!cogl_texture_get_gl_texture (texture, &tex_gl_handle, &tex_gl_target))
return FALSE;
@ -361,15 +340,6 @@ try_creating_fbo (CoglContext *ctx,
)
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
* change framebuffer state so that the old framebuffer will be
* rebound again before drawing. */
@ -379,15 +349,7 @@ try_creating_fbo (CoglContext *ctx,
ctx->glGenFramebuffers (1, &gl_fbo->fbo_handle);
GE (ctx, glBindFramebuffer (GL_FRAMEBUFFER, gl_fbo->fbo_handle));
if (n_samples)
{
GE (ctx, glFramebufferTexture2DMultisampleIMG (GL_FRAMEBUFFER,
GL_COLOR_ATTACHMENT0,
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));
@ -398,8 +360,7 @@ try_creating_fbo (CoglContext *ctx,
try_creating_renderbuffers (ctx,
texture_level_width,
texture_level_height,
flags,
n_samples);
flags);
}
/* Make sure it's complete */
@ -415,21 +376,6 @@ try_creating_fbo (CoglContext *ctx,
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;
}
@ -562,9 +508,6 @@ cogl_gl_framebuffer_fbo_new (CoglFramebuffer *framebuffer,
allocate_flags = 0,
gl_fbo))
{
cogl_framebuffer_update_samples_per_pixel (framebuffer,
gl_fbo->samples_per_pixel);
if (!driver_config->disable_depth_and_stencil)
{
/* Record that the last set of flags succeeded so that we can

View file

@ -75,16 +75,6 @@ cogl_onscreen_egl_choose_config (CoglOnscreenEgl *onscreen_egl,
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;
return TRUE;
}

View file

@ -95,19 +95,6 @@ cogl_onscreen_glx_allocate (CoglFramebuffer *framebuffer,
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.
* We need to document that for windows we create then toolkits
* must be careful not to clear event mask bits that we select.

View file

@ -231,14 +231,6 @@ cogl_display_egl_determine_attributes (CoglDisplay *display,
EGL_OPENGL_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;
g_assert (i < MAX_EGL_CONFIG_ATTRIBS);

View file

@ -498,7 +498,6 @@ glx_attributes_from_framebuffer_config (CoglDisplay *display,
const CoglFramebufferConfig *config,
int *attributes)
{
CoglGLXRenderer *glx_renderer = display->renderer->winsys;
int i = 0;
attributes[i++] = GLX_DRAWABLE_TYPE;
@ -528,15 +527,6 @@ glx_attributes_from_framebuffer_config (CoglDisplay *display,
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;
g_assert (i < MAX_GLX_CONFIG_ATTRIBS);