summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/formatquery.c
diff options
context:
space:
mode:
authorEduardo Lima Mitev <[email protected]>2015-12-16 17:49:29 +0100
committerEduardo Lima Mitev <[email protected]>2016-03-03 15:14:05 +0100
commit993d7345b7c356d96f3d24865d83ff368bc6fc55 (patch)
treef08a3c5a7aed3ca8cbce72787dd3ef3a84feb58d /src/mesa/main/formatquery.c
parent25ee5c60dcb49e68c80eb5157769ccb655d647fa (diff)
mesa/formatquery: Use new driver hook QueryInternalFormat
Implements SAMPLES and NUM_SAMPLE_COUNTS queries using the new generic driver call QueryInternalFormat, which is being introduced as replacement of QuerySamplesForFormat to support ARB_internalformat_query2. Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/main/formatquery.c')
-rw-r--r--src/mesa/main/formatquery.c42
1 files changed, 14 insertions, 28 deletions
diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index 6ffa5534d7c..21d10a8e79c 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -54,10 +54,16 @@ _mesa_query_internal_format_default(struct gl_context *ctx, GLenum target,
(void) ctx;
(void) target;
(void) internalFormat;
- (void) pname;
- (void) params;
- /* @TODO */
+ switch (pname) {
+ case GL_SAMPLES:
+ case GL_NUM_SAMPLE_COUNTS:
+ params[0] = 1;
+ break;
+ default:
+ /* @TODO: handle default values for all the different pnames. */
+ break;
+ }
}
void GLAPIENTRY
@@ -74,7 +80,7 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
return;
}
- assert(ctx->Driver.QuerySamplesForFormat != NULL);
+ assert(ctx->Driver.QueryInternalFormat != NULL);
/* The ARB_internalformat_query spec says:
*
@@ -145,7 +151,8 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
switch (pname) {
case GL_SAMPLES:
- ctx->Driver.QuerySamplesForFormat(ctx, target, internalformat, buffer);
+ ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
+ buffer);
break;
case GL_NUM_SAMPLE_COUNTS: {
if ((ctx->API == API_OPENGLES2 && ctx->Version == 30) &&
@@ -159,29 +166,8 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
*/
buffer[0] = 0;
} else {
- size_t num_samples;
-
- /* The driver can return 0, and we should pass that along to the
- * application. The ARB decided that ARB_internalformat_query should
- * behave as ARB_internalformat_query2 in this situation.
- *
- * The ARB_internalformat_query2 spec says:
- *
- * "- NUM_SAMPLE_COUNTS: The number of sample counts that would be
- * returned by querying SAMPLES is returned in <params>.
- * * If <internalformat> is not color-renderable,
- * depth-renderable, or stencil-renderable (as defined in
- * section 4.4.4), or if <target> does not support multiple
- * samples (ie other than TEXTURE_2D_MULTISAMPLE,
- * TEXTURE_2D_MULTISAMPLE_ARRAY, or RENDERBUFFER), 0 is
- * returned."
- */
- num_samples = ctx->Driver.QuerySamplesForFormat(ctx, target, internalformat, buffer);
-
- /* QuerySamplesForFormat writes some stuff to buffer, so we have to
- * separately over-write it with the requested value.
- */
- buffer[0] = (GLint) num_samples;
+ ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
+ buffer);
}
break;
}