aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/main/mtypes.h2
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c5
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c5
3 files changed, 7 insertions, 5 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 404d586ff7b..1dec89c5445 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3303,7 +3303,7 @@ struct gl_renderbuffer
* called without a rb->TexImage.
*/
GLboolean NeedsFinishRenderTexture;
- GLubyte NumSamples;
+ GLubyte NumSamples; /**< zero means not multisampled */
GLenum InternalFormat; /**< The user-specified format */
GLenum _BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_DEPTH_COMPONENT or
GL_STENCIL_INDEX. */
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 23cbcdc2a19..afc7700306e 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -156,12 +156,11 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx,
* by the implementation.
*
* So let's find the supported number of samples closest to NumSamples.
- * (NumSamples == 1) is treated the same as (NumSamples == 0).
*/
- if (rb->NumSamples > 1) {
+ if (rb->NumSamples > 0) {
unsigned i;
- for (i = rb->NumSamples; i <= ctx->Const.MaxSamples; i++) {
+ for (i = MAX2(2, rb->NumSamples); 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 db2913ed9e3..f1eb548bb87 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -2680,10 +2680,13 @@ st_AllocTextureStorage(struct gl_context *ctx,
bindings = default_bindings(st, fmt);
/* Raise the sample count if the requested one is unsupported. */
- if (num_samples > 1) {
+ if (num_samples > 0) {
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);
+
for (; num_samples <= ctx->Const.MaxSamples; num_samples++) {
if (screen->is_format_supported(screen, fmt, ptarget,
num_samples,