diff options
author | marha <marha@users.sourceforge.net> | 2013-01-22 14:27:38 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-01-22 14:27:38 +0100 |
commit | 7002c66cfba01e7d3b88dae498a195f78f0e83f5 (patch) | |
tree | 2fbbd202a6a4243f0e64a8b22e22417a609ae19d | |
parent | 50c07563e17397daf040a32d8fdd3ab397e72371 (diff) | |
parent | 470f7ca9f0be348faf2f03fc16811844c5eeffce (diff) | |
download | vcxsrv-7002c66cfba01e7d3b88dae498a195f78f0e83f5.tar.gz vcxsrv-7002c66cfba01e7d3b88dae498a195f78f0e83f5.tar.bz2 vcxsrv-7002c66cfba01e7d3b88dae498a195f78f0e83f5.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
fontconfig libfontenc mesa mkfontscale pixman xserver xkeyboard-config
Conflicts:
mesalib/src/mesa/main/syncobj.c
mesalib/src/mesa/main/syncobj.h
xorg-server/hw/xwin/winconfig.c
xorg-server/hw/xwin/winmultiwindowwndproc.c
131 files changed, 1666 insertions, 2110 deletions
diff --git a/fontconfig/src/Makefile.am b/fontconfig/src/Makefile.am index dba42065a..3bb90eab5 100644 --- a/fontconfig/src/Makefile.am +++ b/fontconfig/src/Makefile.am @@ -31,8 +31,9 @@ fontconfig_def_dependency = fontconfig.def # gcc import library install/uninstall -install-libtool-import-lib: - $(INSTALL) .libs/libfontconfig.dll.a $(DESTDIR)$(libdir) +install-libtool-import-lib: libfontconfig.la + $(MKDIR_P) $(DESTDIR)$(libdir) + $(INSTALL) .libs/libfontconfig.dll.a $(DESTDIR)$(libdir)/libfontconfig.dll.a $(INSTALL) fontconfig.def $(DESTDIR)$(libdir)/fontconfig.def uninstall-libtool-import-lib: diff --git a/fontconfig/src/fccache.c b/fontconfig/src/fccache.c index d894fc2b6..36111bd89 100755 --- a/fontconfig/src/fccache.c +++ b/fontconfig/src/fccache.c @@ -31,7 +31,6 @@ #include <dirent.h> #include <string.h> #include <sys/types.h> -#include <time.h> #include <assert.h> #if defined(HAVE_MMAP) || defined(__CYGWIN__) # include <unistd.h> @@ -253,62 +252,6 @@ static FcCacheSkip *fcCacheChains[FC_CACHE_MAX_LEVEL]; static int fcCacheMaxLevel; -static int32_t -FcRandom(void) -{ - int32_t result; - -#if HAVE_RANDOM_R - static struct random_data fcrandbuf; - static char statebuf[256]; - static FcBool initialized = FcFalse; - - if (initialized != FcTrue) - { - initstate_r(time(NULL), statebuf, 256, &fcrandbuf); - initialized = FcTrue; - } - - random_r(&fcrandbuf, &result); -#elif HAVE_RANDOM - static char statebuf[256]; - char *state; - static FcBool initialized = FcFalse; - - if (initialized != FcTrue) - { - state = initstate(time(NULL), statebuf, 256); - initialized = FcTrue; - } - else - state = setstate(statebuf); - - result = random(); - - setstate(state); -#elif HAVE_LRAND48 - result = lrand48(); -#elif HAVE_RAND_R - static unsigned int seed = time(NULL); - - result = rand_r(&seed); -#elif HAVE_RAND - static FcBool initialized = FcFalse; - - if (initialized != FcTrue) - { - srand(time(NULL)); - initialized = FcTrue; - } - result = rand(); -#else -# error no random number generator function available. -#endif - - return result; -} - - static FcMutex *cache_lock; static void diff --git a/fontconfig/src/fccompat.c b/fontconfig/src/fccompat.c index 2aa29ddcc..0a9c135fe 100644 --- a/fontconfig/src/fccompat.c +++ b/fontconfig/src/fccompat.c @@ -31,11 +31,20 @@ #include "fcint.h" +#include <errno.h> +#if HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#if HAVE_SYS_STAT_H +#include <sys/stat.h> +#endif #if HAVE_FCNTL_H #include <fcntl.h> #endif #include <stdarg.h> #include <stdlib.h> +#include <string.h> +#include <time.h> #ifdef O_CLOEXEC #define FC_O_CLOEXEC O_CLOEXEC @@ -47,6 +56,58 @@ #else #define FC_O_LARGEFILE 0 #endif +#ifdef O_BINARY +#define FC_O_BINARY O_BINARY +#else +#define FC_O_BINARY 0 +#endif +#ifdef O_TEMPORARY +#define FC_O_TEMPORARY O_TEMPORARY +#else +#define FC_O_TEMPORARY 0 +#endif +#ifdef O_NOINHERIT +#define FC_O_NOINHERIT O_NOINHERIT +#else +#define FC_O_NOINHERIT 0 +#endif + +#if !defined (HAVE_MKOSTEMP) && !defined(HAVE_MKSTEMP) && !defined(HAVE__MKTEMP_S) +static int +mkstemp (char *template) +{ + static const char s[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + int fd, i; + size_t l; + + if (template == NULL) + { + errno = EINVAL; + return -1; + } + l = strlen (template); + if (l < 6 || strcmp (&template[l - 6], "XXXXXX") != 0) + { + errno = EINVAL; + return -1; + } + do + { + errno = 0; + for (i = l - 6; i < l; i++) + { + int r = FcRandom (); + template[i] = s[r % 62]; + } + fd = FcOpen (template, FC_O_BINARY | O_CREAT | O_EXCL | FC_O_TEMPORARY | FC_O_NOINHERIT | O_RDWR, 0600); + } while (fd < 0 && errno == EEXIST); + if (fd >= 0) + errno = 0; + + return fd; +} +#define HAVE_MKSTEMP 1 +#endif int FcOpen(const char *pathname, int flags, ...) @@ -84,7 +145,7 @@ FcMakeTempfile (char *template) # ifdef F_DUPFD_CLOEXEC if (fd != -1) { - int newfd = fcntl(fd, F_DUPFD_CLOEXEC); + int newfd = fcntl(fd, F_DUPFD_CLOEXEC, STDIN_FILENO); close(fd); fd = newfd; @@ -109,3 +170,58 @@ FcMakeTempfile (char *template) return fd; } + +int32_t +FcRandom(void) +{ + int32_t result; + +#if HAVE_RANDOM_R + static struct random_data fcrandbuf; + static char statebuf[256]; + static FcBool initialized = FcFalse; + + if (initialized != FcTrue) + { + initstate_r(time(NULL), statebuf, 256, &fcrandbuf); + initialized = FcTrue; + } + + random_r(&fcrandbuf, &result); +#elif HAVE_RANDOM + static char statebuf[256]; + char *state; + static FcBool initialized = FcFalse; + + if (initialized != FcTrue) + { + state = initstate(time(NULL), statebuf, 256); + initialized = FcTrue; + } + else + state = setstate(statebuf); + + result = random(); + + setstate(state); +#elif HAVE_LRAND48 + result = lrand48(); +#elif HAVE_RAND_R + static unsigned int seed = time(NULL); + + result = rand_r(&seed); +#elif HAVE_RAND + static FcBool initialized = FcFalse; + + if (initialized != FcTrue) + { + srand(time(NULL)); + initialized = FcTrue; + } + result = rand(); +#else +# error no random number generator function available. +#endif + + return result; +} diff --git a/fontconfig/src/fcdefault.c b/fontconfig/src/fcdefault.c index b1bd9cc1f..d1217a4dc 100644 --- a/fontconfig/src/fcdefault.c +++ b/fontconfig/src/fcdefault.c @@ -148,11 +148,11 @@ retry: prgname = FcStrdup (""); #else char buf[PATH_MAX + 1]; - unsigned int len; + int len; char *p = NULL; len = readlink ("/proc/self/exe", buf, sizeof (buf) - 1); - if (len > 0) + if (len != -1) { buf[len] = '\0'; p = buf; diff --git a/fontconfig/src/fcint.h b/fontconfig/src/fcint.h index 3cf526f3d..71b734150 100644 --- a/fontconfig/src/fcint.h +++ b/fontconfig/src/fcint.h @@ -724,6 +724,9 @@ FcOpen(const char *pathname, int flags, ...); FcPrivate int FcMakeTempfile (char *template); +FcPrivate int32_t +FcRandom (void); + /* fcdbg.c */ FcPrivate void diff --git a/libfontenc/src/Makefile.am b/libfontenc/src/Makefile.am index 96d0a38be..e37043b9d 100644 --- a/libfontenc/src/Makefile.am +++ b/libfontenc/src/Makefile.am @@ -12,7 +12,7 @@ AM_CFLAGS = \ FONTENCDIR=@ENCODINGSDIR@ FONTENCDEFS = -DFONT_ENCODINGS_DIRECTORY=\"$(FONTENCDIR)/encodings.dir\" -INCLUDES = -I$(top_srcdir)/include $(FONTENCDEFS) +AM_CPPFLAGS = -I$(top_srcdir)/include $(FONTENCDEFS) libfontenc_la_LIBADD = @FONTENC_LIBS@ diff --git a/mesalib/configure.ac b/mesalib/configure.ac index 99a08fd06..e7c234016 100644 --- a/mesalib/configure.ac +++ b/mesalib/configure.ac @@ -33,7 +33,7 @@ LIBDRM_REQUIRED=2.4.24 LIBDRM_RADEON_REQUIRED=2.4.40 LIBDRM_INTEL_REQUIRED=2.4.38 LIBDRM_NVVIEUX_REQUIRED=2.4.33 -LIBDRM_NOUVEAU_REQUIRED=2.4.33 +LIBDRM_NOUVEAU_REQUIRED="2.4.33 libdrm >= 2.4.41" DRI2PROTO_REQUIRED=2.6 GLPROTO_REQUIRED=1.4.14 LIBDRM_XORG_REQUIRED=2.4.24 @@ -49,6 +49,7 @@ AM_PROG_CC_C_O AM_PROG_AS AC_CHECK_PROGS([MAKE], [gmake make]) AC_CHECK_PROGS([PYTHON2], [python2 python]) +AX_PYTHON_MODULE([libxml2], [needed]) AC_PROG_SED AC_PROG_MKDIR_P @@ -724,16 +725,12 @@ if test "x$enable_dri" = xno; then enable_shared_glapi=no fi -# TODO: Get rid of SHARED_GLAPI variable -SHARED_GLAPI="0" if test "x$enable_shared_glapi" = xyes; then - SHARED_GLAPI="1" # libGL will use libglapi for function lookups (IN_DRI_DRIVER means to use # the remap table) DEFINES="$DEFINES -DIN_DRI_DRIVER" CORE_DIRS="mapi/shared-glapi" fi -AC_SUBST([SHARED_GLAPI]) AM_CONDITIONAL(HAVE_SHARED_GLAPI, test "x$enable_shared_glapi" = xyes) dnl diff --git a/mesalib/docs/GL3.txt b/mesalib/docs/GL3.txt index 567781d90..3bf91eae5 100644 --- a/mesalib/docs/GL3.txt +++ b/mesalib/docs/GL3.txt @@ -95,7 +95,7 @@ GL_ARB_gpu_shader_fp64 not started GL_ARB_sample_shading not started GL_ARB_shader_subroutine not started GL_ARB_tessellation_shader not started -GL_ARB_texture_buffer_object_rgb32 DONE (softpipe) +GL_ARB_texture_buffer_object_rgb32 DONE (i965, softpipe) GL_ARB_texture_cube_map_array DONE (i965, softpipe) GL_ARB_texture_gather not started GL_ARB_transform_feedback2 DONE diff --git a/mesalib/m4/ax_python_module.m4 b/mesalib/m4/ax_python_module.m4 new file mode 100644 index 000000000..3afc40420 --- /dev/null +++ b/mesalib/m4/ax_python_module.m4 @@ -0,0 +1,49 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_python_module.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PYTHON_MODULE(modname[, fatal]) +# +# DESCRIPTION +# +# Checks for Python module. +# +# If fatal is non-empty then absence of a module will trigger an error. +# +# LICENSE +# +# Copyright (c) 2008 Andrew Collier +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 6 + +AU_ALIAS([AC_PYTHON_MODULE], [AX_PYTHON_MODULE]) +AC_DEFUN([AX_PYTHON_MODULE],[ + if test -z $PYTHON; + then + PYTHON="python" + fi + PYTHON_NAME=`basename $PYTHON` + AC_MSG_CHECKING($PYTHON_NAME module: $1) + $PYTHON -c "import $1" 2>/dev/null + if test $? -eq 0; + then + AC_MSG_RESULT(yes) + eval AS_TR_CPP(HAVE_PYMOD_$1)=yes + else + AC_MSG_RESULT(no) + eval AS_TR_CPP(HAVE_PYMOD_$1)=no + # + if test -n "$2" + then + AC_MSG_ERROR(failed to find required module $1) + exit 1 + fi + fi +]) diff --git a/mesalib/src/gallium/auxiliary/Makefile.sources b/mesalib/src/gallium/auxiliary/Makefile.sources index e54e9201c..74c7902ae 100644 --- a/mesalib/src/gallium/auxiliary/Makefile.sources +++ b/mesalib/src/gallium/auxiliary/Makefile.sources @@ -36,7 +36,6 @@ C_SOURCES := \ draw/draw_vertex.c \ draw/draw_vs.c \ draw/draw_vs_exec.c \ - draw/draw_vs_ppc.c \ draw/draw_vs_variant.c \ os/os_misc.c \ os/os_time.c \ @@ -64,7 +63,6 @@ C_SOURCES := \ rbug/rbug_shader.c \ rtasm/rtasm_cpu.c \ rtasm/rtasm_execmem.c \ - rtasm/rtasm_ppc.c \ rtasm/rtasm_x86sse.c \ tgsi/tgsi_build.c \ tgsi/tgsi_dump.c \ @@ -72,7 +70,6 @@ C_SOURCES := \ tgsi/tgsi_info.c \ tgsi/tgsi_iterate.c \ tgsi/tgsi_parse.c \ - tgsi/tgsi_ppc.c \ tgsi/tgsi_sanity.c \ tgsi/tgsi_scan.c \ tgsi/tgsi_strings.c \ diff --git a/mesalib/src/glsl/Makefile.am b/mesalib/src/glsl/Makefile.am index 0f545d548..36af90ef1 100644 --- a/mesalib/src/glsl/Makefile.am +++ b/mesalib/src/glsl/Makefile.am @@ -25,9 +25,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src/mapi \ -I$(top_srcdir)/src/mesa/ \ - $(LIBRARY_INCLUDES) \ $(DEFINES) \ - $(LIBRARY_DEFINES) \ $(API_DEFINES) AM_CFLAGS = $(VISIBILITY_CFLAGS) AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS) @@ -37,7 +35,8 @@ AM_LFLAGS = --nounistd -o$(LEX_OUTPUT_ROOT).c include Makefile.sources noinst_LTLIBRARIES = libglsl.la -noinst_PROGRAMS = glsl_compiler glsl_test +check_PROGRAMS = glsl_test +noinst_PROGRAMS = glsl_compiler libglsl_la_SOURCES = \ glsl_lexer.ll \ diff --git a/mesalib/src/glsl/ast_function.cpp b/mesalib/src/glsl/ast_function.cpp index b56a3c723..dc7a58bf2 100644 --- a/mesalib/src/glsl/ast_function.cpp +++ b/mesalib/src/glsl/ast_function.cpp @@ -183,7 +183,7 @@ verify_parameter_modes(_mesa_glsl_parse_state *state, */ static ir_rvalue * generate_call(exec_list *instructions, ir_function_signature *sig, - YYLTYPE *loc, exec_list *actual_parameters, + exec_list *actual_parameters, ir_call **call_ir, struct _mesa_glsl_parse_state *state) { @@ -1501,7 +1501,7 @@ ast_function_expression::hir(exec_list *instructions, /* an error has already been emitted */ value = ir_rvalue::error_value(ctx); } else { - value = generate_call(instructions, sig, &loc, &actual_parameters, + value = generate_call(instructions, sig, &actual_parameters, &call, state); } diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp index f934c8e2d..de3ce902e 100644 --- a/mesalib/src/glsl/ast_to_hir.cpp +++ b/mesalib/src/glsl/ast_to_hir.cpp @@ -1933,6 +1933,31 @@ is_varying_var(ir_variable *var, _mesa_glsl_parser_targets target) } +/** + * Matrix layout qualifiers are only allowed on certain types + */ +static void +validate_matrix_layout_for_type(struct _mesa_glsl_parse_state *state, + YYLTYPE *loc, + const glsl_type *type) +{ + if (!type->is_matrix() && !type->is_record()) { + _mesa_glsl_error(loc, state, + "uniform block layout qualifiers row_major and " + "column_major can only be applied to matrix and " + "structure types"); + } else if (type->is_record()) { + /* We allow 'layout(row_major)' on structure types because it's the only + * way to get row-major layouts on matrices contained in structures. + */ + _mesa_glsl_warning(loc, state, + "uniform block layout qualifiers row_major and " + "column_major applied to structure types is not " + "strictly conformant and my be rejected by other " + "compilers"); + } +} + static void apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, ir_variable *var, @@ -2251,12 +2276,14 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, "members"); } - if (!ubo_qualifiers_valid && - (qual->flags.q.row_major || qual->flags.q.column_major)) { - _mesa_glsl_error(loc, state, - "uniform block layout qualifiers row_major and " - "column_major can only be applied to uniform block " - "members"); + if (qual->flags.q.row_major || qual->flags.q.column_major) { + if (!ubo_qualifiers_valid) { + _mesa_glsl_error(loc, state, + "uniform block layout qualifiers row_major and " + "column_major can only be applied to uniform block " + "members"); + } else + validate_matrix_layout_for_type(state, loc, var->type); } } @@ -4105,6 +4132,12 @@ ast_uniform_block::hir(exec_list *instructions, struct gl_uniform_block *ubo = get_next_uniform_block(state); ubo->Name = ralloc_strdup(state->uniform_blocks, this->block_name); + if (!state->symbols->add_uniform_block(ubo)) { + YYLTYPE loc = this->get_location(); + _mesa_glsl_error(&loc, state, "Uniform block name `%s' already taken in " + "the current scope.\n", ubo->Name); + } + unsigned int num_variables = 0; foreach_list_typed(ast_declarator_list, decl_list, link, &declarations) { foreach_list_const(node, &decl_list->declarations) { @@ -4133,7 +4166,6 @@ ast_uniform_block::hir(exec_list *instructions, ubo_var->Name = ralloc_strdup(state->uniform_blocks, var->name); ubo_var->Type = var->type; - ubo_var->Buffer = ubo - state->uniform_blocks; ubo_var->Offset = 0; /* Assigned at link time. */ if (var->type->is_matrix() || diff --git a/mesalib/src/glsl/glcpp/Makefile.am b/mesalib/src/glsl/glcpp/Makefile.am index 1efc9dc1a..d79f8653c 100644 --- a/mesalib/src/glsl/glcpp/Makefile.am +++ b/mesalib/src/glsl/glcpp/Makefile.am @@ -29,9 +29,7 @@ AM_CFLAGS = \ -I$(top_srcdir)/src/mapi \ -I$(top_srcdir)/src/mesa/ \ $(VISIBILITY_CFLAGS) \ - $(LIBRARY_INCLUDES) \ $(DEFINES) \ - $(LIBRARY_DEFINES) \ $(API_DEFINES) AM_YFLAGS = -v -d -p "glcpp_parser_" diff --git a/mesalib/src/glsl/glsl_symbol_table.cpp b/mesalib/src/glsl/glsl_symbol_table.cpp index 247aff55c..32daf0c47 100644 --- a/mesalib/src/glsl/glsl_symbol_table.cpp +++ b/mesalib/src/glsl/glsl_symbol_table.cpp @@ -45,13 +45,15 @@ public: ralloc_free(entry); } - symbol_table_entry(ir_variable *v) : v(v), f(0), t(0) {} - symbol_table_entry(ir_function *f) : v(0), f(f), t(0) {} - symbol_table_entry(const glsl_type *t) : v(0), f(0), t(t) {} + symbol_table_entry(ir_variable *v) : v(v), f(0), t(0), u(0) {} + symbol_table_entry(ir_function *f) : v(0), f(f), t(0), u(0) {} + symbol_table_entry(const glsl_type *t) : v(0), f(0), t(t), u(0) {} + symbol_table_entry(struct gl_uniform_block *u) : v(0), f(0), t(0), u(u) {} ir_variable *v; ir_function *f; const glsl_type *t; + struct gl_uniform_block *u; }; glsl_symbol_table::glsl_symbol_table() @@ -136,6 +138,12 @@ bool glsl_symbol_table::add_function(ir_function *f) return _mesa_symbol_table_add_symbol(table, -1, f->name, entry) == 0; } +bool glsl_symbol_table::add_uniform_block(struct gl_uniform_block *u) +{ + symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(u); + return _mesa_symbol_table_add_symbol(table, -1, u->Name, entry) == 0; +} + void glsl_symbol_table::add_global_function(ir_function *f) { symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(f); diff --git a/mesalib/src/glsl/glsl_symbol_table.h b/mesalib/src/glsl/glsl_symbol_table.h index 55baebf10..2f079c7ef 100644 --- a/mesalib/src/glsl/glsl_symbol_table.h +++ b/mesalib/src/glsl/glsl_symbol_table.h @@ -104,6 +104,7 @@ public: bool add_variable(ir_variable *v); bool add_type(const char *name, const glsl_type *t); bool add_function(ir_function *f); + bool add_uniform_block(struct gl_uniform_block *u); /*@}*/ /** diff --git a/mesalib/src/glsl/ir_clone.cpp b/mesalib/src/glsl/ir_clone.cpp index 4314efa76..c62c1fc20 100644 --- a/mesalib/src/glsl/ir_clone.cpp +++ b/mesalib/src/glsl/ir_clone.cpp @@ -36,10 +36,6 @@ ir_rvalue::clone(void *mem_ctx, struct hash_table *ht) const /** * Duplicate an IR variable - * - * \note - * This will probably be made \c virtual and moved to the base class - * eventually. */ ir_variable * ir_variable::clone(void *mem_ctx, struct hash_table *ht) const diff --git a/mesalib/src/glsl/link_uniforms.cpp b/mesalib/src/glsl/link_uniforms.cpp index 118bfae68..c819f8670 100644 --- a/mesalib/src/glsl/link_uniforms.cpp +++ b/mesalib/src/glsl/link_uniforms.cpp @@ -452,7 +452,7 @@ link_cross_validate_uniform_block(void *mem_ctx, * would point at the uniform block list in one of the pre-linked * shaders). */ -static bool +static void link_update_uniform_buffer_variables(struct gl_shader *shader) { foreach_list(node, shader->ir) { @@ -478,8 +478,6 @@ link_update_uniform_buffer_variables(struct gl_shader *shader) } assert(found); } - - return true; } void @@ -544,8 +542,7 @@ link_assign_uniform_locations(struct gl_shader_program *prog) if (prog->_LinkedShaders[i] == NULL) continue; - if (!link_update_uniform_buffer_variables(prog->_LinkedShaders[i])) - return; + link_update_uniform_buffer_variables(prog->_LinkedShaders[i]); } /* First pass: Count the uniform resources used by the user-defined diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp index 70f3d5bed..63548e071 100644 --- a/mesalib/src/glsl/linker.cpp +++ b/mesalib/src/glsl/linker.cpp @@ -885,8 +885,8 @@ link_intrastage_shaders(void *mem_ctx, for (unsigned i = 0; i < num_shaders; i++) { struct gl_shader *sh = shader_list[i]; - for (unsigned j = 0; j < shader_list[i]->NumUniformBlocks; j++) { - link_assign_uniform_block_offsets(shader_list[i]); + for (unsigned j = 0; j < sh->NumUniformBlocks; j++) { + link_assign_uniform_block_offsets(sh); int index = link_cross_validate_uniform_block(mem_ctx, &uniform_blocks, diff --git a/mesalib/src/mapi/glapi/SConscript b/mesalib/src/mapi/glapi/SConscript index 153374cc5..00cce3e7f 100644 --- a/mesalib/src/mapi/glapi/SConscript +++ b/mesalib/src/mapi/glapi/SConscript @@ -26,6 +26,7 @@ if env['platform'] == 'windows': env.Append(CPPPATH = [ '#/src/mapi', '#/src/mesa', + Dir('..'), # src/mapi build path ]) glapi_sources = [ @@ -103,6 +104,3 @@ glapi = env.ConvenienceLibrary( source = glapi_sources, ) Export('glapi') - - -env.Depends(glapi_sources, glapi_headers) diff --git a/mesalib/src/mapi/glapi/gen/SConscript b/mesalib/src/mapi/glapi/gen/SConscript index 353d02175..6d36248e7 100644 --- a/mesalib/src/mapi/glapi/gen/SConscript +++ b/mesalib/src/mapi/glapi/gen/SConscript @@ -7,43 +7,37 @@ from sys import executable as python_cmd # Mesa and GLX tree. Other .c and .h files are generated elsewhere # if they're only used in one place. -GLAPI = '#src/mapi/glapi/' - -glapi_headers = [] - -glapi_headers += env.CodeGenerate( - target = '#src/mesa/main/dispatch.h', - script = GLAPI + 'gen/gl_table.py', - source = GLAPI + 'gen/gl_and_es_API.xml', +env.CodeGenerate( + target = '../../../mesa/main/dispatch.h', + script = 'gl_table.py', + source = 'gl_and_es_API.xml', command = python_cmd + ' $SCRIPT -m remap_table -f $SOURCE > $TARGET', ) -glapi_headers += env.CodeGenerate( - target = '#src/mapi/glapi/glapitable.h', - script = GLAPI + 'gen/gl_table.py', - source = GLAPI + 'gen/gl_and_es_API.xml', +env.CodeGenerate( + target = '../../../mapi/glapi/glapitable.h', + script = 'gl_table.py', + source = 'gl_and_es_API.xml', command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' ) -glapi_headers += env.CodeGenerate( - target = '#src/mapi/glapi/glapitemp.h', - script = GLAPI + 'gen/gl_apitemp.py', - source = GLAPI + 'gen/gl_and_es_API.xml', +env.CodeGenerate( + target = '../../../mapi/glapi/glapitemp.h', + script = 'gl_apitemp.py', + source = 'gl_and_es_API.xml', command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' ) -glapi_headers += env.CodeGenerate( - target = '#src/mapi/glapi/glprocs.h', - script = GLAPI + 'gen/gl_procs.py', - source = GLAPI + 'gen/gl_and_es_API.xml', +env.CodeGenerate( + target = '../../../mapi/glapi/glprocs.h', + script = 'gl_procs.py', + source = 'gl_and_es_API.xml', command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' ) -glapi_headers += env.CodeGenerate( - target = '#src/mesa/main/remap_helper.h', - script = GLAPI + 'gen/remap_helper.py', - source = GLAPI + 'gen/gl_and_es_API.xml', +env.CodeGenerate( + target = '../../../mesa/main/remap_helper.h', + script = 'remap_helper.py', + source = 'gl_and_es_API.xml', command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' ) - -env.Export('glapi_headers') diff --git a/mesalib/src/mesa/SConscript b/mesalib/src/mesa/SConscript index e03d6a6a3..ca9b70bad 100644 --- a/mesalib/src/mesa/SConscript +++ b/mesalib/src/mesa/SConscript @@ -14,6 +14,8 @@ env.Append(CPPPATH = [ '#/src/mapi', '#/src/glsl', '#/src/mesa', + Dir('../mapi'), # src/mapi build path + Dir('.'), # src/mesa build path ]) enabled_apis = [] @@ -290,9 +292,6 @@ program_lex = env.CFile('program/lex.yy.c', 'program/program_lexer.l') program_parse = env.CFile('program/program_parse.tab.c', 'program/program_parse.y') -# Make program/program_parse.tab.h reacheable from the include path -env.Append(CPPPATH = [Dir('.').abspath]) - program_sources = [ 'program/arbprogparse.c', 'program/prog_hash_table.c', @@ -341,19 +340,6 @@ if env['gles']: enabled_apis += ['ES1', 'ES2'] - # generate GLES sources - gles_sources = [] - - # generate GLES headers - gles_headers = [] - - env.Depends(gles_sources, gles_headers) - - # gles_sources #include gles_headers with full path - env.Append(CPPPATH = [gles_headers[0].dir.up().up()]) - - mesa_sources += gles_sources - env.Append(CPPDEFINES = ["FEATURE_%s=1" % api for api in enabled_apis]) get_hash_gen_opts = ' '.join(["-a %s" % api for api in enabled_apis]) @@ -366,8 +352,6 @@ get_hash_header = env.CodeGenerate( ' -f $SOURCE > $TARGET' ) -env.Depends(glget_sources, get_hash_header) - # # Assembly sources # @@ -453,9 +437,6 @@ env.CodeGenerate( command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET' ) -# We also depend on the auto-generated GL API headers -env.Depends(mesa_sources, glapi_headers) - def write_git_sha1_h_file(filename): """Mesa looks for a git_sha1.h file at compile time in order to display diff --git a/mesalib/src/mesa/drivers/common/driverfuncs.c b/mesalib/src/mesa/drivers/common/driverfuncs.c index 3de5199b4..cf6b686dd 100644 --- a/mesalib/src/mesa/drivers/common/driverfuncs.c +++ b/mesalib/src/mesa/drivers/common/driverfuncs.c @@ -198,7 +198,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->ProgramStringNotify = _tnl_program_string; driver->FlushVertices = NULL; driver->SaveFlushVertices = NULL; - driver->PrepareExecBegin = NULL; driver->NotifySaveBegin = NULL; driver->LightingSpaceChange = NULL; diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile.am b/mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile.am index b99df40d8..b545f37de 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile.am +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile.am @@ -52,7 +52,7 @@ POT=xmlpool.pot .PHONY: all clean pot po mo -all: options.h +BUILT_SOURCES = options.h # All generated files are cleaned up. clean: diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c index c6b2f0df7..8e3851f88 100755 --- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c +++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c @@ -796,7 +796,7 @@ dri_create_context(gl_api api, _mesa_compute_version(mesaCtx); - _mesa_initialize_exec_table(mesaCtx); + _mesa_initialize_dispatch_tables(mesaCtx); _mesa_initialize_vbo_vtxfmt(mesaCtx); *error = __DRI_CTX_ERROR_SUCCESS; diff --git a/mesalib/src/mesa/drivers/windows/gdi/wmesa.c b/mesalib/src/mesa/drivers/windows/gdi/wmesa.c index b76c0edda..48c6661b0 100644 --- a/mesalib/src/mesa/drivers/windows/gdi/wmesa.c +++ b/mesalib/src/mesa/drivers/windows/gdi/wmesa.c @@ -642,7 +642,7 @@ WMesaContext WMesaCreateContext(HDC hDC, _mesa_compute_version(ctx); /* Exec table initialization requires the version to be computed */ - _mesa_initialize_exec_table(ctx); + _mesa_initialize_dispatch_tables(ctx); _mesa_initialize_vbo_vtxfmt(ctx); return c; diff --git a/mesalib/src/mesa/main/accum.c b/mesalib/src/mesa/main/accum.c index 6416ee860..f5888017f 100644 --- a/mesalib/src/mesa/main/accum.c +++ b/mesalib/src/mesa/main/accum.c @@ -41,7 +41,6 @@ _mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) { GLfloat tmp[4]; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); tmp[0] = CLAMP( red, -1.0F, 1.0F ); tmp[1] = CLAMP( green, -1.0F, 1.0F ); @@ -59,7 +58,7 @@ void GLAPIENTRY _mesa_Accum( GLenum op, GLfloat value ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); switch (op) { case GL_ADD: diff --git a/mesalib/src/mesa/main/api_exec.h b/mesalib/src/mesa/main/api_exec.h index 8292c12de..94f7f41c1 100644 --- a/mesalib/src/mesa/main/api_exec.h +++ b/mesalib/src/mesa/main/api_exec.h @@ -31,10 +31,12 @@ struct _glapi_table; struct gl_context; extern struct _glapi_table * -_mesa_alloc_dispatch_table(int size); +_mesa_alloc_dispatch_table(void); extern void _mesa_initialize_exec_table(struct gl_context *ctx); +extern void +_mesa_initialize_dispatch_tables(struct gl_context *ctx); #endif diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c index 133fb6370..53b00211b 100644 --- a/mesalib/src/mesa/main/api_validate.c +++ b/mesalib/src/mesa/main/api_validate.c @@ -313,7 +313,6 @@ _mesa_validate_DrawElements(struct gl_context *ctx, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex) { - ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); FLUSH_CURRENT(ctx, 0); /* From the GLES3 specification, section 2.14.2 (Transform Feedback @@ -380,7 +379,6 @@ _mesa_validate_MultiDrawElements(struct gl_context *ctx, { unsigned i; - ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); FLUSH_CURRENT(ctx, 0); for (i = 0; i < primcount; i++) { @@ -444,7 +442,6 @@ _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex) { - ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); FLUSH_CURRENT(ctx, 0); /* From the GLES3 specification, section 2.14.2 (Transform Feedback @@ -514,7 +511,6 @@ _mesa_validate_DrawArrays(struct gl_context *ctx, { struct gl_transform_feedback_object *xfb_obj = ctx->TransformFeedback.CurrentObject; - ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); FLUSH_CURRENT(ctx, 0); if (count <= 0) { @@ -568,7 +564,6 @@ _mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint fi { struct gl_transform_feedback_object *xfb_obj = ctx->TransformFeedback.CurrentObject; - ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); FLUSH_CURRENT(ctx, 0); if (count <= 0) { @@ -637,7 +632,6 @@ _mesa_validate_DrawElementsInstanced(struct gl_context *ctx, const GLvoid *indices, GLsizei numInstances, GLint basevertex) { - ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); FLUSH_CURRENT(ctx, 0); /* From the GLES3 specification, section 2.14.2 (Transform Feedback @@ -707,7 +701,6 @@ _mesa_validate_DrawTransformFeedback(struct gl_context *ctx, GLuint stream, GLsizei numInstances) { - ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); FLUSH_CURRENT(ctx, 0); if (!_mesa_valid_prim_mode(ctx, mode, "glDrawTransformFeedback*(mode)")) { diff --git a/mesalib/src/mesa/main/arbprogram.c b/mesalib/src/mesa/main/arbprogram.c index 8150b5f4e..5730ea495 100644 --- a/mesalib/src/mesa/main/arbprogram.c +++ b/mesalib/src/mesa/main/arbprogram.c @@ -50,7 +50,6 @@ _mesa_BindProgramARB(GLenum target, GLuint id) { struct gl_program *curProg, *newProg; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); /* Error-check target and get curProg */ if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) { @@ -136,7 +135,8 @@ _mesa_DeleteProgramsARB(GLsizei n, const GLuint *ids) { GLint i; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); if (n < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glDeleteProgramsNV" ); @@ -190,7 +190,6 @@ _mesa_GenProgramsARB(GLsizei n, GLuint *ids) GLuint first; GLuint i; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glGenPrograms"); @@ -304,7 +303,6 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len, { struct gl_program *base; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_PROGRAM); @@ -385,7 +383,6 @@ _mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index, GLfloat *param; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); @@ -408,7 +405,6 @@ _mesa_ProgramEnvParameter4fvARB(GLenum target, GLuint index, GLfloat *param; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); @@ -425,7 +421,6 @@ _mesa_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count, { GET_CURRENT_CONTEXT(ctx); GLfloat * dest; - ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); @@ -480,8 +475,6 @@ _mesa_GetProgramEnvParameterfvARB(GLenum target, GLuint index, GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - if (get_env_param_pointer(ctx, "glGetProgramEnvParameterfv", target, index, ¶m)) { COPY_4V(params, param); @@ -495,7 +488,6 @@ _mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index, { GET_CURRENT_CONTEXT(ctx); GLfloat *param; - ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); @@ -522,7 +514,6 @@ _mesa_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count, { GET_CURRENT_CONTEXT(ctx); GLfloat *dest; - ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); @@ -581,7 +572,6 @@ _mesa_GetProgramLocalParameterfvARB(GLenum target, GLuint index, { GLfloat *param; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (get_local_param_pointer(ctx, "glProgramLocalParameters4fvEXT", target, index, ¶m)) { @@ -596,7 +586,6 @@ _mesa_GetProgramLocalParameterdvARB(GLenum target, GLuint index, { GLfloat *param; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (get_local_param_pointer(ctx, "glProgramLocalParameters4fvEXT", target, index, ¶m)) { @@ -612,8 +601,6 @@ _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params) struct gl_program *prog; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) { prog = &(ctx->VertexProgram.Current->Base); @@ -796,8 +783,6 @@ _mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string) char *dst = (char *) string; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - if (target == GL_VERTEX_PROGRAM_ARB) { prog = &(ctx->VertexProgram.Current->Base); } diff --git a/mesalib/src/mesa/main/arrayobj.c b/mesalib/src/mesa/main/arrayobj.c index 032af43b5..ac3e7e666 100644 --- a/mesalib/src/mesa/main/arrayobj.c +++ b/mesalib/src/mesa/main/arrayobj.c @@ -338,7 +338,6 @@ bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired) { struct gl_array_object * const oldObj = ctx->Array.ArrayObj; struct gl_array_object *newObj = NULL; - ASSERT_OUTSIDE_BEGIN_END(ctx); ASSERT(oldObj != NULL); @@ -435,7 +434,6 @@ _mesa_DeleteVertexArrays(GLsizei n, const GLuint *ids) { GET_CURRENT_CONTEXT(ctx); GLsizei i; - ASSERT_OUTSIDE_BEGIN_END(ctx); if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteVertexArrayAPPLE(n)"); @@ -480,7 +478,6 @@ gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays) { GLuint first; GLint i; - ASSERT_OUTSIDE_BEGIN_END(ctx); if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glGenVertexArraysAPPLE"); diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c index d6f298d93..a95128328 100644 --- a/mesalib/src/mesa/main/attrib.c +++ b/mesalib/src/mesa/main/attrib.c @@ -204,7 +204,6 @@ _mesa_PushAttrib(GLbitfield mask) struct gl_attrib_node *head; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glPushAttrib %x\n", (int) mask); @@ -831,7 +830,7 @@ _mesa_PopAttrib(void) { struct gl_attrib_node *attr, *next; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); if (ctx->AttribStackDepth == 0) { _mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopAttrib" ); @@ -1496,7 +1495,6 @@ _mesa_PushClientAttrib(GLbitfield mask) struct gl_attrib_node *head; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->ClientAttribStackDepth >= MAX_CLIENT_ATTRIB_STACK_DEPTH) { _mesa_error( ctx, GL_STACK_OVERFLOW, "glPushClientAttrib" ); @@ -1541,7 +1539,7 @@ _mesa_PopClientAttrib(void) struct gl_attrib_node *node, *next; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); if (ctx->ClientAttribStackDepth == 0) { _mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopClientAttrib" ); diff --git a/mesalib/src/mesa/main/blend.c b/mesalib/src/mesa/main/blend.c index 1930b1c37..309f1d538 100644 --- a/mesalib/src/mesa/main/blend.c +++ b/mesalib/src/mesa/main/blend.c @@ -207,7 +207,6 @@ _mesa_BlendFuncSeparate( GLenum sfactorRGB, GLenum dfactorRGB, GLuint buf, numBuffers; GLboolean changed; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glBlendFuncSeparate %s %s %s %s\n", @@ -274,7 +273,6 @@ _mesa_BlendFuncSeparateiARB(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.ARB_draw_buffers_blend) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBlendFunc[Separate]i()"); @@ -343,7 +341,6 @@ _mesa_BlendEquation( GLenum mode ) GLuint buf, numBuffers; GLboolean changed; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glBlendEquation(%s)\n", @@ -387,7 +384,6 @@ void GLAPIENTRY _mesa_BlendEquationiARB(GLuint buf, GLenum mode) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glBlendEquationi(%u, %s)\n", @@ -424,7 +420,6 @@ _mesa_BlendEquationSeparate( GLenum modeRGB, GLenum modeA ) GLuint buf, numBuffers; GLboolean changed; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glBlendEquationSeparateEXT(%s %s)\n", @@ -480,7 +475,6 @@ void GLAPIENTRY _mesa_BlendEquationSeparateiARB(GLuint buf, GLenum modeRGB, GLenum modeA) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glBlendEquationSeparatei(%u, %s %s)\n", buf, @@ -536,7 +530,6 @@ _mesa_BlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) { GLfloat tmp[4]; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); tmp[0] = red; tmp[1] = green; @@ -573,7 +566,6 @@ void GLAPIENTRY _mesa_AlphaFunc( GLenum func, GLclampf ref ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glAlphaFunc(%s, %f)\n", @@ -621,7 +613,6 @@ void GLAPIENTRY _mesa_LogicOp( GLenum opcode ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glLogicOp(%s)\n", _mesa_lookup_enum_by_nr(opcode)); @@ -664,7 +655,6 @@ void GLAPIENTRY _mesa_IndexMask( GLuint mask ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->Color.IndexMask == mask) return; @@ -696,7 +686,6 @@ _mesa_ColorMask( GLboolean red, GLboolean green, GLubyte tmp[4]; GLuint i; GLboolean flushed; - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glColorMask(%d, %d, %d, %d)\n", @@ -735,7 +724,6 @@ _mesa_ColorMaski( GLuint buf, GLboolean red, GLboolean green, { GLubyte tmp[4]; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glColorMaskIndexed %u %d %d %d %d\n", @@ -770,8 +758,6 @@ _mesa_ClampColor(GLenum target, GLenum clamp) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - if (clamp != GL_TRUE && clamp != GL_FALSE && clamp != GL_FIXED_ONLY_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glClampColorARB(clamp)"); return; diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c index a9cd7382e..89911fe51 100644 --- a/mesalib/src/mesa/main/bufferobj.c +++ b/mesalib/src/mesa/main/bufferobj.c @@ -819,7 +819,6 @@ void GLAPIENTRY _mesa_BindBuffer(GLenum target, GLuint buffer) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glBindBuffer(%s, %u)\n", @@ -840,7 +839,6 @@ _mesa_DeleteBuffers(GLsizei n, const GLuint *ids) { GET_CURRENT_CONTEXT(ctx); GLsizei i; - ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, 0); if (n < 0) { @@ -951,7 +949,6 @@ _mesa_GenBuffers(GLsizei n, GLuint *buffer) GET_CURRENT_CONTEXT(ctx); GLuint first; GLint i; - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glGenBuffers(%d)\n", n); @@ -1012,7 +1009,6 @@ _mesa_BufferData(GLenum target, GLsizeiptrARB size, GET_CURRENT_CONTEXT(ctx); struct gl_buffer_object *bufObj; bool valid_usage; - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glBufferData(%s, %ld, %p, %s)\n", @@ -1091,7 +1087,6 @@ _mesa_BufferSubData(GLenum target, GLintptrARB offset, { GET_CURRENT_CONTEXT(ctx); struct gl_buffer_object *bufObj; - ASSERT_OUTSIDE_BEGIN_END(ctx); bufObj = buffer_object_subdata_range_good( ctx, target, offset, size, "glBufferSubDataARB" ); @@ -1116,7 +1111,6 @@ _mesa_GetBufferSubData(GLenum target, GLintptrARB offset, { GET_CURRENT_CONTEXT(ctx); struct gl_buffer_object *bufObj; - ASSERT_OUTSIDE_BEGIN_END(ctx); bufObj = buffer_object_subdata_range_good( ctx, target, offset, size, "glGetBufferSubDataARB" ); @@ -1293,7 +1287,6 @@ _mesa_GetBufferParameteriv(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); struct gl_buffer_object *bufObj; - ASSERT_OUTSIDE_BEGIN_END(ctx); bufObj = get_buffer(ctx, "glGetBufferParameterivARB", target); if (!bufObj) @@ -1347,7 +1340,6 @@ _mesa_GetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params) { GET_CURRENT_CONTEXT(ctx); struct gl_buffer_object *bufObj; - ASSERT_OUTSIDE_BEGIN_END(ctx); bufObj = get_buffer(ctx, "glGetBufferParameteri64v", target); if (!bufObj) @@ -1396,7 +1388,6 @@ _mesa_GetBufferPointerv(GLenum target, GLenum pname, GLvoid **params) { GET_CURRENT_CONTEXT(ctx); struct gl_buffer_object * bufObj; - ASSERT_OUTSIDE_BEGIN_END(ctx); if (pname != GL_BUFFER_MAP_POINTER_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferPointervARB(pname)"); @@ -1418,7 +1409,6 @@ _mesa_CopyBufferSubData(GLenum readTarget, GLenum writeTarget, { GET_CURRENT_CONTEXT(ctx); struct gl_buffer_object *src, *dst; - ASSERT_OUTSIDE_BEGIN_END(ctx); src = get_buffer(ctx, "glCopyBufferSubData", readTarget); if (!src) @@ -1628,7 +1618,6 @@ _mesa_FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) { GET_CURRENT_CONTEXT(ctx); struct gl_buffer_object *bufObj; - ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.ARB_map_buffer_range) { _mesa_error(ctx, GL_INVALID_OPERATION, diff --git a/mesalib/src/mesa/main/buffers.c b/mesalib/src/mesa/main/buffers.c index 87848fb93..3f5cbcda7 100644 --- a/mesalib/src/mesa/main/buffers.c +++ b/mesalib/src/mesa/main/buffers.c @@ -244,7 +244,8 @@ _mesa_DrawBuffer(GLenum buffer) { GLbitfield destMask; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex... */ + + FLUSH_VERTICES(ctx, 0); if (MESA_VERBOSE & VERBOSE_API) { _mesa_debug(ctx, "glDrawBuffer %s\n", _mesa_lookup_enum_by_nr(buffer)); @@ -301,7 +302,8 @@ _mesa_DrawBuffers(GLsizei n, const GLenum *buffers) GLbitfield usedBufferMask, supportedMask; GLbitfield destMask[MAX_DRAW_BUFFERS]; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); /* Turns out n==0 is a valid input that should not produce an error. * The remaining code below correctly handles the n==0 case. @@ -609,7 +611,8 @@ _mesa_ReadBuffer(GLenum buffer) GLbitfield supportedMask; GLint srcBuffer; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(buffer)); diff --git a/mesalib/src/mesa/main/clear.c b/mesalib/src/mesa/main/clear.c index 83ffdf66b..af9433306 100644 --- a/mesalib/src/mesa/main/clear.c +++ b/mesalib/src/mesa/main/clear.c @@ -45,7 +45,6 @@ void GLAPIENTRY _mesa_ClearIndex( GLfloat c ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->Color.ClearIndex == (GLuint) c) return; @@ -74,7 +73,6 @@ _mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) { GLfloat tmp[4]; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); tmp[0] = red; tmp[1] = green; @@ -97,7 +95,6 @@ _mesa_ClearColorIiEXT(GLint r, GLint g, GLint b, GLint a) { GLint tmp[4]; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); tmp[0] = r; tmp[1] = g; @@ -120,7 +117,6 @@ _mesa_ClearColorIuiEXT(GLuint r, GLuint g, GLuint b, GLuint a) { GLuint tmp[4]; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); tmp[0] = r; tmp[1] = g; @@ -149,7 +145,7 @@ void GLAPIENTRY _mesa_Clear( GLbitfield mask ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); FLUSH_CURRENT(ctx, 0); @@ -305,7 +301,7 @@ void GLAPIENTRY _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); FLUSH_CURRENT(ctx, 0); @@ -396,8 +392,8 @@ void GLAPIENTRY _mesa_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); FLUSH_CURRENT(ctx, 0); if (ctx->NewState) { @@ -468,8 +464,8 @@ void GLAPIENTRY _mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); FLUSH_CURRENT(ctx, 0); if (ctx->NewState) { @@ -563,8 +559,7 @@ _mesa_ClearBufferfi(GLenum buffer, GLint drawbuffer, GET_CURRENT_CONTEXT(ctx); GLbitfield mask = 0; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - + FLUSH_VERTICES(ctx, 0); FLUSH_CURRENT(ctx, 0); if (buffer != GL_DEPTH_STENCIL) { diff --git a/mesalib/src/mesa/main/clip.c b/mesalib/src/mesa/main/clip.c index ba2028cf2..b01dd3c97 100644 --- a/mesalib/src/mesa/main/clip.c +++ b/mesalib/src/mesa/main/clip.c @@ -54,7 +54,6 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq ) GET_CURRENT_CONTEXT(ctx); GLint p; GLfloat equation[4]; - ASSERT_OUTSIDE_BEGIN_END(ctx); p = (GLint) plane - (GLint) GL_CLIP_PLANE0; if (p < 0 || p >= (GLint) ctx->Const.MaxClipPlanes) { @@ -101,7 +100,6 @@ _mesa_GetClipPlane( GLenum plane, GLdouble *equation ) { GET_CURRENT_CONTEXT(ctx); GLint p; - ASSERT_OUTSIDE_BEGIN_END(ctx); p = (GLint) (plane - GL_CLIP_PLANE0); if (p < 0 || p >= (GLint) ctx->Const.MaxClipPlanes) { diff --git a/mesalib/src/mesa/main/colortab.c b/mesalib/src/mesa/main/colortab.c index f1b3e585a..c201a27cb 100644 --- a/mesalib/src/mesa/main/colortab.c +++ b/mesalib/src/mesa/main/colortab.c @@ -45,7 +45,6 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat, const GLvoid *data ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)"); } @@ -57,7 +56,6 @@ _mesa_ColorSubTable( GLenum target, GLsizei start, const GLvoid *data ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); _mesa_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)"); } @@ -68,7 +66,6 @@ _mesa_CopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); _mesa_error(ctx, GL_INVALID_ENUM, "glCopyColorTable(target)"); } @@ -79,7 +76,6 @@ _mesa_CopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); _mesa_error(ctx, GL_INVALID_ENUM, "glCopyColorSubTable(target)"); } @@ -90,7 +86,6 @@ _mesa_GetnColorTableARB( GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); _mesa_error(ctx, GL_INVALID_ENUM, "glGetnColorTableARB(target)"); } @@ -100,7 +95,6 @@ _mesa_GetColorTable( GLenum target, GLenum format, GLenum type, GLvoid *data ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)"); } @@ -110,7 +104,6 @@ _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) { /* no extensions use this function */ GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(target)"); } @@ -121,7 +114,6 @@ _mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) { /* no extensions use this function */ GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameteriv(target)"); } @@ -131,7 +123,6 @@ void GLAPIENTRY _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameterfv(target)"); } @@ -141,6 +132,5 @@ void GLAPIENTRY _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameteriv(target)"); } diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index 561eb4685..5e9e539b2 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -81,6 +81,7 @@ #include "imports.h" #include "accum.h" #include "api_exec.h" +#include "api_loopback.h" #include "arrayobj.h" #include "attrib.h" #include "blend.h" @@ -835,7 +836,7 @@ _mesa_generic_nop(void) * Allocate and initialize a new dispatch table. */ struct _glapi_table * -_mesa_alloc_dispatch_table(int size) +_mesa_alloc_dispatch_table() { /* Find the larger of Mesa's dispatch table and libGL's dispatch table. * In practice, this'll be the same for stand-alone Mesa. But for DRI @@ -845,9 +846,6 @@ _mesa_alloc_dispatch_table(int size) GLint numEntries = MAX2(_glapi_get_dispatch_table_size(), _gloffset_COUNT); struct _glapi_table *table; - /* should never happen, but just in case */ - numEntries = MAX2(numEntries, size); - table = malloc(numEntries * sizeof(_glapi_proc)); if (table) { _glapi_proc *entry = (_glapi_proc *) table; @@ -859,6 +857,91 @@ _mesa_alloc_dispatch_table(int size) return table; } +/** + * Creates a minimal dispatch table for use within glBegin()/glEnd(). + * + * This ensures that we generate GL_INVALID_OPERATION errors from most + * functions, since the set of functions that are valid within Begin/End is + * very small. + * + * From the GL 1.0 specification section 2.6.3, "GL Commands within + * Begin/End" + * + * "The only GL commands that are allowed within any Begin/End pairs are + * the commands for specifying vertex coordinates, vertex color, normal + * coordinates, and texture coordinates (Vertex, Color, Index, Normal, + * TexCoord), EvalCoord and EvalPoint commands (see section 5.1), + * commands for specifying lighting material parameters (Material + * commands see section 2.12.2), display list invocation commands + * (CallList and CallLists see section 5.4), and the EdgeFlag + * command. Executing Begin after Begin has already been executed but + * before an End is issued generates the INVALID OPERATION error, as does + * executing End without a previous corresponding Begin. Executing any + * other GL command within Begin/End results in the error INVALID + * OPERATION." + * + * The table entries for specifying vertex attributes are set up by + * install_vtxfmt() and _mesa_loopback_init_api_table(), and End() and dlists + * are set by install_vtxfmt() as well. + */ +static struct _glapi_table * +create_beginend_table(const struct gl_context *ctx) +{ + struct _glapi_table *table; + + table = _mesa_alloc_dispatch_table(); + if (!table) + return NULL; + + /* Fill in functions which return a value, since they should return some + * specific value even if they emit a GL_INVALID_OPERATION error from them + * being called within glBegin()/glEnd(). + */ +#define COPY_DISPATCH(func) SET_##func(table, GET_##func(ctx->Exec)) + + COPY_DISPATCH(GenLists); + COPY_DISPATCH(IsProgram); + COPY_DISPATCH(IsVertexArray); + COPY_DISPATCH(IsBuffer); + COPY_DISPATCH(IsEnabled); + COPY_DISPATCH(IsEnabledi); + COPY_DISPATCH(IsRenderbuffer); + COPY_DISPATCH(IsFramebuffer); + COPY_DISPATCH(CheckFramebufferStatus); + COPY_DISPATCH(RenderMode); + COPY_DISPATCH(GetString); + COPY_DISPATCH(GetStringi); + COPY_DISPATCH(GetPointerv); + COPY_DISPATCH(IsQuery); + COPY_DISPATCH(IsSampler); + COPY_DISPATCH(IsSync); + COPY_DISPATCH(IsTexture); + COPY_DISPATCH(IsTransformFeedback); + COPY_DISPATCH(DeleteQueries); + COPY_DISPATCH(AreTexturesResident); + COPY_DISPATCH(FenceSync); + COPY_DISPATCH(ClientWaitSync); + COPY_DISPATCH(MapBuffer); + COPY_DISPATCH(UnmapBuffer); + COPY_DISPATCH(MapBufferRange); + COPY_DISPATCH(MapBufferRange); + COPY_DISPATCH(ObjectPurgeableAPPLE); + COPY_DISPATCH(ObjectUnpurgeableAPPLE); + + _mesa_loopback_init_api_table(ctx, table); + + return table; +} + +void +_mesa_initialize_dispatch_tables(struct gl_context *ctx) +{ + /* Do the code-generated setup of the exec table in api_exec.c. */ + _mesa_initialize_exec_table(ctx); + + if (ctx->Save) + _mesa_initialize_save_table(ctx); +} /** * Initialize a struct gl_context struct (rendering context). @@ -933,19 +1016,15 @@ _mesa_initialize_context(struct gl_context *ctx, _mesa_reference_shared_state(ctx, &ctx->Shared, shared); - if (!init_attrib_groups( ctx )) { - _mesa_reference_shared_state(ctx, &ctx->Shared, NULL); - return GL_FALSE; - } + if (!init_attrib_groups( ctx )) + goto fail; /* setup the API dispatch tables with all nop functions */ - ctx->Exec = _mesa_alloc_dispatch_table(_gloffset_COUNT); - - if (!ctx->Exec) { - _mesa_reference_shared_state(ctx, &ctx->Shared, NULL); - return GL_FALSE; - } - ctx->CurrentDispatch = ctx->Exec; + ctx->OutsideBeginEnd = _mesa_alloc_dispatch_table(); + if (!ctx->OutsideBeginEnd) + goto fail; + ctx->Exec = ctx->OutsideBeginEnd; + ctx->CurrentDispatch = ctx->OutsideBeginEnd; ctx->FragmentProgram._MaintainTexEnvProgram = (_mesa_getenv("MESA_TEX_PROG") != NULL); @@ -967,12 +1046,10 @@ _mesa_initialize_context(struct gl_context *ctx, switch (ctx->API) { case API_OPENGL_COMPAT: - ctx->Save = _mesa_create_save_table(ctx); - if (!ctx->Save) { - _mesa_reference_shared_state(ctx, &ctx->Shared, NULL); - free(ctx->Exec); - return GL_FALSE; - } + ctx->BeginEnd = create_beginend_table(ctx); + ctx->Save = _mesa_alloc_dispatch_table(); + if (!ctx->BeginEnd || !ctx->Save) + goto fail; /* fall-through */ case API_OPENGL_CORE: @@ -1002,6 +1079,12 @@ _mesa_initialize_context(struct gl_context *ctx, ctx->FirstTimeCurrent = GL_TRUE; return GL_TRUE; + +fail: + free(ctx->BeginEnd); + free(ctx->Exec); + free(ctx->Save); + return GL_FALSE; } diff --git a/mesalib/src/mesa/main/context.h b/mesalib/src/mesa/main/context.h index 063f2a381..1b881f3f3 100644 --- a/mesalib/src/mesa/main/context.h +++ b/mesalib/src/mesa/main/context.h @@ -262,31 +262,6 @@ do { \ } \ } while (0) -/** - * Macro to assert that the API call was made outside the - * glBegin()/glEnd() pair and flush the vertices. - * - * \param ctx GL context. - */ -#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx) \ -do { \ - ASSERT_OUTSIDE_BEGIN_END(ctx); \ - FLUSH_VERTICES(ctx, 0); \ -} while (0) - -/** - * Macro to assert that the API call was made outside the - * glBegin()/glEnd() pair and flush the vertices, with return value. - * - * \param ctx GL context. - * \param retval value to return in case the assertion fails. - */ -#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \ -do { \ - ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval); \ - FLUSH_VERTICES(ctx, 0); \ -} while (0) - /*@}*/ diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h index 07787d41d..f91fd4120 100644 --- a/mesalib/src/mesa/main/dd.h +++ b/mesalib/src/mesa/main/dd.h @@ -723,14 +723,6 @@ struct dd_function_table { void (*SaveFlushVertices)( struct gl_context *ctx ); /** - * \brief Hook for drivers to prepare for a glBegin/glEnd block - * - * This hook is called in vbo_exec_Begin() before any action, including - * state updates, occurs. - */ - void (*PrepareExecBegin)( struct gl_context *ctx ); - - /** * Give the driver the opportunity to hook in its own vtxfmt for * compiling optimized display lists. This is called on each valid * glBegin() during list compilation. diff --git a/mesalib/src/mesa/main/depth.c b/mesalib/src/mesa/main/depth.c index bb1625440..8aec94a2d 100644 --- a/mesalib/src/mesa/main/depth.c +++ b/mesalib/src/mesa/main/depth.c @@ -42,7 +42,6 @@ void GLAPIENTRY _mesa_ClearDepth( GLclampd depth ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glClearDepth(%f)\n", depth); @@ -68,7 +67,6 @@ void GLAPIENTRY _mesa_DepthFunc( GLenum func ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glDepthFunc %s\n", _mesa_lookup_enum_by_nr(func)); @@ -104,7 +102,6 @@ void GLAPIENTRY _mesa_DepthMask( GLboolean flag ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glDepthMask %d\n", flag); @@ -132,7 +129,6 @@ void GLAPIENTRY _mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glDepthBounds(%f, %f)\n", zmin, zmax); diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c index 6b99f35bb..4b20d890d 100644 --- a/mesalib/src/mesa/main/dlist.c +++ b/mesalib/src/mesa/main/dlist.c @@ -5648,16 +5648,9 @@ save_Begin(GLenum mode) Node *n; GLboolean error = GL_FALSE; - if (mode > GL_POLYGON) { - _mesa_error(ctx, GL_INVALID_ENUM, "glBegin(mode=%x)", mode); + if (ctx->ExecuteFlag && !_mesa_valid_prim_mode(ctx, mode, "glBegin")) { error = GL_TRUE; } - if (ctx->ExecuteFlag) { - if (!_mesa_valid_prim_mode(ctx, mode, "glBegin")) { - error = GL_TRUE; - } - } - else if (ctx->Driver.CurrentSavePrimitive == PRIM_UNKNOWN) { /* Typically the first begin. This may raise an error on * playback, depending on whether CallList is issued from inside @@ -6014,35 +6007,6 @@ save_VertexAttrib4fvARB(GLuint index, const GLfloat * v) index_error(); } - -/* GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */ - -static void GLAPIENTRY -exec_BindAttribLocationARB(GLuint program, GLuint index, const GLchar *name) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_BindAttribLocation(ctx->Exec, (program, index, name)); -} - -static GLint GLAPIENTRY -exec_GetAttribLocationARB(GLuint program, const GLchar *name) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - return CALL_GetAttribLocation(ctx->Exec, (program, name)); -} - -static GLint GLAPIENTRY -exec_GetUniformLocationARB(GLuint program, const GLchar *name) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - return CALL_GetUniformLocation(ctx->Exec, (program, name)); -} -/* XXX more shader functions needed here */ - - static void GLAPIENTRY save_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, @@ -6984,25 +6948,6 @@ save_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params) } } -/** GL_EXT_texture_integer */ -static void GLAPIENTRY -exec_GetTexParameterIiv(GLenum target, GLenum pname, GLint *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetTexParameterIiv(ctx->Exec, (target, pname, params)); -} - -/** GL_EXT_texture_integer */ -static void GLAPIENTRY -exec_GetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetTexParameterIuiv(ctx->Exec, (target, pname, params)); -} - - /* GL_ARB_instanced_arrays */ static void GLAPIENTRY save_VertexAttribDivisor(GLuint index, GLuint divisor) @@ -8710,7 +8655,7 @@ _mesa_EndList(void) { GET_CURRENT_CONTEXT(ctx); SAVE_FLUSH_VERTICES(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glEndList\n"); @@ -8850,721 +8795,6 @@ _mesa_ListBase(GLuint base) ctx->List.ListBase = base; } - -/* Can no longer assume ctx->Exec->Func is equal to _mesa_Func. - */ -static void GLAPIENTRY -exec_Finish(void) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_Finish(ctx->Exec, ()); -} - -static void GLAPIENTRY -exec_Flush(void) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_Flush(ctx->Exec, ()); -} - -static void GLAPIENTRY -exec_GetBooleanv(GLenum pname, GLboolean *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetBooleanv(ctx->Exec, (pname, params)); -} - -static void GLAPIENTRY -exec_GetClipPlane(GLenum plane, GLdouble * equation) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetClipPlane(ctx->Exec, (plane, equation)); -} - -static void GLAPIENTRY -exec_GetDoublev(GLenum pname, GLdouble *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetDoublev(ctx->Exec, (pname, params)); -} - -static GLenum GLAPIENTRY -exec_GetError(void) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - return CALL_GetError(ctx->Exec, ()); -} - -static void GLAPIENTRY -exec_GetFloatv(GLenum pname, GLfloat *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetFloatv(ctx->Exec, (pname, params)); -} - -static void GLAPIENTRY -exec_GetIntegerv(GLenum pname, GLint *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetIntegerv(ctx->Exec, (pname, params)); -} - -static void GLAPIENTRY -exec_GetLightfv(GLenum light, GLenum pname, GLfloat *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetLightfv(ctx->Exec, (light, pname, params)); -} - -static void GLAPIENTRY -exec_GetLightiv(GLenum light, GLenum pname, GLint *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetLightiv(ctx->Exec, (light, pname, params)); -} - -static void GLAPIENTRY -exec_GetMapdv(GLenum target, GLenum query, GLdouble * v) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetMapdv(ctx->Exec, (target, query, v)); -} - -static void GLAPIENTRY -exec_GetMapfv(GLenum target, GLenum query, GLfloat * v) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetMapfv(ctx->Exec, (target, query, v)); -} - -static void GLAPIENTRY -exec_GetMapiv(GLenum target, GLenum query, GLint * v) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetMapiv(ctx->Exec, (target, query, v)); -} - -static void GLAPIENTRY -exec_GetMaterialfv(GLenum face, GLenum pname, GLfloat *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetMaterialfv(ctx->Exec, (face, pname, params)); -} - -static void GLAPIENTRY -exec_GetMaterialiv(GLenum face, GLenum pname, GLint *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetMaterialiv(ctx->Exec, (face, pname, params)); -} - -static void GLAPIENTRY -exec_GetPixelMapfv(GLenum map, GLfloat *values) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetPixelMapfv(ctx->Exec, (map, values)); -} - -static void GLAPIENTRY -exec_GetPixelMapuiv(GLenum map, GLuint *values) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetPixelMapuiv(ctx->Exec, (map, values)); -} - -static void GLAPIENTRY -exec_GetPixelMapusv(GLenum map, GLushort *values) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetPixelMapusv(ctx->Exec, (map, values)); -} - -static void GLAPIENTRY -exec_GetPolygonStipple(GLubyte * dest) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetPolygonStipple(ctx->Exec, (dest)); -} - -static const GLubyte *GLAPIENTRY -exec_GetString(GLenum name) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - return CALL_GetString(ctx->Exec, (name)); -} - -static void GLAPIENTRY -exec_GetTexEnvfv(GLenum target, GLenum pname, GLfloat *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetTexEnvfv(ctx->Exec, (target, pname, params)); -} - -static void GLAPIENTRY -exec_GetTexEnviv(GLenum target, GLenum pname, GLint *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetTexEnviv(ctx->Exec, (target, pname, params)); -} - -static void GLAPIENTRY -exec_GetTexGendv(GLenum coord, GLenum pname, GLdouble *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetTexGendv(ctx->Exec, (coord, pname, params)); -} - -static void GLAPIENTRY -exec_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetTexGenfv(ctx->Exec, (coord, pname, params)); -} - -static void GLAPIENTRY -exec_GetTexGeniv(GLenum coord, GLenum pname, GLint *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetTexGeniv(ctx->Exec, (coord, pname, params)); -} - -static void GLAPIENTRY -exec_GetTexImage(GLenum target, GLint level, GLenum format, - GLenum type, GLvoid * pixels) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetTexImage(ctx->Exec, (target, level, format, type, pixels)); -} - -static void GLAPIENTRY -exec_GetTexLevelParameterfv(GLenum target, GLint level, - GLenum pname, GLfloat *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetTexLevelParameterfv(ctx->Exec, (target, level, pname, params)); -} - -static void GLAPIENTRY -exec_GetTexLevelParameteriv(GLenum target, GLint level, - GLenum pname, GLint *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetTexLevelParameteriv(ctx->Exec, (target, level, pname, params)); -} - -static void GLAPIENTRY -exec_GetTexParameterfv(GLenum target, GLenum pname, GLfloat *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetTexParameterfv(ctx->Exec, (target, pname, params)); -} - -static void GLAPIENTRY -exec_GetTexParameteriv(GLenum target, GLenum pname, GLint *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetTexParameteriv(ctx->Exec, (target, pname, params)); -} - -static GLboolean GLAPIENTRY -exec_IsEnabled(GLenum cap) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - return CALL_IsEnabled(ctx->Exec, (cap)); -} - -static void GLAPIENTRY -exec_PixelStoref(GLenum pname, GLfloat param) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_PixelStoref(ctx->Exec, (pname, param)); -} - -static void GLAPIENTRY -exec_PixelStorei(GLenum pname, GLint param) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_PixelStorei(ctx->Exec, (pname, param)); -} - -static void GLAPIENTRY -exec_ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, - GLenum format, GLenum type, GLvoid * pixels) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_ReadPixels(ctx->Exec, (x, y, width, height, format, type, pixels)); -} - -static GLint GLAPIENTRY -exec_RenderMode(GLenum mode) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - return CALL_RenderMode(ctx->Exec, (mode)); -} - -static void GLAPIENTRY -exec_FeedbackBuffer(GLsizei size, GLenum type, GLfloat * buffer) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_FeedbackBuffer(ctx->Exec, (size, type, buffer)); -} - -static void GLAPIENTRY -exec_SelectBuffer(GLsizei size, GLuint * buffer) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_SelectBuffer(ctx->Exec, (size, buffer)); -} - -static GLboolean GLAPIENTRY -exec_AreTexturesResident(GLsizei n, const GLuint * texName, - GLboolean * residences) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - return CALL_AreTexturesResident(ctx->Exec, (n, texName, residences)); -} - -static void GLAPIENTRY -exec_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_ColorPointer(ctx->Exec, (size, type, stride, ptr)); -} - -static void GLAPIENTRY -exec_DeleteTextures(GLsizei n, const GLuint * texName) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_DeleteTextures(ctx->Exec, (n, texName)); -} - -static void GLAPIENTRY -exec_DisableClientState(GLenum cap) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_DisableClientState(ctx->Exec, (cap)); -} - -static void GLAPIENTRY -exec_EdgeFlagPointer(GLsizei stride, const GLvoid * vptr) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_EdgeFlagPointer(ctx->Exec, (stride, vptr)); -} - -static void GLAPIENTRY -exec_EnableClientState(GLenum cap) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_EnableClientState(ctx->Exec, (cap)); -} - -static void GLAPIENTRY -exec_GenTextures(GLsizei n, GLuint * texName) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GenTextures(ctx->Exec, (n, texName)); -} - -static void GLAPIENTRY -exec_GetPointerv(GLenum pname, GLvoid **params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetPointerv(ctx->Exec, (pname, params)); -} - -static void GLAPIENTRY -exec_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_IndexPointer(ctx->Exec, (type, stride, ptr)); -} - -static void GLAPIENTRY -exec_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid * pointer) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_InterleavedArrays(ctx->Exec, (format, stride, pointer)); -} - -static GLboolean GLAPIENTRY -exec_IsTexture(GLuint texture) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - return CALL_IsTexture(ctx->Exec, (texture)); -} - -static void GLAPIENTRY -exec_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_NormalPointer(ctx->Exec, (type, stride, ptr)); -} - -static void GLAPIENTRY -exec_PopClientAttrib(void) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_PopClientAttrib(ctx->Exec, ()); -} - -static void GLAPIENTRY -exec_PushClientAttrib(GLbitfield mask) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_PushClientAttrib(ctx->Exec, (mask)); -} - -static void GLAPIENTRY -exec_TexCoordPointer(GLint size, GLenum type, GLsizei stride, - const GLvoid *ptr) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_TexCoordPointer(ctx->Exec, (size, type, stride, ptr)); -} - -static void GLAPIENTRY -exec_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid * img) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetCompressedTexImage(ctx->Exec, (target, level, img)); -} - -static void GLAPIENTRY -exec_VertexPointer(GLint size, GLenum type, GLsizei stride, - const GLvoid *ptr) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_VertexPointer(ctx->Exec, (size, type, stride, ptr)); -} - -static void GLAPIENTRY -exec_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, - GLint x, GLint y, GLsizei width) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_CopyConvolutionFilter1D(ctx->Exec, - (target, internalFormat, x, y, width)); -} - -static void GLAPIENTRY -exec_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, - GLint x, GLint y, GLsizei width, GLsizei height) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_CopyConvolutionFilter2D(ctx->Exec, - (target, internalFormat, x, y, width, - height)); -} - -static void GLAPIENTRY -exec_GetColorTable(GLenum target, GLenum format, GLenum type, GLvoid * data) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetColorTable(ctx->Exec, (target, format, type, data)); -} - -static void GLAPIENTRY -exec_GetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetColorTableParameterfv(ctx->Exec, (target, pname, params)); -} - -static void GLAPIENTRY -exec_GetColorTableParameteriv(GLenum target, GLenum pname, GLint *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetColorTableParameteriv(ctx->Exec, (target, pname, params)); -} - -static void GLAPIENTRY -exec_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, - GLvoid * image) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetConvolutionFilter(ctx->Exec, (target, format, type, image)); -} - -static void GLAPIENTRY -exec_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetConvolutionParameterfv(ctx->Exec, (target, pname, params)); -} - -static void GLAPIENTRY -exec_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetConvolutionParameteriv(ctx->Exec, (target, pname, params)); -} - -static void GLAPIENTRY -exec_GetHistogram(GLenum target, GLboolean reset, GLenum format, - GLenum type, GLvoid *values) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetHistogram(ctx->Exec, (target, reset, format, type, values)); -} - -static void GLAPIENTRY -exec_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetHistogramParameterfv(ctx->Exec, (target, pname, params)); -} - -static void GLAPIENTRY -exec_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetHistogramParameteriv(ctx->Exec, (target, pname, params)); -} - -static void GLAPIENTRY -exec_GetMinmax(GLenum target, GLboolean reset, GLenum format, - GLenum type, GLvoid *values) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetMinmax(ctx->Exec, (target, reset, format, type, values)); -} - -static void GLAPIENTRY -exec_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetMinmaxParameterfv(ctx->Exec, (target, pname, params)); -} - -static void GLAPIENTRY -exec_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetMinmaxParameteriv(ctx->Exec, (target, pname, params)); -} - -static void GLAPIENTRY -exec_GetSeparableFilter(GLenum target, GLenum format, GLenum type, - GLvoid *row, GLvoid *column, GLvoid *span) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_GetSeparableFilter(ctx->Exec, - (target, format, type, row, column, span)); -} - -static void GLAPIENTRY -exec_SeparableFilter2D(GLenum target, GLenum internalFormat, - GLsizei width, GLsizei height, GLenum format, - GLenum type, const GLvoid *row, const GLvoid *column) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_SeparableFilter2D(ctx->Exec, - (target, internalFormat, width, height, format, - type, row, column)); -} - -static void GLAPIENTRY -exec_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, - GLsizei count, const GLvoid *ptr) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_ColorPointerEXT(ctx->Exec, (size, type, stride, count, ptr)); -} - -static void GLAPIENTRY -exec_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_EdgeFlagPointerEXT(ctx->Exec, (stride, count, ptr)); -} - -static void GLAPIENTRY -exec_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, - const GLvoid *ptr) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_IndexPointerEXT(ctx->Exec, (type, stride, count, ptr)); -} - -static void GLAPIENTRY -exec_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, - const GLvoid *ptr) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_NormalPointerEXT(ctx->Exec, (type, stride, count, ptr)); -} - -static void GLAPIENTRY -exec_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, - GLsizei count, const GLvoid *ptr) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_TexCoordPointerEXT(ctx->Exec, (size, type, stride, count, ptr)); -} - -static void GLAPIENTRY -exec_VertexPointerEXT(GLint size, GLenum type, GLsizei stride, - GLsizei count, const GLvoid *ptr) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_VertexPointerEXT(ctx->Exec, (size, type, stride, count, ptr)); -} - -static void GLAPIENTRY -exec_LockArraysEXT(GLint first, GLsizei count) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_LockArraysEXT(ctx->Exec, (first, count)); -} - -static void GLAPIENTRY -exec_UnlockArraysEXT(void) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_UnlockArraysEXT(ctx->Exec, ()); -} - -static void GLAPIENTRY -exec_ClientActiveTextureARB(GLenum target) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_ClientActiveTexture(ctx->Exec, (target)); -} - -static void GLAPIENTRY -exec_SecondaryColorPointerEXT(GLint size, GLenum type, - GLsizei stride, const GLvoid *ptr) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_SecondaryColorPointer(ctx->Exec, (size, type, stride, ptr)); -} - -static void GLAPIENTRY -exec_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_FogCoordPointer(ctx->Exec, (type, stride, ptr)); -} - -/* GL_EXT_multi_draw_arrays */ -static void GLAPIENTRY -exec_MultiDrawArraysEXT(GLenum mode, const GLint *first, - const GLsizei *count, GLsizei primcount) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_MultiDrawArrays(ctx->Exec, (mode, first, count, primcount)); -} - -/* GL_IBM_multimode_draw_arrays */ -static void GLAPIENTRY -exec_MultiModeDrawArraysIBM(const GLenum * mode, const GLint * first, - const GLsizei * count, GLsizei primcount, - GLint modestride) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_MultiModeDrawArraysIBM(ctx->Exec, - (mode, first, count, primcount, modestride)); -} - -/* GL_IBM_multimode_draw_arrays */ -static void GLAPIENTRY -exec_MultiModeDrawElementsIBM(const GLenum * mode, - const GLsizei * count, - GLenum type, - const GLvoid * const *indices, - GLsizei primcount, GLint modestride) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); - CALL_MultiModeDrawElementsIBM(ctx->Exec, - (mode, count, type, indices, primcount, - modestride)); -} - /** * Setup the given dispatch table to point to Mesa's display list * building functions. @@ -9573,14 +8803,17 @@ exec_MultiModeDrawElementsIBM(const GLenum * mode, * initialized from _mesa_init_api_defaults and from the active vtxfmt * struct. */ -struct _glapi_table * -_mesa_create_save_table(const struct gl_context *ctx) +void +_mesa_initialize_save_table(const struct gl_context *ctx) { - struct _glapi_table *table; + struct _glapi_table *table = ctx->Save; + int numEntries = MAX2(_gloffset_COUNT, _glapi_get_dispatch_table_size()); - table = _mesa_alloc_dispatch_table(_gloffset_COUNT); - if (table == NULL) - return NULL; + /* Initially populate the dispatch table with the contents of the + * normal-execution dispatch table. This lets us skip populating functions + * that should be called directly instead of compiled into display lists. + */ + memcpy(table, ctx->Exec, numEntries * sizeof(_glapi_proc)); _mesa_loopback_init_api_table(ctx, table); @@ -9603,7 +8836,6 @@ _mesa_create_save_table(const struct gl_context *ctx) SET_ColorMaterial(table, save_ColorMaterial); SET_CopyPixels(table, save_CopyPixels); SET_CullFace(table, save_CullFace); - SET_DeleteLists(table, _mesa_DeleteLists); SET_DepthFunc(table, save_DepthFunc); SET_DepthMask(table, save_DepthMask); SET_DepthRange(table, save_DepthRange); @@ -9613,51 +8845,17 @@ _mesa_create_save_table(const struct gl_context *ctx) SET_DrawPixels(table, save_DrawPixels); SET_Enable(table, save_Enable); SET_Enablei(table, save_EnableIndexed); - SET_EndList(table, _mesa_EndList); SET_EvalMesh1(table, save_EvalMesh1); SET_EvalMesh2(table, save_EvalMesh2); - SET_Finish(table, exec_Finish); - SET_Flush(table, exec_Flush); SET_Fogf(table, save_Fogf); SET_Fogfv(table, save_Fogfv); SET_Fogi(table, save_Fogi); SET_Fogiv(table, save_Fogiv); SET_FrontFace(table, save_FrontFace); SET_Frustum(table, save_Frustum); - SET_GenLists(table, _mesa_GenLists); - SET_GetBooleanv(table, exec_GetBooleanv); - SET_GetClipPlane(table, exec_GetClipPlane); - SET_GetDoublev(table, exec_GetDoublev); - SET_GetError(table, exec_GetError); - SET_GetFloatv(table, exec_GetFloatv); - SET_GetIntegerv(table, exec_GetIntegerv); - SET_GetLightfv(table, exec_GetLightfv); - SET_GetLightiv(table, exec_GetLightiv); - SET_GetMapdv(table, exec_GetMapdv); - SET_GetMapfv(table, exec_GetMapfv); - SET_GetMapiv(table, exec_GetMapiv); - SET_GetMaterialfv(table, exec_GetMaterialfv); - SET_GetMaterialiv(table, exec_GetMaterialiv); - SET_GetPixelMapfv(table, exec_GetPixelMapfv); - SET_GetPixelMapuiv(table, exec_GetPixelMapuiv); - SET_GetPixelMapusv(table, exec_GetPixelMapusv); - SET_GetPolygonStipple(table, exec_GetPolygonStipple); - SET_GetString(table, exec_GetString); - SET_GetTexEnvfv(table, exec_GetTexEnvfv); - SET_GetTexEnviv(table, exec_GetTexEnviv); - SET_GetTexGendv(table, exec_GetTexGendv); - SET_GetTexGenfv(table, exec_GetTexGenfv); - SET_GetTexGeniv(table, exec_GetTexGeniv); - SET_GetTexImage(table, exec_GetTexImage); - SET_GetTexLevelParameterfv(table, exec_GetTexLevelParameterfv); - SET_GetTexLevelParameteriv(table, exec_GetTexLevelParameteriv); - SET_GetTexParameterfv(table, exec_GetTexParameterfv); - SET_GetTexParameteriv(table, exec_GetTexParameteriv); SET_Hint(table, save_Hint); SET_IndexMask(table, save_IndexMask); SET_InitNames(table, save_InitNames); - SET_IsEnabled(table, exec_IsEnabled); - SET_IsList(table, _mesa_IsList); SET_LightModelf(table, save_LightModelf); SET_LightModelfv(table, save_LightModelfv); SET_LightModeli(table, save_LightModeli); @@ -9691,8 +8889,6 @@ _mesa_create_save_table(const struct gl_context *ctx) SET_PixelMapfv(table, save_PixelMapfv); SET_PixelMapuiv(table, save_PixelMapuiv); SET_PixelMapusv(table, save_PixelMapusv); - SET_PixelStoref(table, exec_PixelStoref); - SET_PixelStorei(table, exec_PixelStorei); SET_PixelTransferf(table, save_PixelTransferf); SET_PixelTransferi(table, save_PixelTransferi); SET_PixelZoom(table, save_PixelZoom); @@ -9731,15 +8927,11 @@ _mesa_create_save_table(const struct gl_context *ctx) SET_RasterPos4s(table, save_RasterPos4s); SET_RasterPos4sv(table, save_RasterPos4sv); SET_ReadBuffer(table, save_ReadBuffer); - SET_ReadPixels(table, exec_ReadPixels); - SET_RenderMode(table, exec_RenderMode); SET_Rotated(table, save_Rotated); SET_Rotatef(table, save_Rotatef); SET_Scaled(table, save_Scaled); SET_Scalef(table, save_Scalef); SET_Scissor(table, save_Scissor); - SET_FeedbackBuffer(table, exec_FeedbackBuffer); - SET_SelectBuffer(table, exec_SelectBuffer); SET_ShadeModel(table, save_ShadeModel); SET_StencilFunc(table, save_StencilFunc); SET_StencilMask(table, save_StencilMask); @@ -9765,30 +8957,14 @@ _mesa_create_save_table(const struct gl_context *ctx) SET_Viewport(table, save_Viewport); /* GL 1.1 */ - SET_AreTexturesResident(table, exec_AreTexturesResident); SET_BindTexture(table, save_BindTexture); - SET_ColorPointer(table, exec_ColorPointer); SET_CopyTexImage1D(table, save_CopyTexImage1D); SET_CopyTexImage2D(table, save_CopyTexImage2D); SET_CopyTexSubImage1D(table, save_CopyTexSubImage1D); SET_CopyTexSubImage2D(table, save_CopyTexSubImage2D); - SET_DeleteTextures(table, exec_DeleteTextures); - SET_DisableClientState(table, exec_DisableClientState); - SET_EdgeFlagPointer(table, exec_EdgeFlagPointer); - SET_EnableClientState(table, exec_EnableClientState); - SET_GenTextures(table, exec_GenTextures); - SET_GetPointerv(table, exec_GetPointerv); - SET_IndexPointer(table, exec_IndexPointer); - SET_InterleavedArrays(table, exec_InterleavedArrays); - SET_IsTexture(table, exec_IsTexture); - SET_NormalPointer(table, exec_NormalPointer); - SET_PopClientAttrib(table, exec_PopClientAttrib); SET_PrioritizeTextures(table, save_PrioritizeTextures); - SET_PushClientAttrib(table, exec_PushClientAttrib); - SET_TexCoordPointer(table, exec_TexCoordPointer); SET_TexSubImage1D(table, save_TexSubImage1D); SET_TexSubImage2D(table, save_TexSubImage2D); - SET_VertexPointer(table, exec_VertexPointer); /* GL 1.2 */ SET_CopyTexSubImage3D(table, save_CopyTexSubImage3D); @@ -9819,26 +8995,10 @@ _mesa_create_save_table(const struct gl_context *ctx) SET_ConvolutionParameteriv(table, save_ConvolutionParameteriv); SET_CopyColorSubTable(table, save_CopyColorSubTable); SET_CopyColorTable(table, save_CopyColorTable); - SET_CopyConvolutionFilter1D(table, exec_CopyConvolutionFilter1D); - SET_CopyConvolutionFilter2D(table, exec_CopyConvolutionFilter2D); - SET_GetColorTable(table, exec_GetColorTable); - SET_GetColorTableParameterfv(table, exec_GetColorTableParameterfv); - SET_GetColorTableParameteriv(table, exec_GetColorTableParameteriv); - SET_GetConvolutionFilter(table, exec_GetConvolutionFilter); - SET_GetConvolutionParameterfv(table, exec_GetConvolutionParameterfv); - SET_GetConvolutionParameteriv(table, exec_GetConvolutionParameteriv); - SET_GetHistogram(table, exec_GetHistogram); - SET_GetHistogramParameterfv(table, exec_GetHistogramParameterfv); - SET_GetHistogramParameteriv(table, exec_GetHistogramParameteriv); - SET_GetMinmax(table, exec_GetMinmax); - SET_GetMinmaxParameterfv(table, exec_GetMinmaxParameterfv); - SET_GetMinmaxParameteriv(table, exec_GetMinmaxParameteriv); - SET_GetSeparableFilter(table, exec_GetSeparableFilter); SET_Histogram(table, save_Histogram); SET_Minmax(table, save_Minmax); SET_ResetHistogram(table, save_ResetHistogram); SET_ResetMinmax(table, save_ResetMinmax); - SET_SeparableFilter2D(table, exec_SeparableFilter2D); /* 2. GL_EXT_blend_color */ #if 0 @@ -9859,19 +9019,8 @@ _mesa_create_save_table(const struct gl_context *ctx) #if 0 SET_ColorTableSGI(table, save_ColorTable); SET_ColorSubTableSGI(table, save_ColorSubTable); - SET_GetColorTableSGI(table, exec_GetColorTable); - SET_GetColorTableParameterfvSGI(table, exec_GetColorTableParameterfv); - SET_GetColorTableParameterivSGI(table, exec_GetColorTableParameteriv); #endif - /* 30. GL_EXT_vertex_array */ - SET_ColorPointerEXT(table, exec_ColorPointerEXT); - SET_EdgeFlagPointerEXT(table, exec_EdgeFlagPointerEXT); - SET_IndexPointerEXT(table, exec_IndexPointerEXT); - SET_NormalPointerEXT(table, exec_NormalPointerEXT); - SET_TexCoordPointerEXT(table, exec_TexCoordPointerEXT); - SET_VertexPointerEXT(table, exec_VertexPointerEXT); - /* 37. GL_EXT_blend_minmax */ #if 0 SET_BlendEquationEXT(table, save_BlendEquationEXT); @@ -9881,25 +9030,9 @@ _mesa_create_save_table(const struct gl_context *ctx) SET_PointParameterf(table, save_PointParameterfEXT); SET_PointParameterfv(table, save_PointParameterfvEXT); - /* 97. GL_EXT_compiled_vertex_array */ - SET_LockArraysEXT(table, exec_LockArraysEXT); - SET_UnlockArraysEXT(table, exec_UnlockArraysEXT); - - /* 145. GL_EXT_secondary_color */ - SET_SecondaryColorPointer(table, exec_SecondaryColorPointerEXT); - - /* 148. GL_EXT_multi_draw_arrays */ - SET_MultiDrawArrays(table, exec_MultiDrawArraysEXT); - - /* 149. GL_EXT_fog_coord */ - SET_FogCoordPointer(table, exec_FogCoordPointerEXT); - /* 173. GL_EXT_blend_func_separate */ SET_BlendFuncSeparate(table, save_BlendFuncSeparateEXT); - /* 196. GL_MESA_resize_buffers */ - SET_ResizeBuffersMESA(table, _mesa_ResizeBuffersMESA); - /* 197. GL_MESA_window_pos */ SET_WindowPos2d(table, save_WindowPos2dMESA); SET_WindowPos2dv(table, save_WindowPos2dvMESA); @@ -9926,19 +9059,12 @@ _mesa_create_save_table(const struct gl_context *ctx) SET_WindowPos4sMESA(table, save_WindowPos4sMESA); SET_WindowPos4svMESA(table, save_WindowPos4svMESA); - /* 200. GL_IBM_multimode_draw_arrays */ - SET_MultiModeDrawArraysIBM(table, exec_MultiModeDrawArraysIBM); - SET_MultiModeDrawElementsIBM(table, exec_MultiModeDrawElementsIBM); - /* 233. GL_NV_vertex_program */ /* The following commands DO NOT go into display lists: * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV, * VertexAttribPointerNV, GetProgram*, GetVertexAttrib* */ SET_BindProgramARB(table, save_BindProgramNV); - SET_DeleteProgramsARB(table, _mesa_DeleteProgramsARB); - SET_GenProgramsARB(table, _mesa_GenProgramsARB); - SET_IsProgramARB(table, _mesa_IsProgramARB); /* 244. GL_ATI_envmap_bumpmap */ SET_TexBumpParameterivATI(table, save_TexBumpParameterivATI); @@ -9955,40 +9081,11 @@ _mesa_create_save_table(const struct gl_context *ctx) /* 268. GL_EXT_stencil_two_side */ SET_ActiveStencilFaceEXT(table, save_ActiveStencilFaceEXT); - /* 273. GL_APPLE_vertex_array_object */ - SET_BindVertexArrayAPPLE(table, _mesa_BindVertexArrayAPPLE); - SET_DeleteVertexArrays(table, _mesa_DeleteVertexArrays); - SET_GenVertexArraysAPPLE(table, _mesa_GenVertexArraysAPPLE); - SET_IsVertexArray(table, _mesa_IsVertexArray); - - /* 310. GL_EXT_framebuffer_object */ - SET_GenFramebuffers(table, _mesa_GenFramebuffers); - SET_BindFramebuffer(table, _mesa_BindFramebuffer); - SET_DeleteFramebuffers(table, _mesa_DeleteFramebuffers); - SET_CheckFramebufferStatus(table, _mesa_CheckFramebufferStatus); - SET_GenRenderbuffers(table, _mesa_GenRenderbuffers); - SET_BindRenderbuffer(table, _mesa_BindRenderbuffer); - SET_DeleteRenderbuffers(table, _mesa_DeleteRenderbuffers); - SET_RenderbufferStorage(table, _mesa_RenderbufferStorage); - SET_FramebufferTexture1D(table, _mesa_FramebufferTexture1D); - SET_FramebufferTexture2D(table, _mesa_FramebufferTexture2D); - SET_FramebufferTexture3D(table, _mesa_FramebufferTexture3D); - SET_FramebufferRenderbuffer(table, _mesa_FramebufferRenderbuffer); - SET_GenerateMipmap(table, _mesa_GenerateMipmap); - - /* 317. GL_EXT_framebuffer_multisample */ - SET_RenderbufferStorageMultisample(table, _mesa_RenderbufferStorageMultisample); - - /* GL_ARB_vertex_array_object */ - SET_BindVertexArray(table, _mesa_BindVertexArray); - SET_GenVertexArrays(table, _mesa_GenVertexArrays); - /* ???. GL_EXT_depth_bounds_test */ SET_DepthBoundsEXT(table, save_DepthBoundsEXT); /* ARB 1. GL_ARB_multitexture */ SET_ActiveTexture(table, save_ActiveTextureARB); - SET_ClientActiveTexture(table, exec_ClientActiveTextureARB); /* ARB 3. GL_ARB_transpose_matrix */ SET_LoadTransposeMatrixd(table, save_LoadTransposeMatrixdARB); @@ -10006,7 +9103,6 @@ _mesa_create_save_table(const struct gl_context *ctx) SET_CompressedTexSubImage3D(table, save_CompressedTexSubImage3DARB); SET_CompressedTexSubImage2D(table, save_CompressedTexSubImage2DARB); SET_CompressedTexSubImage1D(table, save_CompressedTexSubImage1DARB); - SET_GetCompressedTexImage(table, exec_GetCompressedTexImageARB); /* ARB 14. GL_ARB_point_parameters */ /* aliased with EXT_point_parameters functions */ @@ -10017,18 +9113,8 @@ _mesa_create_save_table(const struct gl_context *ctx) /* ARB 26. GL_ARB_vertex_program */ /* ARB 27. GL_ARB_fragment_program */ /* glVertexAttrib* functions alias the NV ones, handled elsewhere */ - SET_VertexAttribPointer(table, _mesa_VertexAttribPointer); - SET_EnableVertexAttribArray(table, _mesa_EnableVertexAttribArray); - SET_DisableVertexAttribArray(table, _mesa_DisableVertexAttribArray); SET_ProgramStringARB(table, save_ProgramStringARB); SET_BindProgramARB(table, save_BindProgramNV); - SET_DeleteProgramsARB(table, _mesa_DeleteProgramsARB); - SET_GenProgramsARB(table, _mesa_GenProgramsARB); - SET_IsProgramARB(table, _mesa_IsProgramARB); - SET_GetVertexAttribdv(table, _mesa_GetVertexAttribdv); - SET_GetVertexAttribfv(table, _mesa_GetVertexAttribfv); - SET_GetVertexAttribiv(table, _mesa_GetVertexAttribiv); - SET_GetVertexAttribPointerv(table, _mesa_GetVertexAttribPointerv); SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB); SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB); SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB); @@ -10037,30 +9123,7 @@ _mesa_create_save_table(const struct gl_context *ctx) SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB); SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB); SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB); - SET_GetProgramEnvParameterdvARB(table, _mesa_GetProgramEnvParameterdvARB); - SET_GetProgramEnvParameterfvARB(table, _mesa_GetProgramEnvParameterfvARB); - SET_GetProgramLocalParameterdvARB(table, - _mesa_GetProgramLocalParameterdvARB); - SET_GetProgramLocalParameterfvARB(table, - _mesa_GetProgramLocalParameterfvARB); - SET_GetProgramivARB(table, _mesa_GetProgramivARB); - SET_GetProgramStringARB(table, _mesa_GetProgramStringARB); - - /* ARB 28. GL_ARB_vertex_buffer_object */ - /* None of the extension's functions get compiled */ - SET_BindBuffer(table, _mesa_BindBuffer); - SET_BufferData(table, _mesa_BufferData); - SET_BufferSubData(table, _mesa_BufferSubData); - SET_DeleteBuffers(table, _mesa_DeleteBuffers); - SET_GenBuffers(table, _mesa_GenBuffers); - SET_GetBufferParameteriv(table, _mesa_GetBufferParameteriv); - SET_GetBufferPointerv(table, _mesa_GetBufferPointerv); - SET_GetBufferSubData(table, _mesa_GetBufferSubData); - SET_IsBuffer(table, _mesa_IsBuffer); - SET_MapBuffer(table, _mesa_MapBuffer); - SET_UnmapBuffer(table, _mesa_UnmapBuffer); - - _mesa_init_queryobj_dispatch(ctx, table); /* glGetQuery, etc */ + SET_BeginQuery(table, save_BeginQueryARB); SET_EndQuery(table, save_EndQueryARB); SET_QueryCounter(table, save_QueryCounter); @@ -10069,8 +9132,6 @@ _mesa_create_save_table(const struct gl_context *ctx) SET_BlitFramebuffer(table, save_BlitFramebufferEXT); - /* GL_ARB_shader_objects */ - _mesa_init_shader_dispatch(ctx, table); /* Plug in glCreate/Delete/Get, etc */ SET_UseProgram(table, save_UseProgramObjectARB); SET_Uniform1f(table, save_Uniform1fARB); SET_Uniform2f(table, save_Uniform2fARB); @@ -10098,12 +9159,6 @@ _mesa_create_save_table(const struct gl_context *ctx) SET_UniformMatrix3x4fv(table, save_UniformMatrix3x4fv); SET_UniformMatrix4x3fv(table, save_UniformMatrix4x3fv); - /* ARB 30/31/32. GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */ - SET_BindAttribLocation(table, exec_BindAttribLocationARB); - SET_GetAttribLocation(table, exec_GetAttribLocationARB); - SET_GetUniformLocation(table, exec_GetUniformLocationARB); - /* XXX additional functions need to be implemented here! */ - /* 299. GL_EXT_blend_equation_separate */ SET_BlendEquationSeparate(table, save_BlendEquationSeparateEXT); @@ -10111,31 +9166,14 @@ _mesa_create_save_table(const struct gl_context *ctx) SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT); SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT); - /* ARB 50. GL_ARB_map_buffer_range */ - SET_MapBufferRange(table, _mesa_MapBufferRange); /* no dlist save */ - SET_FlushMappedBufferRange(table, _mesa_FlushMappedBufferRange); /* no dl */ - - /* ARB 51. GL_ARB_texture_buffer_object */ - SET_TexBuffer(table, _mesa_TexBuffer); /* no dlist save */ - - /* ARB 59. GL_ARB_copy_buffer */ - SET_CopyBufferSubData(table, _mesa_CopyBufferSubData); /* no dlist save */ - /* 364. GL_EXT_provoking_vertex */ SET_ProvokingVertex(table, save_ProvokingVertexEXT); - /* 371. GL_APPLE_object_purgeable */ - SET_ObjectPurgeableAPPLE(table, _mesa_ObjectPurgeableAPPLE); - SET_ObjectUnpurgeableAPPLE(table, _mesa_ObjectUnpurgeableAPPLE); - SET_GetObjectParameterivAPPLE(table, _mesa_GetObjectParameterivAPPLE); - /* GL_EXT_texture_integer */ SET_ClearColorIiEXT(table, save_ClearColorIi); SET_ClearColorIuiEXT(table, save_ClearColorIui); SET_TexParameterIiv(table, save_TexParameterIiv); SET_TexParameterIuiv(table, save_TexParameterIuiv); - SET_GetTexParameterIiv(table, exec_GetTexParameterIiv); - SET_GetTexParameterIuiv(table, exec_GetTexParameterIuiv); /* 377. GL_EXT_separate_shader_objects */ SET_UseShaderProgramEXT(table, save_UseShaderProgramEXT); @@ -10169,11 +9207,6 @@ _mesa_create_save_table(const struct gl_context *ctx) (void) save_Uniform4uiv; #endif - /* These are not compiled into display lists: */ - SET_BindBufferBase(table, _mesa_BindBufferBase); - SET_BindBufferOffsetEXT(table, _mesa_BindBufferOffsetEXT); - SET_BindBufferRange(table, _mesa_BindBufferRange); - SET_TransformFeedbackVaryings(table, _mesa_TransformFeedbackVaryings); /* These are: */ SET_BeginTransformFeedback(table, save_BeginTransformFeedback); SET_EndTransformFeedback(table, save_EndTransformFeedback); @@ -10195,8 +9228,6 @@ _mesa_create_save_table(const struct gl_context *ctx) /* GL_NV_texture_barrier */ SET_TextureBarrierNV(table, save_TextureBarrierNV); - /* GL_ARB_sampler_objects */ - _mesa_init_sampler_object_dispatch(ctx, table); /* plug in Gen/Get/etc functions */ SET_BindSampler(table, save_BindSampler); SET_SamplerParameteri(table, save_SamplerParameteri); SET_SamplerParameterf(table, save_SamplerParameterf); @@ -10221,27 +9252,10 @@ _mesa_create_save_table(const struct gl_context *ctx) SET_EndConditionalRender(table, save_EndConditionalRender); /* GL_ARB_sync */ - _mesa_init_sync_dispatch(table); SET_WaitSync(table, save_WaitSync); - /* GL_ARB_texture_storage (no dlist support) */ - SET_TexStorage1D(table, _mesa_TexStorage1D); - SET_TexStorage2D(table, _mesa_TexStorage2D); - SET_TexStorage3D(table, _mesa_TexStorage3D); - SET_TextureStorage1DEXT(table, _mesa_TextureStorage1DEXT); - SET_TextureStorage2DEXT(table, _mesa_TextureStorage2DEXT); - SET_TextureStorage3DEXT(table, _mesa_TextureStorage3DEXT); - - /* GL_ARB_debug_output (no dlist support) */ - _mesa_init_errors_dispatch(table); - /* GL_ARB_uniform_buffer_object */ SET_UniformBlockBinding(table, save_UniformBlockBinding); - - /* GL_NV_primitive_restart */ - SET_PrimitiveRestartIndex(table, _mesa_PrimitiveRestartIndex); - - return table; } diff --git a/mesalib/src/mesa/main/dlist.h b/mesalib/src/mesa/main/dlist.h index 9d4fc6899..e049476c1 100644 --- a/mesalib/src/mesa/main/dlist.h +++ b/mesalib/src/mesa/main/dlist.h @@ -74,7 +74,7 @@ extern void _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dl extern void _mesa_save_vtxfmt_init( GLvertexformat *vfmt ); -extern struct _glapi_table *_mesa_create_save_table(const struct gl_context *); +extern void _mesa_initialize_save_table(const struct gl_context *); extern void _mesa_install_dlist_vtxfmt(struct _glapi_table *disp, const GLvertexformat *vfmt); diff --git a/mesalib/src/mesa/main/drawpix.c b/mesalib/src/mesa/main/drawpix.c index 3d25ae52b..d9f55d3af 100644 --- a/mesalib/src/mesa/main/drawpix.c +++ b/mesalib/src/mesa/main/drawpix.c @@ -48,7 +48,8 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, { GLenum err; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glDrawPixels(%d, %d, %s, %s, %p) // to %s at %d, %d\n", @@ -191,7 +192,8 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLenum type ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, @@ -297,7 +299,8 @@ _mesa_Bitmap( GLsizei width, GLsizei height, const GLubyte *bitmap ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); if (width < 0 || height < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glBitmap(width or height < 0)" ); diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c index 73257290e..7e85fdfb3 100644 --- a/mesalib/src/mesa/main/enable.c +++ b/mesalib/src/mesa/main/enable.c @@ -165,7 +165,6 @@ void GLAPIENTRY _mesa_EnableClientState( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); client_state( ctx, cap, GL_TRUE ); } @@ -181,7 +180,6 @@ void GLAPIENTRY _mesa_DisableClientState( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); client_state( ctx, cap, GL_FALSE ); } @@ -1039,7 +1037,6 @@ void GLAPIENTRY _mesa_Enable( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); _mesa_set_enable( ctx, cap, GL_TRUE ); } @@ -1053,7 +1050,6 @@ void GLAPIENTRY _mesa_Disable( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); _mesa_set_enable( ctx, cap, GL_FALSE ); } @@ -1102,7 +1098,6 @@ void GLAPIENTRY _mesa_Disablei( GLenum cap, GLuint index ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); _mesa_set_enablei(ctx, cap, index, GL_FALSE); } @@ -1111,7 +1106,6 @@ void GLAPIENTRY _mesa_Enablei( GLenum cap, GLuint index ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); _mesa_set_enablei(ctx, cap, index, GL_TRUE); } diff --git a/mesalib/src/mesa/main/errors.c b/mesalib/src/mesa/main/errors.c index b692f3189..0c5e36d5a 100644 --- a/mesalib/src/mesa/main/errors.c +++ b/mesalib/src/mesa/main/errors.c @@ -726,15 +726,6 @@ _mesa_DebugMessageCallbackARB(GLDEBUGPROCARB callback, const GLvoid *userParam) } void -_mesa_init_errors_dispatch(struct _glapi_table *disp) -{ - SET_DebugMessageCallbackARB(disp, _mesa_DebugMessageCallbackARB); - SET_DebugMessageControlARB(disp, _mesa_DebugMessageControlARB); - SET_DebugMessageInsertARB(disp, _mesa_DebugMessageInsertARB); - SET_GetDebugMessageLogARB(disp, _mesa_GetDebugMessageLogARB); -} - -void _mesa_init_errors(struct gl_context *ctx) { int s, t, sev; diff --git a/mesalib/src/mesa/main/errors.h b/mesalib/src/mesa/main/errors.h index c41d36811..c92ee0a6e 100644 --- a/mesalib/src/mesa/main/errors.h +++ b/mesalib/src/mesa/main/errors.h @@ -48,9 +48,6 @@ struct _glapi_table; struct gl_context; extern void -_mesa_init_errors_dispatch(struct _glapi_table *disp); - -extern void _mesa_init_errors( struct gl_context *ctx ); extern void diff --git a/mesalib/src/mesa/main/eval.c b/mesalib/src/mesa/main/eval.c index 59627cc43..44b57929e 100644 --- a/mesalib/src/mesa/main/eval.c +++ b/mesalib/src/mesa/main/eval.c @@ -311,7 +311,6 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLfloat *pnts; struct gl_1d_map *map = NULL; - ASSERT_OUTSIDE_BEGIN_END(ctx); ASSERT(type == GL_FLOAT || type == GL_DOUBLE); if (u1 == u2) { @@ -394,7 +393,6 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat *pnts; struct gl_2d_map *map = NULL; - ASSERT_OUTSIDE_BEGIN_END(ctx); ASSERT(type == GL_FLOAT || type == GL_DOUBLE); if (u1==u2) { @@ -501,8 +499,6 @@ _mesa_GetnMapdvARB( GLenum target, GLenum query, GLsizei bufSize, GLdouble *v ) GLuint comps; GLsizei numBytes; - ASSERT_OUTSIDE_BEGIN_END(ctx); - comps = _mesa_evaluator_components(target); if (!comps) { _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapdv(target)" ); @@ -593,8 +589,6 @@ _mesa_GetnMapfvARB( GLenum target, GLenum query, GLsizei bufSize, GLfloat *v ) GLuint comps; GLsizei numBytes; - ASSERT_OUTSIDE_BEGIN_END(ctx); - comps = _mesa_evaluator_components(target); if (!comps) { _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapfv(target)" ); @@ -687,8 +681,6 @@ _mesa_GetnMapivARB( GLenum target, GLenum query, GLsizei bufSize, GLint *v ) GLuint comps; GLsizei numBytes; - ASSERT_OUTSIDE_BEGIN_END(ctx); - comps = _mesa_evaluator_components(target); if (!comps) { _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapiv(target)" ); @@ -774,7 +766,6 @@ void GLAPIENTRY _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (un<1) { _mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid1f" ); @@ -800,7 +791,6 @@ _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2 ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (un<1) { _mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(un)" ); diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index 23b494836..fd25d31c6 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -45,6 +45,7 @@ enum { GL = (1 << API_OPENGL_COMPAT) | (1 << API_OPENGL_CORE), ES1 = 1 << API_OPENGLES, ES2 = 1 << API_OPENGLES2, + ES3 = 1 << (API_OPENGL_LAST + 1), }; /** @@ -232,6 +233,7 @@ static const struct extension extension_table[] = { { "GL_EXT_unpack_subimage", o(dummy_true), ES2, 2011 }, { "GL_EXT_vertex_array_bgra", o(EXT_vertex_array_bgra), GL, 2008 }, { "GL_EXT_vertex_array", o(dummy_true), GLL, 1995 }, + { "GL_EXT_color_buffer_float", o(dummy_true), ES3, 2013 }, /* OES extensions */ { "GL_OES_blend_equation_separate", o(EXT_blend_equation_separate), ES1, 2009 }, @@ -243,6 +245,7 @@ static const struct extension extension_table[] = { { "GL_OES_depth24", o(EXT_framebuffer_object), ES1 | ES2, 2005 }, { "GL_OES_depth32", o(dummy_false), DISABLE, 2005 }, { "GL_OES_depth_texture", o(ARB_depth_texture), ES2, 2006 }, + { "GL_OES_depth_texture_cube_map", o(OES_depth_texture_cube_map), ES2, 2012 }, { "GL_OES_draw_texture", o(OES_draw_texture), ES1, 2004 }, /* FIXME: Mesa expects GL_OES_EGL_image to be available in OpenGL contexts. */ { "GL_OES_EGL_image", o(OES_EGL_image), GL | ES1 | ES2, 2006 }, @@ -745,6 +748,9 @@ _mesa_make_extension_string(struct gl_context *ctx) const struct extension *i; unsigned j; unsigned maxYear = ~0; + unsigned api_set = (1 << ctx->API); + if (_mesa_is_gles3(ctx)) + api_set |= ES3; /* Check if the MESA_EXTENSION_MAX_YEAR env var is set */ { @@ -761,7 +767,7 @@ _mesa_make_extension_string(struct gl_context *ctx) for (i = extension_table; i->name != 0; ++i) { if (base[i->offset] && i->year <= maxYear && - (i->api_set & (1 << ctx->API))) { + (i->api_set & api_set)) { length += strlen(i->name) + 1; /* +1 for space */ ++count; } @@ -791,7 +797,7 @@ _mesa_make_extension_string(struct gl_context *ctx) for (i = extension_table; i->name != 0; ++i) { if (base[i->offset] && i->year <= maxYear && - (i->api_set & (1 << ctx->API))) { + (i->api_set & api_set)) { extension_indices[j++] = i - extension_table; } } @@ -801,7 +807,7 @@ _mesa_make_extension_string(struct gl_context *ctx) /* Build the extension string.*/ for (j = 0; j < count; ++j) { i = &extension_table[extension_indices[j]]; - assert(base[i->offset] && (i->api_set & (1 << ctx->API))); + assert(base[i->offset] && (i->api_set & api_set)); strcat(exts, i->name); strcat(exts, " "); } @@ -822,6 +828,9 @@ _mesa_get_extension_count(struct gl_context *ctx) { GLboolean *base; const struct extension *i; + unsigned api_set = (1 << ctx->API); + if (_mesa_is_gles3(ctx)) + api_set |= ES3; /* only count once */ if (ctx->Extensions.Count != 0) @@ -829,7 +838,7 @@ _mesa_get_extension_count(struct gl_context *ctx) base = (GLboolean *) &ctx->Extensions; for (i = extension_table; i->name != 0; ++i) { - if (base[i->offset] && (i->api_set & (1 << ctx->API))) { + if (base[i->offset] && (i->api_set & api_set)) { ctx->Extensions.Count++; } } @@ -845,11 +854,14 @@ _mesa_get_enabled_extension(struct gl_context *ctx, GLuint index) const GLboolean *base; size_t n; const struct extension *i; + unsigned api_set = (1 << ctx->API); + if (_mesa_is_gles3(ctx)) + api_set |= ES3; base = (GLboolean*) &ctx->Extensions; n = 0; for (i = extension_table; i->name != 0; ++i) { - if (base[i->offset] && (i->api_set & (1 << ctx->API))) { + if (base[i->offset] && (i->api_set & api_set)) { if (n == index) return (const GLubyte*) i->name; else diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index 9db5035d1..257f839a6 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -523,6 +523,50 @@ _mesa_is_legal_color_format(const struct gl_context *ctx, GLenum baseFormat) /** + * Is the given base format a legal format for a color renderbuffer? + */ +static GLboolean +is_format_color_renderable(const struct gl_context *ctx, gl_format format, GLenum internalFormat) +{ + const GLenum baseFormat = + _mesa_get_format_base_format(format); + GLboolean valid; + + valid = _mesa_is_legal_color_format(ctx, baseFormat); + if (!valid || _mesa_is_desktop_gl(ctx)) { + return valid; + } + + /* Reject additional cases for GLES */ + switch (internalFormat) { + case GL_RGBA8_SNORM: + case GL_RGB32F: + case GL_RGB32I: + case GL_RGB32UI: + case GL_RGB16F: + case GL_RGB16I: + case GL_RGB16UI: + case GL_RGB8_SNORM: + case GL_RGB8I: + case GL_RGB8UI: + case GL_SRGB8: + case GL_RGB9_E5: + case GL_RG8_SNORM: + case GL_R8_SNORM: + return GL_FALSE; + default: + break; + } + + if (format == MESA_FORMAT_ARGB2101010 && internalFormat != GL_RGB10_A2) { + return GL_FALSE; + } + + return GL_TRUE; +} + + +/** * Is the given base format a legal format for a depth/stencil renderbuffer? */ static GLboolean @@ -770,7 +814,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, f = texImg->_BaseFormat; attFormat = texImg->TexFormat; numImages++; - if (!_mesa_is_legal_color_format(ctx, f) && + if (!is_format_color_renderable(ctx, attFormat, texImg->InternalFormat) && !is_legal_depth_format(ctx, f)) { fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT; fbo_incomplete("texture attachment incomplete", -1); @@ -923,8 +967,6 @@ _mesa_BindRenderbuffer(GLenum target, GLuint renderbuffer) struct gl_renderbuffer *newRb; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - if (target != GL_RENDERBUFFER_EXT) { _mesa_error(ctx, GL_INVALID_ENUM, "glBindRenderbufferEXT(target)"); return; @@ -997,7 +1039,6 @@ _mesa_DeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers) GLint i; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_BUFFERS); for (i = 0; i < n; i++) { @@ -1043,8 +1084,6 @@ _mesa_GenRenderbuffers(GLsizei n, GLuint *renderbuffers) GLuint first; GLint i; - ASSERT_OUTSIDE_BEGIN_END(ctx); - if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glGenRenderbuffersEXT(n)"); return; @@ -1217,21 +1256,27 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat) ctx->Extensions.ARB_framebuffer_object ? GL_ALPHA : 0; case GL_R16F: case GL_R32F: - return (_mesa_is_desktop_gl(ctx) && - ctx->Extensions.ARB_texture_rg && - ctx->Extensions.ARB_texture_float) ? GL_RED : 0; + return ((_mesa_is_desktop_gl(ctx) && + ctx->Extensions.ARB_texture_rg && + ctx->Extensions.ARB_texture_float) || + _mesa_is_gles3(ctx) /* EXT_color_buffer_float */ ) + ? GL_RED : 0; case GL_RG16F: case GL_RG32F: - return (_mesa_is_desktop_gl(ctx) && - ctx->Extensions.ARB_texture_rg && - ctx->Extensions.ARB_texture_float) ? GL_RG : 0; + return ((_mesa_is_desktop_gl(ctx) && + ctx->Extensions.ARB_texture_rg && + ctx->Extensions.ARB_texture_float) || + _mesa_is_gles3(ctx) /* EXT_color_buffer_float */ ) + ? GL_RG : 0; case GL_RGB16F: case GL_RGB32F: return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_float) ? GL_RGB : 0; case GL_RGBA16F: case GL_RGBA32F: - return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_float) + return ((_mesa_is_desktop_gl(ctx) && + ctx->Extensions.ARB_texture_float) || + _mesa_is_gles3(ctx) /* EXT_color_buffer_float */ ) ? GL_RGBA : 0; case GL_ALPHA16F_ARB: case GL_ALPHA32F_ARB: @@ -1258,7 +1303,8 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat) && ctx->Extensions.EXT_texture_shared_exponent) ? GL_RGB : 0; case GL_R11F_G11F_B10F: - return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_packed_float) + return ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_packed_float) || + _mesa_is_gles3(ctx) /* EXT_color_buffer_float */ ) ? GL_RGB : 0; case GL_RGBA8UI_EXT: @@ -1399,8 +1445,6 @@ renderbuffer_storage(GLenum target, GLenum internalFormat, GLenum baseFormat; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - if (MESA_VERBOSE & VERBOSE_API) { if (samples == NO_SAMPLES) _mesa_debug(ctx, "%s(%s, %s, %d, %d)\n", @@ -1423,7 +1467,8 @@ renderbuffer_storage(GLenum target, GLenum internalFormat, baseFormat = _mesa_base_fbo_format(ctx, internalFormat); if (baseFormat == 0) { - _mesa_error(ctx, GL_INVALID_ENUM, "%s(internalFormat)", func); + _mesa_error(ctx, GL_INVALID_ENUM, "%s(internalFormat=%s)", + func, _mesa_lookup_enum_by_nr(internalFormat)); return; } @@ -1500,7 +1545,6 @@ _mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image) { struct gl_renderbuffer *rb; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.OES_EGL_image) { _mesa_error(ctx, GL_INVALID_OPERATION, @@ -1594,8 +1638,6 @@ _mesa_GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params) struct gl_renderbuffer *rb; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - if (target != GL_RENDERBUFFER_EXT) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetRenderbufferParameterivEXT(target)"); @@ -1721,8 +1763,6 @@ _mesa_BindFramebuffer(GLenum target, GLuint framebuffer) } #endif - ASSERT_OUTSIDE_BEGIN_END(ctx); - if (!ctx->Extensions.EXT_framebuffer_object) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBindFramebufferEXT(unsupported)"); @@ -1848,7 +1888,6 @@ _mesa_DeleteFramebuffers(GLsizei n, const GLuint *framebuffers) GLint i; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_BUFFERS); for (i = 0; i < n; i++) { @@ -1903,8 +1942,6 @@ _mesa_GenFramebuffers(GLsizei n, GLuint *framebuffers) GLuint first; GLint i; - ASSERT_OUTSIDE_BEGIN_END(ctx); - if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glGenFramebuffersEXT(n)"); return; @@ -2001,8 +2038,6 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, struct gl_framebuffer *fb; GLenum maxLevelsTarget; - ASSERT_OUTSIDE_BEGIN_END(ctx); - fb = get_framebuffer_target(ctx, target); if (!fb) { _mesa_error(ctx, GL_INVALID_ENUM, @@ -2276,8 +2311,6 @@ _mesa_FramebufferRenderbuffer(GLenum target, GLenum attachment, struct gl_renderbuffer *rb; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - fb = get_framebuffer_target(ctx, target); if (!fb) { _mesa_error(ctx, GL_INVALID_ENUM, "glFramebufferRenderbufferEXT(target)"); @@ -2359,8 +2392,6 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum err; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - /* The error differs in GL and GLES. */ err = _mesa_is_desktop_gl(ctx) ? GL_INVALID_OPERATION : GL_INVALID_ENUM; @@ -2524,6 +2555,22 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, } else { gl_format format = att->Renderbuffer->Format; + + /* Page 235 (page 247 of the PDF) in section 6.1.13 of the OpenGL ES + * 3.0.1 spec says: + * + * "If pname is FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE.... If + * attachment is DEPTH_STENCIL_ATTACHMENT the query will fail and + * generate an INVALID_OPERATION error. + */ + if (_mesa_is_gles3(ctx) && attachment == GL_DEPTH_STENCIL_ATTACHMENT) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetFramebufferAttachmentParameteriv(cannot query " + "GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE of " + "GL_DEPTH_STENCIL_ATTACHMENT"); + return; + } + if (format == MESA_FORMAT_S8) { /* special cases */ *params = GL_INDEX; @@ -2599,7 +2646,6 @@ _mesa_GenerateMipmap(GLenum target) GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_BUFFERS); switch (target) { @@ -2784,7 +2830,6 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, const struct gl_framebuffer *readFb, *drawFb; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_BUFFERS); if (MESA_VERBOSE & VERBOSE_API) @@ -2856,6 +2901,23 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, if (!colorDrawRb) continue; + /* Page 193 (page 205 of the PDF) in section 4.3.2 of the OpenGL + * ES 3.0.1 spec says: + * + * "If the source and destination buffers are identical, an + * INVALID_OPERATION error is generated. Different mipmap + * levels of a texture, different layers of a three- + * dimensional texture or two-dimensional array texture, and + * different faces of a cube map texture do not constitute + * identical buffers." + */ + if (_mesa_is_gles3(ctx) && (colorDrawRb == colorReadRb)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBlitFramebuffer(source and destination color " + "buffer cannot be the same)"); + return; + } + if (!compatible_color_datatypes(colorReadRb->Format, colorDrawRb->Format)) { _mesa_error(ctx, GL_INVALID_OPERATION, @@ -2905,6 +2967,13 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, else { int read_z_bits, draw_z_bits; + if (_mesa_is_gles3(ctx) && (drawRb == readRb)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBlitFramebuffer(source and destination stencil " + "buffer cannot be the same)"); + return; + } + if (_mesa_get_format_bits(readRb->Format, GL_STENCIL_BITS) != _mesa_get_format_bits(drawRb->Format, GL_STENCIL_BITS)) { /* There is no need to check the stencil datatype here, because @@ -2952,6 +3021,13 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, else { int read_s_bit, draw_s_bit; + if (_mesa_is_gles3(ctx) && (drawRb == readRb)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBlitFramebuffer(source and destination depth " + "buffer cannot be the same)"); + return; + } + if ((_mesa_get_format_bits(readRb->Format, GL_DEPTH_BITS) != _mesa_get_format_bits(drawRb->Format, GL_DEPTH_BITS)) || (_mesa_get_format_datatype(readRb->Format) != @@ -2976,23 +3052,58 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, } } - if (readFb->Visual.samples > 0 && - drawFb->Visual.samples > 0 && - readFb->Visual.samples != drawFb->Visual.samples) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glBlitFramebufferEXT(mismatched samples)"); - return; - } - /* extra checks for multisample copies... */ - if (readFb->Visual.samples > 0 || drawFb->Visual.samples > 0) { - /* src and dest region sizes must be the same */ - if (abs(srcX1 - srcX0) != abs(dstX1 - dstX0) || - abs(srcY1 - srcY0) != abs(dstY1 - dstY0)) { + if (_mesa_is_gles3(ctx)) { + /* Page 194 (page 206 of the PDF) in section 4.3.2 of the OpenGL ES + * 3.0.1 spec says: + * + * "If SAMPLE_BUFFERS for the draw framebuffer is greater than zero, + * an INVALID_OPERATION error is generated." + */ + if (drawFb->Visual.samples > 0) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glBlitFramebufferEXT(bad src/dst multisample region sizes)"); + "glBlitFramebuffer(destination samples must be 0)"); return; } + + /* Page 194 (page 206 of the PDF) in section 4.3.2 of the OpenGL ES + * 3.0.1 spec says: + * + * "If SAMPLE_BUFFERS for the read framebuffer is greater than zero, + * no copy is performed and an INVALID_OPERATION error is generated + * if the formats of the read and draw framebuffers are not + * identical or if the source and destination rectangles are not + * defined with the same (X0, Y0) and (X1, Y1) bounds." + * + * The format check was made above because desktop OpenGL has the same + * requirement. + */ + if (readFb->Visual.samples > 0 + && (srcX0 != dstX0 || srcY0 != dstY0 + || srcX1 != dstX1 || srcY1 != dstY1)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBlitFramebuffer(bad src/dst multisample region)"); + return; + } + } else { + if (readFb->Visual.samples > 0 && + drawFb->Visual.samples > 0 && + readFb->Visual.samples != drawFb->Visual.samples) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBlitFramebufferEXT(mismatched samples)"); + return; + } + + /* extra checks for multisample copies... */ + if (readFb->Visual.samples > 0 || drawFb->Visual.samples > 0) { + /* src and dest region sizes must be the same */ + if (abs(srcX1 - srcX0) != abs(dstX1 - dstX0) || + abs(srcY1 - srcY0) != abs(dstY1 - dstY0)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBlitFramebufferEXT(bad src/dst multisample region sizes)"); + return; + } + } } if (!ctx->Extensions.EXT_framebuffer_blit) { @@ -3070,8 +3181,6 @@ invalidate_framebuffer_storage(GLenum target, GLsizei numAttachments, struct gl_framebuffer *fb; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - fb = get_framebuffer_target(ctx, target); if (!fb) { _mesa_error(ctx, GL_INVALID_ENUM, "%s(target)", name); diff --git a/mesalib/src/mesa/main/feedback.c b/mesalib/src/mesa/main/feedback.c index 128a12622..5d4c6e40d 100644 --- a/mesalib/src/mesa/main/feedback.c +++ b/mesalib/src/mesa/main/feedback.c @@ -51,7 +51,6 @@ void GLAPIENTRY _mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->RenderMode==GL_FEEDBACK) { _mesa_error( ctx, GL_INVALID_OPERATION, "glFeedbackBuffer" ); @@ -100,7 +99,6 @@ void GLAPIENTRY _mesa_PassThrough( GLfloat token ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->RenderMode==GL_FEEDBACK) { FLUSH_VERTICES(ctx, 0); @@ -163,7 +161,6 @@ void GLAPIENTRY _mesa_SelectBuffer( GLsizei size, GLuint *buffer ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (size < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glSelectBuffer(size)"); @@ -275,7 +272,7 @@ void GLAPIENTRY _mesa_InitNames( void ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); /* Record the hit before the HitFlag is wiped out again. */ if (ctx->RenderMode == GL_SELECT) { @@ -306,7 +303,6 @@ void GLAPIENTRY _mesa_LoadName( GLuint name ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->RenderMode != GL_SELECT) { return; @@ -345,7 +341,6 @@ void GLAPIENTRY _mesa_PushName( GLuint name ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->RenderMode != GL_SELECT) { return; @@ -376,7 +371,6 @@ void GLAPIENTRY _mesa_PopName( void ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->RenderMode != GL_SELECT) { return; diff --git a/mesalib/src/mesa/main/fog.c b/mesalib/src/mesa/main/fog.c index b37e95f08..3c5228ad5 100644 --- a/mesalib/src/mesa/main/fog.c +++ b/mesalib/src/mesa/main/fog.c @@ -97,7 +97,6 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); GLenum m; - ASSERT_OUTSIDE_BEGIN_END(ctx); switch (pname) { case GL_FOG_MODE: diff --git a/mesalib/src/mesa/main/framebuffer.c b/mesalib/src/mesa/main/framebuffer.c index 8cbfbd6bc..d3abc2b30 100644 --- a/mesalib/src/mesa/main/framebuffer.c +++ b/mesalib/src/mesa/main/framebuffer.c @@ -335,7 +335,7 @@ _mesa_resize_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb, void _mesa_resizebuffers( struct gl_context *ctx ) { - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); + FLUSH_VERTICES(ctx, 0); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glResizeBuffersMESA\n"); @@ -871,13 +871,20 @@ _mesa_dest_buffer_exists(struct gl_context *ctx, GLenum format) GLenum _mesa_get_color_read_format(struct gl_context *ctx) { + const GLenum data_type = _mesa_get_format_datatype( + ctx->ReadBuffer->_ColorReadBuffer->Format); + switch (ctx->ReadBuffer->_ColorReadBuffer->Format) { case MESA_FORMAT_ARGB8888: return GL_BGRA; case MESA_FORMAT_RGB565: return GL_BGR; default: - return GL_RGBA; + if (data_type == GL_UNSIGNED_INT || data_type == GL_INT) { + return GL_RGBA_INTEGER; + } else { + return GL_RGBA; + } } } @@ -888,12 +895,25 @@ _mesa_get_color_read_format(struct gl_context *ctx) GLenum _mesa_get_color_read_type(struct gl_context *ctx) { + const GLenum data_type = _mesa_get_format_datatype( + ctx->ReadBuffer->_ColorReadBuffer->Format); + switch (ctx->ReadBuffer->_ColorReadBuffer->Format) { - case MESA_FORMAT_ARGB8888: - return GL_UNSIGNED_BYTE; case MESA_FORMAT_RGB565: return GL_UNSIGNED_SHORT_5_6_5_REV; default: + break; + } + + switch (data_type) { + case GL_SIGNED_NORMALIZED: + return GL_BYTE; + case GL_UNSIGNED_INT: + case GL_INT: + case GL_FLOAT: + return data_type; + case GL_UNSIGNED_NORMALIZED: + default: return GL_UNSIGNED_BYTE; } } diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c index 7d922ca15..5f4e2fa51 100644 --- a/mesalib/src/mesa/main/get.c +++ b/mesalib/src/mesa/main/get.c @@ -1076,9 +1076,6 @@ _mesa_GetBooleanv(GLenum pname, GLboolean *params) GLmatrix *m; int shift, i; void *p; - GET_CURRENT_CONTEXT(ctx); - - ASSERT_OUTSIDE_BEGIN_END(ctx); d = find_value("glGetBooleanv", pname, &p, &v); switch (d->type) { @@ -1165,9 +1162,6 @@ _mesa_GetFloatv(GLenum pname, GLfloat *params) GLmatrix *m; int shift, i; void *p; - GET_CURRENT_CONTEXT(ctx); - - ASSERT_OUTSIDE_BEGIN_END(ctx); d = find_value("glGetFloatv", pname, &p, &v); switch (d->type) { @@ -1254,9 +1248,6 @@ _mesa_GetIntegerv(GLenum pname, GLint *params) GLmatrix *m; int shift, i; void *p; - GET_CURRENT_CONTEXT(ctx); - - ASSERT_OUTSIDE_BEGIN_END(ctx); d = find_value("glGetIntegerv", pname, &p, &v); switch (d->type) { @@ -1349,9 +1340,6 @@ _mesa_GetInteger64v(GLenum pname, GLint64 *params) GLmatrix *m; int shift, i; void *p; - GET_CURRENT_CONTEXT(ctx); - - ASSERT_OUTSIDE_BEGIN_END(ctx); d = find_value("glGetInteger64v", pname, &p, &v); switch (d->type) { @@ -1444,9 +1432,6 @@ _mesa_GetDoublev(GLenum pname, GLdouble *params) GLmatrix *m; int shift, i; void *p; - GET_CURRENT_CONTEXT(ctx); - - ASSERT_OUTSIDE_BEGIN_END(ctx); d = find_value("glGetDoublev", pname, &p, &v); switch (d->type) { diff --git a/mesalib/src/mesa/main/getstring.c b/mesalib/src/mesa/main/getstring.c index 20e7a014d..1f23cc0a4 100644 --- a/mesalib/src/mesa/main/getstring.c +++ b/mesalib/src/mesa/main/getstring.c @@ -195,7 +195,6 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params ) { GET_CURRENT_CONTEXT(ctx); const GLuint clientUnit = ctx->Array.ActiveTexture; - ASSERT_OUTSIDE_BEGIN_END(ctx); if (!params) return; diff --git a/mesalib/src/mesa/main/glformats.c b/mesalib/src/mesa/main/glformats.c index 7969f77a4..e4f784179 100644 --- a/mesalib/src/mesa/main/glformats.c +++ b/mesalib/src/mesa/main/glformats.c @@ -1697,8 +1697,7 @@ _mesa_es_error_check_format_and_type(GLenum format, GLenum type, */ GLenum _mesa_es3_error_check_format_and_type(GLenum format, GLenum type, - GLenum internalFormat, - unsigned dimensions) + GLenum internalFormat) { GLboolean type_valid = GL_TRUE; @@ -2068,17 +2067,16 @@ _mesa_es3_error_check_format_and_type(GLenum format, GLenum type, break; case GL_DEPTH_COMPONENT: - if (dimensions != 2) { - return GL_INVALID_OPERATION; - } switch (type) { case GL_UNSIGNED_SHORT: - if (internalFormat != GL_DEPTH_COMPONENT16) + if (internalFormat != GL_DEPTH_COMPONENT + && internalFormat != GL_DEPTH_COMPONENT16) return GL_INVALID_OPERATION; break; case GL_UNSIGNED_INT: switch (internalFormat) { + case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT16: case GL_DEPTH_COMPONENT24: break; @@ -2098,12 +2096,10 @@ _mesa_es3_error_check_format_and_type(GLenum format, GLenum type, break; case GL_DEPTH_STENCIL: - if (dimensions != 2) { - return GL_INVALID_OPERATION; - } switch (type) { case GL_UNSIGNED_INT_24_8: - if (internalFormat != GL_DEPTH24_STENCIL8) + if (internalFormat != GL_DEPTH_STENCIL + && internalFormat != GL_DEPTH24_STENCIL8) return GL_INVALID_OPERATION; break; diff --git a/mesalib/src/mesa/main/glformats.h b/mesalib/src/mesa/main/glformats.h index 4cbc82f5e..cdd2b9427 100644 --- a/mesalib/src/mesa/main/glformats.h +++ b/mesalib/src/mesa/main/glformats.h @@ -122,8 +122,7 @@ _mesa_es_error_check_format_and_type(GLenum format, GLenum type, extern GLenum _mesa_es3_error_check_format_and_type(GLenum format, GLenum type, - GLenum internalFormat, - unsigned dimensions); + GLenum internalFormat); #ifdef __cplusplus diff --git a/mesalib/src/mesa/main/hint.c b/mesalib/src/mesa/main/hint.c index 83d7966cd..c2560192a 100644 --- a/mesalib/src/mesa/main/hint.c +++ b/mesalib/src/mesa/main/hint.c @@ -37,7 +37,6 @@ void GLAPIENTRY _mesa_Hint( GLenum target, GLenum mode ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glHint %s %s\n", diff --git a/mesalib/src/mesa/main/light.c b/mesalib/src/mesa/main/light.c index aae5d0ae9..3c43ec766 100644 --- a/mesalib/src/mesa/main/light.c +++ b/mesalib/src/mesa/main/light.c @@ -39,7 +39,6 @@ void GLAPIENTRY _mesa_ShadeModel( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glShadeModel %s\n", _mesa_lookup_enum_by_nr(mode)); @@ -69,7 +68,6 @@ void GLAPIENTRY _mesa_ProvokingVertex(GLenum mode) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glProvokingVertexEXT 0x%x\n", mode); @@ -212,7 +210,6 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params ) GET_CURRENT_CONTEXT(ctx); GLint i = (GLint) (light - GL_LIGHT0); GLfloat temp[4]; - ASSERT_OUTSIDE_BEGIN_END(ctx); if (i < 0 || i >= (GLint) ctx->Const.MaxLights) { _mesa_error( ctx, GL_INVALID_ENUM, "glLight(light=0x%x)", light ); @@ -335,7 +332,6 @@ _mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); GLint l = (GLint) (light - GL_LIGHT0); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (l < 0 || l >= (GLint) ctx->Const.MaxLights) { _mesa_error( ctx, GL_INVALID_ENUM, "glGetLightfv" ); @@ -385,7 +381,6 @@ _mesa_GetLightiv( GLenum light, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); GLint l = (GLint) (light - GL_LIGHT0); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (l < 0 || l >= (GLint) ctx->Const.MaxLights) { _mesa_error( ctx, GL_INVALID_ENUM, "glGetLightiv" ); @@ -456,7 +451,6 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params ) GLenum newenum; GLboolean newbool; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); switch (pname) { case GL_LIGHT_MODEL_AMBIENT: @@ -729,7 +723,6 @@ _mesa_ColorMaterial( GLenum face, GLenum mode ) MAT_BIT_FRONT_SPECULAR | MAT_BIT_BACK_SPECULAR | MAT_BIT_FRONT_DIFFUSE | MAT_BIT_BACK_DIFFUSE | MAT_BIT_FRONT_AMBIENT | MAT_BIT_BACK_AMBIENT); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glColorMaterial %s %s\n", @@ -766,7 +759,7 @@ _mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params ) GET_CURRENT_CONTEXT(ctx); GLuint f; GLfloat (*mat)[4] = ctx->Light.Material.Attrib; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* update materials */ + FLUSH_VERTICES(ctx, 0); /* update materials */ FLUSH_CURRENT(ctx, 0); /* update ctx->Light.Material from vertex buffer */ @@ -818,10 +811,10 @@ _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params ) GET_CURRENT_CONTEXT(ctx); GLuint f; GLfloat (*mat)[4] = ctx->Light.Material.Attrib; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* update materials */ ASSERT(ctx->API == API_OPENGL_COMPAT); + FLUSH_VERTICES(ctx, 0); /* update materials */ FLUSH_CURRENT(ctx, 0); /* update ctx->Light.Material from vertex buffer */ if (face==GL_FRONT) { diff --git a/mesalib/src/mesa/main/lines.c b/mesalib/src/mesa/main/lines.c index e400b3913..a01219c42 100644 --- a/mesalib/src/mesa/main/lines.c +++ b/mesalib/src/mesa/main/lines.c @@ -41,7 +41,6 @@ void GLAPIENTRY _mesa_LineWidth( GLfloat width ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glLineWidth %f\n", width); @@ -95,7 +94,6 @@ void GLAPIENTRY _mesa_LineStipple( GLint factor, GLushort pattern ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glLineStipple %d %u\n", factor, pattern); diff --git a/mesalib/src/mesa/main/matrix.c b/mesalib/src/mesa/main/matrix.c index a4e576237..f2fd56787 100644 --- a/mesalib/src/mesa/main/matrix.c +++ b/mesalib/src/mesa/main/matrix.c @@ -68,7 +68,8 @@ _mesa_Frustum( GLdouble left, GLdouble right, GLdouble nearval, GLdouble farval ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); if (nearval <= 0.0 || farval <= 0.0 || @@ -110,7 +111,8 @@ _mesa_Ortho( GLdouble left, GLdouble right, GLdouble nearval, GLdouble farval ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glOrtho(%f, %f, %f, %f, %f, %f)\n", @@ -147,7 +149,6 @@ void GLAPIENTRY _mesa_MatrixMode( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->Transform.MatrixMode == mode && mode != GL_TEXTURE) return; @@ -226,7 +227,6 @@ _mesa_PushMatrix( void ) { GET_CURRENT_CONTEXT(ctx); struct gl_matrix_stack *stack = ctx->CurrentStack; - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glPushMatrix %s\n", @@ -266,7 +266,8 @@ _mesa_PopMatrix( void ) { GET_CURRENT_CONTEXT(ctx); struct gl_matrix_stack *stack = ctx->CurrentStack; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glPopMatrix %s\n", @@ -303,7 +304,8 @@ void GLAPIENTRY _mesa_LoadIdentity( void ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glLoadIdentity()\n"); @@ -337,7 +339,7 @@ _mesa_LoadMatrixf( const GLfloat *m ) m[2], m[6], m[10], m[14], m[3], m[7], m[11], m[15]); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); _math_matrix_loadf( ctx->CurrentStack->Top, m ); ctx->NewState |= ctx->CurrentStack->DirtyFlag; } @@ -366,7 +368,8 @@ _mesa_MultMatrixf( const GLfloat *m ) m[1], m[5], m[9], m[13], m[2], m[6], m[10], m[14], m[3], m[7], m[11], m[15]); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); _math_matrix_mul_floats( ctx->CurrentStack->Top, m ); ctx->NewState |= ctx->CurrentStack->DirtyFlag; } @@ -390,7 +393,8 @@ void GLAPIENTRY _mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); if (angle != 0.0F) { _math_matrix_rotate( ctx->CurrentStack->Top, angle, x, y, z); ctx->NewState |= ctx->CurrentStack->DirtyFlag; @@ -415,7 +419,8 @@ void GLAPIENTRY _mesa_Scalef( GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); _math_matrix_scale( ctx->CurrentStack->Top, x, y, z); ctx->NewState |= ctx->CurrentStack->DirtyFlag; } @@ -438,7 +443,8 @@ void GLAPIENTRY _mesa_Translatef( GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); _math_matrix_translate( ctx->CurrentStack->Top, x, y, z); ctx->NewState |= ctx->CurrentStack->DirtyFlag; } diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index d0c0e24ac..ead75d50e 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -2274,7 +2274,6 @@ struct gl_uniform_buffer_variable { char *Name; const struct glsl_type *Type; - unsigned int Buffer; unsigned int Offset; GLboolean RowMajor; }; @@ -3134,6 +3133,7 @@ struct gl_extensions GLboolean S3_s3tc; GLboolean OES_EGL_image; GLboolean OES_draw_texture; + GLboolean OES_depth_texture_cube_map; GLboolean OES_EGL_image_external; GLboolean OES_compressed_ETC1_RGB8_texture; GLboolean extension_sentinel; @@ -3440,9 +3440,28 @@ struct gl_context /** \name API function pointer tables */ /*@{*/ gl_api API; - struct _glapi_table *Save; /**< Display list save functions */ - struct _glapi_table *Exec; /**< Execute functions */ - struct _glapi_table *CurrentDispatch; /**< == Save or Exec !! */ + /** + * The current dispatch table for non-displaylist-saving execution, either + * BeginEnd or OutsideBeginEnd + */ + struct _glapi_table *Exec; + /** + * The normal dispatch table for non-displaylist-saving, non-begin/end + */ + struct _glapi_table *OutsideBeginEnd; + /** The dispatch table used between glNewList() and glEndList() */ + struct _glapi_table *Save; + /** + * The dispatch table used between glBegin() and glEnd() (outside of a + * display list). Only valid functions between those two are set, which is + * mostly just the set in a GLvertexformat struct. + */ + struct _glapi_table *BeginEnd; + /** + * Tracks the current dispatch table out of the 3 above, so that it can be + * re-set on glXMakeCurrent(). + */ + struct _glapi_table *CurrentDispatch; /*@}*/ struct gl_config Visual; diff --git a/mesalib/src/mesa/main/multisample.c b/mesalib/src/mesa/main/multisample.c index 347e98e4e..f792ad01e 100644 --- a/mesalib/src/mesa/main/multisample.c +++ b/mesalib/src/mesa/main/multisample.c @@ -38,7 +38,7 @@ _mesa_SampleCoverage(GLclampf value, GLboolean invert) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); + FLUSH_VERTICES(ctx, 0); ctx->Multisample.SampleCoverageValue = (GLfloat) CLAMP(value, 0.0, 1.0); ctx->Multisample.SampleCoverageInvert = invert; diff --git a/mesalib/src/mesa/main/pixel.c b/mesalib/src/mesa/main/pixel.c index 9940eda52..e9f75a7df 100644 --- a/mesalib/src/mesa/main/pixel.c +++ b/mesalib/src/mesa/main/pixel.c @@ -49,8 +49,6 @@ _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - if (ctx->Pixel.ZoomX == xfactor && ctx->Pixel.ZoomY == yfactor) return; @@ -181,7 +179,6 @@ void GLAPIENTRY _mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); /* XXX someday, test against ctx->Const.MaxPixelMapTableSize */ if (mapsize < 1 || mapsize > MAX_PIXEL_MAP_TABLE) { @@ -224,7 +221,6 @@ _mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values ) { GLfloat fvalues[MAX_PIXEL_MAP_TABLE]; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (mapsize < 1 || mapsize > MAX_PIXEL_MAP_TABLE) { _mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapuiv(mapsize)" ); @@ -280,7 +276,6 @@ _mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values ) { GLfloat fvalues[MAX_PIXEL_MAP_TABLE]; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (mapsize < 1 || mapsize > MAX_PIXEL_MAP_TABLE) { _mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapusv(mapsize)" ); @@ -338,8 +333,6 @@ _mesa_GetnPixelMapfvARB( GLenum map, GLsizei bufSize, GLfloat *values ) GLint mapsize, i; const struct gl_pixelmap *pm; - ASSERT_OUTSIDE_BEGIN_END(ctx); - pm = get_pixelmap(ctx, map); if (!pm) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelMapfv(map)"); @@ -389,8 +382,6 @@ _mesa_GetnPixelMapuivARB( GLenum map, GLsizei bufSize, GLuint *values ) GLint mapsize, i; const struct gl_pixelmap *pm; - ASSERT_OUTSIDE_BEGIN_END(ctx); - pm = get_pixelmap(ctx, map); if (!pm) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelMapuiv(map)"); @@ -440,8 +431,6 @@ _mesa_GetnPixelMapusvARB( GLenum map, GLsizei bufSize, GLushort *values ) GLint mapsize, i; const struct gl_pixelmap *pm; - ASSERT_OUTSIDE_BEGIN_END(ctx); - pm = get_pixelmap(ctx, map); if (!pm) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelMapusv(map)"); @@ -506,7 +495,6 @@ void GLAPIENTRY _mesa_PixelTransferf( GLenum pname, GLfloat param ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); switch (pname) { case GL_MAP_COLOR: diff --git a/mesalib/src/mesa/main/pixelstore.c b/mesalib/src/mesa/main/pixelstore.c index e56d5049f..01068e8ea 100644 --- a/mesalib/src/mesa/main/pixelstore.c +++ b/mesalib/src/mesa/main/pixelstore.c @@ -41,7 +41,6 @@ _mesa_PixelStorei( GLenum pname, GLint param ) { /* NOTE: this call can't be compiled into the display list */ GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); switch (pname) { case GL_PACK_SWAP_BYTES: diff --git a/mesalib/src/mesa/main/points.c b/mesalib/src/mesa/main/points.c index b5fc5d5bb..17786408c 100644 --- a/mesalib/src/mesa/main/points.c +++ b/mesalib/src/mesa/main/points.c @@ -44,7 +44,6 @@ void GLAPIENTRY _mesa_PointSize( GLfloat size ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (size <= 0.0) { _mesa_error( ctx, GL_INVALID_VALUE, "glPointSize" ); @@ -99,7 +98,6 @@ void GLAPIENTRY _mesa_PointParameterfv( GLenum pname, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); /* Drivers that support point sprites must also support point parameters. * If point parameters aren't supported, then this function shouldn't even diff --git a/mesalib/src/mesa/main/polygon.c b/mesalib/src/mesa/main/polygon.c index eb53f8a4a..cdef01a2f 100644 --- a/mesalib/src/mesa/main/polygon.c +++ b/mesalib/src/mesa/main/polygon.c @@ -54,7 +54,6 @@ void GLAPIENTRY _mesa_CullFace( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glCullFace %s\n", _mesa_lookup_enum_by_nr(mode)); @@ -90,7 +89,6 @@ void GLAPIENTRY _mesa_FrontFace( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glFrontFace %s\n", _mesa_lookup_enum_by_nr(mode)); @@ -129,7 +127,6 @@ void GLAPIENTRY _mesa_PolygonMode( GLenum face, GLenum mode ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glPolygonMode %s %s\n", @@ -220,7 +217,6 @@ void GLAPIENTRY _mesa_PolygonStipple( const GLubyte *pattern ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glPolygonStipple\n"); @@ -241,7 +237,6 @@ void GLAPIENTRY _mesa_GetnPolygonStippleARB( GLsizei bufSize, GLubyte *dest ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glGetPolygonStipple\n"); @@ -270,7 +265,6 @@ void GLAPIENTRY _mesa_PolygonOffset( GLfloat factor, GLfloat units ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glPolygonOffset %f %f\n", factor, units); diff --git a/mesalib/src/mesa/main/queryobj.c b/mesalib/src/mesa/main/queryobj.c index bd7d0d297..3fdb75323 100644 --- a/mesalib/src/mesa/main/queryobj.c +++ b/mesalib/src/mesa/main/queryobj.c @@ -192,7 +192,6 @@ _mesa_GenQueries(GLsizei n, GLuint *ids) { GLuint first; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glGenQueries(%d)\n", n); @@ -231,7 +230,6 @@ _mesa_DeleteQueries(GLsizei n, const GLuint *ids) { GLint i; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, 0); if (MESA_VERBOSE & VERBOSE_API) @@ -309,7 +307,6 @@ _mesa_BeginQueryIndexed(GLenum target, GLuint index, GLuint id) { struct gl_query_object *q, **bindpt; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glBeginQueryIndexed(%s, %u, %u)\n", @@ -387,7 +384,6 @@ _mesa_EndQueryIndexed(GLenum target, GLuint index) { struct gl_query_object *q, **bindpt; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glEndQueryIndexed(%s, %u)\n", @@ -445,7 +441,6 @@ _mesa_QueryCounter(GLuint id, GLenum target) { struct gl_query_object *q; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glQueryCounter(%u, %s)\n", id, @@ -503,7 +498,6 @@ _mesa_GetQueryIndexediv(GLenum target, GLuint index, GLenum pname, { struct gl_query_object *q = NULL, **bindpt = NULL; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glGetQueryIndexediv(%s, %u, %s)\n", @@ -583,7 +577,6 @@ _mesa_GetQueryObjectiv(GLuint id, GLenum pname, GLint *params) { struct gl_query_object *q = NULL; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glGetQueryObjectiv(%u, %s)\n", id, @@ -635,7 +628,6 @@ _mesa_GetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params) { struct gl_query_object *q = NULL; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glGetQueryObjectuiv(%u, %s)\n", id, @@ -690,7 +682,6 @@ _mesa_GetQueryObjecti64v(GLuint id, GLenum pname, GLint64EXT *params) { struct gl_query_object *q = NULL; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glGetQueryObjecti64v(%u, %s)\n", id, @@ -731,7 +722,6 @@ _mesa_GetQueryObjectui64v(GLuint id, GLenum pname, GLuint64EXT *params) { struct gl_query_object *q = NULL; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glGetQueryObjectui64v(%u, %s)\n", id, @@ -763,33 +753,6 @@ _mesa_GetQueryObjectui64v(GLuint id, GLenum pname, GLuint64EXT *params) } } - -void -_mesa_init_queryobj_dispatch(const struct gl_context *ctx, - struct _glapi_table *disp) -{ - SET_GenQueries(disp, _mesa_GenQueries); - SET_DeleteQueries(disp, _mesa_DeleteQueries); - SET_IsQuery(disp, _mesa_IsQuery); - SET_BeginQuery(disp, _mesa_BeginQuery); - SET_EndQuery(disp, _mesa_EndQuery); - SET_GetQueryiv(disp, _mesa_GetQueryiv); - SET_GetQueryObjectuiv(disp, _mesa_GetQueryObjectuiv); - - if (_mesa_is_desktop_gl(ctx)) { - SET_GetQueryObjectiv(disp, _mesa_GetQueryObjectiv); - SET_QueryCounter(disp, _mesa_QueryCounter); - - SET_GetQueryObjecti64v(disp, _mesa_GetQueryObjecti64v); - SET_GetQueryObjectui64v(disp, _mesa_GetQueryObjectui64v); - - SET_BeginQueryIndexed(disp, _mesa_BeginQueryIndexed); - SET_EndQueryIndexed(disp, _mesa_EndQueryIndexed); - SET_GetQueryIndexediv(disp, _mesa_GetQueryIndexediv); - } -} - - /** * Allocate/init the context state related to query objects. */ diff --git a/mesalib/src/mesa/main/queryobj.h b/mesalib/src/mesa/main/queryobj.h index 78cbfc294..0616c943e 100644 --- a/mesalib/src/mesa/main/queryobj.h +++ b/mesalib/src/mesa/main/queryobj.h @@ -44,10 +44,6 @@ extern void _mesa_init_query_object_functions(struct dd_function_table *driver); extern void -_mesa_init_queryobj_dispatch(const struct gl_context *ctx, - struct _glapi_table *disp); - -extern void _mesa_init_queryobj(struct gl_context *ctx); extern void diff --git a/mesalib/src/mesa/main/rastpos.c b/mesalib/src/mesa/main/rastpos.c index 51747acab..5a030be44 100644 --- a/mesalib/src/mesa/main/rastpos.c +++ b/mesalib/src/mesa/main/rastpos.c @@ -53,7 +53,7 @@ rasterpos(GLfloat x, GLfloat y, GLfloat z, GLfloat w) p[2] = z; p[3] = w; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); FLUSH_CURRENT(ctx, 0); if (ctx->NewState) @@ -225,7 +225,7 @@ window_pos3f(GLfloat x, GLfloat y, GLfloat z) GET_CURRENT_CONTEXT(ctx); GLfloat z2; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); FLUSH_CURRENT(ctx, 0); z2 = CLAMP(z, 0.0F, 1.0F) * (ctx->Viewport.Far - ctx->Viewport.Near) diff --git a/mesalib/src/mesa/main/readpix.c b/mesalib/src/mesa/main/readpix.c index 5b80e9a8b..2f130ae9a 100644 --- a/mesalib/src/mesa/main/readpix.c +++ b/mesalib/src/mesa/main/readpix.c @@ -674,16 +674,65 @@ _mesa_readpixels(struct gl_context *ctx, } +static GLenum +read_pixels_es3_error_check(GLenum format, GLenum type, + const struct gl_renderbuffer *rb) +{ + const GLenum internalFormat = rb->InternalFormat; + const GLenum data_type = _mesa_get_format_datatype(rb->Format); + GLboolean is_unsigned_int = GL_FALSE; + GLboolean is_signed_int = GL_FALSE; + + if (!_mesa_is_color_format(internalFormat)) { + return GL_INVALID_OPERATION; + } + + is_unsigned_int = _mesa_is_enum_format_unsigned_int(internalFormat); + if (!is_unsigned_int) { + is_signed_int = _mesa_is_enum_format_signed_int(internalFormat); + } + + switch (format) { + case GL_RGBA: + if (type == GL_FLOAT && data_type == GL_FLOAT) + return GL_NO_ERROR; /* EXT_color_buffer_float */ + if (type == GL_UNSIGNED_BYTE && data_type == GL_UNSIGNED_NORMALIZED) + return GL_NO_ERROR; + if (internalFormat == GL_RGB10_A2 && + type == GL_UNSIGNED_INT_2_10_10_10_REV) + return GL_NO_ERROR; + if (internalFormat == GL_RGB10_A2UI && type == GL_UNSIGNED_BYTE) + return GL_NO_ERROR; + break; + case GL_BGRA: + /* GL_EXT_read_format_bgra */ + if (type == GL_UNSIGNED_BYTE || + type == GL_UNSIGNED_SHORT_4_4_4_4_REV || + type == GL_UNSIGNED_SHORT_1_5_5_5_REV) + return GL_NO_ERROR; + break; + case GL_RGBA_INTEGER: + if ((is_signed_int && type == GL_INT) || + (is_unsigned_int && type == GL_UNSIGNED_INT)) + return GL_NO_ERROR; + break; + } + + return GL_INVALID_OPERATION; +} + + void GLAPIENTRY _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *pixels ) { GLenum err = GL_NO_ERROR; + struct gl_renderbuffer *rb; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); FLUSH_CURRENT(ctx, 0); if (MESA_VERBOSE & VERBOSE_API) @@ -699,6 +748,22 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height, return; } + if (ctx->NewState) + _mesa_update_state(ctx); + + if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { + _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, + "glReadPixels(incomplete framebuffer)" ); + return; + } + + rb = _mesa_get_read_renderbuffer_for_format(ctx, format); + if (rb == NULL) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glReadPixels(read buffer)"); + return; + } + /* OpenGL ES 1.x and OpenGL ES 2.0 impose additional restrictions on the * combinations of format and type that can be used. * @@ -708,13 +773,20 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height, * combination is, and Mesa can handle anything valid. Just work instead. */ if (_mesa_is_gles(ctx)) { - if (ctx->Version < 30) { + if (ctx->API == API_OPENGLES2 && + _mesa_is_color_format(format) && + _mesa_get_color_read_format(ctx) == format && + _mesa_get_color_read_type(ctx) == type) { + err = GL_NO_ERROR; + } else if (ctx->Version < 30) { err = _mesa_es_error_check_format_and_type(format, type, 2); if (err == GL_NO_ERROR) { if (type == GL_FLOAT || type == GL_HALF_FLOAT_OES) { err = GL_INVALID_OPERATION; } } + } else { + err = read_pixels_es3_error_check(format, type, rb); } if (err == GL_NO_ERROR && (format == GL_DEPTH_COMPONENT @@ -730,9 +802,6 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height, } } - if (ctx->NewState) - _mesa_update_state(ctx); - err = _mesa_error_check_format_and_type(ctx, format, type); if (err != GL_NO_ERROR) { _mesa_error(ctx, err, "glReadPixels(invalid format %s and/or type %s)", @@ -741,12 +810,6 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height, return; } - if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { - _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, - "glReadPixels(incomplete framebuffer)" ); - return; - } - if (_mesa_is_user_fbo(ctx->ReadBuffer) && ctx->ReadBuffer->Visual.samples > 0) { _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(multisample FBO)"); diff --git a/mesalib/src/mesa/main/samplerobj.c b/mesalib/src/mesa/main/samplerobj.c index 773bebf26..319a444d7 100644 --- a/mesalib/src/mesa/main/samplerobj.c +++ b/mesalib/src/mesa/main/samplerobj.c @@ -166,8 +166,6 @@ _mesa_GenSamplers(GLsizei count, GLuint *samplers) GLuint first; GLint i; - ASSERT_OUTSIDE_BEGIN_END(ctx); - if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glGenSamplers(%d)\n", count); @@ -197,7 +195,6 @@ _mesa_DeleteSamplers(GLsizei count, const GLuint *samplers) GET_CURRENT_CONTEXT(ctx); GLsizei i; - ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, 0); if (count < 0) { @@ -606,8 +603,6 @@ _mesa_SamplerParameteri(GLuint sampler, GLenum pname, GLint param) GLuint res; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - sampObj = _mesa_lookup_samplerobj(ctx, sampler); if (!sampObj) { _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameteri(sampler %u)", @@ -693,8 +688,6 @@ _mesa_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param) GLuint res; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - sampObj = _mesa_lookup_samplerobj(ctx, sampler); if (!sampObj) { _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameterf(sampler %u)", @@ -779,8 +772,6 @@ _mesa_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params) GLuint res; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - sampObj = _mesa_lookup_samplerobj(ctx, sampler); if (!sampObj) { _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameteriv(sampler %u)", @@ -873,8 +864,6 @@ _mesa_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params) GLuint res; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - sampObj = _mesa_lookup_samplerobj(ctx, sampler); if (!sampObj) { _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameterfv(sampler %u)", @@ -960,8 +949,6 @@ _mesa_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params) GLuint res; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - sampObj = _mesa_lookup_samplerobj(ctx, sampler); if (!sampObj) { _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameterIiv(sampler %u)", @@ -1048,8 +1035,6 @@ _mesa_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params) GLuint res; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - sampObj = _mesa_lookup_samplerobj(ctx, sampler); if (!sampObj) { _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameterIuiv(sampler %u)", @@ -1135,8 +1120,6 @@ _mesa_GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params) struct gl_sampler_object *sampObj; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - sampObj = _mesa_lookup_samplerobj(ctx, sampler); if (!sampObj) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetSamplerParameteriv(sampler %u)", @@ -1215,8 +1198,6 @@ _mesa_GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params) struct gl_sampler_object *sampObj; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - sampObj = _mesa_lookup_samplerobj(ctx, sampler); if (!sampObj) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetSamplerParameterfv(sampler %u)", @@ -1295,8 +1276,6 @@ _mesa_GetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params) struct gl_sampler_object *sampObj; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - sampObj = _mesa_lookup_samplerobj(ctx, sampler); if (!sampObj) { _mesa_error(ctx, GL_INVALID_VALUE, @@ -1376,8 +1355,6 @@ _mesa_GetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params) struct gl_sampler_object *sampObj; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - sampObj = _mesa_lookup_samplerobj(ctx, sampler); if (!sampObj) { _mesa_error(ctx, GL_INVALID_VALUE, @@ -1457,27 +1434,3 @@ _mesa_init_sampler_object_functions(struct dd_function_table *driver) driver->NewSamplerObject = _mesa_new_sampler_object; driver->DeleteSamplerObject = _mesa_delete_sampler_object; } - - -void -_mesa_init_sampler_object_dispatch(const struct gl_context *ctx, - struct _glapi_table *disp) -{ - SET_GenSamplers(disp, _mesa_GenSamplers); - SET_DeleteSamplers(disp, _mesa_DeleteSamplers); - SET_IsSampler(disp, _mesa_IsSampler); - SET_BindSampler(disp, _mesa_BindSampler); - SET_SamplerParameteri(disp, _mesa_SamplerParameteri); - SET_SamplerParameterf(disp, _mesa_SamplerParameterf); - SET_SamplerParameteriv(disp, _mesa_SamplerParameteriv); - SET_SamplerParameterfv(disp, _mesa_SamplerParameterfv); - SET_GetSamplerParameteriv(disp, _mesa_GetSamplerParameteriv); - SET_GetSamplerParameterfv(disp, _mesa_GetSamplerParameterfv); - - if (_mesa_is_desktop_gl(ctx)) { - SET_SamplerParameterIiv(disp, _mesa_SamplerParameterIiv); - SET_SamplerParameterIuiv(disp, _mesa_SamplerParameterIuiv); - SET_GetSamplerParameterIiv(disp, _mesa_GetSamplerParameterIiv); - SET_GetSamplerParameterIuiv(disp, _mesa_GetSamplerParameterIuiv); - } -} diff --git a/mesalib/src/mesa/main/samplerobj.h b/mesalib/src/mesa/main/samplerobj.h index dce7c6c30..311425701 100644 --- a/mesalib/src/mesa/main/samplerobj.h +++ b/mesalib/src/mesa/main/samplerobj.h @@ -69,10 +69,6 @@ _mesa_new_sampler_object(struct gl_context *ctx, GLuint name); extern void _mesa_init_sampler_object_functions(struct dd_function_table *driver); -extern void -_mesa_init_sampler_object_dispatch(const struct gl_context *ctx, - struct _glapi_table *disp); - void GLAPIENTRY _mesa_GenSamplers(GLsizei count, GLuint *samplers); void GLAPIENTRY diff --git a/mesalib/src/mesa/main/scissor.c b/mesalib/src/mesa/main/scissor.c index df665994a..0c2a91f5c 100644 --- a/mesalib/src/mesa/main/scissor.c +++ b/mesalib/src/mesa/main/scissor.c @@ -36,7 +36,6 @@ void GLAPIENTRY _mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glScissor %d %d %d %d\n", x, y, width, height); diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c index 7f5fce796..2590abe7e 100644 --- a/mesalib/src/mesa/main/shaderapi.c +++ b/mesalib/src/mesa/main/shaderapi.c @@ -1400,8 +1400,6 @@ _mesa_UseProgram(GLhandleARB program) GET_CURRENT_CONTEXT(ctx); struct gl_shader_program *shProg; - ASSERT_OUTSIDE_BEGIN_END(ctx); - if (_mesa_is_xfb_active_and_unpaused(ctx)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glUseProgram(transform feedback active)"); @@ -1522,8 +1520,6 @@ _mesa_GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, struct gl_shader_program *shProg; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetProgramBinary"); if (!shProg) return; @@ -1558,8 +1554,6 @@ _mesa_ProgramBinary(GLuint program, GLenum binaryFormat, struct gl_shader_program *shProg; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramBinary"); if (!shProg) return; @@ -1577,8 +1571,6 @@ _mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value) struct gl_shader_program *shProg; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramParameteri"); if (!shProg) @@ -1707,8 +1699,6 @@ _mesa_UseShaderProgramEXT(GLenum type, GLuint program) GET_CURRENT_CONTEXT(ctx); struct gl_shader_program *shProg = NULL; - ASSERT_OUTSIDE_BEGIN_END(ctx); - if (!validate_shader_target(ctx, type)) { _mesa_error(ctx, GL_INVALID_ENUM, "glUseShaderProgramEXT(type)"); return; @@ -1799,84 +1789,3 @@ _mesa_CreateShaderProgramEXT(GLenum type, const GLchar *string) return program; } - -/** - * Plug in shader-related functions into API dispatch table. - */ -void -_mesa_init_shader_dispatch(const struct gl_context *ctx, - struct _glapi_table *exec) -{ -#if FEATURE_GL - /* GL_ARB_vertex/fragment_shader */ - if (_mesa_is_desktop_gl(ctx)) { - SET_DeleteObjectARB(exec, _mesa_DeleteObjectARB); - SET_GetHandleARB(exec, _mesa_GetHandleARB); - SET_DetachObjectARB(exec, _mesa_DetachObjectARB); - SET_CreateShaderObjectARB(exec, _mesa_CreateShaderObjectARB); - SET_CreateProgramObjectARB(exec, _mesa_CreateProgramObjectARB); - SET_AttachObjectARB(exec, _mesa_AttachObjectARB); - SET_GetObjectParameterfvARB(exec, _mesa_GetObjectParameterfvARB); - SET_GetObjectParameterivARB(exec, _mesa_GetObjectParameterivARB); - SET_GetInfoLogARB(exec, _mesa_GetInfoLogARB); - SET_GetAttachedObjectsARB(exec, _mesa_GetAttachedObjectsARB); - } - - if (ctx->API != API_OPENGLES) { - SET_ShaderSource(exec, _mesa_ShaderSource); - SET_CompileShader(exec, _mesa_CompileShader); - SET_LinkProgram(exec, _mesa_LinkProgram); - SET_UseProgram(exec, _mesa_UseProgram); - SET_ValidateProgram(exec, _mesa_ValidateProgram); - SET_GetShaderSource(exec, _mesa_GetShaderSource); - - /* OpenGL 2.0 */ - SET_AttachShader(exec, _mesa_AttachShader); - SET_CreateProgram(exec, _mesa_CreateProgram); - SET_CreateShader(exec, _mesa_CreateShader); - SET_DeleteProgram(exec, _mesa_DeleteProgram); - SET_DeleteShader(exec, _mesa_DeleteShader); - SET_DetachShader(exec, _mesa_DetachShader); - SET_GetAttachedShaders(exec, _mesa_GetAttachedShaders); - SET_GetProgramiv(exec, _mesa_GetProgramiv); - SET_GetProgramInfoLog(exec, _mesa_GetProgramInfoLog); - SET_GetShaderiv(exec, _mesa_GetShaderiv); - SET_GetShaderInfoLog(exec, _mesa_GetShaderInfoLog); - SET_IsProgram(exec, _mesa_IsProgram); - SET_IsShader(exec, _mesa_IsShader); - - /* GL_ARB_vertex_shader */ - SET_BindAttribLocation(exec, _mesa_BindAttribLocation); - SET_GetActiveAttrib(exec, _mesa_GetActiveAttrib); - SET_GetAttribLocation(exec, _mesa_GetAttribLocation); - } - - if (ctx->API == API_OPENGL_COMPAT) { - SET_UseShaderProgramEXT(exec, _mesa_UseShaderProgramEXT); - SET_ActiveProgramEXT(exec, _mesa_ActiveProgramEXT); - SET_CreateShaderProgramEXT(exec, _mesa_CreateShaderProgramEXT); - } - - /* GL_EXT_gpu_shader4 / GL 3.0 */ - if (_mesa_is_desktop_gl(ctx)) { - SET_BindFragDataLocation(exec, _mesa_BindFragDataLocation); - } - if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) { - SET_GetFragDataLocation(exec, _mesa_GetFragDataLocation); - } - - /* GL_ARB_ES2_compatibility */ - if (ctx->API != API_OPENGLES) { - SET_ReleaseShaderCompiler(exec, _mesa_ReleaseShaderCompiler); - SET_GetShaderPrecisionFormat(exec, _mesa_GetShaderPrecisionFormat); - SET_ShaderBinary(exec, _mesa_ShaderBinary); - } - - /* GL_ARB_blend_func_extended */ - if (_mesa_is_desktop_gl(ctx)) { - SET_BindFragDataLocationIndexed(exec, _mesa_BindFragDataLocationIndexed); - SET_GetFragDataIndex(exec, _mesa_GetFragDataIndex); - } -#endif /* FEATURE_GL */ -} - diff --git a/mesalib/src/mesa/main/shaderapi.h b/mesalib/src/mesa/main/shaderapi.h index d3199db96..342b58905 100644 --- a/mesalib/src/mesa/main/shaderapi.h +++ b/mesalib/src/mesa/main/shaderapi.h @@ -50,10 +50,6 @@ extern void _mesa_active_program(struct gl_context *ctx, struct gl_shader_program *shProg, const char *caller); -extern void -_mesa_init_shader_dispatch(const struct gl_context *ctx, - struct _glapi_table *exec); - extern unsigned _mesa_count_active_attribs(struct gl_shader_program *shProg); diff --git a/mesalib/src/mesa/main/stencil.c b/mesalib/src/mesa/main/stencil.c index 8d2948b8e..c161808e5 100644 --- a/mesalib/src/mesa/main/stencil.c +++ b/mesalib/src/mesa/main/stencil.c @@ -108,7 +108,6 @@ void GLAPIENTRY _mesa_ClearStencil( GLint s ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->Stencil.Clear == (GLuint) s) return; @@ -137,7 +136,6 @@ _mesa_StencilFuncSeparateATI( GLenum frontfunc, GLenum backfunc, GLint ref, GLui { GET_CURRENT_CONTEXT(ctx); const GLint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1; - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glStencilFuncSeparateATI()\n"); @@ -196,7 +194,6 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask ) GET_CURRENT_CONTEXT(ctx); const GLint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1; const GLint face = ctx->Stencil.ActiveFace; - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glStencilFunc()\n"); @@ -268,8 +265,6 @@ _mesa_StencilMask( GLuint mask ) if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glStencilMask()\n"); - ASSERT_OUTSIDE_BEGIN_END(ctx); - if (face != 0) { /* Only modify the EXT_stencil_two_side back-face state. */ @@ -325,8 +320,6 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass) if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glStencilOp()\n"); - ASSERT_OUTSIDE_BEGIN_END(ctx); - if (!validate_stencil_op(ctx, fail)) { _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp(sfail)"); return; @@ -387,7 +380,6 @@ void GLAPIENTRY _mesa_ActiveStencilFaceEXT(GLenum face) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glActiveStencilFaceEXT()\n"); @@ -419,7 +411,6 @@ _mesa_StencilOpSeparate(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass) { GLboolean set = GL_FALSE; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glStencilOpSeparate()\n"); @@ -477,7 +468,6 @@ _mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) { GET_CURRENT_CONTEXT(ctx); const GLint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1; - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glStencilFuncSeparate()\n"); @@ -518,7 +508,6 @@ void GLAPIENTRY _mesa_StencilMaskSeparate(GLenum face, GLuint mask) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glStencilMaskSeparate()\n"); diff --git a/mesalib/src/mesa/main/syncobj.c b/mesalib/src/mesa/main/syncobj.c index f155fea8b..67eb2d357 100644..100755 --- a/mesalib/src/mesa/main/syncobj.c +++ b/mesalib/src/mesa/main/syncobj.c @@ -141,20 +141,6 @@ _mesa_init_sync_object_functions(struct dd_function_table *driver) driver->ServerWaitSync = _mesa_wait_sync; } - -void GLAPIENTRY -_mesa_init_sync_dispatch(struct _glapi_table *disp) -{ - SET_IsSync(disp, _mesa_IsSync); - SET_DeleteSync(disp, _mesa_DeleteSync); - SET_FenceSync(disp, _mesa_FenceSync); - SET_ClientWaitSync(disp, _mesa_ClientWaitSync); - SET_WaitSync(disp, _mesa_WaitSync); - SET_GetInteger64v(disp, _mesa_GetInteger64v); - SET_GetSynciv(disp, _mesa_GetSynciv); -} - - /** * Allocate/init the context state related to sync objects. */ @@ -234,7 +220,6 @@ _mesa_DeleteSync(GLsync sync) { GET_CURRENT_CONTEXT(ctx); struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync; - ASSERT_OUTSIDE_BEGIN_END(ctx); /* From the GL_ARB_sync spec: * @@ -358,7 +343,6 @@ _mesa_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) { GET_CURRENT_CONTEXT(ctx); struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync; - ASSERT_OUTSIDE_BEGIN_END(ctx); if (!_mesa_validate_sync(ctx, syncObj)) { _mesa_error(ctx, GL_INVALID_VALUE, "glWaitSync (not a valid sync object)"); @@ -388,7 +372,6 @@ _mesa_GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, struct gl_sync_object *const syncObj = (struct gl_sync_object *) sync; GLsizei size = 0; GLint v[1]; - ASSERT_OUTSIDE_BEGIN_END(ctx); if (!_mesa_validate_sync(ctx, syncObj)) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetSynciv (not a valid sync object)"); diff --git a/mesalib/src/mesa/main/syncobj.h b/mesalib/src/mesa/main/syncobj.h index b0e09a605..5be2ba10d 100644..100755 --- a/mesalib/src/mesa/main/syncobj.h +++ b/mesalib/src/mesa/main/syncobj.h @@ -43,9 +43,6 @@ extern void GLAPIENTRY _mesa_init_sync_object_functions(struct dd_function_table *driver); extern void GLAPIENTRY -_mesa_init_sync_dispatch(struct _glapi_table *disp); - -extern void GLAPIENTRY _mesa_init_sync(struct gl_context *); extern void GLAPIENTRY diff --git a/mesalib/src/mesa/main/texcompress_etc_tmp.h b/mesalib/src/mesa/main/texcompress_etc_tmp.h index 8bbb2cde8..549756632 100644 --- a/mesalib/src/mesa/main/texcompress_etc_tmp.h +++ b/mesalib/src/mesa/main/texcompress_etc_tmp.h @@ -153,9 +153,9 @@ etc1_unpack_rgba8888(uint8_t *dst_row, for (x = 0; x < width; x+= bw) { etc1_parse_block(&block, src); - for (j = 0; j < bh; j++) { + for (j = 0; j < MIN2(bh, height - y); j++) { uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps; - for (i = 0; i < bw; i++) { + for (i = 0; i < MIN2(bw, width - x); i++) { etc1_fetch_texel(&block, i, j, dst); dst[3] = 255; dst += comps; diff --git a/mesalib/src/mesa/main/texenv.c b/mesalib/src/mesa/main/texenv.c index e8f3af082..0fe5fbd7a 100644 --- a/mesalib/src/mesa/main/texenv.c +++ b/mesalib/src/mesa/main/texenv.c @@ -392,9 +392,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) const GLint iparam0 = (GLint) param[0]; struct gl_texture_unit *texUnit; GLuint maxUnit; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV) ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxCombinedTextureImageUnits; @@ -507,7 +505,8 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) } } else { - _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)",target ); + _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(target=%s)", + _mesa_lookup_enum_by_nr(target)); return; } @@ -667,7 +666,6 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) GLuint maxUnit; const struct gl_texture_unit *texUnit; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV) ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxCombinedTextureImageUnits; @@ -731,7 +729,6 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) GLuint maxUnit; const struct gl_texture_unit *texUnit; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV) ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxCombinedTextureImageUnits; @@ -796,7 +793,6 @@ _mesa_TexBumpParameterivATI( GLenum pname, const GLint *param ) { GLfloat p[4]; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.ATI_envmap_bumpmap) { /* This isn't an "official" error case, but let's tell the user @@ -826,7 +822,6 @@ _mesa_TexBumpParameterfvATI( GLenum pname, const GLfloat *param ) { struct gl_texture_unit *texUnit; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.ATI_envmap_bumpmap) { _mesa_error(ctx, GL_INVALID_OPERATION, "glTexBumpParameterfvATI"); @@ -859,7 +854,6 @@ _mesa_GetTexBumpParameterivATI( GLenum pname, GLint *param ) const struct gl_texture_unit *texUnit; GLuint i; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.ATI_envmap_bumpmap) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexBumpParameterivATI"); @@ -911,7 +905,6 @@ _mesa_GetTexBumpParameterfvATI( GLenum pname, GLfloat *param ) const struct gl_texture_unit *texUnit; GLuint i; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.ATI_envmap_bumpmap) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexBumpParameterfvATI"); diff --git a/mesalib/src/mesa/main/texgen.c b/mesalib/src/mesa/main/texgen.c index fe5fc852d..e45cfe176 100644 --- a/mesalib/src/mesa/main/texgen.c +++ b/mesalib/src/mesa/main/texgen.c @@ -74,7 +74,6 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) struct gl_texture_unit *texUnit; struct gl_texgen *texgen; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) _mesa_debug(ctx, "glTexGen %s %s %.1f(%s)...\n", @@ -294,7 +293,6 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) struct gl_texture_unit *texUnit; struct gl_texgen *texgen; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGendv(current unit)"); @@ -332,7 +330,6 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) struct gl_texture_unit *texUnit; struct gl_texgen *texgen; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGenfv(current unit)"); @@ -378,7 +375,6 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) struct gl_texture_unit *texUnit; struct gl_texgen *texgen; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGeniv(current unit)"); diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c index d435c8269..3a550d941 100644 --- a/mesalib/src/mesa/main/texgetimage.c +++ b/mesalib/src/mesa/main/texgetimage.c @@ -813,7 +813,8 @@ _mesa_GetnTexImageARB( GLenum target, GLint level, GLenum format, struct gl_texture_object *texObj; struct gl_texture_image *texImage; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); if (getteximage_error_check(ctx, target, level, format, type, bufSize, pixels)) { @@ -944,7 +945,8 @@ _mesa_GetnCompressedTexImageARB(GLenum target, GLint level, GLsizei bufSize, struct gl_texture_object *texObj; struct gl_texture_image *texImage; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); if (getcompressedteximage_error_check(ctx, target, level, bufSize, img)) { return; diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index 5e451e235..24a551061 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -1896,8 +1896,7 @@ texture_error_check( struct gl_context *ctx, if (_mesa_is_gles(ctx)) { if (_mesa_is_gles3(ctx)) { err = _mesa_es3_error_check_format_and_type(format, type, - internalFormat, - dimensions); + internalFormat); } else { if (format != internalFormat) { _mesa_error(ctx, GL_INVALID_OPERATION, @@ -2006,7 +2005,8 @@ texture_error_check( struct gl_context *ctx, } /* additional checks for depth textures */ - if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT) { + if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT + || _mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_STENCIL) { /* Only 1D, 2D, rect, array and cube textures supported, not 3D * Cubemaps are only supported for GL version > 3.0 or with EXT_gpu_shader4 */ if (target != GL_TEXTURE_1D && @@ -2020,7 +2020,8 @@ texture_error_check( struct gl_context *ctx, target != GL_TEXTURE_RECTANGLE_ARB && target != GL_PROXY_TEXTURE_RECTANGLE_ARB && !((_mesa_is_cube_face(target) || target == GL_PROXY_TEXTURE_CUBE_MAP) && - (ctx->Version >= 30 || ctx->Extensions.EXT_gpu_shader4)) && + (ctx->Version >= 30 || ctx->Extensions.EXT_gpu_shader4 + || (ctx->API == API_OPENGLES2 && ctx->Extensions.OES_depth_texture_cube_map))) && !((target == GL_TEXTURE_CUBE_MAP_ARRAY || target == GL_PROXY_TEXTURE_CUBE_MAP_ARRAY) && ctx->Extensions.ARB_texture_cube_map_array)) { @@ -2347,6 +2348,7 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions, GLint width, GLint height, GLint border ) { GLint baseFormat; + GLint rb_base_format; struct gl_renderbuffer *rb; GLenum rb_internal_format; @@ -2420,12 +2422,85 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions, baseFormat = _mesa_base_tex_format(ctx, internalFormat); if (baseFormat < 0) { - _mesa_error(ctx, GL_INVALID_VALUE, + _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexImage%dD(internalFormat)", dimensions); return GL_TRUE; } rb_internal_format = rb->InternalFormat; + rb_base_format = _mesa_base_tex_format(ctx, rb->InternalFormat); + if (_mesa_is_color_format(internalFormat)) { + if (rb_base_format < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexImage%dD(internalFormat)", dimensions); + return GL_TRUE; + } + } + + if (_mesa_is_gles(ctx)) { + bool valid = true; + if (_mesa_base_format_component_count(baseFormat) > + _mesa_base_format_component_count(rb_base_format)) { + valid = false; + } + if (baseFormat == GL_DEPTH_COMPONENT || + baseFormat == GL_DEPTH_STENCIL || + rb_base_format == GL_DEPTH_COMPONENT || + rb_base_format == GL_DEPTH_STENCIL || + ((baseFormat == GL_LUMINANCE_ALPHA || + baseFormat == GL_ALPHA) && + rb_base_format != GL_RGBA) || + internalFormat == GL_RGB9_E5) { + valid = false; + } + if (internalFormat == GL_RGB9_E5) { + valid = false; + } + if (!valid) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCopyTexImage%dD(internalFormat)", dimensions); + return GL_TRUE; + } + } + + if ((_mesa_is_desktop_gl(ctx) && + ctx->Extensions.ARB_framebuffer_object) || + _mesa_is_gles3(ctx)) { + bool rb_is_srgb = false; + bool dst_is_srgb = false; + + if (ctx->Extensions.EXT_framebuffer_sRGB && + _mesa_get_format_color_encoding(rb->Format) == GL_SRGB) { + rb_is_srgb = true; + } + + if (_mesa_get_linear_internalformat(internalFormat) != internalFormat) { + dst_is_srgb = true; + } + + if (rb_is_srgb != dst_is_srgb) { + /* Page 190 (page 211 of the PDF) in section 8.6 of the OpenGL 4.3 + * Core Profile spec says: + * + * "An INVALID_OPERATION error is generated under any of the + * following conditions: + * + * ... + * + * - if the value of FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING + * for the framebuffer attachment corresponding to the read + * buffer is LINEAR (see section 9.2.3) and internalformat + * is one of the sRGB formats in table 8.23 + * - if the value of FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING + * for the framebuffer attachment corresponding to the read + * buffer is SRGB and internalformat is not one of the sRGB + * formats. in table 8.23." + */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCopyTexImage%dD(srgb usage mismatch)", dimensions); + return GL_TRUE; + } + } if (!_mesa_source_buffer_exists(ctx, baseFormat)) { _mesa_error(ctx, GL_INVALID_OPERATION, @@ -2869,7 +2944,7 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims, gl_format texFormat; GLboolean dimensionsOK, sizeOK; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) { if (compressed) @@ -3099,7 +3174,7 @@ _mesa_EGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image) struct gl_texture_image *texImage; bool valid_target; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); switch (target) { case GL_TEXTURE_2D: @@ -3161,7 +3236,7 @@ texsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level, struct gl_texture_object *texObj; struct gl_texture_image *texImage; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) _mesa_debug(ctx, "glTexSubImage%uD %s %d %d %d %d %d %d %d %s %s %p\n", @@ -3300,7 +3375,7 @@ copyteximage(struct gl_context *ctx, GLuint dims, const GLuint face = _mesa_tex_target_to_face(target); gl_format texFormat; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) _mesa_debug(ctx, "glCopyTexImage%uD %s %d %s %d %d %d %d %d\n", @@ -3423,7 +3498,7 @@ copytexsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level, struct gl_texture_object *texObj; struct gl_texture_image *texImage; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) _mesa_debug(ctx, "glCopyTexSubImage%uD %s %d %d %d %d %d %d %d %d\n", @@ -3671,7 +3746,7 @@ compressed_tex_sub_image(GLuint dims, GLenum target, GLint level, struct gl_texture_object *texObj; struct gl_texture_image *texImage; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); if (compressed_subtexture_error_check(ctx, dims, target, level, xoffset, yoffset, zoffset, @@ -3937,7 +4012,7 @@ _mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer) gl_format format; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); if (!(ctx->API == API_OPENGL_CORE && ctx->Extensions.ARB_texture_buffer_object)) { diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c index cb7ac19a8..e99b0dc38 100644 --- a/mesalib/src/mesa/main/texobj.c +++ b/mesalib/src/mesa/main/texobj.c @@ -468,7 +468,7 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx, } if (t->MaxLevel < baseLevel) { - incomplete(t, BASE, "MAX_LEVEL (%d) < BASE_LEVEL (%d)", + incomplete(t, MIPMAP, "MAX_LEVEL (%d) < BASE_LEVEL (%d)", t->MaxLevel, baseLevel); return; } @@ -576,7 +576,7 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx, GLuint width, height, depth, face; if (minLevel > maxLevel) { - incomplete(t, BASE, "minLevel > maxLevel"); + incomplete(t, MIPMAP, "minLevel > maxLevel"); return; } @@ -959,7 +959,6 @@ _mesa_GenTextures( GLsizei n, GLuint *textures ) GET_CURRENT_CONTEXT(ctx); GLuint first; GLint i; - ASSERT_OUTSIDE_BEGIN_END(ctx); if (n < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glGenTextures" ); @@ -1069,7 +1068,8 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures) { GET_CURRENT_CONTEXT(ctx); GLint i; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex */ + + FLUSH_VERTICES(ctx, 0); /* too complex */ if (!textures) return; @@ -1184,7 +1184,6 @@ _mesa_BindTexture( GLenum target, GLuint texName ) struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); struct gl_texture_object *newTexObj = NULL; GLint targetIndex; - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) _mesa_debug(ctx, "glBindTexture %s %d\n", @@ -1290,7 +1289,8 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName, { GET_CURRENT_CONTEXT(ctx); GLint i; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); if (n < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glPrioritizeTextures" ); @@ -1428,8 +1428,6 @@ _mesa_InvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, struct gl_texture_image *image; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - t = invalidate_tex_image_error_check(ctx, texture, level, "glInvalidateTexSubImage"); @@ -1568,8 +1566,6 @@ _mesa_InvalidateTexImage(GLuint texture, GLint level) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - invalidate_tex_image_error_check(ctx, texture, level, "glInvalidateTexImage"); diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c index 4d32fd6dd..8d0ae16fb 100644 --- a/mesalib/src/mesa/main/texparam.c +++ b/mesalib/src/mesa/main/texparam.c @@ -642,7 +642,6 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param) GLboolean need_update; struct gl_texture_object *texObj; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); texObj = get_texobj(ctx, target, GL_FALSE); if (!texObj) @@ -698,7 +697,6 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params) GLboolean need_update; struct gl_texture_object *texObj; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); texObj = get_texobj(ctx, target, GL_FALSE); if (!texObj) @@ -770,7 +768,6 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param) GLboolean need_update; struct gl_texture_object *texObj; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); texObj = get_texobj(ctx, target, GL_FALSE); if (!texObj) @@ -814,7 +811,6 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params) GLboolean need_update; struct gl_texture_object *texObj; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); texObj = get_texobj(ctx, target, GL_FALSE); if (!texObj) @@ -875,7 +871,6 @@ _mesa_TexParameterIiv(GLenum target, GLenum pname, const GLint *params) { struct gl_texture_object *texObj; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); texObj = get_texobj(ctx, target, GL_FALSE); if (!texObj) @@ -905,7 +900,6 @@ _mesa_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params) { struct gl_texture_object *texObj; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); texObj = get_texobj(ctx, target, GL_FALSE); if (!texObj) @@ -1242,7 +1236,6 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, struct gl_texture_object *texObj; GLint maxLevels; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->Texture.CurrentUnit >= ctx->Const.MaxCombinedTextureImageUnits) { _mesa_error(ctx, GL_INVALID_OPERATION, @@ -1280,7 +1273,6 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) { struct gl_texture_object *obj; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); obj = get_texobj(ctx, target, GL_TRUE); if (!obj) @@ -1465,7 +1457,6 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) { struct gl_texture_object *obj; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); obj = get_texobj(ctx, target, GL_TRUE); if (!obj) @@ -1644,7 +1635,6 @@ _mesa_GetTexParameterIiv(GLenum target, GLenum pname, GLint *params) { struct gl_texture_object *texObj; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); texObj = get_texobj(ctx, target, GL_TRUE); if (!texObj) @@ -1666,7 +1656,6 @@ _mesa_GetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params) { struct gl_texture_object *texObj; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); texObj = get_texobj(ctx, target, GL_TRUE); if (!texObj) diff --git a/mesalib/src/mesa/main/texstate.c b/mesalib/src/mesa/main/texstate.c index 8e9bbf6a1..9e591d3b9 100644 --- a/mesalib/src/mesa/main/texstate.c +++ b/mesalib/src/mesa/main/texstate.c @@ -297,8 +297,6 @@ _mesa_ActiveTexture(GLenum texture) ctx->Const.MaxTextureCoordUnits); ASSERT(k <= Elements(ctx->Texture.Unit)); - - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) _mesa_debug(ctx, "glActiveTexture %s\n", @@ -329,7 +327,6 @@ _mesa_ClientActiveTexture(GLenum texture) { GET_CURRENT_CONTEXT(ctx); GLuint texUnit = texture - GL_TEXTURE0; - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) _mesa_debug(ctx, "glClientActiveTexture %s\n", @@ -480,6 +477,43 @@ update_tex_combine(struct gl_context *ctx, struct gl_texture_unit *texUnit) } } +static void +update_texgen(struct gl_context *ctx) +{ + GLuint unit; + + /* Setup texgen for those texture coordinate sets that are in use */ + for (unit = 0; unit < ctx->Const.MaxTextureCoordUnits; unit++) { + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + + texUnit->_GenFlags = 0x0; + + if (!(ctx->Texture._EnabledCoordUnits & (1 << unit))) + continue; + + if (texUnit->TexGenEnabled) { + if (texUnit->TexGenEnabled & S_BIT) { + texUnit->_GenFlags |= texUnit->GenS._ModeBit; + } + if (texUnit->TexGenEnabled & T_BIT) { + texUnit->_GenFlags |= texUnit->GenT._ModeBit; + } + if (texUnit->TexGenEnabled & R_BIT) { + texUnit->_GenFlags |= texUnit->GenR._ModeBit; + } + if (texUnit->TexGenEnabled & Q_BIT) { + texUnit->_GenFlags |= texUnit->GenQ._ModeBit; + } + + ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(unit); + ctx->Texture._GenFlags |= texUnit->_GenFlags; + } + + ASSERT(unit < Elements(ctx->TextureMatrixStack)); + if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY) + ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(unit); + } +} /** * \note This routine refers to derived texture matrix values to @@ -500,11 +534,6 @@ update_texture_state( struct gl_context *ctx ) if (ctx->Shader.CurrentVertexProgram && ctx->Shader.CurrentVertexProgram->LinkStatus) { vprog = ctx->Shader.CurrentVertexProgram->_LinkedShaders[MESA_SHADER_VERTEX]->Program; - } else if (ctx->VertexProgram._Enabled) { - /* XXX enable this if/when non-shader vertex programs get - * texture fetches: - vprog = &ctx->VertexProgram.Current->Base; - */ } if (ctx->Shader.CurrentFragmentProgram && @@ -623,7 +652,8 @@ update_texture_state( struct gl_context *ctx ) if (enabledFragTargets) enabledFragUnits |= (1 << unit); - update_tex_combine(ctx, texUnit); + if (!fprog) + update_tex_combine(ctx, texUnit); } @@ -637,37 +667,8 @@ update_texture_state( struct gl_context *ctx ) ctx->Texture._EnabledCoordUnits = enabledFragUnits; } - /* Setup texgen for those texture coordinate sets that are in use */ - for (unit = 0; unit < ctx->Const.MaxTextureCoordUnits; unit++) { - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; - - texUnit->_GenFlags = 0x0; - - if (!(ctx->Texture._EnabledCoordUnits & (1 << unit))) - continue; - - if (texUnit->TexGenEnabled) { - if (texUnit->TexGenEnabled & S_BIT) { - texUnit->_GenFlags |= texUnit->GenS._ModeBit; - } - if (texUnit->TexGenEnabled & T_BIT) { - texUnit->_GenFlags |= texUnit->GenT._ModeBit; - } - if (texUnit->TexGenEnabled & R_BIT) { - texUnit->_GenFlags |= texUnit->GenR._ModeBit; - } - if (texUnit->TexGenEnabled & Q_BIT) { - texUnit->_GenFlags |= texUnit->GenQ._ModeBit; - } - - ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(unit); - ctx->Texture._GenFlags |= texUnit->_GenFlags; - } - - ASSERT(unit < Elements(ctx->TextureMatrixStack)); - if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY) - ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(unit); - } + if (!fprog || !vprog) + update_texgen(ctx); } diff --git a/mesalib/src/mesa/main/texturebarrier.c b/mesalib/src/mesa/main/texturebarrier.c index 56cc8718c..08ff56150 100644 --- a/mesalib/src/mesa/main/texturebarrier.c +++ b/mesalib/src/mesa/main/texturebarrier.c @@ -48,7 +48,6 @@ void GLAPIENTRY _mesa_TextureBarrierNV(void) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); ctx->Driver.TextureBarrier(ctx); } diff --git a/mesalib/src/mesa/main/transformfeedback.c b/mesalib/src/mesa/main/transformfeedback.c index 1bf4beaeb..fd4718d87 100644 --- a/mesalib/src/mesa/main/transformfeedback.c +++ b/mesalib/src/mesa/main/transformfeedback.c @@ -757,8 +757,6 @@ _mesa_GenTransformFeedbacks(GLsizei n, GLuint *names) GLuint first; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glGenTransformFeedbacks(n < 0)"); return; @@ -854,8 +852,6 @@ _mesa_DeleteTransformFeedbacks(GLsizei n, const GLuint *names) GLint i; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteTransformFeedbacks(n < 0)"); return; diff --git a/mesalib/src/mesa/main/uniform_query.cpp b/mesalib/src/mesa/main/uniform_query.cpp index efff8f381..dc550bc43 100644 --- a/mesalib/src/mesa/main/uniform_query.cpp +++ b/mesalib/src/mesa/main/uniform_query.cpp @@ -46,8 +46,6 @@ _mesa_GetActiveUniform(GLhandleARB program, GLuint index, struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetActiveUniform"); - ASSERT_OUTSIDE_BEGIN_END(ctx); - if (!shProg) return; @@ -59,7 +57,7 @@ _mesa_GetActiveUniform(GLhandleARB program, GLuint index, const struct gl_uniform_storage *const uni = &shProg->UniformStorage[index]; if (nameOut) { - _mesa_copy_string(nameOut, maxLength, length, uni->name); + _mesa_get_uniform_name(uni, maxLength, length, nameOut); } if (size) { @@ -122,6 +120,16 @@ _mesa_GetActiveUniformsiv(GLuint program, case GL_UNIFORM_NAME_LENGTH: params[i] = strlen(uni->name) + 1; + + /* Page 61 (page 73 of the PDF) in section 2.11 of the OpenGL ES 3.0 + * spec says: + * + * "If the active uniform is an array, the uniform name returned + * in name will always be the name of the uniform array appended + * with "[0]"." + */ + if (uni->array_elements != 0) + params[i] += 3; break; case GL_UNIFORM_BLOCK_INDEX: @@ -583,8 +591,6 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg, enum glsl_base_type basicType; struct gl_uniform_storage *uni; - ASSERT_OUTSIDE_BEGIN_END(ctx); - if (!validate_uniform_parameters(ctx, shProg, location, count, &loc, &offset, "glUniform", false)) return; @@ -836,8 +842,6 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg, unsigned elements; struct gl_uniform_storage *uni; - ASSERT_OUTSIDE_BEGIN_END(ctx); - if (!validate_uniform_parameters(ctx, shProg, location, count, &loc, &offset, "glUniformMatrix", false)) return; diff --git a/mesalib/src/mesa/main/uniforms.c b/mesalib/src/mesa/main/uniforms.c index 77b195edb..62c85b3c0 100644 --- a/mesalib/src/mesa/main/uniforms.c +++ b/mesalib/src/mesa/main/uniforms.c @@ -782,8 +782,6 @@ _mesa_GetActiveUniformName(GLuint program, GLuint uniformIndex, return; } - ASSERT_OUTSIDE_BEGIN_END(ctx); - shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetActiveUniformName"); if (!shProg) @@ -795,7 +793,46 @@ _mesa_GetActiveUniformName(GLuint program, GLuint uniformIndex, } if (uniformName) { - _mesa_copy_string(uniformName, bufSize, length, - shProg->UniformStorage[uniformIndex].name); + _mesa_get_uniform_name(& shProg->UniformStorage[uniformIndex], + bufSize, length, uniformName); + } +} + +void +_mesa_get_uniform_name(const struct gl_uniform_storage *uni, + GLsizei maxLength, GLsizei *length, + GLchar *nameOut) +{ + GLsizei localLength; + + if (length == NULL) + length = &localLength; + + _mesa_copy_string(nameOut, maxLength, length, uni->name); + + /* Page 61 (page 73 of the PDF) in section 2.11 of the OpenGL ES 3.0 + * spec says: + * + * "If the active uniform is an array, the uniform name returned in + * name will always be the name of the uniform array appended with + * "[0]"." + * + * The same text also appears in the OpenGL 4.2 spec. It does not, + * however, appear in any previous spec. Previous specifications are + * ambiguous in this regard. However, either name can later be passed + * to glGetUniformLocation (and related APIs), so there shouldn't be any + * harm in always appending "[0]" to uniform array names. + */ + if (uni->array_elements != 0) { + unsigned i; + + /* The comparison is strange because *length does *NOT* include the + * terminating NUL, but maxLength does. + */ + for (i = 0; i < 3 && (*length + i + 1) < maxLength; i++) + nameOut[*length + i] = "[0]"[i]; + + nameOut[*length + i] = '\0'; + *length += i; } } diff --git a/mesalib/src/mesa/main/uniforms.h b/mesalib/src/mesa/main/uniforms.h index 287d7106b..f17503121 100644 --- a/mesalib/src/mesa/main/uniforms.h +++ b/mesalib/src/mesa/main/uniforms.h @@ -213,6 +213,11 @@ _mesa_sampler_uniforms_are_valid(const struct gl_shader_program *shProg, extern const struct gl_program_parameter * get_uniform_parameter(struct gl_shader_program *shProg, GLint index); +extern void +_mesa_get_uniform_name(const struct gl_uniform_storage *uni, + GLsizei maxLength, GLsizei *length, + GLchar *nameOut); + struct gl_builtin_uniform_element { const char *field; int tokens[STATE_LENGTH]; diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c index 0f7e2a69b..213b845c9 100644 --- a/mesalib/src/mesa/main/varray.c +++ b/mesalib/src/mesa/main/varray.c @@ -283,7 +283,8 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) DOUBLE_BIT | HALF_BIT | UNSIGNED_INT_2_10_10_10_REV_BIT | INT_2_10_10_10_REV_BIT); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); update_array(ctx, "glVertexPointer", VERT_ATTRIB_POS, legalTypes, 2, 4, @@ -301,7 +302,8 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) HALF_BIT | FLOAT_BIT | DOUBLE_BIT | UNSIGNED_INT_2_10_10_10_REV_BIT | INT_2_10_10_10_REV_BIT); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); update_array(ctx, "glNormalPointer", VERT_ATTRIB_NORMAL, legalTypes, 3, 3, @@ -322,7 +324,8 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) UNSIGNED_INT_2_10_10_10_REV_BIT | INT_2_10_10_10_REV_BIT); const GLint sizeMin = (ctx->API == API_OPENGLES) ? 4 : 3; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); update_array(ctx, "glColorPointer", VERT_ATTRIB_COLOR0, legalTypes, sizeMin, BGRA_OR_4, @@ -335,7 +338,8 @@ _mesa_FogCoordPointer(GLenum type, GLsizei stride, const GLvoid *ptr) { const GLbitfield legalTypes = (HALF_BIT | FLOAT_BIT | DOUBLE_BIT); GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); update_array(ctx, "glFogCoordPointer", VERT_ATTRIB_FOG, legalTypes, 1, 1, @@ -349,7 +353,8 @@ _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) const GLbitfield legalTypes = (UNSIGNED_BYTE_BIT | SHORT_BIT | INT_BIT | FLOAT_BIT | DOUBLE_BIT); GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); update_array(ctx, "glIndexPointer", VERT_ATTRIB_COLOR_INDEX, legalTypes, 1, 1, @@ -368,7 +373,8 @@ _mesa_SecondaryColorPointer(GLint size, GLenum type, UNSIGNED_INT_2_10_10_10_REV_BIT | INT_2_10_10_10_REV_BIT); GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); update_array(ctx, "glSecondaryColorPointer", VERT_ATTRIB_COLOR1, legalTypes, 3, BGRA_OR_4, @@ -389,7 +395,8 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, INT_2_10_10_10_REV_BIT); const GLint sizeMin = (ctx->API == API_OPENGLES) ? 2 : 1; const GLuint unit = ctx->Array.ActiveTexture; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); update_array(ctx, "glTexCoordPointer", VERT_ATTRIB_TEX(unit), legalTypes, sizeMin, 4, @@ -405,7 +412,8 @@ _mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr) /* see table 2.4 edits in GL_EXT_gpu_shader4 spec: */ const GLboolean integer = GL_TRUE; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); update_array(ctx, "glEdgeFlagPointer", VERT_ATTRIB_EDGEFLAG, legalTypes, 1, 1, @@ -418,7 +426,8 @@ _mesa_PointSizePointerOES(GLenum type, GLsizei stride, const GLvoid *ptr) { const GLbitfield legalTypes = (FLOAT_BIT | FIXED_ES_BIT); GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); if (ctx->API != API_OPENGLES) { _mesa_error(ctx, GL_INVALID_OPERATION, @@ -450,7 +459,6 @@ _mesa_VertexAttribPointer(GLuint index, GLint size, GLenum type, UNSIGNED_INT_2_10_10_10_REV_BIT | INT_2_10_10_10_REV_BIT); GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (index >= ctx->Const.VertexProgram.MaxAttribs) { _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerARB(index)"); @@ -479,7 +487,6 @@ _mesa_VertexAttribIPointer(GLuint index, GLint size, GLenum type, const GLboolean normalized = GL_FALSE; const GLboolean integer = GL_TRUE; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (index >= ctx->Const.VertexProgram.MaxAttribs) { _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribIPointer(index)"); @@ -498,7 +505,6 @@ _mesa_EnableVertexAttribArray(GLuint index) { struct gl_array_object *arrayObj; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (index >= ctx->Const.VertexProgram.MaxAttribs) { _mesa_error(ctx, GL_INVALID_VALUE, @@ -525,7 +531,6 @@ _mesa_DisableVertexAttribArray(GLuint index) { struct gl_array_object *arrayObj; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (index >= ctx->Const.VertexProgram.MaxAttribs) { _mesa_error(ctx, GL_INVALID_VALUE, @@ -634,7 +639,6 @@ void GLAPIENTRY _mesa_GetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) { const GLfloat *v = get_current_attrib(ctx, index, "glGetVertexAttribfv"); @@ -653,7 +657,6 @@ void GLAPIENTRY _mesa_GetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) { const GLfloat *v = get_current_attrib(ctx, index, "glGetVertexAttribdv"); @@ -675,7 +678,6 @@ void GLAPIENTRY _mesa_GetVertexAttribiv(GLuint index, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) { const GLfloat *v = get_current_attrib(ctx, index, "glGetVertexAttribiv"); @@ -699,7 +701,6 @@ void GLAPIENTRY _mesa_GetVertexAttribIiv(GLuint index, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) { const GLint *v = (const GLint *) @@ -720,7 +721,6 @@ void GLAPIENTRY _mesa_GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) { const GLuint *v = (const GLuint *) @@ -740,7 +740,6 @@ void GLAPIENTRY _mesa_GetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid **pointer) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (index >= ctx->Const.VertexProgram.MaxAttribs) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribPointerARB(index)"); @@ -823,7 +822,7 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer) GLint defstride; /* default stride */ GLint c, f; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); f = sizeof(GLfloat); c = f * ((4 * sizeof(GLubyte) + (f - 1)) / f); @@ -993,7 +992,8 @@ void GLAPIENTRY _mesa_LockArraysEXT(GLint first, GLsizei count) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glLockArrays %d %d\n", first, count); @@ -1022,7 +1022,8 @@ void GLAPIENTRY _mesa_UnlockArraysEXT( void ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glUnlockArrays\n"); @@ -1046,7 +1047,7 @@ _mesa_MultiDrawArrays( GLenum mode, const GLint *first, GET_CURRENT_CONTEXT(ctx); GLint i; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); for (i = 0; i < primcount; i++) { if (count[i] > 0) { @@ -1065,7 +1066,7 @@ _mesa_MultiModeDrawArraysIBM( const GLenum * mode, const GLint * first, GET_CURRENT_CONTEXT(ctx); GLint i; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); for ( i = 0 ; i < primcount ; i++ ) { if ( count[i] > 0 ) { @@ -1085,7 +1086,7 @@ _mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count, GET_CURRENT_CONTEXT(ctx); GLint i; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); /* XXX not sure about ARB_vertex_buffer_object handling here */ @@ -1111,8 +1112,6 @@ _mesa_PrimitiveRestartIndex(GLuint index) return; } - ASSERT_OUTSIDE_BEGIN_END(ctx); - ctx->Array.RestartIndex = index; if (ctx->Array.PrimitiveRestart && ctx->Array._RestartIndex != index) { FLUSH_VERTICES(ctx, _NEW_TRANSFORM); @@ -1131,7 +1130,6 @@ _mesa_VertexAttribDivisor(GLuint index, GLuint divisor) { struct gl_client_array *array; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.ARB_instanced_arrays) { _mesa_error(ctx, GL_INVALID_OPERATION, "glVertexAttribDivisor()"); diff --git a/mesalib/src/mesa/main/viewport.c b/mesalib/src/mesa/main/viewport.c index a58697ab3..92f04cdf1 100644 --- a/mesalib/src/mesa/main/viewport.c +++ b/mesalib/src/mesa/main/viewport.c @@ -46,7 +46,7 @@ void GLAPIENTRY _mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); _mesa_set_viewport(ctx, x, y, width, height); } @@ -116,7 +116,8 @@ void GLAPIENTRY _mesa_DepthRange(GLclampd nearval, GLclampd farval) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, 0); if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glDepthRange %f %f\n", nearval, farval); diff --git a/mesalib/src/mesa/main/vtxfmt.c b/mesalib/src/mesa/main/vtxfmt.c index 6d687de60..347d07d57 100644 --- a/mesalib/src/mesa/main/vtxfmt.c +++ b/mesalib/src/mesa/main/vtxfmt.c @@ -252,6 +252,8 @@ void _mesa_install_exec_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt) { install_vtxfmt( ctx, ctx->Exec, vfmt ); + if (ctx->BeginEnd) + install_vtxfmt( ctx, ctx->BeginEnd, vfmt ); } diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c index 368a30b68..b416319e1 100644 --- a/mesalib/src/mesa/state_tracker/st_context.c +++ b/mesalib/src/mesa/state_tracker/st_context.c @@ -189,7 +189,7 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe, _mesa_compute_version(ctx); - _mesa_initialize_exec_table(ctx); + _mesa_initialize_dispatch_tables(ctx); _mesa_initialize_vbo_vtxfmt(ctx); return st; diff --git a/mesalib/src/mesa/swrast/s_blit.c b/mesalib/src/mesa/swrast/s_blit.c index 043b578a5..3a4e7eec0 100644 --- a/mesalib/src/mesa/swrast/s_blit.c +++ b/mesalib/src/mesa/swrast/s_blit.c @@ -114,7 +114,7 @@ blit_nearest(struct gl_context *ctx, struct gl_renderbuffer_attachment *readAtt, *drawAtt; struct gl_framebuffer *readFb = ctx->ReadBuffer; struct gl_framebuffer *drawFb = ctx->DrawBuffer; - GLint NumDrawBuffers = 0; + GLuint numDrawBuffers = 0; GLuint i; const GLint srcWidth = ABS(srcX1 - srcX0); @@ -153,14 +153,14 @@ blit_nearest(struct gl_context *ctx, case GL_COLOR_BUFFER_BIT: readAtt = &readFb->Attachment[readFb->_ColorReadBufferIndex]; readRb = readFb->_ColorReadBuffer; - NumDrawBuffers = drawFb->_NumColorDrawBuffers; + numDrawBuffers = drawFb->_NumColorDrawBuffers; break; case GL_DEPTH_BUFFER_BIT: readAtt = &readFb->Attachment[BUFFER_DEPTH]; drawAtt = &drawFb->Attachment[BUFFER_DEPTH]; readRb = readAtt->Renderbuffer; drawRb = drawAtt->Renderbuffer; - NumDrawBuffers = 1; + numDrawBuffers = 1; /* Note that for depth/stencil, the formats of src/dst must match. By * using the core helpers for pack/unpack, we avoid needing to handle @@ -179,7 +179,7 @@ blit_nearest(struct gl_context *ctx, drawAtt = &drawFb->Attachment[BUFFER_STENCIL]; readRb = readAtt->Renderbuffer; drawRb = drawAtt->Renderbuffer; - NumDrawBuffers = 1; + numDrawBuffers = 1; mode = UNPACK_S; pixelSize = 1; break; @@ -212,7 +212,7 @@ blit_nearest(struct gl_context *ctx, } /* Blit to all the draw buffers */ - for (i = 0; i < NumDrawBuffers; i++) { + for (i = 0; i < numDrawBuffers; i++) { if (buffer == GL_COLOR_BUFFER_BIT) { int idx = drawFb->_ColorDrawBufferIndexes[i]; if (idx == -1) @@ -220,6 +220,9 @@ blit_nearest(struct gl_context *ctx, drawAtt = &drawFb->Attachment[idx]; drawRb = drawAtt->Renderbuffer; + if (!drawRb) + continue; + if (readRb->Format == drawRb->Format) { mode = DIRECT; pixelSize = _mesa_get_format_bytes(readRb->Format); @@ -514,8 +517,6 @@ blit_linear(struct gl_context *ctx, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1) { struct gl_framebuffer *drawFb = ctx->DrawBuffer; - struct gl_renderbuffer *drawRb = NULL; - struct gl_renderbuffer_attachment *drawAtt = NULL; struct gl_framebuffer *readFb = ctx->ReadBuffer; struct gl_renderbuffer *readRb = readFb->_ColorReadBuffer; struct gl_renderbuffer_attachment *readAtt = @@ -543,7 +544,6 @@ blit_linear(struct gl_context *ctx, GLvoid *dstBuffer; gl_format readFormat = _mesa_get_srgb_format_linear(readRb->Format); - gl_format drawFormat = _mesa_get_srgb_format_linear(drawRb->Format); GLuint bpp = _mesa_get_format_bytes(readFormat); GLenum pixelType; @@ -587,17 +587,27 @@ blit_linear(struct gl_context *ctx, } for (i = 0; i < drawFb->_NumColorDrawBuffers; i++) { - int idx = drawFb->_ColorDrawBufferIndexes[i]; + GLint idx = drawFb->_ColorDrawBufferIndexes[i]; + struct gl_renderbuffer_attachment *drawAtt; + struct gl_renderbuffer *drawRb; + gl_format drawFormat; + if (idx == -1) continue; + drawAtt = &drawFb->Attachment[idx]; drawRb = drawAtt->Renderbuffer; + if (!drawRb) + continue; + + drawFormat = _mesa_get_srgb_format_linear(drawRb->Format); + /* * Map src / dst renderbuffers */ if ((readRb == drawRb) || (readAtt->Texture && drawAtt->Texture && - (readAtt->Texture = drawAtt->Texture))) { + (readAtt->Texture == drawAtt->Texture))) { /* map whole buffer for read/write */ ctx->Driver.MapRenderbuffer(ctx, readRb, 0, 0, readRb->Width, readRb->Height, diff --git a/mesalib/src/mesa/vbo/vbo_exec_api.c b/mesalib/src/mesa/vbo/vbo_exec_api.c index 657c9aaee..985f2209c 100644 --- a/mesalib/src/mesa/vbo/vbo_exec_api.c +++ b/mesalib/src/mesa/vbo/vbo_exec_api.c @@ -658,8 +658,6 @@ vbo_exec_EvalMesh1(GLenum mode, GLint i1, GLint i2) GLfloat u, du; GLenum prim; - ASSERT_OUTSIDE_BEGIN_END(ctx); - switch (mode) { case GL_POINT: prim = GL_POINTS; @@ -696,8 +694,6 @@ vbo_exec_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) GLfloat u, du, v, dv, v1, u1; GLint i, j; - ASSERT_OUTSIDE_BEGIN_END(ctx); - switch (mode) { case GL_POINT: case GL_LINE: @@ -771,9 +767,6 @@ vbo_exec_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) static void GLAPIENTRY vbo_exec_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) { - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - CALL_Begin(GET_DISPATCH(), (GL_QUADS)); CALL_Vertex2f(GET_DISPATCH(), (x1, y1)); CALL_Vertex2f(GET_DISPATCH(), (x2, y1)); @@ -789,54 +782,61 @@ vbo_exec_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) static void GLAPIENTRY vbo_exec_Begin( GLenum mode ) { GET_CURRENT_CONTEXT( ctx ); + struct vbo_exec_context *exec = &vbo_context(ctx)->exec; + int i; - if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END) { - struct vbo_exec_context *exec = &vbo_context(ctx)->exec; - int i; - - if (!_mesa_valid_prim_mode(ctx, mode, "glBegin")) { - return; - } + if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glBegin"); + return; + } - vbo_draw_method(vbo_context(ctx), DRAW_BEGIN_END); + if (!_mesa_valid_prim_mode(ctx, mode, "glBegin")) { + return; + } - if (ctx->Driver.PrepareExecBegin) - ctx->Driver.PrepareExecBegin(ctx); + vbo_draw_method(vbo_context(ctx), DRAW_BEGIN_END); - if (ctx->NewState) { - _mesa_update_state( ctx ); + if (ctx->NewState) { + _mesa_update_state( ctx ); - CALL_Begin(ctx->Exec, (mode)); - return; - } + CALL_Begin(ctx->Exec, (mode)); + return; + } - if (!_mesa_valid_to_render(ctx, "glBegin")) { - return; - } + if (!_mesa_valid_to_render(ctx, "glBegin")) { + return; + } - /* Heuristic: attempt to isolate attributes occuring outside - * begin/end pairs. - */ - if (exec->vtx.vertex_size && !exec->vtx.attrsz[0]) - vbo_exec_FlushVertices_internal(exec, GL_FALSE); - - i = exec->vtx.prim_count++; - exec->vtx.prim[i].mode = mode; - exec->vtx.prim[i].begin = 1; - exec->vtx.prim[i].end = 0; - exec->vtx.prim[i].indexed = 0; - exec->vtx.prim[i].weak = 0; - exec->vtx.prim[i].pad = 0; - exec->vtx.prim[i].start = exec->vtx.vert_count; - exec->vtx.prim[i].count = 0; - exec->vtx.prim[i].num_instances = 1; - exec->vtx.prim[i].base_instance = 0; - - ctx->Driver.CurrentExecPrimitive = mode; + /* Heuristic: attempt to isolate attributes occuring outside + * begin/end pairs. + */ + if (exec->vtx.vertex_size && !exec->vtx.attrsz[0]) + vbo_exec_FlushVertices_internal(exec, GL_FALSE); + + i = exec->vtx.prim_count++; + exec->vtx.prim[i].mode = mode; + exec->vtx.prim[i].begin = 1; + exec->vtx.prim[i].end = 0; + exec->vtx.prim[i].indexed = 0; + exec->vtx.prim[i].weak = 0; + exec->vtx.prim[i].pad = 0; + exec->vtx.prim[i].start = exec->vtx.vert_count; + exec->vtx.prim[i].count = 0; + exec->vtx.prim[i].num_instances = 1; + exec->vtx.prim[i].base_instance = 0; + + ctx->Driver.CurrentExecPrimitive = mode; + + ctx->Exec = ctx->BeginEnd; + /* We may have been called from a display list, in which case we should + * leave dlist.c's dispatch table in place. + */ + if (ctx->CurrentDispatch == ctx->OutsideBeginEnd) { + ctx->CurrentDispatch = ctx->BeginEnd; + _glapi_set_dispatch(ctx->CurrentDispatch); + } else { + assert(ctx->CurrentDispatch == ctx->Save); } - else - _mesa_error( ctx, GL_INVALID_OPERATION, "glBegin" ); - } @@ -846,26 +846,32 @@ static void GLAPIENTRY vbo_exec_Begin( GLenum mode ) static void GLAPIENTRY vbo_exec_End( void ) { GET_CURRENT_CONTEXT( ctx ); + struct vbo_exec_context *exec = &vbo_context(ctx)->exec; - if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { - struct vbo_exec_context *exec = &vbo_context(ctx)->exec; - - if (exec->vtx.prim_count > 0) { - /* close off current primitive */ - int idx = exec->vtx.vert_count; - int i = exec->vtx.prim_count - 1; + if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glEnd"); + return; + } - exec->vtx.prim[i].end = 1; - exec->vtx.prim[i].count = idx - exec->vtx.prim[i].start; - } + ctx->Exec = ctx->OutsideBeginEnd; + if (ctx->CurrentDispatch == ctx->BeginEnd) { + ctx->CurrentDispatch = ctx->OutsideBeginEnd; + _glapi_set_dispatch(ctx->CurrentDispatch); + } - ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END; + if (exec->vtx.prim_count > 0) { + /* close off current primitive */ + int idx = exec->vtx.vert_count; + int i = exec->vtx.prim_count - 1; - if (exec->vtx.prim_count == VBO_MAX_PRIM) - vbo_exec_vtx_flush( exec, GL_FALSE ); + exec->vtx.prim[i].end = 1; + exec->vtx.prim[i].count = idx - exec->vtx.prim[i].start; } - else - _mesa_error( ctx, GL_INVALID_OPERATION, "glEnd" ); + + ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END; + + if (exec->vtx.prim_count == VBO_MAX_PRIM) + vbo_exec_vtx_flush( exec, GL_FALSE ); if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) { _mesa_flush(ctx); diff --git a/mkfontscale/hash.c b/mkfontscale/hash.c index 135380bff..c2cf9caa3 100644 --- a/mkfontscale/hash.c +++ b/mkfontscale/hash.c @@ -79,7 +79,7 @@ destroyHashTable(HashTablePtr table) char * getHash(HashTablePtr table, const char *key) { - int i = hash(key); + unsigned int i = hash(key); HashBucketPtr bp; for(bp = table[i]; bp; bp = bp->next) { if(strcasecmp(bp->key, key) == 0) @@ -91,7 +91,7 @@ getHash(HashTablePtr table, const char *key) int putHash(HashTablePtr table, char *key, char *value, int prio) { - int i = hash(key); + unsigned int i = hash(key); char *keycopy = NULL, *valuecopy = NULL; HashBucketPtr bp; for(bp = table[i]; bp; bp = bp->next) { diff --git a/pixman/pixman/pixman-mips-dspr2-asm.S b/pixman/pixman/pixman-mips-dspr2-asm.S index ba22e6254..ddfacef62 100644 --- a/pixman/pixman/pixman-mips-dspr2-asm.S +++ b/pixman/pixman/pixman-mips-dspr2-asm.S @@ -2100,6 +2100,350 @@ LEAF_MIPS_DSPR2(pixman_composite_add_8888_8888_asm_mips) END(pixman_composite_add_8888_8888_asm_mips) +LEAF_MIPS_DSPR2(pixman_composite_out_reverse_8_0565_asm_mips) +/* + * a0 - dst (r5g6b5) + * a1 - src (a8) + * a2 - w + */ + + beqz a2, 4f + nop + + SAVE_REGS_ON_STACK 0, s0, s1, s2, s3 + li t2, 0xf800f800 + li t3, 0x07e007e0 + li t4, 0x001F001F + li t5, 0x00ff00ff + + addiu t1, a2, -1 + beqz t1, 2f + nop +1: + lbu t0, 0(a1) /* t0 = source (a8) */ + lbu t1, 1(a1) /* t1 = source (a8) */ + lhu t6, 0(a0) /* t6 = destination (r5g6b5) */ + lhu t7, 2(a0) /* t7 = destination (r5g6b5) */ + addiu a1, a1, 2 + + not t0, t0 + not t1, t1 + andi t0, 0xff /* t0 = neg source1 */ + andi t1, 0xff /* t1 = neg source2 */ + CONVERT_2x0565_TO_2x8888 t6, t7, t8, t9, t3, t4, s0, s1, s2, s3 + MIPS_2xUN8x4_MUL_2xUN8 t8, t9, t0, t1, t6, t7, t5, s0, s1, s2, s3, t8, t9 + CONVERT_2x8888_TO_2x0565 t6, t7, t8, t9, t2, t3, t4, s0, s1 + + sh t8, 0(a0) + sh t9, 2(a0) + addiu a2, a2, -2 + addiu t1, a2, -1 + bgtz t1, 1b + addiu a0, a0, 4 +2: + beqz a2, 3f + nop + lbu t0, 0(a1) /* t0 = source (a8) */ + lhu t1, 0(a0) /* t1 = destination (r5g6b5) */ + + not t0, t0 + andi t0, 0xff /* t0 = neg source */ + CONVERT_1x0565_TO_1x8888 t1, t2, t3, t4 + MIPS_UN8x4_MUL_UN8 t2, t0, t1, t5, t3, t4, t6 + CONVERT_1x8888_TO_1x0565 t1, t2, t3, t4 + + sh t2, 0(a0) +3: + RESTORE_REGS_FROM_STACK 0, s0, s1, s2, s3 +4: + j ra + nop + +END(pixman_composite_out_reverse_8_0565_asm_mips) + +LEAF_MIPS_DSPR2(pixman_composite_out_reverse_8_8888_asm_mips) +/* + * a0 - dst (a8r8g8b8) + * a1 - src (a8) + * a2 - w + */ + + beqz a2, 3f + nop + li t4, 0x00ff00ff + addiu t1, a2, -1 + beqz t1, 2f + nop +1: + lbu t0, 0(a1) /* t0 = source (a8) */ + lbu t1, 1(a1) /* t1 = source (a8) */ + lw t2, 0(a0) /* t2 = destination (a8r8g8b8) */ + lw t3, 4(a0) /* t3 = destination (a8r8g8b8) */ + addiu a1, a1, 2 + not t0, t0 + not t1, t1 + andi t0, 0xff /* t0 = neg source */ + andi t1, 0xff /* t1 = neg source */ + + MIPS_2xUN8x4_MUL_2xUN8 t2, t3, t0, t1, t5, t6, t4, t7, t8, t9, t2, t3, t0 + + sw t5, 0(a0) + sw t6, 4(a0) + addiu a2, a2, -2 + addiu t1, a2, -1 + bgtz t1, 1b + addiu a0, a0, 8 +2: + beqz a2, 3f + nop + lbu t0, 0(a1) /* t0 = source (a8) */ + lw t1, 0(a0) /* t1 = destination (a8r8g8b8) */ + not t0, t0 + andi t0, 0xff /* t0 = neg source */ + + MIPS_UN8x4_MUL_UN8 t1, t0, t2, t4, t3, t5, t6 + + sw t2, 0(a0) +3: + j ra + nop + +END(pixman_composite_out_reverse_8_8888_asm_mips) + +LEAF_MIPS_DSPR2(pixman_composite_over_reverse_n_8888_asm_mips) +/* + * a0 - dst (a8r8g8b8) + * a1 - src (32bit constant) + * a2 - w + */ + + beqz a2, 5f + nop + + SAVE_REGS_ON_STACK 20, s0, s1, s2, s3, s4, s5, s6, s7 + li t0, 0x00ff00ff + srl t9, a2, 2 /* t9 = how many multiples of 4 src pixels */ + beqz t9, 2f /* branch if less than 4 src pixels */ + nop +1: + beqz t9, 2f + addiu t9, t9, -1 + + lw t1, 0(a0) + lw t2, 4(a0) + lw t3, 8(a0) + lw t4, 12(a0) + + addiu a2, a2, -4 + + not t5, t1 + not t6, t2 + not t7, t3 + not t8, t4 + srl t5, t5, 24 + srl t6, t6, 24 + srl t7, t7, 24 + srl t8, t8, 24 + replv.ph t5, t5 + replv.ph t6, t6 + replv.ph t7, t7 + replv.ph t8, t8 + muleu_s.ph.qbl s0, a1, t5 + muleu_s.ph.qbr s1, a1, t5 + muleu_s.ph.qbl s2, a1, t6 + muleu_s.ph.qbr s3, a1, t6 + muleu_s.ph.qbl s4, a1, t7 + muleu_s.ph.qbr s5, a1, t7 + muleu_s.ph.qbl s6, a1, t8 + muleu_s.ph.qbr s7, a1, t8 + + shra_r.ph t5, s0, 8 + shra_r.ph t6, s1, 8 + shra_r.ph t7, s2, 8 + shra_r.ph t8, s3, 8 + and t5, t5, t0 + and t6, t6, t0 + and t7, t7, t0 + and t8, t8, t0 + addq.ph s0, s0, t5 + addq.ph s1, s1, t6 + addq.ph s2, s2, t7 + addq.ph s3, s3, t8 + shra_r.ph s0, s0, 8 + shra_r.ph s1, s1, 8 + shra_r.ph s2, s2, 8 + shra_r.ph s3, s3, 8 + shra_r.ph t5, s4, 8 + shra_r.ph t6, s5, 8 + shra_r.ph t7, s6, 8 + shra_r.ph t8, s7, 8 + and t5, t5, t0 + and t6, t6, t0 + and t7, t7, t0 + and t8, t8, t0 + addq.ph s4, s4, t5 + addq.ph s5, s5, t6 + addq.ph s6, s6, t7 + addq.ph s7, s7, t8 + shra_r.ph s4, s4, 8 + shra_r.ph s5, s5, 8 + shra_r.ph s6, s6, 8 + shra_r.ph s7, s7, 8 + + precr.qb.ph t5, s0, s1 + precr.qb.ph t6, s2, s3 + precr.qb.ph t7, s4, s5 + precr.qb.ph t8, s6, s7 + addu_s.qb t5, t1, t5 + addu_s.qb t6, t2, t6 + addu_s.qb t7, t3, t7 + addu_s.qb t8, t4, t8 + + sw t5, 0(a0) + sw t6, 4(a0) + sw t7, 8(a0) + sw t8, 12(a0) + b 1b + addiu a0, a0, 16 + +2: + beqz a2, 4f + nop +3: + lw t1, 0(a0) + + not t2, t1 + srl t2, t2, 24 + replv.ph t2, t2 + + muleu_s.ph.qbl t4, a1, t2 + muleu_s.ph.qbr t5, a1, t2 + shra_r.ph t6, t4, 8 + shra_r.ph t7, t5, 8 + + and t6,t6,t0 + and t7,t7,t0 + + addq.ph t8, t4, t6 + addq.ph t9, t5, t7 + + shra_r.ph t8, t8, 8 + shra_r.ph t9, t9, 8 + + precr.qb.ph t9, t8, t9 + + addu_s.qb t9, t1, t9 + sw t9, 0(a0) + + addiu a2, a2, -1 + bnez a2, 3b + addiu a0, a0, 4 +4: + RESTORE_REGS_FROM_STACK 20, s0, s1, s2, s3, s4, s5, s6, s7 +5: + j ra + nop + +END(pixman_composite_over_reverse_n_8888_asm_mips) + +LEAF_MIPS_DSPR2(pixman_composite_in_n_8_asm_mips) +/* + * a0 - dst (a8) + * a1 - src (a8r8g8b8) + * a2 - w + */ + + beqz a2, 5f + nop + + SAVE_REGS_ON_STACK 20, s0, s1, s2, s3, s4, s5, s6, s7 + move t7, a1 + srl t5, t7, 24 + replv.ph t5, t5 + srl t9, a2, 2 /* t1 = how many multiples of 4 src pixels */ + beqz t9, 2f /* branch if less than 4 src pixels */ + nop + +1: + addiu t9, t9, -1 + addiu a2, a2, -4 + lbu t0, 0(a0) + lbu t1, 1(a0) + lbu t2, 2(a0) + lbu t3, 3(a0) + + muleu_s.ph.qbl s0, t0, t5 + muleu_s.ph.qbr s1, t0, t5 + muleu_s.ph.qbl s2, t1, t5 + muleu_s.ph.qbr s3, t1, t5 + muleu_s.ph.qbl s4, t2, t5 + muleu_s.ph.qbr s5, t2, t5 + muleu_s.ph.qbl s6, t3, t5 + muleu_s.ph.qbr s7, t3, t5 + + shrl.ph t4, s0, 8 + shrl.ph t6, s1, 8 + shrl.ph t7, s2, 8 + shrl.ph t8, s3, 8 + addq.ph t0, s0, t4 + addq.ph t1, s1, t6 + addq.ph t2, s2, t7 + addq.ph t3, s3, t8 + shra_r.ph t0, t0, 8 + shra_r.ph t1, t1, 8 + shra_r.ph t2, t2, 8 + shra_r.ph t3, t3, 8 + shrl.ph t4, s4, 8 + shrl.ph t6, s5, 8 + shrl.ph t7, s6, 8 + shrl.ph t8, s7, 8 + addq.ph s0, s4, t4 + addq.ph s1, s5, t6 + addq.ph s2, s6, t7 + addq.ph s3, s7, t8 + shra_r.ph t4, s0, 8 + shra_r.ph t6, s1, 8 + shra_r.ph t7, s2, 8 + shra_r.ph t8, s3, 8 + + precr.qb.ph s0, t0, t1 + precr.qb.ph s1, t2, t3 + precr.qb.ph s2, t4, t6 + precr.qb.ph s3, t7, t8 + + sb s0, 0(a0) + sb s1, 1(a0) + sb s2, 2(a0) + sb s3, 3(a0) + bgtz t9, 1b + addiu a0, a0, 4 +2: + beqz a2, 4f + nop +3: + lbu t1, 0(a0) + + muleu_s.ph.qbl t4, t1, t5 + muleu_s.ph.qbr t7, t1, t5 + shrl.ph t6, t4, 8 + shrl.ph t0, t7, 8 + addq.ph t8, t4, t6 + addq.ph t9, t7, t0 + shra_r.ph t8, t8, 8 + shra_r.ph t9, t9, 8 + precr.qb.ph t2, t8, t9 + sb t2, 0(a0) + addiu a2, a2, -1 + bnez a2, 3b + addiu a0, a0, 1 +4: + RESTORE_REGS_FROM_STACK 20, s0, s1, s2, s3, s4, s5, s6, s7 +5: + j ra + nop + +END(pixman_composite_in_n_8_asm_mips) + LEAF_MIPS_DSPR2(pixman_scaled_nearest_scanline_8888_8_0565_OVER_asm_mips) /* * a0 - dst (r5g6b5) diff --git a/pixman/pixman/pixman-mips-dspr2.c b/pixman/pixman/pixman-mips-dspr2.c index 11f1254f9..e14e1c43b 100644 --- a/pixman/pixman/pixman-mips-dspr2.c +++ b/pixman/pixman/pixman-mips-dspr2.c @@ -54,6 +54,10 @@ PIXMAN_MIPS_BIND_FAST_PATH_SRC_DST (0, add_8_8, uint8_t, 1, uint8_t, 1) PIXMAN_MIPS_BIND_FAST_PATH_SRC_DST (0, add_8888_8888, uint32_t, 1, uint32_t, 1) +PIXMAN_MIPS_BIND_FAST_PATH_SRC_DST (0, out_reverse_8_0565, + uint8_t, 1, uint16_t, 1) +PIXMAN_MIPS_BIND_FAST_PATH_SRC_DST (0, out_reverse_8_8888, + uint8_t, 1, uint32_t, 1) PIXMAN_MIPS_BIND_FAST_PATH_N_MASK_DST (0, src_n_8_8888, uint8_t, 1, uint32_t, 1) @@ -85,6 +89,10 @@ PIXMAN_MIPS_BIND_FAST_PATH_N_DST (SKIP_ZERO_SRC, over_n_0565, uint16_t, 1) PIXMAN_MIPS_BIND_FAST_PATH_N_DST (SKIP_ZERO_SRC, over_n_8888, uint32_t, 1) +PIXMAN_MIPS_BIND_FAST_PATH_N_DST (SKIP_ZERO_SRC, over_reverse_n_8888, + uint32_t, 1) +PIXMAN_MIPS_BIND_FAST_PATH_N_DST (0, in_n_8, + uint8_t, 1) PIXMAN_MIPS_BIND_FAST_PATH_SRC_MASK_DST (add_8_8_8, uint8_t, 1, uint8_t, 1, uint8_t, 1) @@ -324,6 +332,13 @@ static const pixman_fast_path_t mips_dspr2_fast_paths[] = PIXMAN_STD_FAST_PATH (ADD, a8, null, a8, mips_composite_add_8_8), PIXMAN_STD_FAST_PATH (ADD, a8r8g8b8, null, a8r8g8b8, mips_composite_add_8888_8888), PIXMAN_STD_FAST_PATH (ADD, a8b8g8r8, null, a8b8g8r8, mips_composite_add_8888_8888), + PIXMAN_STD_FAST_PATH (OUT_REVERSE, a8, null, r5g6b5, mips_composite_out_reverse_8_0565), + PIXMAN_STD_FAST_PATH (OUT_REVERSE, a8, null, b5g6r5, mips_composite_out_reverse_8_0565), + PIXMAN_STD_FAST_PATH (OUT_REVERSE, a8, null, a8r8g8b8, mips_composite_out_reverse_8_8888), + PIXMAN_STD_FAST_PATH (OUT_REVERSE, a8, null, a8b8g8r8, mips_composite_out_reverse_8_8888), + PIXMAN_STD_FAST_PATH (OVER_REVERSE, solid, null, a8r8g8b8, mips_composite_over_reverse_n_8888), + PIXMAN_STD_FAST_PATH (OVER_REVERSE, solid, null, a8b8g8r8, mips_composite_over_reverse_n_8888), + PIXMAN_STD_FAST_PATH (IN, solid, null, a8, mips_composite_in_n_8), PIXMAN_MIPS_SIMPLE_NEAREST_A8_MASK_FAST_PATH (OVER, a8r8g8b8, r5g6b5, mips_8888_8_0565), PIXMAN_MIPS_SIMPLE_NEAREST_A8_MASK_FAST_PATH (OVER, a8b8g8r8, b5g6r5, mips_8888_8_0565), diff --git a/xorg-server/Xi/exevents.c b/xorg-server/Xi/exevents.c index 6d5443341..2ff2471c5 100644 --- a/xorg-server/Xi/exevents.c +++ b/xorg-server/Xi/exevents.c @@ -1189,7 +1189,6 @@ TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource, TouchOwnershipEvent *ev) { Bool was_owner = (resource == ti->listeners[0].listener); - void *grab; int i; /* Send a TouchEnd event to the resource being removed, but only if they @@ -1204,11 +1203,7 @@ TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource, /* Remove the resource from the listener list, updating * ti->num_listeners, as well as ti->num_grabs if it was a grab. */ - if (TouchRemoveListener(ti, resource)) { - if (dixLookupResourceByType(&grab, resource, RT_PASSIVEGRAB, - serverClient, DixGetAttrAccess) == Success) - ti->num_grabs--; - } + TouchRemoveListener(ti, resource); /* If the current owner was removed and there are further listeners, deliver * the TouchOwnership or TouchBegin event to the new owner. */ @@ -1302,34 +1297,19 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti, if (listener->type == LISTENER_GRAB || listener->type == LISTENER_POINTER_GRAB) { - rc = dixLookupResourceByType((pointer *) grab, listener->listener, - RT_PASSIVEGRAB, - serverClient, DixSendAccess); - if (rc != Success) { - /* the grab doesn't exist but we have a grabbing listener - this - * is an implicit/active grab */ - rc = dixLookupClient(client, listener->listener, serverClient, - DixSendAccess); - if (rc != Success) - return FALSE; - - *grab = dev->deviceGrab.grab; - if (!*grab) - return FALSE; - } + + *grab = listener->grab; + + BUG_RETURN_VAL(!*grab, FALSE); *client = rClient(*grab); *win = (*grab)->window; *mask = (*grab)->xi2mask; } else { - if (listener->level == CORE) - rc = dixLookupWindow(win, listener->listener, - serverClient, DixSendAccess); - else - rc = dixLookupResourceByType((pointer *) win, listener->listener, - RT_INPUTCLIENT, - serverClient, DixSendAccess); + rc = dixLookupResourceByType((pointer *) win, listener->listener, + listener->resource_type, + serverClient, DixSendAccess); if (rc != Success) return FALSE; @@ -1469,6 +1449,8 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, */ l = &ti->listeners[ti->num_listeners - 1]; l->listener = devgrab->resource; + l->grab = devgrab; + //l->resource_type = RT_NONE; if (devgrab->grabtype != XI2 || devgrab->type != XI_TouchBegin) l->type = LISTENER_POINTER_GRAB; diff --git a/xorg-server/config/udev.c b/xorg-server/config/udev.c index 454838f4c..de8924143 100644 --- a/xorg-server/config/udev.c +++ b/xorg-server/config/udev.c @@ -267,7 +267,7 @@ device_removed(struct udev_device *device) if (strncmp(sysname,"card", 4) != 0) return; - ErrorF("removing GPU device %s %d\n", syspath, path); + ErrorF("removing GPU device %s %s\n", syspath, path); if (!path) return; diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c index 9d9565b95..cb9440b7c 100644 --- a/xorg-server/dix/events.c +++ b/xorg-server/dix/events.c @@ -1441,6 +1441,7 @@ UpdateTouchesForGrab(DeviceIntPtr mouse) ti->listeners[0].type = LISTENER_POINTER_GRAB; else ti->listeners[0].type = LISTENER_GRAB; + ti->listeners[0].grab = grab; } } } @@ -1524,7 +1525,7 @@ DeactivatePointerGrab(DeviceIntPtr mouse) emulate a ButtonRelease here. So pretend the listener already has the end event */ if (grab->grabtype == CORE || grab->grabtype == XI || - !xi2mask_isset(dev->deviceGrab.grab->xi2mask, dev, XI_TouchBegin)) + !xi2mask_isset(mouse->deviceGrab.grab->xi2mask, mouse, XI_TouchBegin)) ti->listeners[0].state = LISTENER_HAS_END; TouchListenerAcceptReject(mouse, ti, 0, XIRejectTouch); } @@ -1553,15 +1554,6 @@ DeactivatePointerGrab(DeviceIntPtr mouse) ReattachToOldMaster(mouse); ComputeFreezes(); - - /* If an explicit grab was deactivated, we must remove it from the head of - * all the touches' listener lists. */ - for (i = 0; mouse->touch && i < mouse->touch->num_touches; i++) { - TouchPointInfoPtr ti = mouse->touch->touches + i; - - if (ti->active && TouchResourceIsOwner(ti, grab_resource)) - TouchListenerAcceptReject(mouse, ti, 0, XIRejectTouch); - } } /** @@ -2249,7 +2241,7 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent * @return TRUE if the event should be discarded, FALSE otherwise. */ static BOOL -FilterRawEvents(const ClientPtr client, const GrabPtr grab) +FilterRawEvents(const ClientPtr client, const GrabPtr grab, WindowPtr root) { XIClientPtr client_xi_version; int cmp; @@ -2265,7 +2257,10 @@ FilterRawEvents(const ClientPtr client, const GrabPtr grab) client_xi_version->minor_version, 2, 0); /* XI 2.0: if device is grabbed, skip XI 2.1: if device is grabbed by us, skip, we've already delivered */ - return (cmp == 0) ? TRUE : SameClient(grab, client); + if (cmp == 0) + return TRUE; + + return (grab->window != root) ? FALSE : SameClient(grab, client); } /** @@ -2318,7 +2313,7 @@ DeliverRawEvent(RawDeviceEvent *ev, DeviceIntPtr device) */ ic.next = NULL; - if (!FilterRawEvents(rClient(&ic), grab)) + if (!FilterRawEvents(rClient(&ic), grab, root)) DeliverEventToInputClients(device, &ic, root, xi, 1, filter, NULL, &c, &m); } diff --git a/xorg-server/dix/getevents.c b/xorg-server/dix/getevents.c index a158f98c9..ad45149d2 100644 --- a/xorg-server/dix/getevents.c +++ b/xorg-server/dix/getevents.c @@ -1915,16 +1915,16 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid, if (!mask_in || !valuator_mask_isset(mask_in, 0) || !valuator_mask_isset(mask_in, 1)) { - ErrorF("%s: Attempted to start touch without x/y (driver bug)\n", - dev->name); + ErrorFSigSafe("%s: Attempted to start touch without x/y " + "(driver bug)\n", dev->name); return 0; } break; case XI_TouchUpdate: event->type = ET_TouchUpdate; if (!mask_in || valuator_mask_num_valuators(mask_in) <= 0) { - ErrorF("%s: TouchUpdate with no valuators? Driver bug\n", - dev->name); + ErrorFSigSafe("%s: TouchUpdate with no valuators? Driver bug\n", + dev->name); } break; case XI_TouchEnd: diff --git a/xorg-server/dix/ptrveloc.c b/xorg-server/dix/ptrveloc.c index 270a56fcb..7d3d9f938 100644 --- a/xorg-server/dix/ptrveloc.c +++ b/xorg-server/dix/ptrveloc.c @@ -747,7 +747,7 @@ ApplyConstantDeceleration(DeviceVelocityPtr vel, double *fdx, double *fdy) } /* - * compute the acceleration for given velocity and enforce min_acceleartion + * compute the acceleration for given velocity and enforce min_acceleration */ double BasicComputeAcceleration(DeviceIntPtr dev, diff --git a/xorg-server/dix/touch.c b/xorg-server/dix/touch.c index d890b6227..0db842c65 100644 --- a/xorg-server/dix/touch.c +++ b/xorg-server/dix/touch.c @@ -675,15 +675,20 @@ TouchResourceIsOwner(TouchPointInfoPtr ti, XID resource) * Add the resource to this touch's listeners. */ void -TouchAddListener(TouchPointInfoPtr ti, XID resource, enum InputLevel level, - enum TouchListenerType type, enum TouchListenerState state, - WindowPtr window) +TouchAddListener(TouchPointInfoPtr ti, XID resource, int resource_type, + enum InputLevel level, enum TouchListenerType type, + enum TouchListenerState state, WindowPtr window, + GrabPtr grab) { ti->listeners[ti->num_listeners].listener = resource; + ti->listeners[ti->num_listeners].resource_type = resource_type; ti->listeners[ti->num_listeners].level = level; ti->listeners[ti->num_listeners].state = state; ti->listeners[ti->num_listeners].type = type; ti->listeners[ti->num_listeners].window = window; + ti->listeners[ti->num_listeners].grab = grab; + if (grab) + ti->num_grabs++; ti->num_listeners++; } @@ -702,6 +707,11 @@ TouchRemoveListener(TouchPointInfoPtr ti, XID resource) if (ti->listeners[i].listener == resource) { int j; + if (ti->listeners[i].grab) { + ti->listeners[i].grab = NULL; + ti->num_grabs--; + } + for (j = i; j < ti->num_listeners - 1; j++) ti->listeners[j] = ti->listeners[j + 1]; ti->num_listeners--; @@ -732,9 +742,9 @@ TouchAddGrabListener(DeviceIntPtr dev, TouchPointInfoPtr ti, type = LISTENER_POINTER_GRAB; } - TouchAddListener(ti, grab->resource, grab->grabtype, - type, LISTENER_AWAITING_BEGIN, grab->window); - ti->num_grabs++; + /* grab listeners are always RT_NONE since we keep the grab pointer */ + TouchAddListener(ti, grab->resource, RT_NONE, grab->grabtype, + type, LISTENER_AWAITING_BEGIN, grab->window, grab); } /** @@ -789,8 +799,8 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti, if (!xi2mask_isset(iclients->xi2mask, dev, XI_TouchOwnership)) TouchEventHistoryAllocate(ti); - TouchAddListener(ti, iclients->resource, XI2, - type, LISTENER_AWAITING_BEGIN, win); + TouchAddListener(ti, iclients->resource, RT_INPUTCLIENT, XI2, + type, LISTENER_AWAITING_BEGIN, win, NULL); return TRUE; } } @@ -804,9 +814,9 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti, continue; TouchEventHistoryAllocate(ti); - TouchAddListener(ti, iclients->resource, XI, + TouchAddListener(ti, iclients->resource, RT_INPUTCLIENT, XI, LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN, - win); + win, NULL); return TRUE; } } @@ -819,9 +829,9 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti, /* window owner */ if (IsMaster(dev) && (win->eventMask & core_filter)) { TouchEventHistoryAllocate(ti); - TouchAddListener(ti, win->drawable.id, CORE, + TouchAddListener(ti, win->drawable.id, RT_WINDOW, CORE, LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN, - win); + win, NULL); return TRUE; } @@ -831,8 +841,8 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti, continue; TouchEventHistoryAllocate(ti); - TouchAddListener(ti, oclients->resource, CORE, - type, LISTENER_AWAITING_BEGIN, win); + TouchAddListener(ti, oclients->resource, RT_OTHERCLIENT, CORE, + type, LISTENER_AWAITING_BEGIN, win, NULL); return TRUE; } } diff --git a/xorg-server/hw/xfree86/common/xf86DGA.c b/xorg-server/hw/xfree86/common/xf86DGA.c index c25a2747b..6a05ce536 100644 --- a/xorg-server/hw/xfree86/common/xf86DGA.c +++ b/xorg-server/hw/xfree86/common/xf86DGA.c @@ -1033,6 +1033,9 @@ DGAProcessKeyboardEvent(ScreenPtr pScreen, DGAEvent * event, DeviceIntPtr keybd) UpdateDeviceState(keybd, &ev); + if (!IsMaster(keybd)) + return; + /* * Deliver the DGA event */ @@ -1074,6 +1077,7 @@ DGAProcessPointerEvent(ScreenPtr pScreen, DGAEvent * event, DeviceIntPtr mouse) DeviceEvent ev = { .header = ET_Internal, .length = sizeof(ev), + .detail.key = event->detail, .type = event->subtype, .corestate = butc ? butc->state : 0 }; @@ -1083,6 +1087,9 @@ DGAProcessPointerEvent(ScreenPtr pScreen, DGAEvent * event, DeviceIntPtr mouse) UpdateDeviceState(mouse, &ev); + if (!IsMaster(mouse)) + return; + /* * Deliver the DGA event */ @@ -1190,9 +1197,6 @@ DGAHandleEvent(int screen_num, InternalEvent *ev, DeviceIntPtr device) if (!pScreenPriv) return; - if (!IsMaster(device)) - return; - switch (event->subtype) { case KeyPress: case KeyRelease: diff --git a/xorg-server/hw/xfree86/common/xf86Events.c b/xorg-server/hw/xfree86/common/xf86Events.c index d8d4fad9c..377e936f7 100644 --- a/xorg-server/hw/xfree86/common/xf86Events.c +++ b/xorg-server/hw/xfree86/common/xf86Events.c @@ -619,14 +619,16 @@ InputHandlerProc xf86SetConsoleHandler(InputHandlerProc proc, pointer data) { static IHPtr handler = NULL; - IHPtr old_handler = handler; + InputHandlerProc old_proc = NULL; - if (old_handler) - xf86RemoveGeneralHandler(old_handler); + if (handler) { + old_proc = handler->ihproc; + xf86RemoveGeneralHandler(handler); + } handler = xf86AddGeneralHandler(xf86Info.consoleFd, proc, data); - return (old_handler) ? old_handler->ihproc : NULL; + return old_proc; } static void diff --git a/xorg-server/hw/xfree86/common/xf86Module.h b/xorg-server/hw/xfree86/common/xf86Module.h index 1be7ba54d..e545c1498 100644 --- a/xorg-server/hw/xfree86/common/xf86Module.h +++ b/xorg-server/hw/xfree86/common/xf86Module.h @@ -81,7 +81,7 @@ typedef enum { */ #define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4) #define ABI_VIDEODRV_VERSION SET_ABI_VERSION(14, 1) -#define ABI_XINPUT_VERSION SET_ABI_VERSION(18, 0) +#define ABI_XINPUT_VERSION SET_ABI_VERSION(19, 0) #define ABI_EXTENSION_VERSION SET_ABI_VERSION(7, 0) #define ABI_FONT_VERSION SET_ABI_VERSION(0, 6) diff --git a/xorg-server/hw/xfree86/common/xf86Option.c b/xorg-server/hw/xfree86/common/xf86Option.c index c2ec79a53..40c9d15f4 100644 --- a/xorg-server/hw/xfree86/common/xf86Option.c +++ b/xorg-server/hw/xfree86/common/xf86Option.c @@ -515,7 +515,7 @@ ParseOptionValue(int scrnIndex, XF86OptionPtr options, OptionInfoPtr p, if (*s == '\0') { if (markUsed) { xf86DrvMsg(scrnIndex, X_WARNING, - "Option \"%s\" requires an string value\n", + "Option \"%s\" requires a string value\n", p->name); } p->found = FALSE; diff --git a/xorg-server/hw/xwin/winblock.c b/xorg-server/hw/xwin/winblock.c index a4ae8669f..c3ef4becd 100644 --- a/xorg-server/hw/xwin/winblock.c +++ b/xorg-server/hw/xwin/winblock.c @@ -42,14 +42,26 @@ winBlockHandler(ScreenPtr pScreen, #if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) winScreenPriv(pScreen); #endif - MSG msg; #ifndef HAS_DEVWINDOWS struct timeval **tvp = pTimeout; if (*tvp != NULL) { + if (GetQueueStatus(QS_ALLINPUT | QS_ALLPOSTMESSAGE) != 0) { + /* If there are still messages to process on the Windows message + queue, make sure select() just polls rather than blocking. + */ + (*tvp)->tv_sec = 0; + (*tvp)->tv_usec = 0; + } + else { + /* Otherwise, lacking /dev/windows, we must wake up again in + a reasonable time to check the Windows message queue. without + noticeable delay. + */ (*tvp)->tv_sec = 0; (*tvp)->tv_usec = 100; + } } #endif @@ -68,24 +80,12 @@ winBlockHandler(ScreenPtr pScreen, if (iReturn != 0) { ErrorF("winBlockHandler - pthread_mutex_unlock () failed: %d\n", iReturn); - goto winBlockHandler_ProcessMessages; } - - winDebug("winBlockHandler - pthread_mutex_unlock () returned\n"); - } - - winBlockHandler_ProcessMessages: -#endif - - /* Process all messages on our queue */ - while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { - if ((g_hDlgDepthChange == 0 - || !IsDialogMessage(g_hDlgDepthChange, &msg)) - && (g_hDlgExit == 0 || !IsDialogMessage(g_hDlgExit, &msg)) - && (g_hDlgAbout == 0 || !IsDialogMessage(g_hDlgAbout, &msg))) { - DispatchMessage(&msg); + else { + winDebug("winBlockHandler - pthread_mutex_unlock () returned\n"); } } +#endif /* At least one X client has asked to suspend the screensaver, so diff --git a/xorg-server/hw/xwin/winconfig.c b/xorg-server/hw/xwin/winconfig.c index 5d36aa89f..11717a506 100644..100755 --- a/xorg-server/hw/xwin/winconfig.c +++ b/xorg-server/hw/xwin/winconfig.c @@ -81,8 +81,7 @@ WinCmdlineRec g_cmdline = { 0 /* emulate3Timeout */ }; -winInfoRec -g_winInfo = { +winInfoRec g_winInfo = { { /* keyboard */ 0, /* leds */ 500, /* delay */ @@ -763,7 +762,7 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p) break; case OPTV_STRING: if (*s == '\0') { - winDebug ( "Option \"%s\" requires an string value\n", p->name); + winDebug ( "Option \"%s\" requires a string value\n", p->name); p->found = FALSE; } else { diff --git a/xorg-server/hw/xwin/winglobals.h b/xorg-server/hw/xwin/winglobals.h index a7ca6088d..ae2385255 100644 --- a/xorg-server/hw/xwin/winglobals.h +++ b/xorg-server/hw/xwin/winglobals.h @@ -26,6 +26,10 @@ #ifndef WINGLOBALS_H #define WINGLOBALS_H +#ifdef HAVE_XWIN_CONFIG_H +#include <xwin-config.h> +#endif + /* * References to external symbols */ diff --git a/xorg-server/hw/xwin/winkeybd.c b/xorg-server/hw/xwin/winkeybd.c index 8e035956d..1d242a2ba 100644 --- a/xorg-server/hw/xwin/winkeybd.c +++ b/xorg-server/hw/xwin/winkeybd.c @@ -56,7 +56,7 @@ static void static void winKeybdCtrl(DeviceIntPtr pDevice, KeybdCtrl * pCtrl); -/* +/* * Translate a Windows WM_[SYS]KEY(UP/DOWN) message * into an ASCII scan code. * @@ -134,7 +134,7 @@ winKeybdCtrl(DeviceIntPtr pDevice, KeybdCtrl * pCtrl) { } -/* +/* * See Porting Layer Definition - p. 18 * winKeybdProc is known as a DeviceProc. */ @@ -523,8 +523,8 @@ winCheckKeyPressed(WPARAM wParam, LPARAM lParam) return FALSE; } -/* Only on shift release message is sent even if both are pressed. - * Fix this here +/* Only one shift release message is sent even if both are pressed. + * Fix this here */ void winFixShiftKeys(int iScanCode) diff --git a/xorg-server/hw/xwin/winmultiwindowwm.c b/xorg-server/hw/xwin/winmultiwindowwm.c index 424da2bfa..059550c8c 100644 --- a/xorg-server/hw/xwin/winmultiwindowwm.c +++ b/xorg-server/hw/xwin/winmultiwindowwm.c @@ -192,7 +192,7 @@ static void winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle); void - winUpdateWindowPosition(HWND hWnd, Bool reshape, HWND * zstyle); + winUpdateWindowPosition(HWND hWnd, HWND * zstyle); /* * Local globals @@ -560,6 +560,45 @@ UpdateIcon(WMInfoPtr pWMInfo, Window iWindow) winUpdateIcon(hWnd, pWMInfo->pDisplay, iWindow, hIconNew); } +/* + * Updates the style of a HWND according to its X style properties + */ + +static void +UpdateStyle(WMInfoPtr pWMInfo, Window iWindow) +{ + HWND hWnd; + HWND zstyle = HWND_NOTOPMOST; + UINT flags; + + hWnd = getHwnd(pWMInfo, iWindow); + if (!hWnd) + return; + + /* Determine the Window style, which determines borders and clipping region... */ + winApplyHints(pWMInfo->pDisplay, iWindow, hWnd, &zstyle); + winUpdateWindowPosition(hWnd, &zstyle); + + /* Apply the updated window style, without changing it's show or activation state */ + flags = SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE; + if (zstyle == HWND_NOTOPMOST) + flags |= SWP_NOZORDER | SWP_NOOWNERZORDER; + SetWindowPos(hWnd, NULL, 0, 0, 0, 0, flags); + + /* + Use the WS_EX_TOOLWINDOW style to remove window from Alt-Tab window switcher + + According to MSDN, this is supposed to remove the window from the taskbar as well, + if we SW_HIDE before changing the style followed by SW_SHOW afterwards. + + But that doesn't seem to work reliably, and causes the window to flicker, so use + the iTaskbarList interface to tell the taskbar to show or hide this window. + */ + winShowWindowOnTaskbar(hWnd, + (GetWindowLongPtr(hWnd, GWL_EXSTYLE) & + WS_EX_APPWINDOW) ? TRUE : FALSE); +} + #if 0 /* * Fix up any differences between the X11 and Win32 window stacks @@ -691,13 +730,19 @@ winMultiWindowWMProc(void *pArg) (unsigned char *) &(pNode->msg.hwndWindow), 1); UpdateName(pWMInfo, pNode->msg.iWindow); UpdateIcon(pWMInfo, pNode->msg.iWindow); - { - HWND zstyle = HWND_NOTOPMOST; + UpdateStyle(pWMInfo, pNode->msg.iWindow); + - winApplyHints(pWMInfo->pDisplay, pNode->msg.iWindow, - pNode->msg.hwndWindow, &zstyle); - winUpdateWindowPosition(pNode->msg.hwndWindow, TRUE, &zstyle); + /* Reshape */ + { + WindowPtr pWin = + GetProp(pNode->msg.hwndWindow, WIN_WINDOW_PROP); + if (pWin) { + winReshapeMultiWindow(pWin); + winUpdateRgnMultiWindow(pWin); + } } + break; case WM_WM_UNMAP: @@ -750,6 +795,19 @@ winMultiWindowWMProc(void *pArg) UpdateIcon(pWMInfo, pNode->msg.iWindow); break; + case WM_WM_HINTS_EVENT: + { + XWindowAttributes attr; + + /* Don't do anything if this is an override-redirect window */ + XGetWindowAttributes (pWMInfo->pDisplay, pNode->msg.iWindow, &attr); + if (attr.override_redirect) + break; + + UpdateStyle(pWMInfo, pNode->msg.iWindow); + } + break; + case WM_WM_CHANGE_STATE: /* Minimize the window in Windows */ winMinimizeWindow(pNode->msg.iWindow); @@ -800,6 +858,7 @@ winMultiWindowXMsgProc(void *pArg) Atom atmWmHints; Atom atmWmChange; Atom atmNetWmIcon; + Atom atmWindowState, atmMotifWmHints, atmWindowType, atmNormalHints; int iReturn; XIconSize *xis; @@ -926,6 +985,10 @@ winMultiWindowXMsgProc(void *pArg) atmWmHints = XInternAtom(pProcArg->pDisplay, "WM_HINTS", False); atmWmChange = XInternAtom(pProcArg->pDisplay, "WM_CHANGE_STATE", False); atmNetWmIcon = XInternAtom(pProcArg->pDisplay, "_NET_WM_ICON", False); + atmWindowState = XInternAtom(pProcArg->pDisplay, "_NET_WM_STATE", False); + atmMotifWmHints = XInternAtom(pProcArg->pDisplay, "_MOTIF_WM_HINTS", False); + atmWindowType = XInternAtom(pProcArg->pDisplay, "_NET_WM_WINDOW_TYPE", False); + atmNormalHints = XInternAtom(pProcArg->pDisplay, "WM_NORMAL_HINTS", False); /* iiimxcf had a bug until 2009-04-27, assuming that the @@ -1066,14 +1129,34 @@ winMultiWindowXMsgProc(void *pArg) /* Other fields ignored */ winSendMessageToWM(pProcArg->pWMInfo, &msg); } - else if ((event.xproperty.atom == atmWmHints) || - (event.xproperty.atom == atmNetWmIcon)) { - memset(&msg, 0, sizeof(msg)); - msg.msg = WM_WM_ICON_EVENT; - msg.iWindow = event.xproperty.window; + else { + /* + Several properties are considered for WM hints, check if this property change affects any of them... + (this list needs to be kept in sync with winApplyHints()) + */ + if ((event.xproperty.atom == atmWmHints) || + (event.xproperty.atom == atmWindowState) || + (event.xproperty.atom == atmMotifWmHints) || + (event.xproperty.atom == atmWindowType) || + (event.xproperty.atom == atmNormalHints)) { + memset(&msg, 0, sizeof(msg)); + msg.msg = WM_WM_HINTS_EVENT; + msg.iWindow = event.xproperty.window; + + /* Other fields ignored */ + winSendMessageToWM(pProcArg->pWMInfo, &msg); + } - /* Other fields ignored */ - winSendMessageToWM(pProcArg->pWMInfo, &msg); + /* Not an else as WM_HINTS affects both style and icon */ + if ((event.xproperty.atom == atmWmHints) || + (event.xproperty.atom == atmNetWmIcon)) { + memset(&msg, 0, sizeof(msg)); + msg.msg = WM_WM_ICON_EVENT; + msg.iWindow = event.xproperty.window; + + /* Other fields ignored */ + winSendMessageToWM(pProcArg->pWMInfo, &msg); + } } } else if (event.type == ClientMessage @@ -1733,7 +1816,7 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle) } void -winUpdateWindowPosition(HWND hWnd, Bool reshape, HWND * zstyle) +winUpdateWindowPosition(HWND hWnd, HWND * zstyle) { int iX, iY, iWidth, iHeight; int iDx, iDy; @@ -1778,10 +1861,6 @@ winUpdateWindowPosition(HWND hWnd, Bool reshape, HWND * zstyle) SetWindowPos(hWnd, *zstyle, rcNew.left, rcNew.top, rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, 0); - if (reshape) { - winReshapeMultiWindow(pWin); - winUpdateRgnMultiWindow(pWin); - } } void diff --git a/xorg-server/hw/xwin/winmultiwindowwndproc.c b/xorg-server/hw/xwin/winmultiwindowwndproc.c index 7ceee11a5..abd7672cc 100644..100755 --- a/xorg-server/hw/xwin/winmultiwindowwndproc.c +++ b/xorg-server/hw/xwin/winmultiwindowwndproc.c @@ -46,6 +46,8 @@ #include "winmsg.h" #include "inputstr.h" +extern void winUpdateWindowPosition(HWND hWnd, HWND * zstyle); + #ifdef XKB #ifndef XKB_IN_SERVER #define XKB_IN_SERVER @@ -53,7 +55,6 @@ #include <xkbsrv.h> #endif -extern void winUpdateWindowPosition(HWND hWnd, Bool reshape, HWND * zstyle); /* * Local globals @@ -327,7 +328,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) static Bool s_fTracking = FALSE; Bool needRestack = FALSE; LRESULT ret; - static Bool hasEnteredSizeMove = FALSE; + static Bool hasEnteredSizeMove = FALSE; winDebugWin32Message("winTopLevelWindowProc", hwnd, message, wParam, lParam); @@ -863,41 +864,36 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) /* */ if (!pWin->overrideRedirect) { + HWND zstyle = HWND_NOTOPMOST; + /* Flag that this window needs to be made active when clicked */ SetProp(hwnd, WIN_NEEDMANAGE_PROP, (HANDLE) 1); - if (!(GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_APPWINDOW)) { - HWND zstyle = HWND_NOTOPMOST; - - /* Set the window extended style flags */ - SetWindowLongPtr(hwnd, GWL_EXSTYLE, WS_EX_APPWINDOW); - - /* Set the transient style flags */ - if (GetParent(hwnd)) - SetWindowLongPtr(hwnd, GWL_STYLE, - WS_POPUP | WS_OVERLAPPED | WS_SYSMENU | - WS_CLIPCHILDREN | WS_CLIPSIBLINGS); - /* Set the window standard style flags */ - else - SetWindowLongPtr(hwnd, GWL_STYLE, - (WS_POPUP | WS_OVERLAPPEDWINDOW | - WS_CLIPCHILDREN | WS_CLIPSIBLINGS) - & ~WS_CAPTION & ~WS_SIZEBOX); - - winUpdateWindowPosition(hwnd, FALSE, &zstyle); - - { - WinXWMHints hints; - - if (winMultiWindowGetWMHints(pWin, &hints)) { - /* - Give the window focus, unless it has an InputHint - which is FALSE (this is used by e.g. glean to - avoid every test window grabbing the focus) - */ - if (!((hints.flags & InputHint) && (!hints.input))) { - SetForegroundWindow(hwnd); - } + /* Set the transient style flags */ + if (GetParent(hwnd)) + SetWindowLongPtr(hwnd, GWL_STYLE, + WS_POPUP | WS_OVERLAPPED | WS_SYSMENU | + WS_CLIPCHILDREN | WS_CLIPSIBLINGS); + /* Set the window standard style flags */ + else + SetWindowLongPtr(hwnd, GWL_STYLE, + (WS_POPUP | WS_OVERLAPPEDWINDOW | + WS_CLIPCHILDREN | WS_CLIPSIBLINGS) + & ~WS_CAPTION & ~WS_SIZEBOX); + + winUpdateWindowPosition(hwnd, &zstyle); + + { + WinXWMHints hints; + + if (winMultiWindowGetWMHints(pWin, &hints)) { + /* + Give the window focus, unless it has an InputHint + which is FALSE (this is used by e.g. glean to + avoid every test window grabbing the focus) + */ + if (!((hints.flags & InputHint) && (!hints.input))) { + SetForegroundWindow(hwnd); } } } diff --git a/xorg-server/hw/xwin/wintrayicon.c b/xorg-server/hw/xwin/wintrayicon.c index 8a3952629..bcea0cc81 100644 --- a/xorg-server/hw/xwin/wintrayicon.c +++ b/xorg-server/hw/xwin/wintrayicon.c @@ -137,7 +137,7 @@ winHandleIconMessage(HWND hwnd, UINT message, break; case WM_LBUTTONUP: /* Restack and bring all windows to top */ - SetForegroundWindow(hwnd); + SetForegroundWindow (pScreenPriv->hwndScreen); #ifdef XWIN_MULTIWINDOWEXTWM if (pScreenInfo->fMWExtWM) diff --git a/xorg-server/hw/xwin/winwakeup.c b/xorg-server/hw/xwin/winwakeup.c index 77c160533..795221a1a 100644 --- a/xorg-server/hw/xwin/winwakeup.c +++ b/xorg-server/hw/xwin/winwakeup.c @@ -43,8 +43,8 @@ winWakeupHandler(ScreenPtr pScreen, { MSG msg; - /* Process all messages on our queue */ - while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { + /* Process one message from our queue */ + if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if ((g_hDlgDepthChange == 0 || !IsDialogMessage(g_hDlgDepthChange, &msg)) && (g_hDlgExit == 0 || !IsDialogMessage(g_hDlgExit, &msg)) diff --git a/xorg-server/hw/xwin/winwindow.h b/xorg-server/hw/xwin/winwindow.h index f80e5752d..bc4ed5abe 100644 --- a/xorg-server/hw/xwin/winwindow.h +++ b/xorg-server/hw/xwin/winwindow.h @@ -105,6 +105,7 @@ typedef struct _winWMMessageRec { #define WM_WM_CHANGE_STATE (WM_USER + 11) #define WM_WM_MAP2 (WM_USER + 12) #define WM_WM_MAP3 (WM_USER + 13) +#define WM_WM_HINTS_EVENT (WM_USER + 14) #define WM_MANAGE (WM_USER + 100) #define WM_UNMANAGE (WM_USER + 102) #define WM_WM_REINIT (WM_USER + 200) diff --git a/xorg-server/include/input.h b/xorg-server/include/input.h index 23a20b59d..f53ed9905 100644 --- a/xorg-server/include/input.h +++ b/xorg-server/include/input.h @@ -565,9 +565,9 @@ extern void TouchEventHistoryPush(TouchPointInfoPtr ti, const DeviceEvent *ev); extern void TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev, XID resource); extern Bool TouchResourceIsOwner(TouchPointInfoPtr ti, XID resource); -extern void TouchAddListener(TouchPointInfoPtr ti, XID resource, +extern void TouchAddListener(TouchPointInfoPtr ti, XID resource, int resource_type, enum InputLevel level, enum TouchListenerType type, - enum TouchListenerState state, WindowPtr window); + enum TouchListenerState state, WindowPtr window, GrabPtr grab); extern Bool TouchRemoveListener(TouchPointInfoPtr ti, XID resource); extern void TouchSetupListeners(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev); diff --git a/xorg-server/include/inputstr.h b/xorg-server/include/inputstr.h index 17cee9854..48a29bede 100644 --- a/xorg-server/include/inputstr.h +++ b/xorg-server/include/inputstr.h @@ -298,6 +298,17 @@ typedef struct _ValuatorClassRec { int v_scroll_axis; /* vert smooth-scrolling axis */ } ValuatorClassRec; +typedef struct _TouchListener { + XID listener; /* grabs/event selection IDs receiving + * events for this touch */ + int resource_type; /* listener's resource type */ + enum TouchListenerType type; + enum TouchListenerState state; + enum InputLevel level; /* matters only for emulating touches */ + WindowPtr window; + GrabPtr grab; +} TouchListener; + typedef struct _TouchPointInfo { uint32_t client_id; /* touch ID as seen in client events */ int sourceid; /* Source device's ID for this touchpoint */ @@ -306,14 +317,7 @@ typedef struct _TouchPointInfo { * but still owned by a grab */ SpriteRec sprite; /* window trace for delivery */ ValuatorMask *valuators; /* last recorded axis values */ - struct _TouchListener { - XID listener; /* grabs/event selection IDs receiving - * events for this touch */ - enum TouchListenerType type; - enum TouchListenerState state; - enum InputLevel level; /* matters only for emulating touches */ - WindowPtr window; - } *listeners; + TouchListener *listeners; /* set of listeners */ int num_listeners; int num_grabs; /* number of open grabs on this touch * which have not accepted or rejected */ @@ -323,8 +327,6 @@ typedef struct _TouchPointInfo { size_t history_size; /* Size of history in elements */ } TouchPointInfoRec; -typedef struct _TouchListener TouchListener; - typedef struct _DDXTouchPointInfo { uint32_t client_id; /* touch ID as seen in client events */ Bool active; /* whether or not the touch is active */ diff --git a/xorg-server/include/xwin-config.h.in b/xorg-server/include/xwin-config.h.in index 8122f5543..c5119f268 100644 --- a/xorg-server/include/xwin-config.h.in +++ b/xorg-server/include/xwin-config.h.in @@ -31,3 +31,6 @@ /* Default log location */ #undef DEFAULT_LOGDIR + +/* Whether we should re-locate the root to where the executable lives */ +#undef RELOCATE_PROJECTROOT diff --git a/xorg-server/mi/mieq.c b/xorg-server/mi/mieq.c index 22f8c91bb..d7d73deb6 100644 --- a/xorg-server/mi/mieq.c +++ b/xorg-server/mi/mieq.c @@ -627,7 +627,11 @@ mieqProcessInputEvents(void) mieqProcessDeviceEvent(dev, &event, screen); /* Update the sprite now. Next event may be from different device. */ - if (event.any.type == ET_Motion && master) + if (master && + (event.any.type == ET_Motion || + ((event.any.type == ET_TouchBegin || + event.any.type == ET_TouchUpdate) && + event.device_event.flags & TOUCH_POINTER_EMULATED))) miPointerUpdateSprite(dev); #ifdef XQUARTZ diff --git a/xorg-server/render/animcur.c b/xorg-server/render/animcur.c index ebc5b8ef7..9cbba83fa 100644 --- a/xorg-server/render/animcur.c +++ b/xorg-server/render/animcur.c @@ -143,6 +143,8 @@ AnimCurScreenBlockHandler(ScreenPtr pScreen, Bool activeDevice = FALSE; CARD32 now = 0, soonest = ~0; /* earliest time to wakeup again */ + Unwrap(as, pScreen, BlockHandler); + for (dev = inputInfo.devices; dev; dev = dev->next) { if (IsPointerDevice(dev) && pScreen == dev->spriteInfo->anim.pScreen) { if (!activeDevice) { @@ -180,7 +182,6 @@ AnimCurScreenBlockHandler(ScreenPtr pScreen, if (activeDevice) AdjustWaitForDelay(pTimeout, soonest - now); - Unwrap(as, pScreen, BlockHandler); (*pScreen->BlockHandler) (pScreen, pTimeout, pReadmask); if (activeDevice) Wrap(as, pScreen, BlockHandler, AnimCurScreenBlockHandler); diff --git a/xorg-server/test/xi2/protocol-xiwarppointer.c b/xorg-server/test/xi2/protocol-xiwarppointer.c index 4bea333c3..f7986c1eb 100644 --- a/xorg-server/test/xi2/protocol-xiwarppointer.c +++ b/xorg-server/test/xi2/protocol-xiwarppointer.c @@ -68,7 +68,7 @@ __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access) * This function overrides the one in the screen rec. */ static Bool -ScreenSetCursorPosition(DeviceIntPtr dev, ScreenPtr screen, +ScreenSetCursorPosition(DeviceIntPtr dev, ScreenPtr scr, int x, int y, Bool generateEvent) { assert(x == expected_x); diff --git a/xorg-server/xkb/xkbUtils.c b/xorg-server/xkb/xkbUtils.c index c23cd7784..6c6af60f0 100644 --- a/xorg-server/xkb/xkbUtils.c +++ b/xorg-server/xkb/xkbUtils.c @@ -642,6 +642,7 @@ XkbComputeCompatState(XkbSrvInfoPtr xkbi) CARD16 grp_mask; XkbStatePtr state = &xkbi->state; XkbCompatMapPtr map; + XkbControlsPtr ctrls; if (!state || !xkbi->desc || !xkbi->desc->ctrls || !xkbi->desc->compat) return; @@ -650,9 +651,14 @@ XkbComputeCompatState(XkbSrvInfoPtr xkbi) grp_mask = map->groups[state->group].mask; state->compat_state = state->mods | grp_mask; state->compat_lookup_mods = state->lookup_mods | grp_mask; + ctrls= xkbi->desc->ctrls; - if (xkbi->desc->ctrls->enabled_ctrls & XkbIgnoreGroupLockMask) - grp_mask = map->groups[state->base_group].mask; + if (ctrls->enabled_ctrls & XkbIgnoreGroupLockMask) { + unsigned char grp = state->base_group+state->latched_group; + if (grp >= ctrls->num_groups) + grp = XkbAdjustGroup(XkbCharToInt(grp), ctrls); + grp_mask = map->groups[grp].mask; + } state->compat_grab_mods = state->grab_mods | grp_mask; return; } diff --git a/xorg-server/xkeyboard-config/rules/base.extras.xml.in b/xorg-server/xkeyboard-config/rules/base.extras.xml.in index 1614eec96..cec043f67 100644 --- a/xorg-server/xkeyboard-config/rules/base.extras.xml.in +++ b/xorg-server/xkeyboard-config/rules/base.extras.xml.in @@ -462,7 +462,7 @@ <variant> <configItem> <name>sun_type6</name> - <_description>Portuguese (Brazil,Sun Type 6/7)</_description> + <_description>Portuguese (Brazil, Sun Type 6/7)</_description> </configItem> </variant> </variantList> @@ -693,7 +693,7 @@ <configItem> <name>ch</name> <_shortDescription>de</_shortDescription> - <_description>>German (Switzerland)</_description> + <_description>German (Switzerland)</_description> </configItem> <variantList> <variant> diff --git a/xorg-server/xkeyboard-config/symbols/ad b/xorg-server/xkeyboard-config/symbols/ad deleted file mode 100644 index 0b1520175..000000000 --- a/xorg-server/xkeyboard-config/symbols/ad +++ /dev/null @@ -1,31 +0,0 @@ -// -// Catalan Keyboard, as manufactured by Large Format Computing, Inc. -// -// For layout graphic, see http://www.language-keyboard.com/languages/catalan_layout.htm -// -// Contributed by Robert Millan - -partial default alphanumeric_keys -xkb_symbols "basic" { - include "us" - - name[Group1]="Catalan"; - - key <AE02> { [ 2, at, dead_diaeresis ] }; - key <AE07> { [ 7, ampersand, dead_acute ] }; - key <AE09> { [ 9, parenleft, dead_grave ] }; - key <AD02> { [ w, W, eacute, Eacute ] }; - key <AD03> { [ e, E, egrave, Egrave ] }; - key <AD06> { [ y, Y, udiaeresis, Udiaeresis ] }; - key <AD07> { [ u, U, uacute, Uacute ] }; - key <AD08> { [ i, I, iacute, Iacute ] }; - key <AD09> { [ o, O, oacute, Oacute ] }; - key <AD10> { [ p, P, ograve, Ograve ] }; - key <AD12> { [ bracketright, braceright, EuroSign ] }; - key <AC01> { [ a, A, agrave, Agrave ] }; - key <AC08> { [ k, K, idiaeresis, Idiaeresis ] }; - key <AC09> { [ l, L, periodcentered ] }; - key <AB03> { [ c, C, ccedilla, Ccedilla ] }; - - include "level3(ralt_switch)" -}; diff --git a/xorg-server/xkeyboard-config/symbols/am b/xorg-server/xkeyboard-config/symbols/am index 5e6954e0b..abe6e1270 100644 --- a/xorg-server/xkeyboard-config/symbols/am +++ b/xorg-server/xkeyboard-config/symbols/am @@ -12,7 +12,7 @@ xkb_symbols "basic" { key <AE01> { [ 0x1000586, 0x1000556 ] }; key <AE02> { [ 0x1000571, 0x1000541 ] }; - key <AE03> { [ 0x1002013, 0x1002014 ] }; + key <AE03> { [ 0x100058a, 0x1002014 ] }; key <AE04> { [ comma, dollar ] }; key <AE05> { [ 0x1000589, 0x1002026 ] }; key <AE06> { [ 0x100055e, percent ] }; |