aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format.c41
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format.h12
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format_other.c10
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format_parse.py11
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_inlines.h16
-rw-r--r--mesalib/src/glsl/glcpp/README4
-rw-r--r--mesalib/src/glsl/glcpp/glcpp-parse.y99
-rw-r--r--mesalib/src/glsl/glcpp/glcpp.c2
-rw-r--r--mesalib/src/glsl/ir_function_detect_recursion.cpp1
-rw-r--r--mesalib/src/glsl/ir_validate.cpp4
-rw-r--r--mesalib/src/glsl/main.cpp2
-rw-r--r--mesalib/src/glsl/opt_constant_propagation.cpp1
-rw-r--r--mesalib/src/glsl/test_optpass.cpp2
-rw-r--r--mesalib/src/mapi/glapi/gen/gl_genexec.py2
-rw-r--r--mesalib/src/mesa/Android.gen.mk1
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c51
-rw-r--r--mesalib/src/mesa/drivers/dri/common/dri_util.c12
-rw-r--r--mesalib/src/mesa/drivers/dri/common/drisw_util.c2
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast.c8
-rw-r--r--mesalib/src/mesa/drivers/windows/gdi/wmesa.c6
-rw-r--r--mesalib/src/mesa/main/api_loopback.c4
-rw-r--r--mesalib/src/mesa/main/api_validate.c4
-rw-r--r--mesalib/src/mesa/main/attrib.c2
-rw-r--r--mesalib/src/mesa/main/buffers.c2
-rw-r--r--mesalib/src/mesa/main/context.c2
-rw-r--r--mesalib/src/mesa/main/context.h2
-rw-r--r--mesalib/src/mesa/main/enable.c196
-rw-r--r--mesalib/src/mesa/main/extensions.c4
-rw-r--r--mesalib/src/mesa/main/fbobject.c181
-rw-r--r--mesalib/src/mesa/main/fog.c6
-rw-r--r--mesalib/src/mesa/main/get.c2
-rw-r--r--mesalib/src/mesa/main/getstring.c24
-rw-r--r--mesalib/src/mesa/main/glformats.c117
-rw-r--r--mesalib/src/mesa/main/glformats.h6
-rw-r--r--mesalib/src/mesa/main/hint.c8
-rw-r--r--mesalib/src/mesa/main/light.c8
-rw-r--r--mesalib/src/mesa/main/matrix.c2
-rw-r--r--mesalib/src/mesa/main/mtypes.h4
-rw-r--r--mesalib/src/mesa/main/points.c2
-rw-r--r--mesalib/src/mesa/main/queryobj.c2
-rw-r--r--mesalib/src/mesa/main/renderbuffer.c8
-rw-r--r--mesalib/src/mesa/main/renderbuffer.h2
-rw-r--r--mesalib/src/mesa/main/shaderapi.c6
-rw-r--r--mesalib/src/mesa/main/shared.c3
-rw-r--r--mesalib/src/mesa/main/texenv.c26
-rw-r--r--mesalib/src/mesa/main/texgen.c14
-rw-r--r--mesalib/src/mesa/main/texgetimage.c38
-rw-r--r--mesalib/src/mesa/main/teximage.c4
-rw-r--r--mesalib/src/mesa/main/texparam.c30
-rw-r--r--mesalib/src/mesa/main/version.c4
-rw-r--r--mesalib/src/mesa/main/vtxfmt.c14
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_fbo.c12
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_flush.c1
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_manager.c4
-rw-r--r--mesalib/src/mesa/swrast/s_renderbuffer.c4
-rw-r--r--mesalib/src/mesa/swrast/s_texrender.c2
-rw-r--r--mesalib/src/mesa/vbo/vbo_context.c4
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_api.c6
59 files changed, 564 insertions, 485 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_format.c b/mesalib/src/gallium/auxiliary/util/u_format.c
index ddce95601..8228de1f2 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format.c
+++ b/mesalib/src/gallium/auxiliary/util/u_format.c
@@ -134,47 +134,6 @@ util_format_is_pure_uint(enum pipe_format format)
return (desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED && desc->channel[i].pure_integer) ? TRUE : FALSE;
}
-boolean
-util_format_is_array(const struct util_format_description *desc)
-{
- unsigned chan;
-
- if (desc->layout != UTIL_FORMAT_LAYOUT_PLAIN ||
- desc->colorspace != UTIL_FORMAT_COLORSPACE_RGB ||
- desc->block.width != 1 ||
- desc->block.height != 1) {
- return FALSE;
- }
-
- for (chan = 0; chan < desc->nr_channels; ++chan) {
- if (desc->channel[chan].size != desc->channel[0].size)
- return FALSE;
-
- if (desc->channel[chan].type == UTIL_FORMAT_TYPE_VOID && (chan + 1) == desc->nr_channels)
- continue;
-
- if (desc->channel[chan].type != desc->channel[0].type)
- return FALSE;
-
- if (desc->channel[chan].normalized != desc->channel[0].normalized)
- return FALSE;
-
- if (desc->channel[chan].pure_integer != desc->channel[0].pure_integer)
- return FALSE;
- }
-
- if (desc->nr_channels == 4) {
- if (desc->swizzle[3] < 3)
- return FALSE;
- } else {
- for (chan = 0; chan < desc->nr_channels; ++chan) {
- if (desc->swizzle[chan] != chan)
- return FALSE;
- }
- }
-
- return TRUE;
-}
boolean
util_format_is_luminance_alpha(enum pipe_format format)
diff --git a/mesalib/src/gallium/auxiliary/util/u_format.h b/mesalib/src/gallium/auxiliary/util/u_format.h
index 25bfd234b..024dabb07 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format.h
+++ b/mesalib/src/gallium/auxiliary/util/u_format.h
@@ -156,7 +156,7 @@ struct util_format_description
unsigned nr_channels:3;
/**
- * Whether all channels have the same number of (whole) bytes.
+ * Whether all channels have the same number of (whole) bytes and type.
*/
unsigned is_array:1;
@@ -591,16 +591,6 @@ boolean
util_format_is_pure_uint(enum pipe_format format);
/**
- * Whether the format is a simple array format where all channels
- * are of the same type and can be loaded from memory as a vector.
- *
- * If format is 4 channel it can be swizzled (eg BGRA) as long
- * as the alpha is the 3rd channel.
- */
-boolean
-util_format_is_array(const struct util_format_description *desc);
-
-/**
* Check if the src format can be blitted to the destination format with
* a simple memcpy. For example, blitting from RGBA to RGBx is OK, but not
* the reverse.
diff --git a/mesalib/src/gallium/auxiliary/util/u_format_other.c b/mesalib/src/gallium/auxiliary/util/u_format_other.c
index c23f4ee4a..85001c14f 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format_other.c
+++ b/mesalib/src/gallium/auxiliary/util/u_format_other.c
@@ -342,7 +342,7 @@ util_format_r8g8bx_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
int16_t r, g;
#ifdef PIPE_ARCH_BIG_ENDIAN
- value = util_bswap32(value);
+ value = util_bswap16(value);
#endif
r = ((int16_t)(value << 8)) >> 8;
@@ -374,7 +374,7 @@ util_format_r8g8bx_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_strid
int16_t r, g;
#ifdef PIPE_ARCH_BIG_ENDIAN
- value = util_bswap32(value);
+ value = util_bswap16(value);
#endif
r = ((int16_t)(value << 8)) >> 8;
@@ -408,7 +408,7 @@ util_format_r8g8bx_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
value |= (uint16_t)((((int8_t)(CLAMP(src[1], -1, 1) * 0x7f)) & 0xff) << 8) ;
#ifdef PIPE_ARCH_BIG_ENDIAN
- value = util_bswap32(value);
+ value = util_bswap16(value);
#endif
*dst++ = value;
@@ -438,7 +438,7 @@ util_format_r8g8bx_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
value |= (src[1] >> 1) << 8;
#ifdef PIPE_ARCH_BIG_ENDIAN
- value = util_bswap32(value);
+ value = util_bswap16(value);
#endif
*dst++ = value;
@@ -459,7 +459,7 @@ util_format_r8g8bx_snorm_fetch_rgba_float(float *dst, const uint8_t *src,
int16_t r, g;
#ifdef PIPE_ARCH_BIG_ENDIAN
- value = util_bswap32(value);
+ value = util_bswap16(value);
#endif
r = ((int16_t)(value << 8)) >> 8;
diff --git a/mesalib/src/gallium/auxiliary/util/u_format_parse.py b/mesalib/src/gallium/auxiliary/util/u_format_parse.py
index 3a39e5ba5..07052b996 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format_parse.py
+++ b/mesalib/src/gallium/auxiliary/util/u_format_parse.py
@@ -144,9 +144,18 @@ class Format:
if self.layout != PLAIN:
return False
ref_channel = self.channels[0]
- for channel in self.channels[1:]:
+ if ref_channel.type == VOID:
+ ref_channel = self.channels[1]
+ for channel in self.channels:
if channel.size and (channel.size != ref_channel.size or channel.size % 8):
return False
+ if channel.type != VOID:
+ if channel.type != ref_channel.type:
+ return False
+ if channel.norm != ref_channel.norm:
+ return False
+ if channel.pure != ref_channel.pure:
+ return False
return True
def is_mixed(self):
diff --git a/mesalib/src/gallium/auxiliary/util/u_inlines.h b/mesalib/src/gallium/auxiliary/util/u_inlines.h
index 6ef5fecc6..cb06ee2e0 100644
--- a/mesalib/src/gallium/auxiliary/util/u_inlines.h
+++ b/mesalib/src/gallium/auxiliary/util/u_inlines.h
@@ -114,6 +114,22 @@ pipe_surface_reference(struct pipe_surface **ptr, struct pipe_surface *surf)
*ptr = surf;
}
+/**
+ * Similar to pipe_surface_reference() but always set the pointer to NULL
+ * and pass in an explicit context. The explicit context avoids the problem
+ * of using a deleted context's surface_destroy() method when freeing a surface
+ * that's shared by multiple contexts.
+ */
+static INLINE void
+pipe_surface_release(struct pipe_context *pipe, struct pipe_surface **ptr)
+{
+ if (pipe_reference_described(&(*ptr)->reference, NULL,
+ (debug_reference_descriptor)debug_describe_surface))
+ pipe->surface_destroy(pipe, *ptr);
+ *ptr = NULL;
+}
+
+
static INLINE void
pipe_resource_reference(struct pipe_resource **ptr, struct pipe_resource *tex)
{
diff --git a/mesalib/src/glsl/glcpp/README b/mesalib/src/glsl/glcpp/README
index 0b5ef508c..0637935e2 100644
--- a/mesalib/src/glsl/glcpp/README
+++ b/mesalib/src/glsl/glcpp/README
@@ -20,13 +20,11 @@ to encounter and deal with the following preprocessor macros:
#pragma
#extension
-All other macros will be handles according to the GLSL specification
+All other macros will be handled according to the GLSL specification
and will not appear in the output.
Known limitations
-----------------
-The __LINE__ and __FILE__ macros are not yet supported.
-
A file that ends with a function-like macro name as the last
non-whitespace token will result in a parse error, (where it should be
passed through as is). \ No newline at end of file
diff --git a/mesalib/src/glsl/glcpp/glcpp-parse.y b/mesalib/src/glsl/glcpp/glcpp-parse.y
index b0537c3b0..e7daf7fea 100644
--- a/mesalib/src/glsl/glcpp/glcpp-parse.y
+++ b/mesalib/src/glsl/glcpp/glcpp-parse.y
@@ -1054,26 +1054,67 @@ _token_paste (glcpp_parser_t *parser, token_t *token, token_t *other)
return combined;
}
- /* Two string-valued tokens can usually just be mashed
- * together.
+ /* Two string-valued (or integer) tokens can usually just be
+ * mashed together. (We also handle a string followed by an
+ * integer here as well.)
*
- * XXX: This isn't actually legitimate. Several things here
- * should result in a diagnostic since the result cannot be a
- * valid, single pre-processing token. For example, pasting
- * "123" and "abc" is not legal, but we don't catch that
- * here. */
- if ((token->type == IDENTIFIER || token->type == OTHER || token->type == INTEGER_STRING) &&
- (other->type == IDENTIFIER || other->type == OTHER || other->type == INTEGER_STRING))
+ * There are some exceptions here. Notably, if the first token
+ * is an integer (or a string representing an integer), then
+ * the second token must also be an integer or must be a
+ * string representing an integer that begins with a digit.
+ */
+ if ((token->type == IDENTIFIER || token->type == OTHER || token->type == INTEGER_STRING || token->type == INTEGER) &&
+ (other->type == IDENTIFIER || other->type == OTHER || other->type == INTEGER_STRING || other->type == INTEGER))
{
char *str;
+ int combined_type;
+
+ /* Check that pasting onto an integer doesn't create a
+ * non-integer, (that is, only digits can be
+ * pasted. */
+ if (token->type == INTEGER_STRING || token->type == INTEGER)
+ {
+ switch (other->type) {
+ case INTEGER_STRING:
+ if (other->value.str[0] < '0' ||
+ other->value.str[0] > '9')
+ goto FAIL;
+ break;
+ case INTEGER:
+ if (other->value.ival < 0)
+ goto FAIL;
+ break;
+ default:
+ goto FAIL;
+ }
+ }
- str = ralloc_asprintf (token, "%s%s", token->value.str,
- other->value.str);
- combined = _token_create_str (token, token->type, str);
+ if (token->type == INTEGER)
+ str = ralloc_asprintf (token, "%" PRIiMAX,
+ token->value.ival);
+ else
+ str = ralloc_strdup (token, token->value.str);
+
+
+ if (other->type == INTEGER)
+ ralloc_asprintf_append (&str, "%" PRIiMAX,
+ other->value.ival);
+ else
+ ralloc_strcat (&str, other->value.str);
+
+ /* New token is same type as original token, unless we
+ * started with an integer, in which case we will be
+ * creating an integer-string. */
+ combined_type = token->type;
+ if (combined_type == INTEGER)
+ combined_type = INTEGER_STRING;
+
+ combined = _token_create_str (token, combined_type, str);
combined->location = token->location;
return combined;
}
+ FAIL:
glcpp_error (&token->location, parser, "");
ralloc_asprintf_rewrite_tail (&parser->info_log, &parser->info_log_length, "Pasting \"");
_token_print (&parser->info_log, &parser->info_log_length, token);
@@ -1300,18 +1341,30 @@ _arguments_parse (argument_list_t *arguments,
}
static token_list_t *
-_token_list_create_with_one_space (void *ctx)
+_token_list_create_with_one_ival (void *ctx, int type, int ival)
{
token_list_t *list;
- token_t *space;
+ token_t *node;
list = _token_list_create (ctx);
- space = _token_create_ival (list, SPACE, SPACE);
- _token_list_append (list, space);
+ node = _token_create_ival (list, type, ival);
+ _token_list_append (list, node);
return list;
}
+static token_list_t *
+_token_list_create_with_one_space (void *ctx)
+{
+ return _token_list_create_with_one_ival (ctx, SPACE, SPACE);
+}
+
+static token_list_t *
+_token_list_create_with_one_integer (void *ctx, int ival)
+{
+ return _token_list_create_with_one_ival (ctx, INTEGER, ival);
+}
+
/* Perform macro expansion on 'list', placing the resulting tokens
* into a new list which is initialized with a first token of type
* 'head_token_type'. Then begin lexing from the resulting list,
@@ -1528,8 +1581,18 @@ _glcpp_parser_expand_node (glcpp_parser_t *parser,
return NULL;
}
- /* Look up this identifier in the hash table. */
+ *last = node;
identifier = token->value.str;
+
+ /* Special handling for __LINE__ and __FILE__, (not through
+ * the hash table). */
+ if (strcmp(identifier, "__LINE__") == 0)
+ return _token_list_create_with_one_integer (parser, node->token->location.first_line);
+
+ if (strcmp(identifier, "__FILE__") == 0)
+ return _token_list_create_with_one_integer (parser, node->token->location.source);
+
+ /* Look up this identifier in the hash table. */
macro = hash_table_find (parser->defines, identifier);
/* Not a macro, so no expansion needed. */
@@ -1550,14 +1613,12 @@ _glcpp_parser_expand_node (glcpp_parser_t *parser,
final = _token_create_str (parser, OTHER, str);
expansion = _token_list_create (parser);
_token_list_append (expansion, final);
- *last = node;
return expansion;
}
if (! macro->is_function)
{
token_list_t *replacement;
- *last = node;
/* Replace a macro defined as empty with a SPACE token. */
if (macro->replacements == NULL)
diff --git a/mesalib/src/glsl/glcpp/glcpp.c b/mesalib/src/glsl/glcpp/glcpp.c
index 130f4324d..bef9fd08e 100644
--- a/mesalib/src/glsl/glcpp/glcpp.c
+++ b/mesalib/src/glsl/glcpp/glcpp.c
@@ -119,7 +119,7 @@ main (int argc, char *argv[])
if (shader == NULL)
return 1;
- ret = glcpp_preprocess(ctx, &shader, &info_log, NULL, API_OPENGL);
+ ret = glcpp_preprocess(ctx, &shader, &info_log, NULL, API_OPENGL_COMPAT);
printf("%s", shader);
fprintf(stderr, "%s", info_log);
diff --git a/mesalib/src/glsl/ir_function_detect_recursion.cpp b/mesalib/src/glsl/ir_function_detect_recursion.cpp
index 0a5e647cd..4b39f9724 100644
--- a/mesalib/src/glsl/ir_function_detect_recursion.cpp
+++ b/mesalib/src/glsl/ir_function_detect_recursion.cpp
@@ -173,6 +173,7 @@ public:
has_recursion_visitor()
: current(NULL)
{
+ progress = false;
this->mem_ctx = ralloc_context(NULL);
this->function_hash = hash_table_ctor(0, hash_table_pointer_hash,
hash_table_pointer_compare);
diff --git a/mesalib/src/glsl/ir_validate.cpp b/mesalib/src/glsl/ir_validate.cpp
index af0b5768a..ad57a3149 100644
--- a/mesalib/src/glsl/ir_validate.cpp
+++ b/mesalib/src/glsl/ir_validate.cpp
@@ -120,7 +120,7 @@ ir_visitor_status
ir_validate::visit_leave(ir_loop *ir)
{
if (ir->counter != NULL) {
- if ((ir->from == NULL) || (ir->from == NULL) || (ir->increment == NULL)) {
+ if ((ir->from == NULL) || (ir->to == NULL) || (ir->increment == NULL)) {
printf("ir_loop has invalid loop controls:\n"
" counter: %p\n"
" from: %p\n"
@@ -136,7 +136,7 @@ ir_validate::visit_leave(ir_loop *ir)
abort();
}
} else {
- if ((ir->from != NULL) || (ir->from != NULL) || (ir->increment != NULL)) {
+ if ((ir->from != NULL) || (ir->to != NULL) || (ir->increment != NULL)) {
printf("ir_loop has invalid loop controls:\n"
" counter: %p\n"
" from: %p\n"
diff --git a/mesalib/src/glsl/main.cpp b/mesalib/src/glsl/main.cpp
index 23bd3cde2..af97c545b 100644
--- a/mesalib/src/glsl/main.cpp
+++ b/mesalib/src/glsl/main.cpp
@@ -234,7 +234,7 @@ main(int argc, char **argv)
if (argc <= optind)
usage_fail(argv[0]);
- initialize_context(ctx, (glsl_es) ? API_OPENGLES2 : API_OPENGL);
+ initialize_context(ctx, (glsl_es) ? API_OPENGLES2 : API_OPENGL_COMPAT);
struct gl_shader_program *whole_program;
diff --git a/mesalib/src/glsl/opt_constant_propagation.cpp b/mesalib/src/glsl/opt_constant_propagation.cpp
index c5ae36b69..a03811999 100644
--- a/mesalib/src/glsl/opt_constant_propagation.cpp
+++ b/mesalib/src/glsl/opt_constant_propagation.cpp
@@ -92,6 +92,7 @@ public:
ir_constant_propagation_visitor()
{
progress = false;
+ killed_all = false;
mem_ctx = ralloc_context(0);
this->acp = new(mem_ctx) exec_list;
this->kills = new(mem_ctx) exec_list;
diff --git a/mesalib/src/glsl/test_optpass.cpp b/mesalib/src/glsl/test_optpass.cpp
index 5ed11702c..ce5df24d9 100644
--- a/mesalib/src/glsl/test_optpass.cpp
+++ b/mesalib/src/glsl/test_optpass.cpp
@@ -197,7 +197,7 @@ int test_optpass(int argc, char **argv)
struct gl_context local_ctx;
struct gl_context *ctx = &local_ctx;
- initialize_context_to_defaults(ctx, API_OPENGL);
+ initialize_context_to_defaults(ctx, API_OPENGL_COMPAT);
ctx->Driver.NewShader = _mesa_new_shader;
diff --git a/mesalib/src/mapi/glapi/gen/gl_genexec.py b/mesalib/src/mapi/glapi/gen/gl_genexec.py
index 9b716894c..593d1955b 100644
--- a/mesalib/src/mapi/glapi/gen/gl_genexec.py
+++ b/mesalib/src/mapi/glapi/gen/gl_genexec.py
@@ -166,7 +166,7 @@ class PrintCode(gl_XML.gl_print_base):
condition_parts = []
if f.desktop:
if f.deprecated:
- condition_parts.append('ctx->API == API_OPENGL')
+ condition_parts.append('ctx->API == API_OPENGL_COMPAT')
else:
condition_parts.append('_mesa_is_desktop_gl(ctx)')
if 'es1' in f.api_map:
diff --git a/mesalib/src/mesa/Android.gen.mk b/mesalib/src/mesa/Android.gen.mk
index 5f0d73cff..35f00da09 100644
--- a/mesalib/src/mesa/Android.gen.mk
+++ b/mesalib/src/mesa/Android.gen.mk
@@ -32,6 +32,7 @@ intermediates := $(call local-intermediates-dir)
# This is the list of auto-generated files: sources and headers
sources := \
main/enums.c \
+ main/api_exec.c \
main/dispatch.h \
main/remap_helper.h \
main/get_hash.h
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index 7d58281c1..d5e8af3c0 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -567,7 +567,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
save->PolygonCull = ctx->Polygon.CullFlag;
_mesa_PolygonMode(GL_FRONT_AND_BACK, GL_FILL);
_mesa_set_enable(ctx, GL_POLYGON_OFFSET_FILL, GL_FALSE);
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
_mesa_set_enable(ctx, GL_POLYGON_SMOOTH, GL_FALSE);
_mesa_set_enable(ctx, GL_POLYGON_STIPPLE, GL_FALSE);
}
@@ -580,14 +580,14 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
}
if (state & MESA_META_SHADER) {
- if (ctx->API == API_OPENGL && ctx->Extensions.ARB_vertex_program) {
+ if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_vertex_program) {
save->VertexProgramEnabled = ctx->VertexProgram.Enabled;
_mesa_reference_vertprog(ctx, &save->VertexProgram,
ctx->VertexProgram.Current);
_mesa_set_enable(ctx, GL_VERTEX_PROGRAM_ARB, GL_FALSE);
}
- if (ctx->API == API_OPENGL && ctx->Extensions.ARB_fragment_program) {
+ if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_fragment_program) {
save->FragmentProgramEnabled = ctx->FragmentProgram.Enabled;
_mesa_reference_fragprog(ctx, &save->FragmentProgram,
ctx->FragmentProgram.Current);
@@ -623,7 +623,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
save->EnvMode = ctx->Texture.Unit[0].EnvMode;
/* Disable all texture units */
- if (ctx->API == API_OPENGL || ctx->API == API_OPENGLES) {
+ if (ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES) {
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
save->TexEnabled[u] = ctx->Texture.Unit[u].Enabled;
save->TexGenEnabled[u] = ctx->Texture.Unit[u].TexGenEnabled;
@@ -636,7 +636,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
if (ctx->Extensions.OES_EGL_image_external)
_mesa_set_enable(ctx, GL_TEXTURE_EXTERNAL_OES, GL_FALSE);
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
_mesa_set_enable(ctx, GL_TEXTURE_1D, GL_FALSE);
_mesa_set_enable(ctx, GL_TEXTURE_3D, GL_FALSE);
if (ctx->Extensions.NV_texture_rectangle)
@@ -661,7 +661,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
/* set defaults for unit[0] */
_mesa_ActiveTexture(GL_TEXTURE0);
_mesa_ClientActiveTexture(GL_TEXTURE0);
- if (ctx->API == API_OPENGL || ctx->API == API_OPENGLES) {
+ if (ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES) {
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
}
}
@@ -684,11 +684,9 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
_mesa_LoadIdentity();
_mesa_MatrixMode(GL_PROJECTION);
_mesa_LoadIdentity();
- if (ctx->DrawBuffer->Initialized) {
- _mesa_Ortho(0.0, ctx->DrawBuffer->Width,
- 0.0, ctx->DrawBuffer->Height,
- -1.0, 1.0);
- }
+ _mesa_Ortho(0.0, ctx->DrawBuffer->Width,
+ 0.0, ctx->DrawBuffer->Height,
+ -1.0, 1.0);
}
if (state & MESA_META_CLIP) {
@@ -885,7 +883,7 @@ _mesa_meta_end(struct gl_context *ctx)
_mesa_PolygonMode(GL_FRONT, save->FrontPolygonMode);
_mesa_PolygonMode(GL_BACK, save->BackPolygonMode);
}
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
_mesa_set_enable(ctx, GL_POLYGON_STIPPLE, save->PolygonStipple);
_mesa_set_enable(ctx, GL_POLYGON_SMOOTH, save->PolygonSmooth);
}
@@ -900,7 +898,7 @@ _mesa_meta_end(struct gl_context *ctx)
}
if (state & MESA_META_SHADER) {
- if (ctx->API == API_OPENGL && ctx->Extensions.ARB_vertex_program) {
+ if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_vertex_program) {
_mesa_set_enable(ctx, GL_VERTEX_PROGRAM_ARB,
save->VertexProgramEnabled);
_mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
@@ -908,7 +906,7 @@ _mesa_meta_end(struct gl_context *ctx)
_mesa_reference_vertprog(ctx, &save->VertexProgram, NULL);
}
- if (ctx->API == API_OPENGL && ctx->Extensions.ARB_fragment_program) {
+ if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_fragment_program) {
_mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB,
save->FragmentProgramEnabled);
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
@@ -941,7 +939,7 @@ _mesa_meta_end(struct gl_context *ctx)
_mesa_set_enable(ctx, GL_STENCIL_TEST, stencil->Enabled);
_mesa_ClearStencil(stencil->Clear);
- if (ctx->API == API_OPENGL && ctx->Extensions.EXT_stencil_two_side) {
+ if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.EXT_stencil_two_side) {
_mesa_set_enable(ctx, GL_STENCIL_TEST_TWO_SIDE_EXT,
stencil->TestTwoSide);
_mesa_ActiveStencilFaceEXT(stencil->ActiveFace
@@ -973,7 +971,7 @@ _mesa_meta_end(struct gl_context *ctx)
ASSERT(ctx->Texture.CurrentUnit == 0);
/* restore texenv for unit[0] */
- if (ctx->API == API_OPENGL || ctx->API == API_OPENGLES) {
+ if (ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES) {
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, save->EnvMode);
}
@@ -988,7 +986,7 @@ _mesa_meta_end(struct gl_context *ctx)
}
/* Restore fixed function texture enables, texgen */
- if (ctx->API == API_OPENGL || ctx->API == API_OPENGLES) {
+ if (ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES) {
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
if (ctx->Texture.Unit[u].Enabled != save->TexEnabled[u]) {
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
@@ -3268,7 +3266,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
_mesa_BindFramebuffer(GL_FRAMEBUFFER_EXT, mipmap->FBO);
- if (ctx->API == API_OPENGL || ctx->API == API_OPENGLES)
+ if (ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES)
_mesa_TexParameteri(target, GL_GENERATE_MIPMAP, GL_FALSE);
else
assert(!genMipmapSave);
@@ -3687,6 +3685,7 @@ decompress_texture_image(struct gl_context *ctx,
/* read pixels from renderbuffer */
{
GLenum baseTexFormat = texImage->_BaseFormat;
+ GLenum destBaseFormat = _mesa_base_tex_format(ctx, destFormat);
/* The pixel transfer state will be set to default values at this point
* (see MESA_META_PIXEL_TRANSFER) so pixel transfer ops are effectively
@@ -3695,9 +3694,19 @@ decompress_texture_image(struct gl_context *ctx,
* returned as red and two-channel texture values are returned as
* red/alpha.
*/
- if (baseTexFormat == GL_LUMINANCE ||
- baseTexFormat == GL_LUMINANCE_ALPHA ||
- baseTexFormat == GL_INTENSITY) {
+ if ((baseTexFormat == GL_LUMINANCE ||
+ baseTexFormat == GL_LUMINANCE_ALPHA ||
+ baseTexFormat == GL_INTENSITY) ||
+ /* If we're reading back an RGB(A) texture (using glGetTexImage) as
+ * luminance then we need to return L=tex(R).
+ */
+ ((baseTexFormat == GL_RGBA ||
+ baseTexFormat == GL_RGB ||
+ baseTexFormat == GL_RG) &&
+ (destBaseFormat == GL_LUMINANCE ||
+ destBaseFormat == GL_LUMINANCE_ALPHA ||
+ destBaseFormat == GL_LUMINANCE_INTEGER_EXT ||
+ destBaseFormat == GL_LUMINANCE_ALPHA_INTEGER_EXT))) {
/* Green and blue must be zero */
_mesa_PixelTransferf(GL_GREEN_SCALE, 0.0f);
_mesa_PixelTransferf(GL_BLUE_SCALE, 0.0f);
diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.c b/mesalib/src/mesa/drivers/dri/common/dri_util.c
index 917b9465b..9cebcea92 100644
--- a/mesalib/src/mesa/drivers/dri/common/dri_util.c
+++ b/mesalib/src/mesa/drivers/dri/common/dri_util.c
@@ -183,7 +183,7 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
switch (api) {
case __DRI_API_OPENGL:
- mesa_api = API_OPENGL;
+ mesa_api = API_OPENGL_COMPAT;
break;
case __DRI_API_GLES:
mesa_api = API_OPENGLES;
@@ -221,13 +221,13 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
}
/* Mesa does not support the GL_ARB_compatibilty extension or the
- * compatibility profile. This means that we treat a API_OPENGL 3.1 as
- * API_OPENGL_CORE and reject API_OPENGL 3.2+.
+ * compatibility profile. This means that we treat a API_OPENGL_COMPAT 3.1 as
+ * API_OPENGL_CORE and reject API_OPENGL_COMPAT 3.2+.
*/
- if (mesa_api == API_OPENGL && major_version == 3 && minor_version == 1)
+ if (mesa_api == API_OPENGL_COMPAT && major_version == 3 && minor_version == 1)
mesa_api = API_OPENGL_CORE;
- if (mesa_api == API_OPENGL
+ if (mesa_api == API_OPENGL_COMPAT
&& ((major_version > 3)
|| (major_version == 3 && minor_version >= 2))) {
*error = __DRI_CTX_ERROR_BAD_API;
@@ -244,7 +244,7 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
* anything specific about this case. However, none of the known flags
* have any meaning in an ES context, so this seems safe.
*/
- if (mesa_api != API_OPENGL
+ if (mesa_api != API_OPENGL_COMPAT
&& mesa_api != API_OPENGL_CORE
&& flags != 0) {
*error = __DRI_CTX_ERROR_BAD_FLAG;
diff --git a/mesalib/src/mesa/drivers/dri/common/drisw_util.c b/mesalib/src/mesa/drivers/dri/common/drisw_util.c
index a5bdf8988..e22ae1b84 100644
--- a/mesalib/src/mesa/drivers/dri/common/drisw_util.c
+++ b/mesalib/src/mesa/drivers/dri/common/drisw_util.c
@@ -118,7 +118,7 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
switch (api) {
case __DRI_API_OPENGL:
- mesa_api = API_OPENGL;
+ mesa_api = API_OPENGL_COMPAT;
break;
case __DRI_API_GLES:
mesa_api = API_OPENGLES;
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
index 207a84340..005ab08d4 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
@@ -256,14 +256,14 @@ choose_pixel_format(const struct gl_config *v)
}
static void
-swrast_delete_renderbuffer(struct gl_renderbuffer *rb)
+swrast_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
struct dri_swrast_renderbuffer *xrb = dri_swrast_renderbuffer(rb);
TRACE;
free(xrb->Base.Buffer);
- _mesa_delete_renderbuffer(rb);
+ _mesa_delete_renderbuffer(ctx, rb);
}
/* see bytes_per_line in libGL */
@@ -711,7 +711,7 @@ dri_create_context(gl_api api,
(void) flags;
switch (api) {
- case API_OPENGL:
+ case API_OPENGL_COMPAT:
if (major_version > 2
|| (major_version == 2 && minor_version > 1)) {
*error = __DRI_CTX_ERROR_BAD_VERSION;
@@ -773,7 +773,7 @@ dri_create_context(gl_api api,
switch (api) {
case API_OPENGL_CORE:
/* XXX fix me, fall-through for now */
- case API_OPENGL:
+ case API_OPENGL_COMPAT:
_mesa_enable_1_3_extensions(mesaCtx);
_mesa_enable_1_4_extensions(mesaCtx);
_mesa_enable_1_5_extensions(mesaCtx);
diff --git a/mesalib/src/mesa/drivers/windows/gdi/wmesa.c b/mesalib/src/mesa/drivers/windows/gdi/wmesa.c
index 5728d3aa4..50347cf77 100644
--- a/mesalib/src/mesa/drivers/windows/gdi/wmesa.c
+++ b/mesalib/src/mesa/drivers/windows/gdi/wmesa.c
@@ -426,9 +426,9 @@ static void clear(struct gl_context *ctx, GLbitfield mask)
static void
-wmesa_delete_renderbuffer(struct gl_renderbuffer *rb)
+wmesa_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
- free(rb);
+ _mesa_delete_renderbuffer(ctx, rb);
}
@@ -610,7 +610,7 @@ WMesaContext WMesaCreateContext(HDC hDC,
/* initialize the Mesa context data */
ctx = &c->gl_ctx;
- _mesa_initialize_context(ctx, API_OPENGL, visual,
+ _mesa_initialize_context(ctx, API_OPENGL_COMPAT, visual,
NULL, &functions);
/* visual no longer needed - it was copied by _mesa_initialize_context() */
diff --git a/mesalib/src/mesa/main/api_loopback.c b/mesalib/src/mesa/main/api_loopback.c
index 6b66319a9..59d399b42 100644
--- a/mesalib/src/mesa/main/api_loopback.c
+++ b/mesalib/src/mesa/main/api_loopback.c
@@ -1507,7 +1507,7 @@ _mesa_loopback_init_api_table(const struct gl_context *ctx,
SET_Color4ub(dest, _mesa_Color4ub);
SET_Materialf(dest, _mesa_Materialf);
}
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
SET_Color3b(dest, _mesa_Color3b);
SET_Color3d(dest, _mesa_Color3d);
SET_Color3i(dest, _mesa_Color3i);
@@ -1654,7 +1654,7 @@ _mesa_loopback_init_api_table(const struct gl_context *ctx,
SET_FogCoorddv(dest, _mesa_FogCoorddv);
}
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
SET_VertexAttrib1sNV(dest, _mesa_VertexAttrib1sNV);
SET_VertexAttrib1dNV(dest, _mesa_VertexAttrib1dNV);
SET_VertexAttrib2sNV(dest, _mesa_VertexAttrib2sNV);
diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c
index 6f0250800..e47db23e0 100644
--- a/mesalib/src/mesa/main/api_validate.c
+++ b/mesalib/src/mesa/main/api_validate.c
@@ -124,7 +124,7 @@ check_valid_to_render(struct gl_context *ctx, const char *function)
return GL_FALSE;
break;
- case API_OPENGL:
+ case API_OPENGL_COMPAT:
case API_OPENGL_CORE:
{
const struct gl_shader_program *vsProg =
@@ -219,7 +219,7 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name)
case GL_QUADS:
case GL_QUAD_STRIP:
case GL_POLYGON:
- valid_enum = (ctx->API == API_OPENGL);
+ valid_enum = (ctx->API == API_OPENGL_COMPAT);
break;
case GL_LINES_ADJACENCY:
case GL_LINE_STRIP_ADJACENCY:
diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c
index acb33885a..a19d61054 100644
--- a/mesalib/src/mesa/main/attrib.c
+++ b/mesalib/src/mesa/main/attrib.c
@@ -1150,7 +1150,7 @@ _mesa_PopAttrib(void)
_mesa_PointParameteri(GL_POINT_SPRITE_R_MODE_NV,
ctx->Point.SpriteRMode);
- if ((ctx->API == API_OPENGL && ctx->Version >= 20)
+ if ((ctx->API == API_OPENGL_COMPAT && ctx->Version >= 20)
|| ctx->API == API_OPENGL_CORE)
_mesa_PointParameterf(GL_POINT_SPRITE_COORD_ORIGIN,
(GLfloat)ctx->Point.SpriteOrigin);
diff --git a/mesalib/src/mesa/main/buffers.c b/mesalib/src/mesa/main/buffers.c
index fd430aad0..76f0d4671 100644
--- a/mesalib/src/mesa/main/buffers.c
+++ b/mesalib/src/mesa/main/buffers.c
@@ -353,7 +353,7 @@ updated_drawbuffers(struct gl_context *ctx)
{
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
- if (ctx->API == API_OPENGL && !ctx->Extensions.ARB_ES2_compatibility) {
+ if (ctx->API == API_OPENGL_COMPAT && !ctx->Extensions.ARB_ES2_compatibility) {
struct gl_framebuffer *fb = ctx->DrawBuffer;
/* Flag the FBO as requiring validation. */
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index 0508378b7..fa552e818 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -963,7 +963,7 @@ _mesa_initialize_context(struct gl_context *ctx,
sizeof(ctx->TextureFormatSupported));
switch (ctx->API) {
- case API_OPENGL:
+ case API_OPENGL_COMPAT:
ctx->Save = _mesa_create_save_table(ctx);
if (!ctx->Save) {
_mesa_reference_shared_state(ctx, &ctx->Shared, NULL);
diff --git a/mesalib/src/mesa/main/context.h b/mesalib/src/mesa/main/context.h
index a5f770a6e..063f2a381 100644
--- a/mesalib/src/mesa/main/context.h
+++ b/mesalib/src/mesa/main/context.h
@@ -296,7 +296,7 @@ do { \
static inline GLboolean
_mesa_is_desktop_gl(const struct gl_context *ctx)
{
- return ctx->API == API_OPENGL || ctx->API == API_OPENGL_CORE;
+ return ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGL_CORE;
}
diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c
index c7114b73a..b48794f95 100644
--- a/mesalib/src/mesa/main/enable.c
+++ b/mesalib/src/mesa/main/enable.c
@@ -278,7 +278,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
switch (cap) {
case GL_ALPHA_TEST:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
if (ctx->Color.AlphaEnabled == state)
return;
@@ -286,7 +286,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Color.AlphaEnabled = state;
break;
case GL_AUTO_NORMAL:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.AutoNormal == state)
return;
@@ -333,7 +333,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
}
break;
case GL_COLOR_MATERIAL:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
if (ctx->Light.ColorMaterialEnabled == state)
return;
@@ -369,7 +369,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Color.DitherFlag = state;
break;
case GL_FOG:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
if (ctx->Fog.Enabled == state)
return;
@@ -384,7 +384,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
case GL_LIGHT5:
case GL_LIGHT6:
case GL_LIGHT7:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
if (ctx->Light.Light[cap-GL_LIGHT0].Enabled == state)
return;
@@ -399,7 +399,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
}
break;
case GL_LIGHTING:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
if (ctx->Light.Enabled == state)
return;
@@ -420,7 +420,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->_TriangleCaps ^= DD_LINE_SMOOTH;
break;
case GL_LINE_STIPPLE:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Line.StippleFlag == state)
return;
@@ -429,7 +429,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->_TriangleCaps ^= DD_LINE_STIPPLE;
break;
case GL_INDEX_LOGIC_OP:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Color.IndexLogicOpEnabled == state)
return;
@@ -445,7 +445,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Color.ColorLogicOpEnabled = state;
break;
case GL_MAP1_COLOR_4:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map1Color4 == state)
return;
@@ -453,7 +453,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map1Color4 = state;
break;
case GL_MAP1_INDEX:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map1Index == state)
return;
@@ -461,7 +461,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map1Index = state;
break;
case GL_MAP1_NORMAL:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map1Normal == state)
return;
@@ -469,7 +469,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map1Normal = state;
break;
case GL_MAP1_TEXTURE_COORD_1:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map1TextureCoord1 == state)
return;
@@ -477,7 +477,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map1TextureCoord1 = state;
break;
case GL_MAP1_TEXTURE_COORD_2:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map1TextureCoord2 == state)
return;
@@ -485,7 +485,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map1TextureCoord2 = state;
break;
case GL_MAP1_TEXTURE_COORD_3:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map1TextureCoord3 == state)
return;
@@ -493,7 +493,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map1TextureCoord3 = state;
break;
case GL_MAP1_TEXTURE_COORD_4:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map1TextureCoord4 == state)
return;
@@ -501,7 +501,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map1TextureCoord4 = state;
break;
case GL_MAP1_VERTEX_3:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map1Vertex3 == state)
return;
@@ -509,7 +509,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map1Vertex3 = state;
break;
case GL_MAP1_VERTEX_4:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map1Vertex4 == state)
return;
@@ -517,7 +517,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map1Vertex4 = state;
break;
case GL_MAP2_COLOR_4:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map2Color4 == state)
return;
@@ -525,7 +525,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map2Color4 = state;
break;
case GL_MAP2_INDEX:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map2Index == state)
return;
@@ -533,7 +533,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map2Index = state;
break;
case GL_MAP2_NORMAL:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map2Normal == state)
return;
@@ -541,7 +541,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map2Normal = state;
break;
case GL_MAP2_TEXTURE_COORD_1:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map2TextureCoord1 == state)
return;
@@ -549,7 +549,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map2TextureCoord1 = state;
break;
case GL_MAP2_TEXTURE_COORD_2:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map2TextureCoord2 == state)
return;
@@ -557,7 +557,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map2TextureCoord2 = state;
break;
case GL_MAP2_TEXTURE_COORD_3:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map2TextureCoord3 == state)
return;
@@ -565,7 +565,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map2TextureCoord3 = state;
break;
case GL_MAP2_TEXTURE_COORD_4:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map2TextureCoord4 == state)
return;
@@ -573,7 +573,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map2TextureCoord4 = state;
break;
case GL_MAP2_VERTEX_3:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map2Vertex3 == state)
return;
@@ -581,7 +581,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map2Vertex3 = state;
break;
case GL_MAP2_VERTEX_4:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Eval.Map2Vertex4 == state)
return;
@@ -589,7 +589,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Eval.Map2Vertex4 = state;
break;
case GL_NORMALIZE:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
if (ctx->Transform.Normalize == state)
return;
@@ -597,7 +597,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Transform.Normalize = state;
break;
case GL_POINT_SMOOTH:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
if (ctx->Point.SmoothFlag == state)
return;
@@ -615,7 +615,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->_TriangleCaps ^= DD_TRI_SMOOTH;
break;
case GL_POLYGON_STIPPLE:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Polygon.StippleFlag == state)
return;
@@ -646,7 +646,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Polygon.OffsetFill = state;
break;
case GL_RESCALE_NORMAL_EXT:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
if (ctx->Transform.RescaleNormals == state)
return;
@@ -666,21 +666,21 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Stencil.Enabled = state;
break;
case GL_TEXTURE_1D:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (!enable_texture(ctx, state, TEXTURE_1D_BIT)) {
return;
}
break;
case GL_TEXTURE_2D:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
if (!enable_texture(ctx, state, TEXTURE_2D_BIT)) {
return;
}
break;
case GL_TEXTURE_3D:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
if (!enable_texture(ctx, state, TEXTURE_3D_BIT)) {
return;
@@ -693,7 +693,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
{
struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (texUnit) {
@@ -745,7 +745,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
/* GL_ARB_texture_cube_map */
case GL_TEXTURE_CUBE_MAP_ARB:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
CHECK_EXTENSION(ARB_texture_cube_map, cap);
if (!enable_texture(ctx, state, TEXTURE_CUBE_BIT)) {
@@ -755,7 +755,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
/* GL_EXT_secondary_color */
case GL_COLOR_SUM_EXT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION2(EXT_secondary_color, ARB_vertex_program, cap);
if (ctx->Fog.ColorSumEnabled == state)
@@ -801,7 +801,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
/* GL_IBM_rasterpos_clip */
case GL_RASTER_POSITION_UNCLIPPED_IBM:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Transform.RasterPositionUnclipped == state)
return;
@@ -811,7 +811,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
/* GL_NV_point_sprite */
case GL_POINT_SPRITE_NV:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
CHECK_EXTENSION2(NV_point_sprite, ARB_point_sprite, cap);
if (ctx->Point.PointSprite == state)
@@ -821,7 +821,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
break;
case GL_VERTEX_PROGRAM_ARB:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(ARB_vertex_program, cap);
if (ctx->VertexProgram.Enabled == state)
@@ -842,7 +842,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->VertexProgram.PointSizeEnabled = state;
break;
case GL_VERTEX_PROGRAM_TWO_SIDE_ARB:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(ARB_vertex_program, cap);
if (ctx->VertexProgram.TwoSideEnabled == state)
@@ -853,7 +853,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
/* GL_NV_texture_rectangle */
case GL_TEXTURE_RECTANGLE_NV:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(NV_texture_rectangle, cap);
if (!enable_texture(ctx, state, TEXTURE_RECT_BIT)) {
@@ -863,7 +863,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
/* GL_EXT_stencil_two_side */
case GL_STENCIL_TEST_TWO_SIDE_EXT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(EXT_stencil_two_side, cap);
if (ctx->Stencil.TestTwoSide == state)
@@ -878,7 +878,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
break;
case GL_FRAGMENT_PROGRAM_ARB:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(ARB_fragment_program, cap);
if (ctx->FragmentProgram.Enabled == state)
@@ -909,7 +909,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
break;
case GL_FRAGMENT_SHADER_ATI:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(ATI_fragment_shader, cap);
if (ctx->ATIFragmentShader.Enabled == state)
@@ -920,7 +920,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
/* GL_MESA_texture_array */
case GL_TEXTURE_1D_ARRAY_EXT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(MESA_texture_array, cap);
if (!enable_texture(ctx, state, TEXTURE_1D_ARRAY_BIT)) {
@@ -929,7 +929,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
break;
case GL_TEXTURE_2D_ARRAY_EXT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(MESA_texture_array, cap);
if (!enable_texture(ctx, state, TEXTURE_2D_ARRAY_BIT)) {
@@ -1154,11 +1154,11 @@ _mesa_IsEnabled( GLenum cap )
switch (cap) {
case GL_ALPHA_TEST:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return ctx->Color.AlphaEnabled;
case GL_AUTO_NORMAL:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.AutoNormal;
case GL_BLEND:
@@ -1179,7 +1179,7 @@ _mesa_IsEnabled( GLenum cap )
return (ctx->Transform.ClipPlanesEnabled >> p) & 1;
}
case GL_COLOR_MATERIAL:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return ctx->Light.ColorMaterialEnabled;
case GL_CULL_FACE:
@@ -1193,11 +1193,11 @@ _mesa_IsEnabled( GLenum cap )
case GL_DITHER:
return ctx->Color.DitherFlag;
case GL_FOG:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return ctx->Fog.Enabled;
case GL_LIGHTING:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return ctx->Light.Enabled;
case GL_LIGHT0:
@@ -1208,7 +1208,7 @@ _mesa_IsEnabled( GLenum cap )
case GL_LIGHT5:
case GL_LIGHT6:
case GL_LIGHT7:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return ctx->Light.Light[cap-GL_LIGHT0].Enabled;
case GL_LINE_SMOOTH:
@@ -1216,11 +1216,11 @@ _mesa_IsEnabled( GLenum cap )
goto invalid_enum_error;
return ctx->Line.SmoothFlag;
case GL_LINE_STIPPLE:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Line.StippleFlag;
case GL_INDEX_LOGIC_OP:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Color.IndexLogicOpEnabled;
case GL_COLOR_LOGIC_OP:
@@ -1228,83 +1228,83 @@ _mesa_IsEnabled( GLenum cap )
goto invalid_enum_error;
return ctx->Color.ColorLogicOpEnabled;
case GL_MAP1_COLOR_4:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map1Color4;
case GL_MAP1_INDEX:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map1Index;
case GL_MAP1_NORMAL:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map1Normal;
case GL_MAP1_TEXTURE_COORD_1:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map1TextureCoord1;
case GL_MAP1_TEXTURE_COORD_2:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map1TextureCoord2;
case GL_MAP1_TEXTURE_COORD_3:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map1TextureCoord3;
case GL_MAP1_TEXTURE_COORD_4:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map1TextureCoord4;
case GL_MAP1_VERTEX_3:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map1Vertex3;
case GL_MAP1_VERTEX_4:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map1Vertex4;
case GL_MAP2_COLOR_4:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map2Color4;
case GL_MAP2_INDEX:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map2Index;
case GL_MAP2_NORMAL:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map2Normal;
case GL_MAP2_TEXTURE_COORD_1:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map2TextureCoord1;
case GL_MAP2_TEXTURE_COORD_2:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map2TextureCoord2;
case GL_MAP2_TEXTURE_COORD_3:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map2TextureCoord3;
case GL_MAP2_TEXTURE_COORD_4:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map2TextureCoord4;
case GL_MAP2_VERTEX_3:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map2Vertex3;
case GL_MAP2_VERTEX_4:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Eval.Map2Vertex4;
case GL_NORMALIZE:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return ctx->Transform.Normalize;
case GL_POINT_SMOOTH:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return ctx->Point.SmoothFlag;
case GL_POLYGON_SMOOTH:
@@ -1312,7 +1312,7 @@ _mesa_IsEnabled( GLenum cap )
goto invalid_enum_error;
return ctx->Polygon.SmoothFlag;
case GL_POLYGON_STIPPLE:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Polygon.StippleFlag;
case GL_POLYGON_OFFSET_POINT:
@@ -1326,7 +1326,7 @@ _mesa_IsEnabled( GLenum cap )
case GL_POLYGON_OFFSET_FILL:
return ctx->Polygon.OffsetFill;
case GL_RESCALE_NORMAL_EXT:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return ctx->Transform.RescaleNormals;
case GL_SCISSOR_TEST:
@@ -1334,15 +1334,15 @@ _mesa_IsEnabled( GLenum cap )
case GL_STENCIL_TEST:
return ctx->Stencil.Enabled;
case GL_TEXTURE_1D:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return is_texture_enabled(ctx, TEXTURE_1D_BIT);
case GL_TEXTURE_2D:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return is_texture_enabled(ctx, TEXTURE_2D_BIT);
case GL_TEXTURE_3D:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return is_texture_enabled(ctx, TEXTURE_3D_BIT);
case GL_TEXTURE_GEN_S:
@@ -1352,7 +1352,7 @@ _mesa_IsEnabled( GLenum cap )
{
const struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (texUnit) {
@@ -1376,37 +1376,37 @@ _mesa_IsEnabled( GLenum cap )
/* client-side state */
case GL_VERTEX_ARRAY:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled != 0);
case GL_NORMAL_ARRAY:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled != 0);
case GL_COLOR_ARRAY:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled != 0);
case GL_INDEX_ARRAY:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled != 0);
case GL_TEXTURE_COORD_ARRAY:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)]
.Enabled != 0);
case GL_EDGE_FLAG_ARRAY:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled != 0);
case GL_FOG_COORDINATE_ARRAY_EXT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(EXT_fog_coord);
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled != 0);
case GL_SECONDARY_COLOR_ARRAY_EXT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(EXT_secondary_color);
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled != 0);
@@ -1422,7 +1422,7 @@ _mesa_IsEnabled( GLenum cap )
/* GL_EXT_secondary_color */
case GL_COLOR_SUM_EXT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION2(EXT_secondary_color, ARB_vertex_program);
return ctx->Fog.ColorSumEnabled;
@@ -1447,19 +1447,19 @@ _mesa_IsEnabled( GLenum cap )
/* GL_IBM_rasterpos_clip */
case GL_RASTER_POSITION_UNCLIPPED_IBM:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->Transform.RasterPositionUnclipped;
/* GL_NV_point_sprite */
case GL_POINT_SPRITE_NV:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
CHECK_EXTENSION2(NV_point_sprite, ARB_point_sprite)
return ctx->Point.PointSprite;
case GL_VERTEX_PROGRAM_ARB:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(ARB_vertex_program);
return ctx->VertexProgram.Enabled;
@@ -1472,27 +1472,27 @@ _mesa_IsEnabled( GLenum cap )
CHECK_EXTENSION(ARB_vertex_program);
return ctx->VertexProgram.PointSizeEnabled;
case GL_VERTEX_PROGRAM_TWO_SIDE_ARB:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(ARB_vertex_program);
return ctx->VertexProgram.TwoSideEnabled;
/* GL_NV_texture_rectangle */
case GL_TEXTURE_RECTANGLE_NV:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(NV_texture_rectangle);
return is_texture_enabled(ctx, TEXTURE_RECT_BIT);
/* GL_EXT_stencil_two_side */
case GL_STENCIL_TEST_TWO_SIDE_EXT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(EXT_stencil_two_side);
return ctx->Stencil.TestTwoSide;
case GL_FRAGMENT_PROGRAM_ARB:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
return ctx->FragmentProgram.Enabled;
@@ -1511,7 +1511,7 @@ _mesa_IsEnabled( GLenum cap )
return ctx->Transform.DepthClamp;
case GL_FRAGMENT_SHADER_ATI:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
CHECK_EXTENSION(ATI_fragment_shader);
return ctx->ATIFragmentShader.Enabled;
@@ -1530,7 +1530,7 @@ _mesa_IsEnabled( GLenum cap )
/* GL_NV_primitive_restart */
case GL_PRIMITIVE_RESTART_NV:
- if (ctx->API != API_OPENGL || !ctx->Extensions.NV_primitive_restart) {
+ if (ctx->API != API_OPENGL_COMPAT || !ctx->Extensions.NV_primitive_restart) {
goto invalid_enum_error;
}
return ctx->Array.PrimitiveRestart;
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index d5a7886c9..9e23a66d7 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -41,9 +41,9 @@
enum {
DISABLE = 0,
- GLL = 1 << API_OPENGL, /* GL Legacy / Compatibility */
+ GLL = 1 << API_OPENGL_COMPAT, /* GL Legacy / Compatibility */
GLC = 1 << API_OPENGL_CORE, /* GL Core */
- GL = (1 << API_OPENGL) | (1 << API_OPENGL_CORE),
+ GL = (1 << API_OPENGL_COMPAT) | (1 << API_OPENGL_CORE),
ES1 = 1 << API_OPENGLES,
ES2 = 1 << API_OPENGLES2,
};
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index 891ec5dce..9eec61de6 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -78,7 +78,7 @@ static struct gl_framebuffer IncompleteFramebuffer;
static void
-delete_dummy_renderbuffer(struct gl_renderbuffer *rb)
+delete_dummy_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
/* no op */
}
@@ -1072,14 +1072,14 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_ALPHA8:
case GL_ALPHA12:
case GL_ALPHA16:
- return ctx->API == API_OPENGL && ctx->Extensions.ARB_framebuffer_object
+ return ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_framebuffer_object
? GL_ALPHA : 0;
case GL_LUMINANCE:
case GL_LUMINANCE4:
case GL_LUMINANCE8:
case GL_LUMINANCE12:
case GL_LUMINANCE16:
- return ctx->API == API_OPENGL && ctx->Extensions.ARB_framebuffer_object
+ return ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_framebuffer_object
? GL_LUMINANCE : 0;
case GL_LUMINANCE_ALPHA:
case GL_LUMINANCE4_ALPHA4:
@@ -1088,14 +1088,14 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_LUMINANCE12_ALPHA4:
case GL_LUMINANCE12_ALPHA12:
case GL_LUMINANCE16_ALPHA16:
- return ctx->API == API_OPENGL && ctx->Extensions.ARB_framebuffer_object
+ return ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_framebuffer_object
? GL_LUMINANCE_ALPHA : 0;
case GL_INTENSITY:
case GL_INTENSITY4:
case GL_INTENSITY8:
case GL_INTENSITY12:
case GL_INTENSITY16:
- return ctx->API == API_OPENGL && ctx->Extensions.ARB_framebuffer_object
+ return ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_framebuffer_object
? GL_INTENSITY : 0;
case GL_RGB8:
return GL_RGB;
@@ -1146,11 +1146,11 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
? GL_DEPTH_STENCIL_EXT : 0;
case GL_DEPTH_COMPONENT32F:
return ctx->Version >= 30
- || (ctx->API == API_OPENGL && ctx->Extensions.ARB_depth_buffer_float)
+ || (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_depth_buffer_float)
? GL_DEPTH_COMPONENT : 0;
case GL_DEPTH32F_STENCIL8:
return ctx->Version >= 30
- || (ctx->API == API_OPENGL && ctx->Extensions.ARB_depth_buffer_float)
+ || (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_depth_buffer_float)
? GL_DEPTH_STENCIL : 0;
case GL_RED:
case GL_R16:
@@ -1169,7 +1169,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
/* signed normalized texture formats */
case GL_R8_SNORM:
return ctx->Version >= 30
- || (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
+ || (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.EXT_texture_snorm)
? GL_RED : 0;
case GL_RED_SNORM:
case GL_R16_SNORM:
@@ -1177,7 +1177,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
? GL_RED : 0;
case GL_RG8_SNORM:
return ctx->Version >= 30
- || (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
+ || (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.EXT_texture_snorm)
? GL_RG : 0;
case GL_RG_SNORM:
case GL_RG16_SNORM:
@@ -1185,7 +1185,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
? GL_RG : 0;
case GL_RGB8_SNORM:
return ctx->Version >= 30
- || (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
+ || (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.EXT_texture_snorm)
? GL_RGB : 0;
case GL_RGB_SNORM:
case GL_RGB16_SNORM:
@@ -1193,7 +1193,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
? GL_RGB : 0;
case GL_RGBA8_SNORM:
return ctx->Version >= 30
- || (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
+ || (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.EXT_texture_snorm)
? GL_RGBA : 0;
case GL_RGBA_SNORM:
case GL_RGBA16_SNORM:
@@ -1202,37 +1202,37 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_ALPHA_SNORM:
case GL_ALPHA8_SNORM:
case GL_ALPHA16_SNORM:
- return ctx->API == API_OPENGL &&
+ return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.EXT_texture_snorm &&
ctx->Extensions.ARB_framebuffer_object ? GL_ALPHA : 0;
case GL_LUMINANCE_SNORM:
case GL_LUMINANCE8_SNORM:
case GL_LUMINANCE16_SNORM:
- return ctx->API == API_OPENGL &&
+ return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.EXT_texture_snorm &&
ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE : 0;
case GL_LUMINANCE_ALPHA_SNORM:
case GL_LUMINANCE8_ALPHA8_SNORM:
case GL_LUMINANCE16_ALPHA16_SNORM:
- return ctx->API == API_OPENGL &&
+ return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.EXT_texture_snorm &&
ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE_ALPHA : 0;
case GL_INTENSITY_SNORM:
case GL_INTENSITY8_SNORM:
case GL_INTENSITY16_SNORM:
- return ctx->API == API_OPENGL &&
+ return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.EXT_texture_snorm &&
ctx->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0;
case GL_R16F:
case GL_R32F:
return ctx->Version >= 30
- || (ctx->API == API_OPENGL &&
+ || (ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.ARB_texture_rg &&
ctx->Extensions.ARB_texture_float) ? GL_RED : 0;
case GL_RG16F:
case GL_RG32F:
return ctx->Version >= 30
- || (ctx->API == API_OPENGL &&
+ || (ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.ARB_texture_rg &&
ctx->Extensions.ARB_texture_float) ? GL_RG : 0;
case GL_RGB16F:
@@ -1247,22 +1247,22 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
? GL_RGBA : 0;
case GL_ALPHA16F_ARB:
case GL_ALPHA32F_ARB:
- return ctx->API == API_OPENGL &&
+ return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.ARB_texture_float &&
ctx->Extensions.ARB_framebuffer_object ? GL_ALPHA : 0;
case GL_LUMINANCE16F_ARB:
case GL_LUMINANCE32F_ARB:
- return ctx->API == API_OPENGL &&
+ return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.ARB_texture_float &&
ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE : 0;
case GL_LUMINANCE_ALPHA16F_ARB:
case GL_LUMINANCE_ALPHA32F_ARB:
- return ctx->API == API_OPENGL &&
+ return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.ARB_texture_float &&
ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE_ALPHA : 0;
case GL_INTENSITY16F_ARB:
case GL_INTENSITY32F_ARB:
- return ctx->API == API_OPENGL &&
+ return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.ARB_texture_float &&
ctx->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0;
case GL_RGB9_E5:
@@ -1321,7 +1321,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_INTENSITY16UI_EXT:
case GL_INTENSITY32I_EXT:
case GL_INTENSITY32UI_EXT:
- return ctx->API == API_OPENGL &&
+ return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.EXT_texture_integer &&
ctx->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0;
@@ -1331,7 +1331,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_LUMINANCE16UI_EXT:
case GL_LUMINANCE32I_EXT:
case GL_LUMINANCE32UI_EXT:
- return ctx->API == API_OPENGL &&
+ return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.EXT_texture_integer &&
ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE : 0;
@@ -1341,7 +1341,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_LUMINANCE_ALPHA16UI_EXT:
case GL_LUMINANCE_ALPHA32I_EXT:
case GL_LUMINANCE_ALPHA32UI_EXT:
- return ctx->API == API_OPENGL &&
+ return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.EXT_texture_integer &&
ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE_ALPHA : 0;
@@ -1351,7 +1351,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_ALPHA16UI_EXT:
case GL_ALPHA32I_EXT:
case GL_ALPHA32UI_EXT:
- return ctx->API == API_OPENGL &&
+ return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.EXT_texture_integer &&
ctx->Extensions.ARB_framebuffer_object ? GL_ALPHA : 0;
@@ -2498,7 +2498,7 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment,
}
return;
case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
- if ((ctx->API != API_OPENGL || !ctx->Extensions.ARB_framebuffer_object)
+ if ((ctx->API != API_OPENGL_COMPAT || !ctx->Extensions.ARB_framebuffer_object)
&& ctx->API != API_OPENGL_CORE
&& !_mesa_is_gles3(ctx)) {
goto invalid_pname_enum;
@@ -2716,127 +2716,16 @@ compatible_color_datatypes(gl_format srcFormat, gl_format dstFormat)
}
-/**
- * Return the equivalent non-generic internal format.
- * This is useful for comparing whether two internal formats are semantically
- * equivalent.
- */
-static GLenum
-get_nongeneric_internalformat(GLenum format)
-{
- switch (format) {
- /* GL 1.1 formats. */
- case 4:
- case GL_RGBA:
- return GL_RGBA8;
-
- case 3:
- case GL_RGB:
- return GL_RGB8;
-
- case 2:
- case GL_LUMINANCE_ALPHA:
- return GL_LUMINANCE8_ALPHA8;
-
- case 1:
- case GL_LUMINANCE:
- return GL_LUMINANCE8;
-
- case GL_ALPHA:
- return GL_ALPHA8;
-
- case GL_INTENSITY:
- return GL_INTENSITY8;
-
- /* GL_ARB_texture_rg */
- case GL_RED:
- return GL_R8;
-
- case GL_RG:
- return GL_RG8;
-
- /* GL_EXT_texture_sRGB */
- case GL_SRGB:
- return GL_SRGB8;
-
- case GL_SRGB_ALPHA:
- return GL_SRGB8_ALPHA8;
-
- case GL_SLUMINANCE:
- return GL_SLUMINANCE8;
-
- case GL_SLUMINANCE_ALPHA:
- return GL_SLUMINANCE8_ALPHA8;
-
- /* GL_EXT_texture_snorm */
- case GL_RGBA_SNORM:
- return GL_RGBA8_SNORM;
-
- case GL_RGB_SNORM:
- return GL_RGB8_SNORM;
-
- case GL_RG_SNORM:
- return GL_RG8_SNORM;
-
- case GL_RED_SNORM:
- return GL_R8_SNORM;
-
- case GL_LUMINANCE_ALPHA_SNORM:
- return GL_LUMINANCE8_ALPHA8_SNORM;
-
- case GL_LUMINANCE_SNORM:
- return GL_LUMINANCE8_SNORM;
-
- case GL_ALPHA_SNORM:
- return GL_ALPHA8_SNORM;
-
- case GL_INTENSITY_SNORM:
- return GL_INTENSITY8_SNORM;
-
- default:
- return format;
- }
-}
-
-
-static GLenum
-get_linear_internalformat(GLenum format)
-{
- switch (format) {
- case GL_SRGB:
- return GL_RGB;
-
- case GL_SRGB_ALPHA:
- return GL_RGBA;
-
- case GL_SRGB8:
- return GL_RGB8;
-
- case GL_SRGB8_ALPHA8:
- return GL_RGBA8;
-
- case GL_SLUMINANCE:
- return GL_LUMINANCE8;
-
- case GL_SLUMINANCE_ALPHA:
- return GL_LUMINANCE8_ALPHA8;
-
- default:
- return format;
- }
-}
-
-
static GLboolean
-compatible_resolve_formats(const struct gl_renderbuffer *colorReadRb,
- const struct gl_renderbuffer *colorDrawRb)
+compatible_resolve_formats(const struct gl_renderbuffer *readRb,
+ const struct gl_renderbuffer *drawRb)
{
GLenum readFormat, drawFormat;
/* The simple case where we know the backing Mesa formats are the same.
*/
- if (_mesa_get_srgb_format_linear(colorReadRb->Format) ==
- _mesa_get_srgb_format_linear(colorDrawRb->Format)) {
+ if (_mesa_get_srgb_format_linear(readRb->Format) ==
+ _mesa_get_srgb_format_linear(drawRb->Format)) {
return GL_TRUE;
}
@@ -2850,10 +2739,10 @@ compatible_resolve_formats(const struct gl_renderbuffer *colorReadRb,
*
* Blits between linear and sRGB formats are also allowed.
*/
- readFormat = get_nongeneric_internalformat(colorReadRb->InternalFormat);
- drawFormat = get_nongeneric_internalformat(colorDrawRb->InternalFormat);
- readFormat = get_linear_internalformat(readFormat);
- drawFormat = get_linear_internalformat(drawFormat);
+ readFormat = _mesa_get_nongeneric_internalformat(readRb->InternalFormat);
+ drawFormat = _mesa_get_nongeneric_internalformat(drawRb->InternalFormat);
+ readFormat = _mesa_get_linear_internalformat(readFormat);
+ drawFormat = _mesa_get_linear_internalformat(drawFormat);
if (readFormat == drawFormat) {
return GL_TRUE;
@@ -3153,7 +3042,7 @@ invalidate_framebuffer_storage(GLenum target, GLsizei numAttachments,
/* Accumulation buffers and auxilary buffers were removed in
* OpenGL 3.1, and they never existed in OpenGL ES.
*/
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum;
break;
case GL_COLOR:
diff --git a/mesalib/src/mesa/main/fog.c b/mesalib/src/mesa/main/fog.c
index 07405fb4b..b37e95f08 100644
--- a/mesalib/src/mesa/main/fog.c
+++ b/mesalib/src/mesa/main/fog.c
@@ -141,7 +141,7 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
update_fog_scale(ctx);
break;
case GL_FOG_INDEX:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
if (ctx->Fog.Index == *params)
return;
@@ -163,7 +163,7 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
break;
case GL_FOG_COORDINATE_SOURCE_EXT: {
GLenum p = (GLenum) (GLint) *params;
- if (ctx->API != API_OPENGL || !ctx->Extensions.EXT_fog_coord ||
+ if (ctx->API != API_OPENGL_COMPAT || !ctx->Extensions.EXT_fog_coord ||
(p != GL_FOG_COORDINATE_EXT && p != GL_FRAGMENT_DEPTH_EXT)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glFog");
return;
@@ -176,7 +176,7 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
}
case GL_FOG_DISTANCE_MODE_NV: {
GLenum p = (GLenum) (GLint) *params;
- if (ctx->API != API_OPENGL || !ctx->Extensions.NV_fog_distance ||
+ if (ctx->API != API_OPENGL_COMPAT || !ctx->Extensions.NV_fog_distance ||
(p != GL_EYE_RADIAL_NV && p != GL_EYE_PLANE && p != GL_EYE_PLANE_ABSOLUTE_NV)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glFog");
return;
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c
index e1ebd1856..97dccd0ed 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -395,7 +395,7 @@ print_table_stats(int api)
int i, j, collisions[11], count, hash, mask;
const struct value_desc *d;
const char *api_names[] = {
- [API_OPENGL] = "GL",
+ [API_OPENGL_COMPAT] = "GL",
[API_OPENGL_CORE] = "GL_CORE",
[API_OPENGLES] = "GLES",
[API_OPENGLES2] = "GLES2",
diff --git a/mesalib/src/mesa/main/getstring.c b/mesalib/src/mesa/main/getstring.c
index a04db0dc7..20e7a014d 100644
--- a/mesalib/src/mesa/main/getstring.c
+++ b/mesalib/src/mesa/main/getstring.c
@@ -40,7 +40,7 @@ static const GLubyte *
shading_language_version(struct gl_context *ctx)
{
switch (ctx->API) {
- case API_OPENGL:
+ case API_OPENGL_COMPAT:
case API_OPENGL_CORE:
if (!ctx->Extensions.ARB_shader_objects) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetString");
@@ -136,7 +136,7 @@ _mesa_GetString( GLenum name )
break;
return shading_language_version(ctx);
case GL_PROGRAM_ERROR_STRING_NV:
- if (ctx->API == API_OPENGL &&
+ if (ctx->API == API_OPENGL_COMPAT &&
(ctx->Extensions.ARB_fragment_program ||
ctx->Extensions.ARB_vertex_program)) {
return (const GLubyte *) ctx->Program.ErrorString;
@@ -205,52 +205,52 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params )
switch (pname) {
case GL_VERTEX_ARRAY_POINTER:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_pname;
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Ptr;
break;
case GL_NORMAL_ARRAY_POINTER:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_pname;
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Ptr;
break;
case GL_COLOR_ARRAY_POINTER:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_pname;
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Ptr;
break;
case GL_SECONDARY_COLOR_ARRAY_POINTER_EXT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Ptr;
break;
case GL_FOG_COORDINATE_ARRAY_POINTER_EXT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG].Ptr;
break;
case GL_INDEX_ARRAY_POINTER:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Ptr;
break;
case GL_TEXTURE_COORD_ARRAY_POINTER:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_pname;
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_TEX(clientUnit)].Ptr;
break;
case GL_EDGE_FLAG_ARRAY_POINTER:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Ptr;
break;
case GL_FEEDBACK_BUFFER_POINTER:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = ctx->Feedback.Buffer;
break;
case GL_SELECTION_BUFFER_POINTER:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = ctx->Select.Buffer;
break;
diff --git a/mesalib/src/mesa/main/glformats.c b/mesalib/src/mesa/main/glformats.c
index ba79f193b..69caef70b 100644
--- a/mesalib/src/mesa/main/glformats.c
+++ b/mesalib/src/mesa/main/glformats.c
@@ -821,10 +821,10 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum format)
case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT:
case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT:
- return ctx->API == API_OPENGL
+ return ctx->API == API_OPENGL_COMPAT
&& ctx->Extensions.EXT_texture_compression_latc;
case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:
- return ctx->API == API_OPENGL
+ return ctx->API == API_OPENGL_COMPAT
&& ctx->Extensions.ATI_texture_compression_3dc;
case GL_ETC1_RGB8_OES:
return _mesa_is_gles(ctx)
@@ -1008,6 +1008,119 @@ _mesa_generic_compressed_format_to_uncompressed_format(GLenum format)
/**
+ * Return the equivalent non-generic internal format.
+ * This is useful for comparing whether two internal formats are equivalent.
+ */
+GLenum
+_mesa_get_nongeneric_internalformat(GLenum format)
+{
+ switch (format) {
+ /* GL 1.1 formats. */
+ case 4:
+ case GL_RGBA:
+ return GL_RGBA8;
+
+ case 3:
+ case GL_RGB:
+ return GL_RGB8;
+
+ case 2:
+ case GL_LUMINANCE_ALPHA:
+ return GL_LUMINANCE8_ALPHA8;
+
+ case 1:
+ case GL_LUMINANCE:
+ return GL_LUMINANCE8;
+
+ case GL_ALPHA:
+ return GL_ALPHA8;
+
+ case GL_INTENSITY:
+ return GL_INTENSITY8;
+
+ /* GL_ARB_texture_rg */
+ case GL_RED:
+ return GL_R8;
+
+ case GL_RG:
+ return GL_RG8;
+
+ /* GL_EXT_texture_sRGB */
+ case GL_SRGB:
+ return GL_SRGB8;
+
+ case GL_SRGB_ALPHA:
+ return GL_SRGB8_ALPHA8;
+
+ case GL_SLUMINANCE:
+ return GL_SLUMINANCE8;
+
+ case GL_SLUMINANCE_ALPHA:
+ return GL_SLUMINANCE8_ALPHA8;
+
+ /* GL_EXT_texture_snorm */
+ case GL_RGBA_SNORM:
+ return GL_RGBA8_SNORM;
+
+ case GL_RGB_SNORM:
+ return GL_RGB8_SNORM;
+
+ case GL_RG_SNORM:
+ return GL_RG8_SNORM;
+
+ case GL_RED_SNORM:
+ return GL_R8_SNORM;
+
+ case GL_LUMINANCE_ALPHA_SNORM:
+ return GL_LUMINANCE8_ALPHA8_SNORM;
+
+ case GL_LUMINANCE_SNORM:
+ return GL_LUMINANCE8_SNORM;
+
+ case GL_ALPHA_SNORM:
+ return GL_ALPHA8_SNORM;
+
+ case GL_INTENSITY_SNORM:
+ return GL_INTENSITY8_SNORM;
+
+ default:
+ return format;
+ }
+}
+
+
+/**
+ * Convert an sRGB internal format to linear.
+ */
+GLenum
+_mesa_get_linear_internalformat(GLenum format)
+{
+ switch (format) {
+ case GL_SRGB:
+ return GL_RGB;
+
+ case GL_SRGB_ALPHA:
+ return GL_RGBA;
+
+ case GL_SRGB8:
+ return GL_RGB8;
+
+ case GL_SRGB8_ALPHA8:
+ return GL_RGBA8;
+
+ case GL_SLUMINANCE:
+ return GL_LUMINANCE8;
+
+ case GL_SLUMINANCE_ALPHA:
+ return GL_LUMINANCE8_ALPHA8;
+
+ default:
+ return format;
+ }
+}
+
+
+/**
* Do error checking of format/type combinations for glReadPixels,
* glDrawPixels and glTex[Sub]Image. Note that depending on the format
* and type values, we may either generate GL_INVALID_OPERATION or
diff --git a/mesalib/src/mesa/main/glformats.h b/mesalib/src/mesa/main/glformats.h
index e5b63a963..5d0995140 100644
--- a/mesalib/src/mesa/main/glformats.h
+++ b/mesalib/src/mesa/main/glformats.h
@@ -95,6 +95,12 @@ extern GLenum
_mesa_generic_compressed_format_to_uncompressed_format(GLenum format);
extern GLenum
+_mesa_get_nongeneric_internalformat(GLenum format);
+
+extern GLenum
+_mesa_get_linear_internalformat(GLenum format);
+
+extern GLenum
_mesa_error_check_format_and_type(const struct gl_context *ctx,
GLenum format, GLenum type);
diff --git a/mesalib/src/mesa/main/hint.c b/mesalib/src/mesa/main/hint.c
index 90130e3db..83d7966cd 100644
--- a/mesalib/src/mesa/main/hint.c
+++ b/mesalib/src/mesa/main/hint.c
@@ -51,7 +51,7 @@ _mesa_Hint( GLenum target, GLenum mode )
switch (target) {
case GL_FOG_HINT:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_target;
if (ctx->Hint.Fog == mode)
return;
@@ -67,7 +67,7 @@ _mesa_Hint( GLenum target, GLenum mode )
ctx->Hint.LineSmooth = mode;
break;
case GL_PERSPECTIVE_CORRECTION_HINT:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_target;
if (ctx->Hint.PerspectiveCorrection == mode)
return;
@@ -75,7 +75,7 @@ _mesa_Hint( GLenum target, GLenum mode )
ctx->Hint.PerspectiveCorrection = mode;
break;
case GL_POINT_SMOOTH_HINT:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_target;
if (ctx->Hint.PointSmooth == mode)
return;
@@ -93,7 +93,7 @@ _mesa_Hint( GLenum target, GLenum mode )
/* GL_EXT_clip_volume_hint */
case GL_CLIP_VOLUME_CLIPPING_HINT_EXT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_target;
if (ctx->Hint.ClipVolumeClipping == mode)
return;
diff --git a/mesalib/src/mesa/main/light.c b/mesalib/src/mesa/main/light.c
index b0a10e9ed..aae5d0ae9 100644
--- a/mesalib/src/mesa/main/light.c
+++ b/mesalib/src/mesa/main/light.c
@@ -466,7 +466,7 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params )
COPY_4V( ctx->Light.Model.Ambient, params );
break;
case GL_LIGHT_MODEL_LOCAL_VIEWER:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
newbool = (params[0]!=0.0);
if (ctx->Light.Model.LocalViewer == newbool)
@@ -486,7 +486,7 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params )
ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
break;
case GL_LIGHT_MODEL_COLOR_CONTROL:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
if (params[0] == (GLfloat) GL_SINGLE_COLOR)
newenum = GL_SINGLE_COLOR;
@@ -798,7 +798,7 @@ _mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params )
*params = mat[MAT_ATTRIB_SHININESS(f)][0];
break;
case GL_COLOR_INDEXES:
- if (ctx->API != API_OPENGL) {
+ if (ctx->API != API_OPENGL_COMPAT) {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetMaterialfv(pname)" );
return;
}
@@ -820,7 +820,7 @@ _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params )
GLfloat (*mat)[4] = ctx->Light.Material.Attrib;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* update materials */
- ASSERT(ctx->API == API_OPENGL);
+ ASSERT(ctx->API == API_OPENGL_COMPAT);
FLUSH_CURRENT(ctx, 0); /* update ctx->Light.Material from vertex buffer */
diff --git a/mesalib/src/mesa/main/matrix.c b/mesalib/src/mesa/main/matrix.c
index 00b8e00b7..a4e576237 100644
--- a/mesalib/src/mesa/main/matrix.c
+++ b/mesalib/src/mesa/main/matrix.c
@@ -187,7 +187,7 @@ _mesa_MatrixMode( GLenum mode )
case GL_MATRIX5_ARB:
case GL_MATRIX6_ARB:
case GL_MATRIX7_ARB:
- if (ctx->API == API_OPENGL
+ if (ctx->API == API_OPENGL_COMPAT
&& (ctx->Extensions.ARB_vertex_program ||
ctx->Extensions.ARB_fragment_program)) {
const GLuint m = mode - GL_MATRIX0_ARB;
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index da72da9d1..5bfae69c8 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2605,7 +2605,7 @@ struct gl_renderbuffer
gl_format Format; /**< The actual renderbuffer memory format */
/** Delete this renderbuffer */
- void (*Delete)(struct gl_renderbuffer *rb);
+ void (*Delete)(struct gl_context *ctx, struct gl_renderbuffer *rb);
/** Allocate new storage for this renderbuffer */
GLboolean (*AllocStorage)(struct gl_context *ctx,
@@ -3315,7 +3315,7 @@ struct gl_debug_state
*/
typedef enum
{
- API_OPENGL, /* legacy / compatibility contexts */
+ API_OPENGL_COMPAT, /* legacy / compatibility contexts */
API_OPENGLES,
API_OPENGLES2,
API_OPENGL_CORE,
diff --git a/mesalib/src/mesa/main/points.c b/mesalib/src/mesa/main/points.c
index 7d6e5a5e1..b5fc5d5bb 100644
--- a/mesalib/src/mesa/main/points.c
+++ b/mesalib/src/mesa/main/points.c
@@ -190,7 +190,7 @@ _mesa_PointParameterfv( GLenum pname, const GLfloat *params)
/* GL_POINT_SPRITE_COORD_ORIGIN was added to point sprites when the
* extension was merged into OpenGL 2.0.
*/
- if ((ctx->API == API_OPENGL && ctx->Version >= 20)
+ if ((ctx->API == API_OPENGL_COMPAT && ctx->Version >= 20)
|| ctx->API == API_OPENGL_CORE) {
GLenum value = (GLenum) params[0];
if (value != GL_LOWER_LEFT && value != GL_UPPER_LEFT) {
diff --git a/mesalib/src/mesa/main/queryobj.c b/mesalib/src/mesa/main/queryobj.c
index 20799e843..cfb20cd4c 100644
--- a/mesalib/src/mesa/main/queryobj.c
+++ b/mesalib/src/mesa/main/queryobj.c
@@ -321,7 +321,7 @@ _mesa_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
q = _mesa_lookup_query_object(ctx, id);
if (!q) {
- if (ctx->API != API_OPENGL) {
+ if (ctx->API != API_OPENGL_COMPAT) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glBeginQuery{Indexed}(non-gen name)");
return;
diff --git a/mesalib/src/mesa/main/renderbuffer.c b/mesalib/src/mesa/main/renderbuffer.c
index 26f53d100..2f2844329 100644
--- a/mesalib/src/mesa/main/renderbuffer.c
+++ b/mesalib/src/mesa/main/renderbuffer.c
@@ -80,7 +80,7 @@ _mesa_new_renderbuffer(struct gl_context *ctx, GLuint name)
* free the object in the end.
*/
void
-_mesa_delete_renderbuffer(struct gl_renderbuffer *rb)
+_mesa_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
_glthread_DESTROY_MUTEX(rb->Mutex);
free(rb);
@@ -159,7 +159,11 @@ _mesa_reference_renderbuffer_(struct gl_renderbuffer **ptr,
_glthread_UNLOCK_MUTEX(oldRb->Mutex);
if (deleteFlag) {
- oldRb->Delete(oldRb);
+ GET_CURRENT_CONTEXT(ctx);
+ if (ctx)
+ oldRb->Delete(ctx, oldRb);
+ else
+ _mesa_problem(NULL, "Unable to delete renderbuffer, no context");
}
*ptr = NULL;
diff --git a/mesalib/src/mesa/main/renderbuffer.h b/mesalib/src/mesa/main/renderbuffer.h
index 0934d85df..5495ae150 100644
--- a/mesalib/src/mesa/main/renderbuffer.h
+++ b/mesalib/src/mesa/main/renderbuffer.h
@@ -40,7 +40,7 @@ extern struct gl_renderbuffer *
_mesa_new_renderbuffer(struct gl_context *ctx, GLuint name);
extern void
-_mesa_delete_renderbuffer(struct gl_renderbuffer *rb);
+_mesa_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb);
extern void
_mesa_add_renderbuffer(struct gl_framebuffer *fb,
diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c
index 5c0a923e4..53e9d0486 100644
--- a/mesalib/src/mesa/main/shaderapi.c
+++ b/mesalib/src/mesa/main/shaderapi.c
@@ -452,7 +452,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param
/* Is transform feedback available in this context?
*/
const bool has_xfb =
- (ctx->API == API_OPENGL && ctx->Extensions.EXT_transform_feedback)
+ (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.EXT_transform_feedback)
|| ctx->API == API_OPENGL_CORE
|| _mesa_is_gles3(ctx);
@@ -464,7 +464,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param
/* Are uniform buffer objects available in this context?
*/
const bool has_ubo =
- (ctx->API == API_OPENGL && ctx->Extensions.ARB_uniform_buffer_object)
+ (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_uniform_buffer_object)
|| ctx->API == API_OPENGL_CORE
|| _mesa_is_gles3(ctx);
@@ -1728,7 +1728,7 @@ _mesa_init_shader_dispatch(const struct gl_context *ctx,
SET_GetAttribLocation(exec, _mesa_GetAttribLocation);
}
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
SET_UseShaderProgramEXT(exec, _mesa_UseShaderProgramEXT);
SET_ActiveProgramEXT(exec, _mesa_ActiveProgramEXT);
SET_CreateShaderProgramEXT(exec, _mesa_CreateShaderProgramEXT);
diff --git a/mesalib/src/mesa/main/shared.c b/mesalib/src/mesa/main/shared.c
index ba82628f3..eaf9f8de1 100644
--- a/mesalib/src/mesa/main/shared.c
+++ b/mesalib/src/mesa/main/shared.c
@@ -253,10 +253,11 @@ delete_framebuffer_cb(GLuint id, void *data, void *userData)
static void
delete_renderbuffer_cb(GLuint id, void *data, void *userData)
{
+ struct gl_context *ctx = (struct gl_context *) userData;
struct gl_renderbuffer *rb = (struct gl_renderbuffer *) data;
rb->RefCount = 0; /* see comment for FBOs above */
if (rb->Delete)
- rb->Delete(rb);
+ rb->Delete(ctx, rb);
}
diff --git a/mesalib/src/mesa/main/texenv.c b/mesalib/src/mesa/main/texenv.c
index f1064c5e3..e8f3af082 100644
--- a/mesalib/src/mesa/main/texenv.c
+++ b/mesalib/src/mesa/main/texenv.c
@@ -122,7 +122,7 @@ set_combiner_mode(struct gl_context *ctx,
break;
case GL_DOT3_RGB_EXT:
case GL_DOT3_RGBA_EXT:
- legal = (ctx->API == API_OPENGL &&
+ legal = (ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.EXT_texture_env_dot3 &&
pname == GL_COMBINE_RGB);
break;
@@ -134,11 +134,11 @@ set_combiner_mode(struct gl_context *ctx,
case GL_MODULATE_ADD_ATI:
case GL_MODULATE_SIGNED_ADD_ATI:
case GL_MODULATE_SUBTRACT_ATI:
- legal = (ctx->API == API_OPENGL &&
+ legal = (ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.ATI_texture_env_combine3);
break;
case GL_BUMP_ENVMAP_ATI:
- legal = (ctx->API == API_OPENGL &&
+ legal = (ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.ATI_envmap_bumpmap &&
pname == GL_COMBINE_RGB);
break;
@@ -206,7 +206,7 @@ set_combiner_source(struct gl_context *ctx,
return;
}
- if ((term == 3) && (ctx->API != API_OPENGL
+ if ((term == 3) && (ctx->API != API_OPENGL_COMPAT
|| !ctx->Extensions.NV_texture_env_combine4)) {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
@@ -236,12 +236,12 @@ set_combiner_source(struct gl_context *ctx,
param - GL_TEXTURE0 < ctx->Const.MaxTextureUnits);
break;
case GL_ZERO:
- legal = (ctx->API == API_OPENGL &&
+ legal = (ctx->API == API_OPENGL_COMPAT &&
(ctx->Extensions.ATI_texture_env_combine3 ||
ctx->Extensions.NV_texture_env_combine4));
break;
case GL_ONE:
- legal = (ctx->API == API_OPENGL &&
+ legal = (ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.ATI_texture_env_combine3);
break;
default:
@@ -293,7 +293,7 @@ set_combiner_operand(struct gl_context *ctx,
return;
}
- if ((term == 3) && (ctx->API != API_OPENGL
+ if ((term == 3) && (ctx->API != API_OPENGL_COMPAT
|| !ctx->Extensions.NV_texture_env_combine4)) {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
@@ -442,7 +442,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
set_combiner_scale(ctx, texUnit, pname, param[0]);
break;
case GL_BUMP_TARGET_ATI:
- if (ctx->API != API_OPENGL || !ctx->Extensions.ATI_envmap_bumpmap) {
+ if (ctx->API != API_OPENGL_COMPAT || !ctx->Extensions.ATI_envmap_bumpmap) {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname=0x%x)", pname );
return;
}
@@ -588,7 +588,7 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit,
return texUnit->Combine.SourceRGB[rgb_idx];
}
case GL_SOURCE3_RGB_NV:
- if (ctx->API == API_OPENGL && ctx->Extensions.NV_texture_env_combine4) {
+ if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.NV_texture_env_combine4) {
return texUnit->Combine.SourceRGB[3];
}
else {
@@ -602,7 +602,7 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit,
return texUnit->Combine.SourceA[alpha_idx];
}
case GL_SOURCE3_ALPHA_NV:
- if (ctx->API == API_OPENGL && ctx->Extensions.NV_texture_env_combine4) {
+ if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.NV_texture_env_combine4) {
return texUnit->Combine.SourceA[3];
}
else {
@@ -616,7 +616,7 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit,
return texUnit->Combine.OperandRGB[op_rgb];
}
case GL_OPERAND3_RGB_NV:
- if (ctx->API == API_OPENGL && ctx->Extensions.NV_texture_env_combine4) {
+ if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.NV_texture_env_combine4) {
return texUnit->Combine.OperandRGB[3];
}
else {
@@ -630,7 +630,7 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit,
return texUnit->Combine.OperandA[op_alpha];
}
case GL_OPERAND3_ALPHA_NV:
- if (ctx->API == API_OPENGL && ctx->Extensions.NV_texture_env_combine4) {
+ if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.NV_texture_env_combine4) {
return texUnit->Combine.OperandA[3];
}
else {
@@ -643,7 +643,7 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit,
return 1 << texUnit->Combine.ScaleShiftA;
case GL_BUMP_TARGET_ATI:
/* spec doesn't say so, but I think this should be queryable */
- if (ctx->API == API_OPENGL && ctx->Extensions.ATI_envmap_bumpmap) {
+ if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ATI_envmap_bumpmap) {
return texUnit->BumpTarget;
}
else {
diff --git a/mesalib/src/mesa/main/texgen.c b/mesalib/src/mesa/main/texgen.c
index 7c9c2a760..fe5fc852d 100644
--- a/mesalib/src/mesa/main/texgen.c
+++ b/mesalib/src/mesa/main/texgen.c
@@ -129,7 +129,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
_mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
return;
}
- if (ctx->API != API_OPENGL
+ if (ctx->API != API_OPENGL_COMPAT
&& (bit & (TEXGEN_REFLECTION_MAP_NV | TEXGEN_NORMAL_MAP_NV)) == 0) {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
return;
@@ -143,7 +143,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
case GL_OBJECT_PLANE:
{
- if (ctx->API != API_OPENGL) {
+ if (ctx->API != API_OPENGL_COMPAT) {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
return;
}
@@ -158,7 +158,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
{
GLfloat tmp[4];
- if (ctx->API != API_OPENGL) {
+ if (ctx->API != API_OPENGL_COMPAT) {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
return;
}
@@ -352,14 +352,14 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
params[0] = ENUM_TO_FLOAT(texgen->Mode);
break;
case GL_OBJECT_PLANE:
- if (ctx->API != API_OPENGL) {
+ if (ctx->API != API_OPENGL_COMPAT) {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(param)" );
return;
}
COPY_4V(params, texgen->ObjectPlane);
break;
case GL_EYE_PLANE:
- if (ctx->API != API_OPENGL) {
+ if (ctx->API != API_OPENGL_COMPAT) {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(param)" );
return;
}
@@ -398,7 +398,7 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
params[0] = texgen->Mode;
break;
case GL_OBJECT_PLANE:
- if (ctx->API != API_OPENGL) {
+ if (ctx->API != API_OPENGL_COMPAT) {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(param)" );
return;
}
@@ -408,7 +408,7 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
params[3] = (GLint) texgen->ObjectPlane[3];
break;
case GL_EYE_PLANE:
- if (ctx->API != API_OPENGL) {
+ if (ctx->API != API_OPENGL_COMPAT) {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(param)" );
return;
}
diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c
index 2ccdcebd9..69067df9f 100644
--- a/mesalib/src/mesa/main/texgetimage.c
+++ b/mesalib/src/mesa/main/texgetimage.c
@@ -229,6 +229,8 @@ get_tex_rgba_compressed(struct gl_context *ctx, GLuint dimensions,
const gl_format texFormat =
_mesa_get_srgb_format_linear(texImage->TexFormat);
const GLenum baseFormat = _mesa_get_format_base_format(texFormat);
+ const GLenum destBaseFormat = _mesa_base_tex_format(ctx, format);
+ GLenum rebaseFormat = GL_NONE;
const GLuint width = texImage->Width;
const GLuint height = texImage->Height;
const GLuint depth = texImage->Depth;
@@ -266,9 +268,31 @@ get_tex_rgba_compressed(struct gl_context *ctx, GLuint dimensions,
}
if (baseFormat == GL_LUMINANCE ||
+ baseFormat == GL_INTENSITY ||
baseFormat == GL_LUMINANCE_ALPHA) {
+ /* If a luminance (or intensity) texture is read back as RGB(A), the
+ * returned value should be (L,0,0,1), not (L,L,L,1). Set rebaseFormat
+ * here to get G=B=0.
+ */
+ rebaseFormat = texImage->_BaseFormat;
+ }
+ else if ((baseFormat == GL_RGBA ||
+ baseFormat == GL_RGB ||
+ baseFormat == GL_RG) &&
+ (destBaseFormat == GL_LUMINANCE ||
+ destBaseFormat == GL_LUMINANCE_ALPHA ||
+ destBaseFormat == GL_LUMINANCE_INTEGER_EXT ||
+ destBaseFormat == GL_LUMINANCE_ALPHA_INTEGER_EXT)) {
+ /* If we're reading back an RGB(A) texture as luminance then we need
+ * to return L=tex(R). Note, that's different from glReadPixels which
+ * returns L=R+G+B.
+ */
+ rebaseFormat = GL_LUMINANCE_ALPHA; /* this covers GL_LUMINANCE too */
+ }
+
+ if (rebaseFormat) {
_mesa_rebase_rgba_float(width * height, (GLfloat (*)[4]) tempImage,
- baseFormat);
+ rebaseFormat);
}
srcRow = tempImage;
@@ -332,7 +356,8 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint dimensions,
rebaseFormat = texImage->_BaseFormat;
}
else if ((texImage->_BaseFormat == GL_RGBA ||
- texImage->_BaseFormat == GL_RGB) &&
+ texImage->_BaseFormat == GL_RGB ||
+ texImage->_BaseFormat == GL_RG) &&
(destBaseFormat == GL_LUMINANCE ||
destBaseFormat == GL_LUMINANCE_ALPHA ||
destBaseFormat == GL_LUMINANCE_INTEGER_EXT ||
@@ -419,15 +444,6 @@ get_tex_rgba(struct gl_context *ctx, GLuint dimensions,
transferOps |= IMAGE_CLAMP_BIT;
}
}
- /* This applies to RGB, RGBA textures. if the format is either LUMINANCE
- * or LUMINANCE ALPHA, luminance (L) is computed as L=R+G+B .we need to
- * clamp the sum to [0,1].
- */
- else if ((format == GL_LUMINANCE ||
- format == GL_LUMINANCE_ALPHA) &&
- dataType == GL_UNSIGNED_NORMALIZED) {
- transferOps |= IMAGE_CLAMP_BIT;
- }
if (_mesa_is_format_compressed(texImage->TexFormat)) {
get_tex_rgba_compressed(ctx, dimensions, format, type,
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 7d5a574e4..a720c38b8 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -1853,7 +1853,7 @@ texture_error_check( struct gl_context *ctx,
/* Check border */
if (border < 0 || border > 1 ||
- ((ctx->API != API_OPENGL ||
+ ((ctx->API != API_OPENGL_COMPAT ||
target == GL_TEXTURE_RECTANGLE_NV ||
target == GL_PROXY_TEXTURE_RECTANGLE_NV) && border != 0)) {
_mesa_error(ctx, GL_INVALID_VALUE,
@@ -2353,7 +2353,7 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
/* Check border */
if (border < 0 || border > 1 ||
- ((ctx->API != API_OPENGL ||
+ ((ctx->API != API_OPENGL_COMPAT ||
target == GL_TEXTURE_RECTANGLE_NV ||
target == GL_PROXY_TEXTURE_RECTANGLE_NV) && border != 0)) {
_mesa_error(ctx, GL_INVALID_VALUE,
diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c
index 92c89102f..c2d161f9a 100644
--- a/mesalib/src/mesa/main/texparam.c
+++ b/mesalib/src/mesa/main/texparam.c
@@ -64,7 +64,7 @@ validate_texture_wrap_mode(struct gl_context * ctx, GLenum target, GLenum wrap)
/* GL_CLAMP was removed in the core profile, and it has never existed in
* OpenGL ES.
*/
- supported = (ctx->API == API_OPENGL)
+ supported = (ctx->API == API_OPENGL_COMPAT)
&& (target != GL_TEXTURE_EXTERNAL_OES);
break;
@@ -358,7 +358,7 @@ set_tex_parameteri(struct gl_context *ctx,
return GL_TRUE;
case GL_GENERATE_MIPMAP_SGIS:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_pname;
if (params[0] && texObj->Target == GL_TEXTURE_EXTERNAL_OES)
@@ -418,7 +418,7 @@ set_tex_parameteri(struct gl_context *ctx,
/* GL_DEPTH_TEXTURE_MODE_ARB is removed in core-profile and it has never
* existed in OpenGL ES.
*/
- if (ctx->API == API_OPENGL && ctx->Extensions.ARB_depth_texture) {
+ if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_depth_texture) {
if (texObj->DepthMode == params[0])
return GL_FALSE;
if (params[0] == GL_LUMINANCE ||
@@ -562,7 +562,7 @@ set_tex_parameterf(struct gl_context *ctx,
return GL_TRUE;
case GL_TEXTURE_PRIORITY:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
flush(ctx);
@@ -595,7 +595,7 @@ set_tex_parameterf(struct gl_context *ctx,
* It was removed in core-profile, and it has never existed in OpenGL
* ES.
*/
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
if (texObj->Sampler.LodBias != params[0]) {
@@ -1328,13 +1328,13 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
}
break;
case GL_TEXTURE_RESIDENT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = 1.0F;
break;
case GL_TEXTURE_PRIORITY:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = obj->Priority;
@@ -1366,7 +1366,7 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
*params = obj->Sampler.MaxAnisotropy;
break;
case GL_GENERATE_MIPMAP_SGIS:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_pname;
*params = (GLfloat) obj->GenerateMipmap;
@@ -1387,12 +1387,12 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
/* GL_DEPTH_TEXTURE_MODE_ARB is removed in core-profile and it has
* never existed in OpenGL ES.
*/
- if (ctx->API != API_OPENGL || !ctx->Extensions.ARB_depth_texture)
+ if (ctx->API != API_OPENGL_COMPAT || !ctx->Extensions.ARB_depth_texture)
goto invalid_pname;
*params = (GLfloat) obj->DepthMode;
break;
case GL_TEXTURE_LOD_BIAS:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = obj->Sampler.LodBias;
@@ -1510,13 +1510,13 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
}
break;
case GL_TEXTURE_RESIDENT:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = 1;
break;
case GL_TEXTURE_PRIORITY:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = FLOAT_TO_INT(obj->Priority);
@@ -1548,7 +1548,7 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
*params = (GLint) obj->Sampler.MaxAnisotropy;
break;
case GL_GENERATE_MIPMAP_SGIS:
- if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_pname;
*params = (GLint) obj->GenerateMipmap;
@@ -1566,12 +1566,12 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
*params = (GLint) obj->Sampler.CompareFunc;
break;
case GL_DEPTH_TEXTURE_MODE_ARB:
- if (ctx->API != API_OPENGL || !ctx->Extensions.ARB_depth_texture)
+ if (ctx->API != API_OPENGL_COMPAT || !ctx->Extensions.ARB_depth_texture)
goto invalid_pname;
*params = (GLint) obj->DepthMode;
break;
case GL_TEXTURE_LOD_BIAS:
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
*params = (GLint) obj->Sampler.LodBias;
diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c
index 334e6e80b..cfaf4bbda 100644
--- a/mesalib/src/mesa/main/version.c
+++ b/mesalib/src/mesa/main/version.c
@@ -114,7 +114,7 @@ _mesa_override_gl_version(struct gl_context *ctx)
} else if (ctx->Version >= 31) {
ctx->API = API_OPENGL_CORE;
} else {
- ctx->API = API_OPENGL;
+ ctx->API = API_OPENGL_COMPAT;
}
create_version_string(ctx, "");
}
@@ -344,7 +344,7 @@ _mesa_compute_version(struct gl_context *ctx)
return;
switch (ctx->API) {
- case API_OPENGL:
+ case API_OPENGL_COMPAT:
case API_OPENGL_CORE:
compute_version(ctx);
break;
diff --git a/mesalib/src/mesa/main/vtxfmt.c b/mesalib/src/mesa/main/vtxfmt.c
index 5891a5231..674edb5e1 100644
--- a/mesalib/src/mesa/main/vtxfmt.c
+++ b/mesalib/src/mesa/main/vtxfmt.c
@@ -50,7 +50,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
SET_Color4f(tab, vfmt->Color4f);
}
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
_mesa_install_arrayelt_vtxfmt(tab, vfmt);
SET_Color3f(tab, vfmt->Color3f);
SET_Color3fv(tab, vfmt->Color3fv);
@@ -58,7 +58,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
SET_EdgeFlag(tab, vfmt->EdgeFlag);
}
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
_mesa_install_eval_vtxfmt(tab, vfmt);
}
@@ -68,7 +68,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
SET_Normal3f(tab, vfmt->Normal3f);
}
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
SET_FogCoordfEXT(tab, vfmt->FogCoordfEXT);
SET_FogCoordfvEXT(tab, vfmt->FogCoordfvEXT);
SET_Indexf(tab, vfmt->Indexf);
@@ -83,7 +83,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
SET_Normal3fv(tab, vfmt->Normal3fv);
}
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
SET_SecondaryColor3fEXT(tab, vfmt->SecondaryColor3fEXT);
SET_SecondaryColor3fvEXT(tab, vfmt->SecondaryColor3fvEXT);
SET_TexCoord1f(tab, vfmt->TexCoord1f);
@@ -102,7 +102,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
SET_Vertex4fv(tab, vfmt->Vertex4fv);
}
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
_mesa_install_dlist_vtxfmt(tab, vfmt); /* glCallList / glCallLists */
SET_Begin(tab, vfmt->Begin);
@@ -145,7 +145,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
}
/* Originally for GL_NV_vertex_program, this is also used by dlist.c */
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
SET_VertexAttrib1fNV(tab, vfmt->VertexAttrib1fNV);
SET_VertexAttrib1fvNV(tab, vfmt->VertexAttrib1fvNV);
SET_VertexAttrib2fNV(tab, vfmt->VertexAttrib2fNV);
@@ -189,7 +189,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
SET_VertexAttribI4uivEXT(tab, vfmt->VertexAttribI4uiv);
}
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL_COMPAT) {
/* GL_ARB_vertex_type_10_10_10_2_rev / GL 3.3 */
SET_VertexP2ui(tab, vfmt->VertexP2ui);
SET_VertexP2uiv(tab, vfmt->VertexP2uiv);
diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
index adee00bd2..04907c9f7 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
@@ -225,14 +225,16 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx,
* gl_renderbuffer::Delete()
*/
static void
-st_renderbuffer_delete(struct gl_renderbuffer *rb)
+st_renderbuffer_delete(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
struct st_renderbuffer *strb = st_renderbuffer(rb);
- ASSERT(strb);
- pipe_surface_reference(&strb->surface, NULL);
+ struct st_context *st = st_context(ctx);
+ struct pipe_context *pipe = st->pipe;
+
+ pipe_surface_release(pipe, &strb->surface);
pipe_resource_reference(&strb->texture, NULL);
free(strb->data);
- _mesa_delete_renderbuffer(rb);
+ _mesa_delete_renderbuffer(ctx, rb);
}
@@ -434,7 +436,7 @@ st_render_texture(struct gl_context *ctx,
pipe_resource_reference( &strb->texture, pt );
- pipe_surface_reference(&strb->surface, NULL);
+ pipe_surface_release(pipe, &strb->surface);
assert(strb->rtt_level <= strb->texture->last_level);
diff --git a/mesalib/src/mesa/state_tracker/st_cb_flush.c b/mesalib/src/mesa/state_tracker/st_cb_flush.c
index b4372ae7c..7c9f91f1b 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_flush.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_flush.c
@@ -79,6 +79,7 @@ display_front_buffer(struct st_context *st)
void st_flush( struct st_context *st,
struct pipe_fence_handle **fence )
{
+ FLUSH_VERTICES(st->ctx, 0);
FLUSH_CURRENT(st->ctx, 0);
st_flush_bitmap_cache(st);
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 7570d6894..62a736bb6 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -527,7 +527,7 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.NV_texture_rectangle = GL_TRUE;
ctx->Extensions.OES_EGL_image = GL_TRUE;
- if (ctx->API != API_OPENGL)
+ if (ctx->API != API_OPENGL_COMPAT)
ctx->Extensions.OES_EGL_image_external = GL_TRUE;
ctx->Extensions.OES_draw_texture = GL_TRUE;
diff --git a/mesalib/src/mesa/state_tracker/st_manager.c b/mesalib/src/mesa/state_tracker/st_manager.c
index 5576a0d6c..0b9add95e 100644
--- a/mesalib/src/mesa/state_tracker/st_manager.c
+++ b/mesalib/src/mesa/state_tracker/st_manager.c
@@ -615,7 +615,7 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
switch (attribs->profile) {
case ST_PROFILE_DEFAULT:
- api = API_OPENGL;
+ api = API_OPENGL_COMPAT;
break;
case ST_PROFILE_OPENGL_ES1:
api = API_OPENGLES;
@@ -673,6 +673,8 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
st->iface.copy = st_context_copy;
st->iface.share = st_context_share;
st->iface.st_context_private = (void *) smapi;
+ st->iface.cso_context = st->cso_context;
+ st->iface.pipe = st->pipe;
*error = ST_CONTEXT_SUCCESS;
return &st->iface;
diff --git a/mesalib/src/mesa/swrast/s_renderbuffer.c b/mesalib/src/mesa/swrast/s_renderbuffer.c
index b1fb57823..282b2c482 100644
--- a/mesalib/src/mesa/swrast/s_renderbuffer.c
+++ b/mesalib/src/mesa/swrast/s_renderbuffer.c
@@ -164,13 +164,13 @@ soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
* Called via gl_renderbuffer::Delete()
*/
static void
-soft_renderbuffer_delete(struct gl_renderbuffer *rb)
+soft_renderbuffer_delete(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
struct swrast_renderbuffer *srb = swrast_renderbuffer(rb);
free(srb->Buffer);
srb->Buffer = NULL;
- _mesa_delete_renderbuffer(rb);
+ _mesa_delete_renderbuffer(ctx, rb);
}
diff --git a/mesalib/src/mesa/swrast/s_texrender.c b/mesalib/src/mesa/swrast/s_texrender.c
index 140e4b50f..7b25a7b7d 100644
--- a/mesalib/src/mesa/swrast/s_texrender.c
+++ b/mesalib/src/mesa/swrast/s_texrender.c
@@ -16,7 +16,7 @@
static void
-delete_texture_wrapper(struct gl_renderbuffer *rb)
+delete_texture_wrapper(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
ASSERT(rb->RefCount == 0);
free(rb);
diff --git a/mesalib/src/mesa/vbo/vbo_context.c b/mesalib/src/mesa/vbo/vbo_context.c
index fd15fb6a9..7eda31e8f 100644
--- a/mesalib/src/mesa/vbo/vbo_context.c
+++ b/mesalib/src/mesa/vbo/vbo_context.c
@@ -189,7 +189,7 @@ GLboolean _vbo_CreateContext( struct gl_context *ctx )
* vtxfmt mechanism can be removed now.
*/
vbo_exec_init( ctx );
- if (ctx->API == API_OPENGL)
+ if (ctx->API == API_OPENGL_COMPAT)
vbo_save_init( ctx );
_math_init_eval();
@@ -221,7 +221,7 @@ void _vbo_DestroyContext( struct gl_context *ctx )
}
vbo_exec_destroy(ctx);
- if (ctx->API == API_OPENGL)
+ if (ctx->API == API_OPENGL_COMPAT)
vbo_save_destroy(ctx);
free(vbo);
ctx->swtnl_im = NULL;
diff --git a/mesalib/src/mesa/vbo/vbo_exec_api.c b/mesalib/src/mesa/vbo/vbo_exec_api.c
index 75e549fc4..2aaa2895c 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_api.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_api.c
@@ -465,10 +465,10 @@ vbo_Materialfv(GLenum face, GLenum pname, const GLfloat *params)
updateMats = ALL_MATERIAL_BITS;
}
- if (ctx->API == API_OPENGL && face == GL_FRONT) {
+ if (ctx->API == API_OPENGL_COMPAT && face == GL_FRONT) {
updateMats &= FRONT_MATERIAL_BITS;
}
- else if (ctx->API == API_OPENGL && face == GL_BACK) {
+ else if (ctx->API == API_OPENGL_COMPAT && face == GL_BACK) {
updateMats &= BACK_MATERIAL_BITS;
}
else if (face != GL_FRONT_AND_BACK) {
@@ -514,7 +514,7 @@ vbo_Materialfv(GLenum face, GLenum pname, const GLfloat *params)
MAT_ATTR(VBO_ATTRIB_MAT_BACK_SHININESS, 1, params);
break;
case GL_COLOR_INDEXES:
- if (ctx->API != API_OPENGL) {
+ if (ctx->API != API_OPENGL_COMPAT) {
_mesa_error(ctx, GL_INVALID_ENUM, "glMaterialfv(pname)");
return;
}