aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/fbobject.c
diff options
context:
space:
mode:
authorChris Forbes <[email protected]>2013-02-06 20:42:53 +1300
committerChris Forbes <[email protected]>2013-03-24 16:38:18 +1300
commit90b5a2425a5f362ef51ae7bb4d296fc682b92f46 (patch)
tree356729947fb243c166574fce99e6057ac823798c /src/mesa/main/fbobject.c
parent86b83806007c65baea916a2ccf71ecbcc256ebba (diff)
mesa: helper for checking renderbuffer sample count
Pulls the checking of the sample count into a helper function, and extends the existing logic to include the interactions with both ARB_texture_multisample and ARB_internalformat_query. _mesa_check_sample_count() checks a desired sample count against a a combination of target/internalformat, and returns the error enum to be produced, if any. Unfortunately the conditions are messy and the errors vary. V2: - Tidy up spurious block. - Move _mesa_check_sample_count() to multisample.c instead; It doesn't really belong in fbobject.c or teximage.c. - Inlined spec quotes Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/main/fbobject.c')
-rw-r--r--src/mesa/main/fbobject.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index d7e15e1ce6c..3fdf62667b9 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -43,6 +43,7 @@
#include "hash.h"
#include "macros.h"
#include "mfeatures.h"
+#include "multisample.h"
#include "mtypes.h"
#include "renderbuffer.h"
#include "state.h"
@@ -1492,6 +1493,7 @@ renderbuffer_storage(GLenum target, GLenum internalFormat,
"glRenderbufferStorage" : "glRenderbufferStorageMultisample";
struct gl_renderbuffer *rb;
GLenum baseFormat;
+ GLenum sample_count_error;
GET_CURRENT_CONTEXT(ctx);
if (MESA_VERBOSE & VERBOSE_API) {
@@ -1535,9 +1537,14 @@ renderbuffer_storage(GLenum target, GLenum internalFormat,
/* NumSamples == 0 indicates non-multisampling */
samples = 0;
}
- else if (samples > (GLsizei) ctx->Const.MaxSamples) {
- /* note: driver may choose to use more samples than what's requested */
- _mesa_error(ctx, GL_INVALID_VALUE, "%s(samples)", func);
+
+ /* check the sample count;
+ * note: driver may choose to use more samples than what's requested
+ */
+ sample_count_error = _mesa_check_sample_count(ctx, target,
+ internalFormat, samples);
+ if (sample_count_error != GL_NO_ERROR) {
+ _mesa_error(ctx, sample_count_error, "%s(samples)", func);
return;
}