diff options
-rw-r--r-- | src/mesa/state_tracker/st_cb_fbo.c | 13 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_texture.c | 11 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_extensions.c | 14 |
3 files changed, 24 insertions, 14 deletions
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index afc7700306e..a7c286bcc52 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -155,12 +155,19 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx, * to <samples> and no more than the next larger sample count supported * by the implementation. * - * So let's find the supported number of samples closest to NumSamples. + * Find the supported number of samples >= rb->NumSamples */ if (rb->NumSamples > 0) { - unsigned i; + unsigned start, i; - for (i = MAX2(2, rb->NumSamples); i <= ctx->Const.MaxSamples; i++) { + if (ctx->Const.MaxSamples > 1 && rb->NumSamples == 1) { + /* don't try num_samples = 1 with drivers that support real msaa */ + start = 2; + } else { + start = rb->NumSamples; + } + + for (i = start; i <= ctx->Const.MaxSamples; i++) { format = st_choose_renderbuffer_format(st, internalFormat, i); if (format != PIPE_FORMAT_NONE) { diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index af2052db243..b5006b05a7b 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -2739,13 +2739,18 @@ st_texture_storage(struct gl_context *ctx, bindings = default_bindings(st, fmt); - /* Raise the sample count if the requested one is unsupported. */ if (num_samples > 0) { + /* Find msaa sample count which is actually supported. For example, + * if the user requests 1x but only 4x or 8x msaa is supported, we'll + * choose 4x here. + */ enum pipe_texture_target ptarget = gl_target_to_pipe(texObj->Target); boolean found = FALSE; - /* start the query with at least two samples */ - num_samples = MAX2(num_samples, 2); + if (ctx->Const.MaxSamples > 1 && num_samples == 1) { + /* don't try num_samples = 1 with drivers that support real msaa */ + num_samples = 2; + } for (; num_samples <= ctx->Const.MaxSamples; num_samples++) { if (screen->is_format_supported(screen, fmt, ptarget, diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 87859032512..bc206df3bf1 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -1046,17 +1046,15 @@ void st_init_extensions(struct pipe_screen *screen, void_formats, 32, PIPE_BIND_RENDER_TARGET); } - if (consts->MaxSamples == 1) { - /* one sample doesn't really make sense */ - consts->MaxSamples = 0; - } - else if (consts->MaxSamples >= 2) { + + if (consts->MaxSamples >= 2) { + /* Real MSAA support */ extensions->EXT_framebuffer_multisample = GL_TRUE; extensions->EXT_framebuffer_multisample_blit_scaled = GL_TRUE; } - - if (consts->MaxSamples == 0 && - screen->get_param(screen, PIPE_CAP_FAKE_SW_MSAA)) { + else if (consts->MaxSamples > 0 && + screen->get_param(screen, PIPE_CAP_FAKE_SW_MSAA)) { + /* fake MSAA support */ consts->FakeSWMSAA = GL_TRUE; extensions->EXT_framebuffer_multisample = GL_TRUE; extensions->EXT_framebuffer_multisample_blit_scaled = GL_TRUE; |