diff options
Diffstat (limited to 'mesalib/src')
-rw-r--r-- | mesalib/src/mesa/main/debug.c | 24 | ||||
-rw-r--r-- | mesalib/src/mesa/main/debug.h | 4 | ||||
-rw-r--r-- | mesalib/src/mesa/main/extensions.c | 24 |
3 files changed, 47 insertions, 5 deletions
diff --git a/mesalib/src/mesa/main/debug.c b/mesalib/src/mesa/main/debug.c index e336b077e..f82e32ed8 100644 --- a/mesalib/src/mesa/main/debug.c +++ b/mesalib/src/mesa/main/debug.c @@ -251,6 +251,9 @@ write_ppm(const char *filename, const GLubyte *buffer, int width, int height, }
fclose(f);
}
+ else {
+ fprintf(stderr, "Unable to create %s in write_ppm()\n", filename);
+ }
}
@@ -549,6 +552,27 @@ _mesa_dump_stencil_buffer(const char *filename) }
+void
+_mesa_dump_image(const char *filename, const void *image, GLuint w, GLuint h,
+ GLenum format, GLenum type)
+{
+ GLboolean invert = GL_TRUE;
+
+ if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) {
+ write_ppm(filename, image, w, h, 4, 0, 1, 2, invert);
+ }
+ else if (format == GL_BGRA && type == GL_UNSIGNED_BYTE) {
+ write_ppm(filename, image, w, h, 4, 2, 1, 0, invert);
+ }
+ else if (format == GL_LUMINANCE_ALPHA && type == GL_UNSIGNED_BYTE) {
+ write_ppm(filename, image, w, h, 2, 1, 0, 0, invert);
+ }
+ else {
+ _mesa_problem(NULL, "Unsupported format/type in _mesa_dump_image()");
+ }
+}
+
+
/**
* Quick and dirty function to "print" a texture to stdout.
*/
diff --git a/mesalib/src/mesa/main/debug.h b/mesalib/src/mesa/main/debug.h index 81fcf100d..eda377abb 100644 --- a/mesalib/src/mesa/main/debug.h +++ b/mesalib/src/mesa/main/debug.h @@ -85,6 +85,10 @@ extern void _mesa_dump_stencil_buffer(const char *filename);
extern void
+_mesa_dump_image(const char *filename, const void *image, GLuint w, GLuint h,
+ GLenum format, GLenum type);
+
+extern void
_mesa_print_texture(struct gl_context *ctx, const struct gl_texture_image *img);
#endif
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index 6de672e92..b58d3635e 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -753,7 +753,7 @@ _mesa_extension_is_enabled( struct gl_context *ctx, const char *name ) static char *
get_extension_override( struct gl_context *ctx )
{
- const char *env_const= _mesa_getenv("MESA_EXTENSION_OVERRIDE");
+ const char *env_const = _mesa_getenv("MESA_EXTENSION_OVERRIDE");
char *env;
char *ext;
char *extra_exts;
@@ -794,7 +794,7 @@ get_extension_override( struct gl_context *ctx ) }
/* Remove trailing space. */
- len = strlen(extra_exts);
+ len = strlen(extra_exts);
if (extra_exts[len - 1] == ' ')
extra_exts[len - 1] = '\0';
@@ -875,12 +875,24 @@ _mesa_make_extension_string(struct gl_context *ctx) GLboolean *base = (GLboolean *) &ctx->Extensions;
const struct extension *i;
unsigned j;
-
+ unsigned maxYear = ~0;
+
+ /* Check if the MESA_EXTENSION_MAX_YEAR env var is set */
+ {
+ const char *env = getenv("MESA_EXTENSION_MAX_YEAR");
+ if (env) {
+ maxYear = atoi(env);
+ _mesa_debug(ctx, "Note: limiting GL extensions to %u or earlier\n",
+ maxYear);
+ }
+ }
/* Compute length of the extension string. */
count = 0;
for (i = extension_table; i->name != 0; ++i) {
- if (base[i->offset] && (i->api_set & (1 << ctx->API))) {
+ if (base[i->offset] &&
+ i->year <= maxYear &&
+ (i->api_set & (1 << ctx->API))) {
length += strlen(i->name) + 1; /* +1 for space */
++count;
}
@@ -908,7 +920,9 @@ _mesa_make_extension_string(struct gl_context *ctx) */
j = 0;
for (i = extension_table; i->name != 0; ++i) {
- if (base[i->offset] && (i->api_set & (1 << ctx->API))) {
+ if (base[i->offset] &&
+ i->year <= maxYear &&
+ (i->api_set & (1 << ctx->API))) {
extension_indices[j++] = i - extension_table;
}
}
|