From cbfb19790917d271b8ca6156554b16acc802719f Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 28 Mar 2014 17:35:36 +0100 Subject: libxtrans fontconfig mesa xserver git update 28 Mar 2014 xserver commit a2880699e8f1f576e1a48ebf25e8982463323f84 libxtrans commit 68f60238c4224f954ff6556ae778c72e420175f0 fontconfig commit fcba9ef01c978323fc71c17e455d3cd6ae35edcc mesa commit 029ccd773d01a5f801c809c499516d7b0c4cc3f8 --- mesalib/SConstruct | 7 - mesalib/configure.ac | 2 - mesalib/docs/README.WIN32 | 16 +- mesalib/docs/install.html | 4 - mesalib/m4/ax_python_module.m4 | 49 -- mesalib/src/glsl/glsl_parser.yy | 1 - mesalib/src/glsl/glsl_symbol_table.cpp | 25 - mesalib/src/glsl/glsl_symbol_table.h | 2 - mesalib/src/glsl/ir.h | 36 -- mesalib/src/glsl/ir_clone.cpp | 10 +- mesalib/src/glsl/ir_constant_expression.cpp | 205 +++--- mesalib/src/mapi/glapi/gen/glX_XML.py | 55 +- mesalib/src/mapi/glapi/gen/glX_doc.py | 280 -------- mesalib/src/mapi/glapi/gen/glX_proto_common.py | 13 +- mesalib/src/mapi/glapi/gen/gl_XML.py | 217 +++---- mesalib/src/mesa/drivers/common/meta.c | 33 +- mesalib/src/mesa/drivers/common/meta.h | 2 + mesalib/src/mesa/main/api_validate.c | 15 +- mesalib/src/mesa/main/context.c | 16 +- mesalib/src/mesa/main/fbobject.c | 94 +-- mesalib/src/mesa/main/ff_fragment_shader.cpp | 8 +- mesalib/src/mesa/main/format_pack.c | 714 ++++++++++----------- mesalib/src/mesa/main/format_unpack.c | 470 +++++++------- mesalib/src/mesa/main/formats.c | 20 +- mesalib/src/mesa/main/get.c | 21 + mesalib/src/mesa/main/get_hash_params.py | 3 + mesalib/src/mesa/main/mtypes.h | 27 + mesalib/src/mesa/main/pipelineobj.c | 396 +++++++++++- mesalib/src/mesa/main/pipelineobj.h | 3 + mesalib/src/mesa/main/shaderapi.c | 144 ++++- mesalib/src/mesa/main/shaderapi.h | 3 +- mesalib/src/mesa/main/state.c | 14 +- mesalib/src/mesa/main/texstate.c | 6 +- mesalib/src/mesa/main/transformfeedback.c | 4 +- mesalib/src/mesa/main/uniform_query.cpp | 81 ++- mesalib/src/mesa/main/uniforms.c | 66 +- mesalib/src/mesa/main/uniforms.h | 2 + mesalib/src/mesa/main/varray.c | 7 +- mesalib/src/mesa/program/ir_to_mesa.cpp | 6 +- mesalib/src/mesa/state_tracker/st_atom_clip.c | 2 +- mesalib/src/mesa/state_tracker/st_atom_constbuf.c | 6 +- mesalib/src/mesa/state_tracker/st_atom_texture.c | 216 ++++--- mesalib/src/mesa/state_tracker/st_cb_drawpixels.c | 2 +- mesalib/src/mesa/state_tracker/st_cb_queryobj.c | 18 +- mesalib/src/mesa/state_tracker/st_context.c | 17 + mesalib/src/mesa/state_tracker/st_draw.c | 2 +- mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 +- mesalib/src/mesa/state_tracker/st_program.c | 2 +- mesalib/src/mesa/state_tracker/st_texture.c | 7 + mesalib/src/mesa/state_tracker/st_texture.h | 4 + mesalib/src/mesa/swrast/s_fragprog.c | 2 +- 51 files changed, 1858 insertions(+), 1499 deletions(-) delete mode 100644 mesalib/m4/ax_python_module.m4 delete mode 100644 mesalib/src/mapi/glapi/gen/glX_doc.py (limited to 'mesalib') diff --git a/mesalib/SConstruct b/mesalib/SConstruct index de735e94c..0e10818ba 100644 --- a/mesalib/SConstruct +++ b/mesalib/SConstruct @@ -59,13 +59,6 @@ else: Help(opts.GenerateHelpText(env)) -# fail early for a common error on windows -if env['gles']: - try: - import libxml2 - except ImportError: - raise SCons.Errors.UserError, "GLES requires libxml2-python to build" - ####################################################################### # Environment setup diff --git a/mesalib/configure.ac b/mesalib/configure.ac index c5042f93e..1e5e49667 100644 --- a/mesalib/configure.ac +++ b/mesalib/configure.ac @@ -54,7 +54,6 @@ 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 @@ -1549,7 +1548,6 @@ if test "x$enable_gallium_llvm" = xyes; then LLVM_CXXFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cxxflags"` LLVM_INCLUDEDIR=`$LLVM_CONFIG --includedir` LLVM_LIBDIR=`$LLVM_CONFIG --libdir` - LLVM_LDFLAGS="-Wl,-rpath,$LLVM_LIBDIR $LLVM_LDFLAGS" AC_COMPUTE_INT([LLVM_VERSION_MAJOR], [LLVM_VERSION_MAJOR], [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"]) diff --git a/mesalib/docs/README.WIN32 b/mesalib/docs/README.WIN32 index 0cd007c8a..c8759f65b 100644 --- a/mesalib/docs/README.WIN32 +++ b/mesalib/docs/README.WIN32 @@ -36,17 +36,15 @@ Recipe Building on windows requires several open-source packages. These are steps that work as of this writing. -1) install python 2.7 -2) install scons (latest) -3) install mingw, flex, and bison -4) install libxml2 from here: http://www.lfd.uci.edu/~gohlke/pythonlibs - get libxml2-python-2.9.1.win-amd64-py2.7.exe -5) install pywin32 from here: http://www.lfd.uci.edu/~gohlke/pythonlibs +- install python 2.7 +- install scons (latest) +- install mingw, flex, and bison +- install pywin32 from here: http://www.lfd.uci.edu/~gohlke/pythonlibs get pywin32-218.4.win-amd64-py2.7.exe -6) install git -7) download mesa from git +- install git +- download mesa from git see http://www.mesa3d.org/repository.html -8) run scons +- run scons General ------- diff --git a/mesalib/docs/install.html b/mesalib/docs/install.html index 24492a786..5061eded0 100644 --- a/mesalib/docs/install.html +++ b/mesalib/docs/install.html @@ -44,10 +44,6 @@ On Windows with MinGW, install flex and bison with:
  • python - Python is needed for building the Gallium components. Version 2.6.4 or later should work. -
    -
    -To build OpenGL ES 1.1 and 2.0 you'll also need -libxml2-python.
  • diff --git a/mesalib/m4/ax_python_module.m4 b/mesalib/m4/ax_python_module.m4 deleted file mode 100644 index 2e6670a0f..000000000 --- a/mesalib/m4/ax_python_module.m4 +++ /dev/null @@ -1,49 +0,0 @@ -# =========================================================================== -# 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 $PYTHON2; - then - PYTHON2="python" - fi - PYTHON_NAME=`basename $PYTHON2` - AC_MSG_CHECKING($PYTHON_NAME module: $1) - $PYTHON2 -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/glsl/glsl_parser.yy b/mesalib/src/glsl/glsl_parser.yy index faaf4388c..2d0e7be54 100644 --- a/mesalib/src/glsl/glsl_parser.yy +++ b/mesalib/src/glsl/glsl_parser.yy @@ -1901,7 +1901,6 @@ struct_specifier: $$ = new(ctx) ast_struct_specifier($2, $4); $$->set_location_range(@2, @5); state->symbols->add_type($2, glsl_type::void_type); - state->symbols->add_type_ast($2, new(ctx) ast_type_specifier($$)); } | STRUCT '{' struct_declaration_list '}' { diff --git a/mesalib/src/glsl/glsl_symbol_table.cpp b/mesalib/src/glsl/glsl_symbol_table.cpp index 11569f47e..a05236203 100644 --- a/mesalib/src/glsl/glsl_symbol_table.cpp +++ b/mesalib/src/glsl/glsl_symbol_table.cpp @@ -162,23 +162,6 @@ bool glsl_symbol_table::add_type(const char *name, const glsl_type *t) return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0; } -static char *make_ast_name(const char *name) -{ - char *ast_name = new char[strlen("#ast.") + strlen(name) + 1]; - strcpy(ast_name, "#ast."); - strcat(ast_name + strlen("#ast."), name); - return ast_name; -} - -bool glsl_symbol_table::add_type_ast(const char *name, const class ast_type_specifier *a) -{ - symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(a); - char *ast_name = make_ast_name(name); - bool ret = _mesa_symbol_table_add_symbol(table, -1, ast_name, entry) == 0; - delete [] ast_name; - return ret; -} - bool glsl_symbol_table::add_interface(const char *name, const glsl_type *i, enum ir_variable_mode mode) { @@ -230,14 +213,6 @@ const glsl_type *glsl_symbol_table::get_type(const char *name) return entry != NULL ? entry->t : NULL; } -const class ast_type_specifier *glsl_symbol_table::get_type_ast(const char *name) -{ - char *ast_name = make_ast_name(name); - symbol_table_entry *entry = get_entry(ast_name); - delete [] ast_name; - return entry != NULL ? entry->a : NULL; -} - const glsl_type *glsl_symbol_table::get_interface(const char *name, enum ir_variable_mode mode) { diff --git a/mesalib/src/glsl/glsl_symbol_table.h b/mesalib/src/glsl/glsl_symbol_table.h index 0e62448e2..f323fc305 100644 --- a/mesalib/src/glsl/glsl_symbol_table.h +++ b/mesalib/src/glsl/glsl_symbol_table.h @@ -98,7 +98,6 @@ public: /*@{*/ bool add_variable(ir_variable *v); bool add_type(const char *name, const glsl_type *t); - bool add_type_ast(const char *name, const class ast_type_specifier *t); bool add_function(ir_function *f); bool add_interface(const char *name, const glsl_type *i, enum ir_variable_mode mode); @@ -115,7 +114,6 @@ public: /*@{*/ ir_variable *get_variable(const char *name); const glsl_type *get_type(const char *name); - const class ast_type_specifier *get_type_ast(const char *name); ir_function *get_function(const char *name); const glsl_type *get_interface(const char *name, enum ir_variable_mode mode); diff --git a/mesalib/src/glsl/ir.h b/mesalib/src/glsl/ir.h index ed3f086ce..8fa3b9ef6 100644 --- a/mesalib/src/glsl/ir.h +++ b/mesalib/src/glsl/ir.h @@ -1914,15 +1914,6 @@ public: * Get the variable that is ultimately referenced by an r-value */ virtual ir_variable *variable_referenced() const = 0; - - /** - * Get the constant that is ultimately referenced by an r-value, - * in a constant expression evaluation context. - * - * The offset is used when the reference is to a specific column of - * a matrix. - */ - virtual void constant_referenced(struct hash_table *variable_context, ir_constant *&store, int &offset) const = 0; }; @@ -1950,15 +1941,6 @@ public: return this->var; } - /** - * Get the constant that is ultimately referenced by an r-value, - * in a constant expression evaluation context. - * - * The offset is used when the reference is to a specific column of - * a matrix. - */ - virtual void constant_referenced(struct hash_table *variable_context, ir_constant *&store, int &offset) const; - virtual ir_variable *whole_variable_referenced() { /* ir_dereference_variable objects always dereference the entire @@ -2010,15 +1992,6 @@ public: return this->array->variable_referenced(); } - /** - * Get the constant that is ultimately referenced by an r-value, - * in a constant expression evaluation context. - * - * The offset is used when the reference is to a specific column of - * a matrix. - */ - virtual void constant_referenced(struct hash_table *variable_context, ir_constant *&store, int &offset) const; - virtual void accept(ir_visitor *v) { v->visit(this); @@ -2058,15 +2031,6 @@ public: return this->record->variable_referenced(); } - /** - * Get the constant that is ultimately referenced by an r-value, - * in a constant expression evaluation context. - * - * The offset is used when the reference is to a specific column of - * a matrix. - */ - virtual void constant_referenced(struct hash_table *variable_context, ir_constant *&store, int &offset) const; - virtual void accept(ir_visitor *v) { v->visit(this); diff --git a/mesalib/src/glsl/ir_clone.cpp b/mesalib/src/glsl/ir_clone.cpp index 311c992be..167b80c9f 100644 --- a/mesalib/src/glsl/ir_clone.cpp +++ b/mesalib/src/glsl/ir_clone.cpp @@ -265,10 +265,12 @@ ir_assignment::clone(void *mem_ctx, struct hash_table *ht) const if (this->condition) new_condition = this->condition->clone(mem_ctx, ht); - return new(mem_ctx) ir_assignment(this->lhs->clone(mem_ctx, ht), - this->rhs->clone(mem_ctx, ht), - new_condition, - this->write_mask); + ir_assignment *cloned = + new(mem_ctx) ir_assignment(this->lhs->clone(mem_ctx, ht), + this->rhs->clone(mem_ctx, ht), + new_condition); + cloned->write_mask = this->write_mask; + return cloned; } ir_function * diff --git a/mesalib/src/glsl/ir_constant_expression.cpp b/mesalib/src/glsl/ir_constant_expression.cpp index 7fa5a09d4..8afe8f776 100644 --- a/mesalib/src/glsl/ir_constant_expression.cpp +++ b/mesalib/src/glsl/ir_constant_expression.cpp @@ -386,8 +386,104 @@ unpack_half_1x16(uint16_t u) return _mesa_half_to_float(u); } +/** + * Get the constant that is ultimately referenced by an r-value, in a constant + * expression evaluation context. + * + * The offset is used when the reference is to a specific column of a matrix. + */ +static bool +constant_referenced(const ir_dereference *deref, + struct hash_table *variable_context, + ir_constant *&store, int &offset) +{ + store = NULL; + offset = 0; + + if (variable_context == NULL) + return false; + + switch (deref->ir_type) { + case ir_type_dereference_array: { + const ir_dereference_array *const da = + (const ir_dereference_array *) deref; + + ir_constant *const index_c = + da->array_index->constant_expression_value(variable_context); + + if (!index_c || !index_c->type->is_scalar() || !index_c->type->is_integer()) + break; + + const int index = index_c->type->base_type == GLSL_TYPE_INT ? + index_c->get_int_component(0) : + index_c->get_uint_component(0); + + ir_constant *substore; + int suboffset; + + const ir_dereference *const deref = da->array->as_dereference(); + if (!deref) + break; + + if (!constant_referenced(deref, variable_context, substore, suboffset)) + break; + + const glsl_type *const vt = da->array->type; + if (vt->is_array()) { + store = substore->get_array_element(index); + offset = 0; + } else if (vt->is_matrix()) { + store = substore; + offset = index * vt->vector_elements; + } else if (vt->is_vector()) { + store = substore; + offset = suboffset + index; + } + + break; + } + + case ir_type_dereference_record: { + const ir_dereference_record *const dr = + (const ir_dereference_record *) deref; + + const ir_dereference *const deref = dr->record->as_dereference(); + if (!deref) + break; + + ir_constant *substore; + int suboffset; + + if (!constant_referenced(deref, variable_context, substore, suboffset)) + break; + + /* Since we're dropping it on the floor... + */ + assert(suboffset == 0); + + store = substore->get_record_field(dr->field); + break; + } + + case ir_type_dereference_variable: { + const ir_dereference_variable *const dv = + (const ir_dereference_variable *) deref; + + store = (ir_constant *) hash_table_find(variable_context, dv->var); + break; + } + + default: + assert(!"Should not get here."); + break; + } + + return store != NULL; +} + + ir_constant * -ir_rvalue::constant_expression_value(struct hash_table *variable_context) +ir_rvalue::constant_expression_value(struct hash_table *) { assert(this->type->is_error()); return NULL; @@ -1534,7 +1630,7 @@ ir_expression::constant_expression_value(struct hash_table *variable_context) ir_constant * -ir_texture::constant_expression_value(struct hash_table *variable_context) +ir_texture::constant_expression_value(struct hash_table *) { /* texture lookups aren't constant expressions */ return NULL; @@ -1570,19 +1666,6 @@ ir_swizzle::constant_expression_value(struct hash_table *variable_context) } -void -ir_dereference_variable::constant_referenced(struct hash_table *variable_context, - ir_constant *&store, int &offset) const -{ - if (variable_context) { - store = (ir_constant *)hash_table_find(variable_context, var); - offset = 0; - } else { - store = NULL; - offset = 0; - } -} - ir_constant * ir_dereference_variable::constant_expression_value(struct hash_table *variable_context) { @@ -1610,60 +1693,6 @@ ir_dereference_variable::constant_expression_value(struct hash_table *variable_c } -void -ir_dereference_array::constant_referenced(struct hash_table *variable_context, - ir_constant *&store, int &offset) const -{ - ir_constant *index_c = array_index->constant_expression_value(variable_context); - - if (!index_c || !index_c->type->is_scalar() || !index_c->type->is_integer()) { - store = 0; - offset = 0; - return; - } - - int index = index_c->type->base_type == GLSL_TYPE_INT ? - index_c->get_int_component(0) : - index_c->get_uint_component(0); - - ir_constant *substore; - int suboffset; - const ir_dereference *deref = array->as_dereference(); - if (!deref) { - store = 0; - offset = 0; - return; - } - - deref->constant_referenced(variable_context, substore, suboffset); - - if (!substore) { - store = 0; - offset = 0; - return; - } - - const glsl_type *vt = array->type; - if (vt->is_array()) { - store = substore->get_array_element(index); - offset = 0; - return; - } - if (vt->is_matrix()) { - store = substore; - offset = index * vt->vector_elements; - return; - } - if (vt->is_vector()) { - store = substore; - offset = suboffset + index; - return; - } - - store = 0; - offset = 0; -} - ir_constant * ir_dereference_array::constant_expression_value(struct hash_table *variable_context) { @@ -1719,33 +1748,8 @@ ir_dereference_array::constant_expression_value(struct hash_table *variable_cont } -void -ir_dereference_record::constant_referenced(struct hash_table *variable_context, - ir_constant *&store, int &offset) const -{ - ir_constant *substore; - int suboffset; - const ir_dereference *deref = record->as_dereference(); - if (!deref) { - store = 0; - offset = 0; - return; - } - - deref->constant_referenced(variable_context, substore, suboffset); - - if (!substore) { - store = 0; - offset = 0; - return; - } - - store = substore->get_record_field(field); - offset = 0; -} - ir_constant * -ir_dereference_record::constant_expression_value(struct hash_table *variable_context) +ir_dereference_record::constant_expression_value(struct hash_table *) { ir_constant *v = this->record->constant_expression_value(); @@ -1754,7 +1758,7 @@ ir_dereference_record::constant_expression_value(struct hash_table *variable_con ir_constant * -ir_assignment::constant_expression_value(struct hash_table *variable_context) +ir_assignment::constant_expression_value(struct hash_table *) { /* FINISHME: Handle CEs involving assignment (return RHS) */ return NULL; @@ -1762,7 +1766,7 @@ ir_assignment::constant_expression_value(struct hash_table *variable_context) ir_constant * -ir_constant::constant_expression_value(struct hash_table *variable_context) +ir_constant::constant_expression_value(struct hash_table *) { return this; } @@ -1803,9 +1807,8 @@ bool ir_function_signature::constant_expression_evaluate_expression_list(const s ir_constant *store = NULL; int offset = 0; - asg->lhs->constant_referenced(variable_context, store, offset); - if (!store) + if (!constant_referenced(asg->lhs, variable_context, store, offset)) return false; ir_constant *value = asg->rhs->constant_expression_value(variable_context); @@ -1836,9 +1839,9 @@ bool ir_function_signature::constant_expression_evaluate_expression_list(const s ir_constant *store = NULL; int offset = 0; - call->return_deref->constant_referenced(variable_context, store, offset); - if (!store) + if (!constant_referenced(call->return_deref, variable_context, + store, offset)) return false; ir_constant *value = call->constant_expression_value(variable_context); diff --git a/mesalib/src/mapi/glapi/gen/glX_XML.py b/mesalib/src/mapi/glapi/gen/glX_XML.py index 03a35b740..12ff291fc 100644 --- a/mesalib/src/mapi/glapi/gen/glX_XML.py +++ b/mesalib/src/mapi/glapi/gen/glX_XML.py @@ -33,29 +33,27 @@ import sys, getopt, string class glx_item_factory(gl_XML.gl_item_factory): """Factory to create GLX protocol oriented objects derived from gl_item.""" - def create_item(self, name, element, context): - if name == "function": - return glx_function(element, context) - elif name == "enum": - return glx_enum(element, context) - elif name == "api": - return glx_api(self) - else: - return gl_XML.gl_item_factory.create_item(self, name, element, context) + def create_function(self, element, context): + return glx_function(element, context) + + def create_enum(self, element, context, category): + return glx_enum(element, context, category) + + def create_api(self): + return glx_api(self) class glx_enum(gl_XML.gl_enum): - def __init__(self, element, context): - gl_XML.gl_enum.__init__(self, element, context) + def __init__(self, element, context, category): + gl_XML.gl_enum.__init__(self, element, context, category) self.functions = {} - child = element.children - while child: - if child.type == "element" and child.name == "size": - n = child.nsProp( "name", None ) - c = child.nsProp( "count", None ) - m = child.nsProp( "mode", None ) + for child in element.getchildren(): + if child.tag == "size": + n = child.get( "name" ) + c = child.get( "count" ) + m = child.get( "mode", "set" ) if not c: c = self.default_count @@ -70,8 +68,6 @@ class glx_enum(gl_XML.gl_enum): if not self.functions.has_key(n): self.functions[ n ] = [c, mode] - child = child.next - return @@ -120,10 +116,10 @@ class glx_function(gl_XML.gl_function): # appears after the function that it aliases. if not self.vectorequiv: - self.vectorequiv = element.nsProp("vectorequiv", None) + self.vectorequiv = element.get("vectorequiv") - name = element.nsProp("name", None) + name = element.get("name") if name == self.name: for param in self.parameters: self.parameters_by_name[ param.name ] = param @@ -135,12 +131,11 @@ class glx_function(gl_XML.gl_function): self.counter_list.append(param.counter) - child = element.children - while child: - if child.type == "element" and child.name == "glx": - rop = child.nsProp( 'rop', None ) - sop = child.nsProp( 'sop', None ) - vop = child.nsProp( 'vendorpriv', None ) + for child in element.getchildren(): + if child.tag == "glx": + rop = child.get( 'rop' ) + sop = child.get( 'sop' ) + vop = child.get( 'vendorpriv' ) if rop: self.glx_rop = int(rop) @@ -152,12 +147,12 @@ class glx_function(gl_XML.gl_function): self.glx_vendorpriv = int(vop) self.glx_vendorpriv_names.append(name) - self.img_reset = child.nsProp( 'img_reset', None ) + self.img_reset = child.get( 'img_reset' ) # The 'handcode' attribute can be one of 'true', # 'false', 'client', or 'server'. - handcode = child.nsProp( 'handcode', None ) + handcode = child.get( 'handcode', 'false' ) if handcode == "false": self.server_handcode = 0 self.client_handcode = 0 @@ -179,8 +174,6 @@ class glx_function(gl_XML.gl_function): self.reply_always_array = gl_XML.is_attr_true( child, 'always_array' ) self.dimensions_in_reply = gl_XML.is_attr_true( child, 'dimensions_in_reply' ) - child = child.next - # Do some validation of the GLX protocol information. As # new tests are discovered, they should be added here. diff --git a/mesalib/src/mapi/glapi/gen/glX_doc.py b/mesalib/src/mapi/glapi/gen/glX_doc.py deleted file mode 100644 index 35d068894..000000000 --- a/mesalib/src/mapi/glapi/gen/glX_doc.py +++ /dev/null @@ -1,280 +0,0 @@ -#!/usr/bin/env python - -# (C) Copyright IBM Corporation 2004, 2005 -# All Rights Reserved. -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# on the rights to use, copy, modify, merge, publish, distribute, sub -# license, and/or sell copies of the Software, and to permit persons to whom -# the Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice (including the next -# paragraph) shall be included in all copies or substantial portions of the -# Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL -# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# Authors: -# Ian Romanick - -import gl_XML, glX_XML, glX_proto_common, license -import sys, getopt - - -class glx_doc_item_factory(glX_proto_common.glx_proto_item_factory): - """Factory to create GLX protocol documentation oriented objects derived from glItem.""" - - def create_item(self, name, element, context): - if name == "parameter": - return glx_doc_parameter(element, context) - else: - return glX_proto_common.glx_proto_item_factory.create_item(self, name, element, context) - - -class glx_doc_parameter(gl_XML.gl_parameter): - def packet_type(self, type_dict): - """Get the type string for the packet header - - GLX protocol documentation uses type names like CARD32, - FLOAT64, LISTofCARD8, and ENUM. This function converts the - type of the parameter to one of these names.""" - - list_of = "" - if self.is_array(): - list_of = "LISTof" - - t_name = self.get_base_type_string() - if not type_dict.has_key( t_name ): - type_name = "CARD8" - else: - type_name = type_dict[ t_name ] - - return "%s%s" % (list_of, type_name) - - - def packet_size(self): - p = None - s = self.size() - if s == 0: - a_prod = "n" - b_prod = self.p_type.size - - if not self.count_parameter_list and self.counter: - a_prod = self.counter - elif self.count_parameter_list and not self.counter or self.is_output: - pass - elif self.count_parameter_list and self.counter: - b_prod = self.counter - else: - raise RuntimeError("Parameter '%s' to function '%s' has size 0." % (self.name, self.context.name)) - - ss = "%s*%s" % (a_prod, b_prod) - - return [ss, p] - else: - if s % 4 != 0: - p = "p" - - return [str(s), p] - -class PrintGlxProtoText(gl_XML.gl_print_base): - def __init__(self): - gl_XML.gl_print_base.__init__(self) - self.license = "" - - - def printHeader(self): - return - - - def body_size(self, f): - # At some point, refactor this function and - # glXFunction::command_payload_length. - - size = 0; - size_str = "" - pad_str = "" - plus = "" - for p in f.parameterIterateGlxSend(): - [s, pad] = p.packet_size() - try: - size += int(s) - except Exception,e: - size_str += "%s%s" % (plus, s) - plus = "+" - - if pad != None: - pad_str = pad - - return [size, size_str, pad_str] - - - def print_render_header(self, f): - [size, size_str, pad_str] = self.body_size(f) - size += 4; - - if size_str == "": - s = "%u" % ((size + 3) & ~3) - elif pad_str != "": - s = "%u+%s+%s" % (size, size_str, pad_str) - else: - s = "%u+%s" % (size, size_str) - - print ' 2 %-15s rendering command length' % (s) - print ' 2 %-4u rendering command opcode' % (f.glx_rop) - return - - - def print_single_header(self, f): - [size, size_str, pad_str] = self.body_size(f) - size = ((size + 3) / 4) + 2; - - if f.glx_vendorpriv != 0: - size += 1 - - print ' 1 CARD8 opcode (X assigned)' - print ' 1 %-4u GLX opcode (%s)' % (f.opcode_real_value(), f.opcode_real_name()) - - if size_str == "": - s = "%u" % (size) - elif pad_str != "": - s = "%u+((%s+%s)/4)" % (size, size_str, pad_str) - else: - s = "%u+((%s)/4)" % (size, size_str) - - print ' 2 %-15s request length' % (s) - - if f.glx_vendorpriv != 0: - print ' 4 %-4u vendor specific opcode' % (f.opcode_value()) - - print ' 4 GLX_CONTEXT_TAG context tag' - - return - - - def print_reply(self, f): - print ' =>' - print ' 1 1 reply' - print ' 1 unused' - print ' 2 CARD16 sequence number' - - if f.output == None: - print ' 4 0 reply length' - elif f.reply_always_array: - print ' 4 m reply length' - else: - print ' 4 m reply length, m = (n == 1 ? 0 : n)' - - - output = None - for x in f.parameterIterateOutputs(): - output = x - break - - - unused = 24 - if f.return_type != 'void': - print ' 4 %-15s return value' % (f.return_type) - unused -= 4 - elif output != None: - print ' 4 unused' - unused -= 4 - - if output != None: - print ' 4 CARD32 n' - unused -= 4 - - if output != None: - if not f.reply_always_array: - print '' - print ' if (n = 1) this follows:' - print '' - print ' 4 CARD32 %s' % (output.name) - print ' %-2u unused' % (unused - 4) - print '' - print ' otherwise this follows:' - print '' - - print ' %-2u unused' % (unused) - - [s, pad] = output.packet_size() - print ' %-8s %-15s %s' % (s, output.packet_type( self.type_map ), output.name) - if pad != None: - try: - bytes = int(s) - bytes = 4 - (bytes & 3) - print ' %-8u %-15s unused' % (bytes, "") - except Exception,e: - print ' %-8s %-15s unused, %s=pad(%s)' % (pad, "", pad, s) - else: - print ' %-2u unused' % (unused) - - - def print_body(self, f): - for p in f.parameterIterateGlxSend(): - [s, pad] = p.packet_size() - print ' %-8s %-15s %s' % (s, p.packet_type( self.type_map ), p.name) - if pad != None: - try: - bytes = int(s) - bytes = 4 - (bytes & 3) - print ' %-8u %-15s unused' % (bytes, "") - except Exception,e: - print ' %-8s %-15s unused, %s=pad(%s)' % (pad, "", pad, s) - - def printBody(self, api): - self.type_map = {} - for t in api.typeIterate(): - self.type_map[ "GL" + t.name ] = t.glx_name - - - # At some point this should be expanded to support pixel - # functions, but I'm not going to lose any sleep over it now. - - for f in api.functionIterateByOffset(): - if f.client_handcode or f.server_handcode or f.vectorequiv or len(f.get_images()): - continue - - - if f.glx_rop: - print ' %s' % (f.name) - self.print_render_header(f) - elif f.glx_sop or f.glx_vendorpriv: - print ' %s' % (f.name) - self.print_single_header(f) - else: - continue - - self.print_body(f) - - if f.needs_reply(): - self.print_reply(f) - - print '' - return - - -if __name__ == '__main__': - file_name = "gl_API.xml" - - try: - (args, trail) = getopt.getopt(sys.argv[1:], "f:") - except Exception,e: - show_usage() - - for (arg,val) in args: - if arg == "-f": - file_name = val - - api = gl_XML.parse_GL_API( file_name, glx_doc_item_factory() ) - - printer = PrintGlxProtoText() - printer.Print( api ) diff --git a/mesalib/src/mapi/glapi/gen/glX_proto_common.py b/mesalib/src/mapi/glapi/gen/glX_proto_common.py index 86d9189a9..ae2c2d581 100644 --- a/mesalib/src/mapi/glapi/gen/glX_proto_common.py +++ b/mesalib/src/mapi/glapi/gen/glX_proto_common.py @@ -32,18 +32,15 @@ import string class glx_proto_item_factory(glX_XML.glx_item_factory): """Factory to create GLX protocol oriented objects derived from gl_item.""" - def create_item(self, name, element, context): - if name == "type": - return glx_proto_type(element, context) - else: - return glX_XML.glx_item_factory.create_item(self, name, element, context) + def create_type(self, element, context, category): + return glx_proto_type(element, context, category) class glx_proto_type(gl_XML.gl_type): - def __init__(self, element, context): - gl_XML.gl_type.__init__(self, element, context) + def __init__(self, element, context, category): + gl_XML.gl_type.__init__(self, element, context, category) - self.glx_name = element.nsProp( "glx_name", None ) + self.glx_name = element.get( "glx_name" ) return diff --git a/mesalib/src/mapi/glapi/gen/gl_XML.py b/mesalib/src/mapi/glapi/gen/gl_XML.py index 3bbc79439..1a2bc2b91 100644 --- a/mesalib/src/mapi/glapi/gen/gl_XML.py +++ b/mesalib/src/mapi/glapi/gen/gl_XML.py @@ -26,20 +26,19 @@ # Ian Romanick from decimal import Decimal -import libxml2 +import xml.etree.ElementTree as ET import re, sys, string +import os.path import typeexpr def parse_GL_API( file_name, factory = None ): - doc = libxml2.readFile( file_name, None, libxml2.XML_PARSE_XINCLUDE + libxml2.XML_PARSE_NOBLANKS + libxml2.XML_PARSE_DTDVALID + libxml2.XML_PARSE_DTDATTR + libxml2.XML_PARSE_DTDLOAD + libxml2.XML_PARSE_NOENT ) - ret = doc.xincludeProcess() if not factory: factory = gl_item_factory() - api = factory.create_item( "api", None, None ) - api.process_element( doc ) + api = factory.create_api() + api.parse_file( file_name ) # After the XML has been processed, we need to go back and assign # dispatch offsets to the functions that request that their offsets @@ -51,12 +50,10 @@ def parse_GL_API( file_name, factory = None ): func.offset = api.next_offset; api.next_offset += 1 - doc.freeDoc() - return api -def is_attr_true( element, name ): +def is_attr_true( element, name, default = "false" ): """Read a name value from an element's attributes. The value read from the attribute list must be either 'true' or @@ -64,7 +61,7 @@ def is_attr_true( element, name ): value is 'true', non-zero will be returned. An exception will be raised for any other value.""" - value = element.nsProp( name, None ) + value = element.get( name, default ) if value == "true": return 1 elif value == "false": @@ -254,8 +251,8 @@ class gl_print_base(object): def real_function_name(element): - name = element.nsProp( "name", None ) - alias = element.nsProp( "alias", None ) + name = element.get( "name" ) + alias = element.get( "alias" ) if alias: return alias @@ -324,21 +321,22 @@ def create_parameter_string(parameters, include_names): class gl_item(object): - def __init__(self, element, context): + def __init__(self, element, context, category): self.context = context - self.name = element.nsProp( "name", None ) - self.category = real_category_name( element.parent.nsProp( "name", None ) ) + self.name = element.get( "name" ) + self.category = real_category_name( category ) + return class gl_type( gl_item ): - def __init__(self, element, context): - gl_item.__init__(self, element, context) - self.size = int( element.nsProp( "size", None ), 0 ) + def __init__(self, element, context, category): + gl_item.__init__(self, element, context, category) + self.size = int( element.get( "size" ), 0 ) te = typeexpr.type_expression( None ) tn = typeexpr.type_node() - tn.size = int( element.nsProp( "size", None ), 0 ) + tn.size = int( element.get( "size" ), 0 ) tn.integer = not is_attr_true( element, "float" ) tn.unsigned = is_attr_true( element, "unsigned" ) tn.pointer = is_attr_true( element, "pointer" ) @@ -354,11 +352,11 @@ class gl_type( gl_item ): class gl_enum( gl_item ): - def __init__(self, element, context): - gl_item.__init__(self, element, context) - self.value = int( element.nsProp( "value", None ), 0 ) + def __init__(self, element, context, category): + gl_item.__init__(self, element, context, category) + self.value = int( element.get( "value" ), 0 ) - temp = element.nsProp( "count", None ) + temp = element.get( "count" ) if not temp or temp == "?": self.default_count = -1 else: @@ -404,12 +402,12 @@ class gl_enum( gl_item ): class gl_parameter(object): def __init__(self, element, context): - self.name = element.nsProp( "name", None ) + self.name = element.get( "name" ) - ts = element.nsProp( "type", None ) + ts = element.get( "type" ) self.type_expr = typeexpr.type_expression( ts, context ) - temp = element.nsProp( "variable_param", None ) + temp = element.get( "variable_param" ) if temp: self.count_parameter_list = temp.split( ' ' ) else: @@ -420,7 +418,7 @@ class gl_parameter(object): # statement will throw an exception, and the except block will # take over. - c = element.nsProp( "count", None ) + c = element.get( "count" ) try: count = int(c) self.count = count @@ -430,7 +428,7 @@ class gl_parameter(object): self.count = 0 self.counter = c - self.count_scale = int(element.nsProp( "count_scale", None )) + self.count_scale = int(element.get( "count_scale", "1" )) elements = (count * self.count_scale) if elements == 1: @@ -450,19 +448,19 @@ class gl_parameter(object): # Pixel data has special parameters. - self.width = element.nsProp('img_width', None) - self.height = element.nsProp('img_height', None) - self.depth = element.nsProp('img_depth', None) - self.extent = element.nsProp('img_extent', None) + self.width = element.get('img_width') + self.height = element.get('img_height') + self.depth = element.get('img_depth') + self.extent = element.get('img_extent') - self.img_xoff = element.nsProp('img_xoff', None) - self.img_yoff = element.nsProp('img_yoff', None) - self.img_zoff = element.nsProp('img_zoff', None) - self.img_woff = element.nsProp('img_woff', None) + self.img_xoff = element.get('img_xoff') + self.img_yoff = element.get('img_yoff') + self.img_zoff = element.get('img_zoff') + self.img_woff = element.get('img_woff') - self.img_format = element.nsProp('img_format', None) - self.img_type = element.nsProp('img_type', None) - self.img_target = element.nsProp('img_target', None) + self.img_format = element.get('img_format') + self.img_type = element.get('img_type') + self.img_target = element.get('img_target') self.img_pad_dimensions = is_attr_true( element, 'img_pad_dimensions' ) self.img_null_flag = is_attr_true( element, 'img_null_flag' ) @@ -648,17 +646,17 @@ class gl_function( gl_item ): def process_element(self, element): - name = element.nsProp( "name", None ) - alias = element.nsProp( "alias", None ) + name = element.get( "name" ) + alias = element.get( "alias" ) - if is_attr_true(element, "static_dispatch"): + if is_attr_true(element, "static_dispatch", "true"): self.static_entry_points.append(name) self.entry_points.append( name ) self.entry_point_api_map[name] = {} for api in ('es1', 'es2'): - version_str = element.nsProp(api, None) + version_str = element.get(api, 'none') assert version_str is not None if version_str != 'none': version_decimal = Decimal(version_str) @@ -667,15 +665,15 @@ class gl_function( gl_item ): version_decimal < self.api_map[api]: self.api_map[api] = version_decimal - exec_flavor = element.nsProp('exec', None) + exec_flavor = element.get('exec') if exec_flavor: self.exec_flavor = exec_flavor - deprecated = element.nsProp('deprecated', None) + deprecated = element.get('deprecated', 'none') if deprecated != 'none': self.deprecated = Decimal(deprecated) - if not is_attr_true(element, 'desktop'): + if not is_attr_true(element, 'desktop', 'true'): self.desktop = False if alias: @@ -686,7 +684,7 @@ class gl_function( gl_item ): # Only try to set the offset when a non-alias entry-point # is being processed. - offset = element.nsProp( "offset", None ) + offset = element.get( "offset" ) if offset: try: o = int( offset ) @@ -712,16 +710,12 @@ class gl_function( gl_item ): parameters = [] return_type = "void" - child = element.children - while child: - if child.type == "element": - if child.name == "return": - return_type = child.nsProp( "type", None ) - elif child.name == "param": - param = self.context.factory.create_item( "parameter", child, self.context) - parameters.append( param ) - - child = child.next + for child in element.getchildren(): + if child.tag == "return": + return_type = child.get( "type", "void" ) + elif child.tag == "param": + param = self.context.factory.create_parameter(child, self.context) + parameters.append( param ) if self.initialized: @@ -746,7 +740,7 @@ class gl_function( gl_item ): if param.is_image(): self.images.append( param ) - if element.children: + if element.getchildren(): self.initialized = 1 self.entry_point_parameters[name] = parameters else: @@ -848,19 +842,20 @@ class gl_function( gl_item ): class gl_item_factory(object): """Factory to create objects derived from gl_item.""" - def create_item(self, item_name, element, context): - if item_name == "function": - return gl_function(element, context) - if item_name == "type": - return gl_type(element, context) - elif item_name == "enum": - return gl_enum(element, context) - elif item_name == "parameter": - return gl_parameter(element, context) - elif item_name == "api": - return gl_api(self) - else: - return None + def create_function(self, element, context): + return gl_function(element, context) + + def create_type(self, element, context, category): + return gl_type(element, context, category) + + def create_enum(self, element, context, category): + return gl_enum(element, context, category) + + def create_parameter(self, element, context): + return gl_parameter(element, context) + + def create_api(self): + return gl_api(self) class gl_api(object): @@ -903,66 +898,64 @@ class gl_api(object): self.functions_by_name = functions_by_name - def process_element(self, doc): - element = doc.children - while element.type != "element" or element.name != "OpenGLAPI": - element = element.next - if element: - self.process_OpenGLAPI(element) - return + def parse_file(self, file_name): + doc = ET.parse( file_name ) + self.process_element(file_name, doc) - def process_OpenGLAPI(self, element): - child = element.children - while child: - if child.type == "element": - if child.name == "category": - self.process_category( child ) - elif child.name == "OpenGLAPI": - self.process_OpenGLAPI( child ) + def process_element(self, file_name, doc): + element = doc.getroot() + if element.tag == "OpenGLAPI": + self.process_OpenGLAPI(file_name, element) + return + - child = child.next + def process_OpenGLAPI(self, file_name, element): + for child in element.getchildren(): + if child.tag == "category": + self.process_category( child ) + elif child.tag == "OpenGLAPI": + self.process_OpenGLAPI( file_name, child ) + elif child.tag == '{http://www.w3.org/2001/XInclude}include': + href = child.get('href') + href = os.path.join(os.path.dirname(file_name), href) + self.parse_file(href) return def process_category(self, cat): - cat_name = cat.nsProp( "name", None ) - cat_number = cat.nsProp( "number", None ) + cat_name = cat.get( "name" ) + cat_number = cat.get( "number" ) [cat_type, key] = classify_category(cat_name, cat_number) self.categories[cat_type][key] = [cat_name, cat_number] - child = cat.children - while child: - if child.type == "element": - if child.name == "function": - func_name = real_function_name( child ) - - temp_name = child.nsProp( "name", None ) - self.category_dict[ temp_name ] = [cat_name, cat_number] - - if self.functions_by_name.has_key( func_name ): - func = self.functions_by_name[ func_name ] - func.process_element( child ) - else: - func = self.factory.create_item( "function", child, self ) - self.functions_by_name[ func_name ] = func + for child in cat.getchildren(): + if child.tag == "function": + func_name = real_function_name( child ) - if func.offset >= self.next_offset: - self.next_offset = func.offset + 1 + temp_name = child.get( "name" ) + self.category_dict[ temp_name ] = [cat_name, cat_number] + if self.functions_by_name.has_key( func_name ): + func = self.functions_by_name[ func_name ] + func.process_element( child ) + else: + func = self.factory.create_function( child, self ) + self.functions_by_name[ func_name ] = func - elif child.name == "enum": - enum = self.factory.create_item( "enum", child, self ) - self.enums_by_name[ enum.name ] = enum - elif child.name == "type": - t = self.factory.create_item( "type", child, self ) - self.types_by_name[ "GL" + t.name ] = t + if func.offset >= self.next_offset: + self.next_offset = func.offset + 1 - child = child.next + elif child.tag == "enum": + enum = self.factory.create_enum( child, self, cat_name ) + self.enums_by_name[ enum.name ] = enum + elif child.tag == "type": + t = self.factory.create_type( child, self, cat_name ) + self.types_by_name[ "GL" + t.name ] = t return diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c index 76cbb41a9..acf927b09 100644 --- a/mesalib/src/mesa/drivers/common/meta.c +++ b/mesalib/src/mesa/drivers/common/meta.c @@ -53,6 +53,7 @@ #include "main/mipmap.h" #include "main/multisample.h" #include "main/objectlabel.h" +#include "main/pipelineobj.h" #include "main/pixel.h" #include "main/pbo.h" #include "main/polygon.h" @@ -535,12 +536,20 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) _mesa_set_enable(ctx, GL_FRAGMENT_SHADER_ATI, GL_FALSE); } + if (ctx->Extensions.ARB_separate_shader_objects) { + /* Warning it must be done before _mesa_UseProgram call */ + _mesa_reference_pipeline_object(ctx, &save->_Shader, ctx->_Shader); + _mesa_reference_pipeline_object(ctx, &save->Pipeline, + ctx->Pipeline.Current); + _mesa_BindProgramPipeline(0); + } + for (i = 0; i < MESA_SHADER_STAGES; i++) { _mesa_reference_shader_program(ctx, &save->Shader[i], - ctx->Shader.CurrentProgram[i]); + ctx->_Shader->CurrentProgram[i]); } _mesa_reference_shader_program(ctx, &save->ActiveShader, - ctx->Shader.ActiveProgram); + ctx->_Shader->ActiveProgram); _mesa_UseProgram(0); } @@ -880,25 +889,37 @@ _mesa_meta_end(struct gl_context *ctx) save->ATIFragmentShaderEnabled); } + /* Warning it must be done before _mesa_use_shader_program call */ + if (ctx->Extensions.ARB_separate_shader_objects) { + _mesa_reference_pipeline_object(ctx, &ctx->_Shader, save->_Shader); + _mesa_reference_pipeline_object(ctx, &ctx->Pipeline.Current, + save->Pipeline); + _mesa_reference_pipeline_object(ctx, &save->Pipeline, NULL); + } + if (ctx->Extensions.ARB_vertex_shader) { _mesa_use_shader_program(ctx, GL_VERTEX_SHADER, - save->Shader[MESA_SHADER_VERTEX]); + save->Shader[MESA_SHADER_VERTEX], + ctx->_Shader); } if (_mesa_has_geometry_shaders(ctx)) _mesa_use_shader_program(ctx, GL_GEOMETRY_SHADER_ARB, - save->Shader[MESA_SHADER_GEOMETRY]); + save->Shader[MESA_SHADER_GEOMETRY], + ctx->_Shader); if (ctx->Extensions.ARB_fragment_shader) _mesa_use_shader_program(ctx, GL_FRAGMENT_SHADER, - save->Shader[MESA_SHADER_FRAGMENT]); + save->Shader[MESA_SHADER_FRAGMENT], + ctx->_Shader); - _mesa_reference_shader_program(ctx, &ctx->Shader.ActiveProgram, + _mesa_reference_shader_program(ctx, &ctx->_Shader->ActiveProgram, save->ActiveShader); for (i = 0; i < MESA_SHADER_STAGES; i++) _mesa_reference_shader_program(ctx, &save->Shader[i], NULL); _mesa_reference_shader_program(ctx, &save->ActiveShader, NULL); + _mesa_reference_pipeline_object(ctx, &save->_Shader, NULL); } if (state & MESA_META_STENCIL_TEST) { diff --git a/mesalib/src/mesa/drivers/common/meta.h b/mesalib/src/mesa/drivers/common/meta.h index e2ccb939e..4faae0b40 100644 --- a/mesalib/src/mesa/drivers/common/meta.h +++ b/mesalib/src/mesa/drivers/common/meta.h @@ -121,6 +121,8 @@ struct save_state GLboolean ATIFragmentShaderEnabled; struct gl_shader_program *Shader[MESA_SHADER_STAGES]; struct gl_shader_program *ActiveShader; + struct gl_pipeline_object *_Shader; + struct gl_pipeline_object *Pipeline; /** MESA_META_STENCIL_TEST */ struct gl_stencil_attrib Stencil; diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c index f3fd1a475..8f0b1998d 100644 --- a/mesalib/src/mesa/main/api_validate.c +++ b/mesalib/src/mesa/main/api_validate.c @@ -125,11 +125,14 @@ check_valid_to_render(struct gl_context *ctx, const char *function) return GL_FALSE; break; - case API_OPENGL_COMPAT: case API_OPENGL_CORE: + if (ctx->Array.VAO == ctx->Array.DefaultVAO) + return GL_FALSE; + /* fallthrough */ + case API_OPENGL_COMPAT: { const struct gl_shader_program *vsProg = - ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX]; + ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX]; GLboolean haveVertexShader = (vsProg && vsProg->LinkStatus); GLboolean haveVertexProgram = ctx->VertexProgram._Enabled; if (haveVertexShader || haveVertexProgram) { @@ -270,9 +273,9 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name) * TRIANGLES_ADJACENCY_ARB or TRIANGLE_STRIP_ADJACENCY_ARB. * */ - if (ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]) { + if (ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]) { const GLenum geom_mode = - ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]->Geom.InputType; + ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]->Geom.InputType; switch (mode) { case GL_POINTS: valid_enum = (geom_mode == GL_POINTS); @@ -331,8 +334,8 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name) if (_mesa_is_xfb_active_and_unpaused(ctx)) { GLboolean pass = GL_TRUE; - if(ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]) { - switch (ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]->Geom.OutputType) { + if(ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]) { + switch (ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]->Geom.OutputType) { case GL_POINTS: pass = ctx->TransformFeedback.Mode == GL_POINTS; break; diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index cd009c115..860ae8605 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -1841,6 +1841,7 @@ shader_linked_or_absent(struct gl_context *ctx, * Prior to drawing anything with glBegin, glDrawArrays, etc. this function * is called to see if it's valid to render. This involves checking that * the current shader is valid and the framebuffer is complete. + * It also check the current pipeline object is valid if any. * If an error is detected it'll be recorded here. * \return GL_TRUE if OK to render, GL_FALSE if not */ @@ -1855,7 +1856,7 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where) _mesa_update_state(ctx); for (i = 0; i < MESA_SHADER_COMPUTE; i++) { - if (!shader_linked_or_absent(ctx, ctx->Shader.CurrentProgram[i], + if (!shader_linked_or_absent(ctx, ctx->_Shader->CurrentProgram[i], &from_glsl_shader[i], where)) return GL_FALSE; } @@ -1892,6 +1893,15 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where) } } + /* A pipeline object is bound */ + if (ctx->_Shader->Name && !ctx->_Shader->Validated) { + /* Error message will be printed inside _mesa_validate_program_pipeline. + */ + if (!_mesa_validate_program_pipeline(ctx, ctx->_Shader, GL_TRUE)) { + return GL_FALSE; + } + } + if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, "%s(incomplete framebuffer)", where); @@ -1903,8 +1913,8 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where) } #ifdef DEBUG - if (ctx->Shader.Flags & GLSL_LOG) { - struct gl_shader_program **shProg = ctx->Shader.CurrentProgram; + if (ctx->_Shader->Flags & GLSL_LOG) { + struct gl_shader_program **shProg = ctx->_Shader->CurrentProgram; gl_shader_stage i; for (i = 0; i < MESA_SHADER_STAGES; i++) { diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index 107919f0b..6c4f1b548 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -632,7 +632,8 @@ _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, mesa_format format, GLenum internalFormat) +is_format_color_renderable(const struct gl_context *ctx, mesa_format format, + GLenum internalFormat) { const GLenum baseFormat = _mesa_get_format_base_format(format); @@ -664,7 +665,8 @@ is_format_color_renderable(const struct gl_context *ctx, mesa_format format, GLe break; } - if (format == MESA_FORMAT_B10G10R10A2_UNORM && internalFormat != GL_RGB10_A2) { + if (format == MESA_FORMAT_B10G10R10A2_UNORM && + internalFormat != GL_RGB10_A2) { return GL_FALSE; } @@ -948,7 +950,8 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, attFormat = texImg->TexFormat; numImages++; - if (!is_format_color_renderable(ctx, attFormat, texImg->InternalFormat) && + if (!is_format_color_renderable(ctx, attFormat, + texImg->InternalFormat) && !is_legal_depth_format(ctx, f)) { fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT; fbo_incomplete(ctx, "texture attachment incomplete", -1); @@ -1071,7 +1074,9 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, return; } else if (is_layered != att->Layered) { fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS; - fbo_incomplete(ctx, "framebuffer attachment layer mode is inconsistent", i); + fbo_incomplete(ctx, + "framebuffer attachment layer mode is inconsistent", + i); return; } else if (att_layer_count > max_layer_count) { max_layer_count = att_layer_count; @@ -1149,7 +1154,8 @@ _mesa_IsRenderbuffer(GLuint renderbuffer) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); if (renderbuffer) { - struct gl_renderbuffer *rb = _mesa_lookup_renderbuffer(ctx, renderbuffer); + struct gl_renderbuffer *rb = + _mesa_lookup_renderbuffer(ctx, renderbuffer); if (rb != NULL && rb != &DummyRenderbuffer) return GL_TRUE; } @@ -1291,8 +1297,8 @@ _mesa_DeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers) } /* Section 4.4.2 (Attaching Images to Framebuffer Objects), - * subsection "Attaching Renderbuffer Images to a Framebuffer," of - * the OpenGL 3.1 spec says: + * subsection "Attaching Renderbuffer Images to a Framebuffer," + * of the OpenGL 3.1 spec says: * * "If a renderbuffer object is deleted while its image is * attached to one or more attachment points in the currently @@ -1387,15 +1393,15 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat) case GL_ALPHA8: case GL_ALPHA12: case GL_ALPHA16: - return ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_framebuffer_object - ? GL_ALPHA : 0; + return (ctx->API == API_OPENGL_COMPAT && + ctx->Extensions.ARB_framebuffer_object) ? GL_ALPHA : 0; case GL_LUMINANCE: case GL_LUMINANCE4: case GL_LUMINANCE8: case GL_LUMINANCE12: case GL_LUMINANCE16: - return ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_framebuffer_object - ? GL_LUMINANCE : 0; + return (ctx->API == API_OPENGL_COMPAT && + ctx->Extensions.ARB_framebuffer_object) ? GL_LUMINANCE : 0; case GL_LUMINANCE_ALPHA: case GL_LUMINANCE4_ALPHA4: case GL_LUMINANCE6_ALPHA2: @@ -1403,15 +1409,15 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat) case GL_LUMINANCE12_ALPHA4: case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: - return ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_framebuffer_object - ? GL_LUMINANCE_ALPHA : 0; + return (ctx->API == API_OPENGL_COMPAT && + ctx->Extensions.ARB_framebuffer_object) ? GL_LUMINANCE_ALPHA : 0; case GL_INTENSITY: case GL_INTENSITY4: case GL_INTENSITY8: case GL_INTENSITY12: case GL_INTENSITY16: - return ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_framebuffer_object - ? GL_INTENSITY : 0; + return (ctx->API == API_OPENGL_COMPAT && + ctx->Extensions.ARB_framebuffer_object) ? GL_INTENSITY : 0; case GL_RGB8: return GL_RGB; case GL_RGB: @@ -1458,11 +1464,13 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat) return GL_DEPTH_STENCIL; case GL_DEPTH_COMPONENT32F: return ctx->Version >= 30 - || (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_depth_buffer_float) + || (ctx->API == API_OPENGL_COMPAT && + ctx->Extensions.ARB_depth_buffer_float) ? GL_DEPTH_COMPONENT : 0; case GL_DEPTH32F_STENCIL8: return ctx->Version >= 30 - || (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_depth_buffer_float) + || (ctx->API == API_OPENGL_COMPAT && + ctx->Extensions.ARB_depth_buffer_float) ? GL_DEPTH_STENCIL : 0; case GL_RED: case GL_R16: @@ -1694,7 +1702,7 @@ invalidate_rb(GLuint key, void *data, void *userData) /** - * Helper function used by _mesa_RenderbufferStorage() and + * Helper function used by _mesa_RenderbufferStorage() and * _mesa_RenderbufferStorageMultisample(). * samples will be NO_SAMPLES if called by _mesa_RenderbufferStorage(). */ @@ -2142,6 +2150,7 @@ _mesa_BindFramebuffer(GLenum target, GLuint framebuffer) bind_framebuffer(target, framebuffer, _mesa_is_gles(ctx)); } + void GLAPIENTRY _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) { @@ -2152,6 +2161,7 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) bind_framebuffer(target, framebuffer, true); } + void GLAPIENTRY _mesa_DeleteFramebuffers(GLsizei n, const GLuint *framebuffers) { @@ -2222,7 +2232,6 @@ _mesa_GenFramebuffers(GLsizei n, GLuint *framebuffers) } - GLenum GLAPIENTRY _mesa_CheckFramebufferStatus(GLenum target) { @@ -2297,7 +2306,7 @@ reuse_framebuffer_texture_attachment(struct gl_framebuffer *fb, * glFramebufferTexture(), false otherwise. */ static void -framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, +framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset, GLboolean layered) { @@ -2492,10 +2501,9 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, } - void GLAPIENTRY _mesa_FramebufferTexture1D(GLenum target, GLenum attachment, - GLenum textarget, GLuint texture, GLint level) + GLenum textarget, GLuint texture, GLint level) { GET_CURRENT_CONTEXT(ctx); @@ -2528,7 +2536,7 @@ _mesa_FramebufferTexture1D(GLenum target, GLenum attachment, void GLAPIENTRY _mesa_FramebufferTexture2D(GLenum target, GLenum attachment, - GLenum textarget, GLuint texture, GLint level) + GLenum textarget, GLuint texture, GLint level) { GET_CURRENT_CONTEXT(ctx); @@ -2579,8 +2587,8 @@ _mesa_FramebufferTexture2D(GLenum target, GLenum attachment, void GLAPIENTRY _mesa_FramebufferTexture3D(GLenum target, GLenum attachment, - GLenum textarget, GLuint texture, - GLint level, GLint zoffset) + GLenum textarget, GLuint texture, + GLint level, GLint zoffset) { GET_CURRENT_CONTEXT(ctx); @@ -2597,7 +2605,7 @@ _mesa_FramebufferTexture3D(GLenum target, GLenum attachment, void GLAPIENTRY _mesa_FramebufferTextureLayer(GLenum target, GLenum attachment, - GLuint texture, GLint level, GLint layer) + GLuint texture, GLint level, GLint layer) { GET_CURRENT_CONTEXT(ctx); @@ -2624,8 +2632,8 @@ _mesa_FramebufferTexture(GLenum target, GLenum attachment, void GLAPIENTRY _mesa_FramebufferRenderbuffer(GLenum target, GLenum attachment, - GLenum renderbufferTarget, - GLuint renderbuffer) + GLenum renderbufferTarget, + GLuint renderbuffer) { struct gl_renderbuffer_attachment *att; struct gl_framebuffer *fb; @@ -2634,7 +2642,8 @@ _mesa_FramebufferRenderbuffer(GLenum target, GLenum attachment, fb = get_framebuffer_target(ctx, target); if (!fb) { - _mesa_error(ctx, GL_INVALID_ENUM, "glFramebufferRenderbufferEXT(target)"); + _mesa_error(ctx, GL_INVALID_ENUM, + "glFramebufferRenderbufferEXT(target)"); return; } @@ -2691,7 +2700,6 @@ _mesa_FramebufferRenderbuffer(GLenum target, GLenum attachment, } } - FLUSH_VERTICES(ctx, _NEW_BUFFERS); assert(ctx->Driver.FramebufferRenderbuffer); @@ -2706,7 +2714,7 @@ _mesa_FramebufferRenderbuffer(GLenum target, GLenum attachment, void GLAPIENTRY _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, - GLenum pname, GLint *params) + GLenum pname, GLint *params) { const struct gl_renderbuffer_attachment *att; struct gl_framebuffer *buffer; @@ -2734,7 +2742,8 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, * OES_framebuffer_object spec refers to the EXT_framebuffer_object * spec. */ - if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_framebuffer_object) + if ((!_mesa_is_desktop_gl(ctx) || + !ctx->Extensions.ARB_framebuffer_object) && !_mesa_is_gles3(ctx)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetFramebufferAttachmentParameteriv(bound FBO = 0)"); @@ -2845,7 +2854,8 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, } return; case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: - if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_framebuffer_object) + if ((!_mesa_is_desktop_gl(ctx) || + !ctx->Extensions.ARB_framebuffer_object) && !_mesa_is_gles3(ctx)) { goto invalid_pname_enum; } @@ -2855,7 +2865,8 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, } else { if (ctx->Extensions.EXT_framebuffer_sRGB) { - *params = _mesa_get_format_color_encoding(att->Renderbuffer->Format); + *params = + _mesa_get_format_color_encoding(att->Renderbuffer->Format); } else { /* According to ARB_framebuffer_sRGB, we should return LINEAR @@ -2865,7 +2876,8 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, } return; case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: - if ((ctx->API != API_OPENGL_COMPAT || !ctx->Extensions.ARB_framebuffer_object) + if ((ctx->API != API_OPENGL_COMPAT || + !ctx->Extensions.ARB_framebuffer_object) && ctx->API != API_OPENGL_CORE && !_mesa_is_gles3(ctx)) { goto invalid_pname_enum; @@ -2884,7 +2896,8 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, * 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) { + 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 " @@ -2916,7 +2929,8 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: - if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_framebuffer_object) + if ((!_mesa_is_desktop_gl(ctx) || + !ctx->Extensions.ARB_framebuffer_object) && !_mesa_is_gles3(ctx)) { goto invalid_pname_enum; } @@ -3079,6 +3093,7 @@ invalid_enum: return; } + void GLAPIENTRY _mesa_InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, @@ -3089,6 +3104,7 @@ _mesa_InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, "glInvalidateSubFramebuffer"); } + void GLAPIENTRY _mesa_InvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments) @@ -3106,10 +3122,12 @@ _mesa_InvalidateFramebuffer(GLenum target, GLsizei numAttachments, * respectively." */ invalidate_framebuffer_storage(target, numAttachments, attachments, - 0, 0, MAX_VIEWPORT_WIDTH, MAX_VIEWPORT_HEIGHT, + 0, 0, + MAX_VIEWPORT_WIDTH, MAX_VIEWPORT_HEIGHT, "glInvalidateFramebuffer"); } + void GLAPIENTRY _mesa_DiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum *attachments) diff --git a/mesalib/src/mesa/main/ff_fragment_shader.cpp b/mesalib/src/mesa/main/ff_fragment_shader.cpp index cad67aa85..1d2ad604b 100644 --- a/mesalib/src/mesa/main/ff_fragment_shader.cpp +++ b/mesalib/src/mesa/main/ff_fragment_shader.cpp @@ -317,9 +317,9 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx ) { /* _NEW_PROGRAM */ const GLboolean vertexShader = - (ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX] && - ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX]->LinkStatus && - ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX]->_LinkedShaders[MESA_SHADER_VERTEX]); + (ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX] && + ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX]->LinkStatus && + ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX]->_LinkedShaders[MESA_SHADER_VERTEX]); const GLboolean vertexProgram = ctx->VertexProgram._Enabled; GLbitfield fp_inputs = 0x0; @@ -383,7 +383,7 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx ) * validation (see additional comments in state.c). */ if (vertexShader) - vprog = ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX]->_LinkedShaders[MESA_SHADER_VERTEX]->Program; + vprog = ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX]->_LinkedShaders[MESA_SHADER_VERTEX]->Program; else vprog = &ctx->VertexProgram.Current->Base; diff --git a/mesalib/src/mesa/main/format_pack.c b/mesalib/src/mesa/main/format_pack.c index 9fbd41746..e3cbfff7e 100644 --- a/mesalib/src/mesa/main/format_pack.c +++ b/mesalib/src/mesa/main/format_pack.c @@ -96,22 +96,22 @@ linear_ubyte_to_srgb_ubyte(GLubyte cl) */ static void -pack_ubyte_RGBA8888(const GLubyte src[4], void *dst) +pack_ubyte_A8B8G8R8_UNORM(const GLubyte src[4], void *dst) { GLuint *d = ((GLuint *) dst); *d = PACK_COLOR_8888(src[RCOMP], src[GCOMP], src[BCOMP], src[ACOMP]); } static void -pack_float_RGBA8888(const GLfloat src[4], void *dst) +pack_float_A8B8G8R8_UNORM(const GLfloat src[4], void *dst) { GLubyte v[4]; _mesa_unclamped_float_rgba_to_ubyte(v, src); - pack_ubyte_RGBA8888(v, dst); + pack_ubyte_A8B8G8R8_UNORM(v, dst); } static void -pack_row_ubyte_RGBA8888(GLuint n, const GLubyte src[][4], void *dst) +pack_row_ubyte_A8B8G8R8_UNORM(GLuint n, const GLubyte src[][4], void *dst) { GLuint *d = ((GLuint *) dst); GLuint i; @@ -122,14 +122,14 @@ pack_row_ubyte_RGBA8888(GLuint n, const GLubyte src[][4], void *dst) } static void -pack_row_float_RGBA8888(GLuint n, const GLfloat src[][4], void *dst) +pack_row_float_A8B8G8R8_UNORM(GLuint n, const GLfloat src[][4], void *dst) { GLuint *d = ((GLuint *) dst); GLuint i; for (i = 0; i < n; i++) { GLubyte v[4]; _mesa_unclamped_float_rgba_to_ubyte(v, src[i]); - pack_ubyte_RGBA8888(v, d + i); + pack_ubyte_A8B8G8R8_UNORM(v, d + i); } } @@ -140,22 +140,22 @@ pack_row_float_RGBA8888(GLuint n, const GLfloat src[][4], void *dst) */ static void -pack_ubyte_RGBA8888_REV(const GLubyte src[4], void *dst) +pack_ubyte_R8G8B8A8_UNORM(const GLubyte src[4], void *dst) { GLuint *d = ((GLuint *) dst); *d = PACK_COLOR_8888(src[ACOMP], src[BCOMP], src[GCOMP], src[RCOMP]); } static void -pack_float_RGBA8888_REV(const GLfloat src[4], void *dst) +pack_float_R8G8B8A8_UNORM(const GLfloat src[4], void *dst) { GLubyte v[4]; _mesa_unclamped_float_rgba_to_ubyte(v, src); - pack_ubyte_RGBA8888_REV(v, dst); + pack_ubyte_R8G8B8A8_UNORM(v, dst); } static void -pack_row_ubyte_RGBA8888_REV(GLuint n, const GLubyte src[][4], void *dst) +pack_row_ubyte_R8G8B8A8_UNORM(GLuint n, const GLubyte src[][4], void *dst) { GLuint *d = ((GLuint *) dst); GLuint i; @@ -166,14 +166,14 @@ pack_row_ubyte_RGBA8888_REV(GLuint n, const GLubyte src[][4], void *dst) } static void -pack_row_float_RGBA8888_REV(GLuint n, const GLfloat src[][4], void *dst) +pack_row_float_R8G8B8A8_UNORM(GLuint n, const GLfloat src[][4], void *dst) { GLuint *d = ((GLuint *) dst); GLuint i; for (i = 0; i < n; i++) { GLubyte v[4]; _mesa_unclamped_float_rgba_to_ubyte(v, src[i]); - pack_ubyte_RGBA8888_REV(v, d + i); + pack_ubyte_R8G8B8A8_UNORM(v, d + i); } } @@ -183,22 +183,22 @@ pack_row_float_RGBA8888_REV(GLuint n, const GLfloat src[][4], void *dst) */ static void -pack_ubyte_ARGB8888(const GLubyte src[4], void *dst) +pack_ubyte_B8G8R8A8_UNORM(const GLubyte src[4], void *dst) { GLuint *d = ((GLuint *) dst); *d = PACK_COLOR_8888(src[ACOMP], src[RCOMP], src[GCOMP], src[BCOMP]); } static void -pack_float_ARGB8888(const GLfloat src[4], void *dst) +pack_float_B8G8R8A8_UNORM(const GLfloat src[4], void *dst) { GLubyte v[4]; _mesa_unclamped_float_rgba_to_ubyte(v, src); - pack_ubyte_ARGB8888(v, dst); + pack_ubyte_B8G8R8A8_UNORM(v, dst); } static void -pack_row_ubyte_ARGB8888(GLuint n, const GLubyte src[][4], void *dst) +pack_row_ubyte_B8G8R8A8_UNORM(GLuint n, const GLubyte src[][4], void *dst) { GLuint *d = ((GLuint *) dst); GLuint i; @@ -209,14 +209,14 @@ pack_row_ubyte_ARGB8888(GLuint n, const GLubyte src[][4], void *dst) } static void -pack_row_float_ARGB8888(GLuint n, const GLfloat src[][4], void *dst) +pack_row_float_B8G8R8A8_UNORM(GLuint n, const GLfloat src[][4], void *dst) { GLuint *d = ((GLuint *) dst); GLuint i; for (i = 0; i < n; i++) { GLubyte v[4]; _mesa_unclamped_float_rgba_to_ubyte(v, src[i]); - pack_ubyte_ARGB8888(v, d + i); + pack_ubyte_B8G8R8A8_UNORM(v, d + i); } } @@ -226,22 +226,22 @@ pack_row_float_ARGB8888(GLuint n, const GLfloat src[][4], void *dst) */ static void -pack_ubyte_ARGB8888_REV(const GLubyte src[4], void *dst) +pack_ubyte_A8R8G8B8_UNORM(const GLubyte src[4], void *dst) { GLuint *d = ((GLuint *) dst); *d = PACK_COLOR_8888(src[BCOMP], src[GCOMP], src[RCOMP], src[ACOMP]); } static void -pack_float_ARGB8888_REV(const GLfloat src[4], void *dst) +pack_float_A8R8G8B8_UNORM(const GLfloat src[4], void *dst) { GLubyte v[4]; _mesa_unclamped_float_rgba_to_ubyte(v, src); - pack_ubyte_ARGB8888_REV(v, dst); + pack_ubyte_A8R8G8B8_UNORM(v, dst); } static void -pack_row_ubyte_ARGB8888_REV(GLuint n, const GLubyte src[][4], void *dst) +pack_row_ubyte_A8R8G8B8_UNORM(GLuint n, const GLubyte src[][4], void *dst) { GLuint *d = ((GLuint *) dst); GLuint i; @@ -252,14 +252,14 @@ pack_row_ubyte_ARGB8888_REV(GLuint n, const GLubyte src[][4], void *dst) } static void -pack_row_float_ARGB8888_REV(GLuint n, const GLfloat src[][4], void *dst) +pack_row_float_A8R8G8B8_UNORM(GLuint n, const GLfloat src[][4], void *dst) { GLuint *d = ((GLuint *) dst); GLuint i; for (i = 0; i < n; i++) { GLubyte v[4]; _mesa_unclamped_float_rgba_to_ubyte(v, src[i]); - pack_ubyte_ARGB8888_REV(v, d + i); + pack_ubyte_A8R8G8B8_UNORM(v, d + i); } } @@ -269,22 +269,22 @@ pack_row_float_ARGB8888_REV(GLuint n, const GLfloat src[][4], void *dst) */ static void -pack_ubyte_XRGB8888(const GLubyte src[4], void *dst) +pack_ubyte_B8G8R8X8_UNORM(const GLubyte src[4], void *dst) { GLuint *d = ((GLuint *) dst); *d = PACK_COLOR_8888(0x0, src[RCOMP], src[GCOMP], src[BCOMP]); } static void -pack_float_XRGB8888(const GLfloat src[4], void *dst) +pack_float_B8G8R8X8_UNORM(const GLfloat src[4], void *dst) { GLubyte v[4]; _mesa_unclamped_float_rgba_to_ubyte(v, src); - pack_ubyte_XRGB8888(v, dst); + pack_ubyte_B8G8R8X8_UNORM(v, dst); } static void -pack_row_ubyte_XRGB8888(GLuint n, const GLubyte src[][4], void *dst) +pack_row_ubyte_B8G8R8X8_UNORM(GLuint n, const GLubyte src[][4], void *dst) { GLuint *d = ((GLuint *) dst); GLuint i; @@ -294,14 +294,14 @@ pack_row_ubyte_XRGB8888(GLuint n, const GLubyte src[][4], void *dst) } static void -pack_row_float_XRGB8888(GLuint n, const GLfloat src[][4], void *dst) +pack_row_float_B8G8R8X8_UNORM(GLuint n, const GLfloat src[][4], void *dst) { GLuint *d = ((GLuint *) dst); GLuint i; for (i = 0; i < n; i++) { GLubyte v[4]; _mesa_unclamped_float_rgba_to_ubyte(v, src[i]); - pack_ubyte_XRGB8888(v, d + i); + pack_ubyte_B8G8R8X8_UNORM(v, d + i); } } @@ -311,22 +311,22 @@ pack_row_float_XRGB8888(GLuint n, const GLfloat src[][4], void *dst) */ static void -pack_ubyte_XRGB8888_REV(const GLubyte src[4], void *dst) +pack_ubyte_X8R8G8B8_UNORM(const GLubyte src[4], void *dst) { GLuint *d = ((GLuint *) dst); *d = PACK_COLOR_8888(src[BCOMP], src[GCOMP], src[RCOMP], 0); } static void -pack_float_XRGB8888_REV(const GLfloat src[4], void *dst) +pack_float_X8R8G8B8_UNORM(const GLfloat src[4], void *dst) { GLubyte v[4]; _mesa_unclamped_float_rgba_to_ubyte(v, src); - pack_ubyte_XRGB8888_REV(v, dst); + pack_ubyte_X8R8G8B8_UNORM(v, dst); } static void -pack_row_ubyte_XRGB8888_REV(GLuint n, const GLubyte src[][4], void *dst) +pack_row_ubyte_X8R8G8B8_UNORM(GLuint n, const GLubyte src[][4], void *dst) { GLuint *d = ((GLuint *) dst); GLuint i; @@ -336,14 +336,14 @@ pack_row_ubyte_XRGB8888_REV(GLuint n, const GLubyte src[][4], void *dst) } static void -pack_row_float_XRGB8888_REV(GLuint n, const GLfloat src[][4], void *dst) +pack_row_float_X8R8G8B8_UNORM(GLuint n, const GLfloat src[][4], void *dst) { GLuint *d = ((GLuint *) dst); GLuint i; for (i = 0; i < n; i++) { GLubyte v[4]; _mesa_unclamped_float_rgba_to_ubyte(v, src[i]); - pack_ubyte_XRGB8888_REV(v, d + i); + pack_ubyte_X8R8G8B8_UNORM(v, d + i); } } @@ -353,7 +353,7 @@ pack_row_float_XRGB8888_REV(GLuint n, const GLfloat src[][4], void *dst) */ static void -pack_ubyte_RGB888(const GLubyte src[4], void *dst) +pack_ubyte_BGR_UNORM8(const GLubyte src[4], void *dst) { GLubyte *d = ((GLubyte *) dst); d[2] = src[RCOMP]; @@ -362,7 +362,7 @@ pack_ubyte_RGB888(const GLubyte src[4], void *dst) } static void -pack_float_RGB888(const GLfloat src[4], void *dst) +pack_float_BGR_UNORM8(const GLfloat src[4], void *dst) { GLubyte *d = ((GLubyte *) dst); UNCLAMPED_FLOAT_TO_UBYTE(d[2], src[RCOMP]); @@ -371,7 +371,7 @@ pack_float_RGB888(const GLfloat src[4], void *dst) } static void -pack_row_ubyte_RGB888(GLuint n, const GLubyte src[][4], void *dst) +pack_row_ubyte_BGR_UNORM8(GLuint n, const GLubyte src[][4], void *dst) { GLubyte *d = ((GLubyte *) dst); GLuint i; @@ -383,7 +383,7 @@ pack_row_ubyte_RGB888(GLuint n, const GLubyte src[][4], void *dst) } static void -pack_row_float_RGB888(GLuint n, const GLfloat src[][4], void *dst) +pack_row_float_BGR_UNORM8(GLuint n, const GLfloat src[][4], void *dst) { GLubyte *d = ((GLubyte *) dst); GLuint i; @@ -402,7 +402,7 @@ pack_row_float_RGB888(GLuint n, const GLfloat src[][4], void *dst) */ static void -pack_ubyte_BGR888(const GLubyte src[4], void *dst) +pack_ubyte_RGB_UNORM8(const GLubyte src[4], void *dst) { GLubyte *d = ((GLubyte *) dst); d[2] = src[BCOMP]; @@ -411,7 +411,7 @@ pack_ubyte_BGR888(const GLubyte src[4], void *dst) } static void -pack_float_BGR888(const GLfloat src[4], void *dst) +pack_float_RGB_UNORM8(const GLfloat src[4], void *dst) { GLubyte *d = ((GLubyte *) dst); UNCLAMPED_FLOAT_TO_UBYTE(d[2], src[BCOMP]); @@ -420,7 +420,7 @@ pack_float_BGR888(const GLfloat src[4], void *dst) } static void -pack_row_ubyte_BGR888(GLuint n, const GLubyte src[][4], void *dst) +pack_row_ubyte_RGB_UNORM8(GLuint n, const GLubyte src[][4], void *dst) { GLubyte *d = ((GLubyte *) dst); GLuint i; @@ -432,7 +432,7 @@ pack_row_ubyte_BGR888(GLuint n, const GLubyte src[][4], void *dst) } static void -pack_row_float_BGR888(GLuint n, const GLfloat src[][4], void *dst) +pack_row_float_RGB_UNORM8(GLuint n, const GLfloat src[][4], void *dst) { GLubyte *d = ((GLubyte *) dst); GLuint i; @@ -451,41 +451,41 @@ pack_row_float_BGR888(GLuint n, const GLfloat src[][4], void *dst) */ static void -pack_ubyte_RGB565(const GLubyte src[4], void *dst) +pack_ubyte_B5G6R5_UNORM(const GLubyte src[4], void *dst) { GLushort *d = ((GLushort *) dst); *d = PACK_COLOR_565(src[RCOMP], src[GCOMP], src[BCOMP]); } static void -pack_float_RGB565(const GLfloat src[4], void *dst) +pack_float_B5G6R5_UNORM(const GLfloat src[4], void *dst) { GLubyte v[3]; UNCLAMPED_FLOAT_TO_UBYTE(v[0], src[RCOMP]); UNCLAMPED_FLOAT_TO_UBYTE(v[1], src[GCOMP]); UNCLAMPED_FLOAT_TO_UBYTE(v[2], src[BCOMP]); - pack_ubyte_RGB565(v, dst); + pack_ubyte_B5G6R5_UNORM(v, dst); } static void -pack_row_ubyte_RGB565(GLuint n, const GLubyte src[][4], void *dst) +pack_row_ubyte_B5G6R5_UNORM(GLuint n, const GLubyte src[][4], void *dst) { GLushort *d = ((GLushort *) dst); GLuint i; for (i = 0; i < n; i++) { - pack_ubyte_RGB565(src[i], d + i); + pack_ubyte_B5G6R5_UNORM(src[i], d + i); } } static void -pack_row_float_RGB565(GLuint n, const GLfloat src[][4], void *dst) +pack_row_float_B5G6R5_UNORM(GLuint n, const GLfloat src[][4], void *dst) { GLushort *d = ((GLushort *) dst); GLuint i; for (i = 0; i < n; i++) { GLubyte v[4]; _mesa_unclamped_float_rgba_to_ubyte(v, src[i]); - pack_ubyte_RGB565(v, d + i); + pack_ubyte_B5G6R5_UNORM(v, d + i); } } @@ -497,14 +497,14 @@ pack_row_float_RGB565(GLuint n, const GLfloat src[][4], void *dst) */ static void -pack_ubyte_RGB565_REV(const GLubyte src[4], void *dst) +pack_ubyte_R5G6B5_UNORM(const GLubyte src[4], void *dst) { GLushort *d = ((GLushort *) dst); *d = PACK_COLOR_565_REV(src[RCOMP], src[GCOMP], src[BCOMP]); } static void -pack_float_RGB565_REV(const GLfloat src[4], void *dst) +pack_float_R5G6B5_UNORM(const GLfloat src[4], void *dst) { GLushort *d = ((GLushort *) dst); GLubyte r, g, b; @@ -515,24 +515,24 @@ pack_float_RGB565_REV(const GLfloat src[4], void *dst) } static void -pack_row_ubyte_RGB565_REV(GLuint n, const GLubyte src[][4], void *dst) +pack_row_ubyte_R5G6B5_UNORM(GLuint n, const GLubyte src[][4], void *dst) { GLushort *d = ((GLushort *) dst); GLuint i; for (i = 0; i < n; i++) { - pack_ubyte_RGB565_REV(src[i], d + i); + pack_ubyte_R5G6B5_UNORM(src[i], d + i); } } static void -pack_row_float_RGB565_REV(GLuint n, const GLfloat src[][4], void *dst) +pack_row_float_R5G6B5_UNORM(GLuint n, const GLfloat src[][4], void *dst) { GLushort *d = ((GLushort *) dst); GLuint i; for (i = 0; i < n; i++) { GLubyte v[4]; _mesa_unclamped_float_rgba_to_ubyte(v, src[i]); - pack_ubyte_RGB565_REV(v, d + i); + pack_ubyte_R5G6B5_UNORM(v, d + i); } } @@ -542,18 +542,18 @@ pack_row_float_RGB565_REV(GLuint n, const GLfloat src[][4], void *dst) */ static void -pack_ubyte_ARGB4444(const GLubyte src[4], void *dst) +pack_ubyte_B4G4R4A4_UNORM(const GLubyte src[4], void *dst) { GLushort *d = ((GLushort *) dst); *d = PACK_COLOR_4444(src[ACOMP], src[RCOMP], src[GCOMP], src[BCOMP]); } static void -pack_float_ARGB4444(const GLfloat src[4], void *dst) +pack_float_B4G4R4A4_UNORM(const GLfloat src[4], void *dst) { GLubyte v[4]; _mesa_unclamped_float_rgba_to_ubyte(v, src); - pack_ubyte_ARGB4444(v, dst); + pack_ubyte_B4G4R4A4_UNORM(v, dst); } /* use fallback row packing functions */ @@ -564,18 +564,18 @@ pack_float_ARGB4444(const GLfloat src[4], void *dst) */ static void -pack_ubyte_ARGB4444_REV(const GLubyte src[4], void *dst) +pack_ubyte_A4R4G4B4_UNORM(const GLubyte src[4], void *dst) { GLushort *d = ((GLushort *) dst); *d = PACK_COLOR_4444(src[BCOMP], src[GCOMP], src[RCOMP], src[ACOMP]); } static void -pack_float_ARGB4444_REV(const GLfloat src[4], void *dst) +pack_float_A4R4G4B4_UNORM(const GLfloat src[4], void *dst) { GLubyte v[4]; _mesa_unclamped_float_rgba_to_ubyte(v, src); - pack_ubyte_ARGB4444_REV(v, dst); + pack_ubyte_A4R4G4B4_UNORM(v, dst); } /* use fallback row packing functions */ @@ -586,18 +586,18 @@ pack_float_ARGB4444_REV(const GLfloat src[4], void *dst) */ static void -pack_ubyte_RGBA5551(const GLubyte src[4], void *dst) +pack_ubyte_A1B5G5R5_UNORM(const GLubyte src[4], void *dst) { GLushort *d = ((GLushort *) dst); *d = PACK_COLOR_5551(src[RCOMP], src[GCOMP], src[BCOMP], src[ACOMP]); } static void -pack_float_RGBA5551(const GLfloat src[4], void *dst) +pack_float_A1B5G5R5_UNORM(const GLfloat src[4], void *dst) { GLubyte v[4]; _mesa_unclamped_float_rgba_to_ubyte(v, src); - pack_ubyte_RGBA5551(v, dst); + pack_ubyte_A1B5G5R5_UNORM(v, dst); } /* use fallback row packing functions */ @@ -608,18 +608,18 @@ pack_float_RGBA5551(const GLfloat src[4], void *dst) */ static void -pack_ubyte_ARGB1555(const GLubyte src[4], void *dst) +pack_ubyte_B5G5R5A1_UNORM(const GLubyte src[4], void *dst) { GLushort *d = ((GLushort *) dst); *d = PACK_COLOR_1555(src[ACOMP], src[RCOMP], src[GCOMP], src[BCOMP]); } static void -pack_float_ARGB1555(const GLfloat src[4], void *dst) +pack_float_B5G5R5A1_UNORM(const GLfloat src[4], void *dst) { GLubyte v[4]; _mesa_unclamped_float_rgba_to_ubyte(v, src); - pack_ubyte_ARGB1555(v, dst); + pack_ubyte_B5G5R5A1_UNORM(v, dst); } @@ -629,7 +629,7 @@ pack_float_ARGB1555(const GLfloat src[4], void *dst) */ static void -pack_ubyte_ARGB1555_REV(const GLubyte src[4], void *dst) +pack_ubyte_A1R5G5B5_UNORM(const GLubyte src[4], void *dst) { GLushort *d = ((GLushort *) dst), tmp; tmp = PACK_COLOR_1555(src[ACOMP], src[RCOMP], src[GCOMP], src[BCOMP]); @@ -637,75 +637,75 @@ pack_ubyte_ARGB1555_REV(const GLubyte src[4], void *dst) } static void -pack_float_ARGB1555_REV(const GLfloat src[4], void *dst) +pack_float_A1R5G5B5_UNORM(const GLfloat src[4], void *dst) { GLubyte v[4]; _mesa_unclamped_float_rgba_to_ubyte(v, src); - pack_ubyte_ARGB1555_REV(v, dst); + pack_ubyte_A1R5G5B5_UNORM(v, dst); } /* MESA_FORMAT_L4A4_UNORM */ static void -pack_ubyte_AL44(const GLubyte src[4], void *dst) +pack_ubyte_L4A4_UNORM(const GLubyte src[4], void *dst) { GLubyte *d = ((GLubyte *) dst); *d = PACK_COLOR_44(src[ACOMP], src[RCOMP]); } static void -pack_float_AL44(const GLfloat src[4], void *dst) +pack_float_L4A4_UNORM(const GLfloat src[4], void *dst) { GLubyte v[4]; UNCLAMPED_FLOAT_TO_UBYTE(v[0], src[RCOMP]); UNCLAMPED_FLOAT_TO_UBYTE(v[3], src[ACOMP]); - pack_ubyte_AL44(v, dst); + pack_ubyte_L4A4_UNORM(v, dst); } /* MESA_FORMAT_L8A8_UNORM */ static void -pack_ubyte_AL88(const GLubyte src[4], void *dst) +pack_ubyte_L8A8_UNORM(const GLubyte src[4], void *dst) { GLushort *d = ((GLushort *) dst); *d = PACK_COLOR_88(src[ACOMP], src[RCOMP]); } static void -pack_float_AL88(const GLfloat src[4], void *dst) +pack_float_L8A8_UNORM(const GLfloat src[4], void *dst) { GLubyte v[4]; UNCLAMPED_FLOAT_TO_UBYTE(v[0], src[RCOMP]); UNCLAMPED_FLOAT_TO_UBYTE(v[3], src[ACOMP]); - pack_ubyte_AL88(v, dst); + pack_ubyte_L8A8_UNORM(v, dst); } /* MESA_FORMAT_A8L8_UNORM */ static void -pack_ubyte_AL88_REV(const GLubyte src[4], void *dst) +pack_ubyte_A8L8_UNORM(const GLubyte src[4], void *dst) { GLushort *d = ((GLushort *) dst); *d = PACK_COLOR_88(src[RCOMP], src[ACOMP]); } static void -pack_float_AL88_REV(const GLfloat src[4], void *dst) +pack_float_A8L8_UNORM(const GLfloat src[4], void *dst) { GLubyte v[4]; UNCLAMPED_FLOAT_TO_UBYTE(v[0], src[RCOMP]); UNCLAMPED_FLOAT_TO_UBYTE(v[3], src[ACOMP]); - pack_ubyte_AL88_REV(v, dst); + pack_ubyte_A8L8_UNORM(v, dst); } /* MESA_FORMAT_L16A16_UNORM */ static void -pack_ubyte_AL1616(const GLubyte src[4], void *dst) +pack_ubyte_L16A16_UNORM(const GLubyte src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLushort l = UBYTE_TO_USHORT(src[RCOMP]); @@ -714,7 +714,7 @@ pack_ubyte_AL1616(const GLubyte src[4], void *dst) } static void -pack_float_AL1616(const GLfloat src[4], void *dst) +pack_float_L16A16_UNORM(const GLfloat src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLushort l, a; @@ -727,7 +727,7 @@ pack_float_AL1616(const GLfloat src[4], void *dst) /* MESA_FORMAT_A16L16_UNORM */ static void -pack_ubyte_AL1616_REV(const GLubyte src[4], void *dst) +pack_ubyte_A16L16_UNORM(const GLubyte src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLushort l = UBYTE_TO_USHORT(src[RCOMP]); @@ -736,7 +736,7 @@ pack_ubyte_AL1616_REV(const GLubyte src[4], void *dst) } static void -pack_float_AL1616_REV(const GLfloat src[4], void *dst) +pack_float_A16L16_UNORM(const GLfloat src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLushort l, a; @@ -749,34 +749,34 @@ pack_float_AL1616_REV(const GLfloat src[4], void *dst) /* MESA_FORMAT_B2G3R3_UNORM */ static void -pack_ubyte_RGB332(const GLubyte src[4], void *dst) +pack_ubyte_B2G3R3_UNORM(const GLubyte src[4], void *dst) { GLubyte *d = ((GLubyte *) dst); *d = PACK_COLOR_332(src[RCOMP], src[GCOMP], src[BCOMP]); } static void -pack_float_RGB332(const GLfloat src[4], void *dst) +pack_float_B2G3R3_UNORM(const GLfloat src[4], void *dst) { GLubyte v[4]; UNCLAMPED_FLOAT_TO_UBYTE(v[0], src[RCOMP]); UNCLAMPED_FLOAT_TO_UBYTE(v[1], src[GCOMP]); UNCLAMPED_FLOAT_TO_UBYTE(v[2], src[BCOMP]); - pack_ubyte_RGB332(v, dst); + pack_ubyte_B2G3R3_UNORM(v, dst); } /* MESA_FORMAT_A_UNORM8 */ static void -pack_ubyte_A8(const GLubyte src[4], void *dst) +pack_ubyte_A_UNORM8(const GLubyte src[4], void *dst) { GLubyte *d = ((GLubyte *) dst); *d = src[ACOMP]; } static void -pack_float_A8(const GLfloat src[4], void *dst) +pack_float_A_UNORM8(const GLfloat src[4], void *dst) { GLubyte *d = ((GLubyte *) dst); UNCLAMPED_FLOAT_TO_UBYTE(d[0], src[ACOMP]); @@ -786,14 +786,14 @@ pack_float_A8(const GLfloat src[4], void *dst) /* MESA_FORMAT_A_UNORM16 */ static void -pack_ubyte_A16(const GLubyte src[4], void *dst) +pack_ubyte_A_UNORM16(const GLubyte src[4], void *dst) { GLushort *d = ((GLushort *) dst); *d = UBYTE_TO_USHORT(src[ACOMP]); } static void -pack_float_A16(const GLfloat src[4], void *dst) +pack_float_A_UNORM16(const GLfloat src[4], void *dst) { GLushort *d = ((GLushort *) dst); UNCLAMPED_FLOAT_TO_USHORT(d[0], src[ACOMP]); @@ -803,14 +803,14 @@ pack_float_A16(const GLfloat src[4], void *dst) /* MESA_FORMAT_L_UNORM8 */ static void -pack_ubyte_L8(const GLubyte src[4], void *dst) +pack_ubyte_L_UNORM8(const GLubyte src[4], void *dst) { GLubyte *d = ((GLubyte *) dst); *d = src[RCOMP]; } static void -pack_float_L8(const GLfloat src[4], void *dst) +pack_float_L_UNORM8(const GLfloat src[4], void *dst) { GLubyte *d = ((GLubyte *) dst); UNCLAMPED_FLOAT_TO_UBYTE(d[0], src[RCOMP]); @@ -820,14 +820,14 @@ pack_float_L8(const GLfloat src[4], void *dst) /* MESA_FORMAT_L_UNORM16 */ static void -pack_ubyte_L16(const GLubyte src[4], void *dst) +pack_ubyte_L_UNORM16(const GLubyte src[4], void *dst) { GLushort *d = ((GLushort *) dst); *d = UBYTE_TO_USHORT(src[RCOMP]); } static void -pack_float_L16(const GLfloat src[4], void *dst) +pack_float_L_UNORM16(const GLfloat src[4], void *dst) { GLushort *d = ((GLushort *) dst); UNCLAMPED_FLOAT_TO_USHORT(d[0], src[RCOMP]); @@ -867,14 +867,14 @@ pack_float_YCBCR_REV(const GLfloat src[4], void *dst) /* MESA_FORMAT_R_UNORM8 */ static void -pack_ubyte_R8(const GLubyte src[4], void *dst) +pack_ubyte_R_UNORM8(const GLubyte src[4], void *dst) { GLubyte *d = ((GLubyte *) dst); *d = src[RCOMP]; } static void -pack_float_R8(const GLfloat src[4], void *dst) +pack_float_R_UNORM8(const GLfloat src[4], void *dst) { GLubyte *d = ((GLubyte *) dst); GLubyte r; @@ -886,14 +886,14 @@ pack_float_R8(const GLfloat src[4], void *dst) /* MESA_FORMAT_R8G8_UNORM */ static void -pack_ubyte_GR88(const GLubyte src[4], void *dst) +pack_ubyte_R8G8_UNORM(const GLubyte src[4], void *dst) { GLubyte *d = ((GLubyte *) dst); *d = PACK_COLOR_88(src[GCOMP], src[RCOMP]); } static void -pack_float_GR88(const GLfloat src[4], void *dst) +pack_float_R8G8_UNORM(const GLfloat src[4], void *dst) { GLushort *d = ((GLushort *) dst); GLubyte r, g; @@ -906,14 +906,14 @@ pack_float_GR88(const GLfloat src[4], void *dst) /* MESA_FORMAT_G8R8_UNORM */ static void -pack_ubyte_RG88(const GLubyte src[4], void *dst) +pack_ubyte_G8R8_UNORM(const GLubyte src[4], void *dst) { GLubyte *d = ((GLubyte *) dst); *d = PACK_COLOR_88(src[RCOMP], src[GCOMP]); } static void -pack_float_RG88(const GLfloat src[4], void *dst) +pack_float_G8R8_UNORM(const GLfloat src[4], void *dst) { GLushort *d = ((GLushort *) dst); GLubyte r, g; @@ -926,14 +926,14 @@ pack_float_RG88(const GLfloat src[4], void *dst) /* MESA_FORMAT_R_UNORM16 */ static void -pack_ubyte_R16(const GLubyte src[4], void *dst) +pack_ubyte_R_UNORM16(const GLubyte src[4], void *dst) { GLushort *d = ((GLushort *) dst); *d = UBYTE_TO_USHORT(src[RCOMP]); } static void -pack_float_R16(const GLfloat src[4], void *dst) +pack_float_R_UNORM16(const GLfloat src[4], void *dst) { GLushort *d = ((GLushort *) dst); UNCLAMPED_FLOAT_TO_USHORT(d[0], src[RCOMP]); @@ -943,7 +943,7 @@ pack_float_R16(const GLfloat src[4], void *dst) /* MESA_FORMAT_R16G16_UNORM */ static void -pack_ubyte_GR1616(const GLubyte src[4], void *dst) +pack_ubyte_R16G16_UNORM(const GLubyte src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLushort r = UBYTE_TO_USHORT(src[RCOMP]); @@ -952,7 +952,7 @@ pack_ubyte_GR1616(const GLubyte src[4], void *dst) } static void -pack_float_GR1616(const GLfloat src[4], void *dst) +pack_float_R16G16_UNORM(const GLfloat src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLushort r, g; @@ -965,7 +965,7 @@ pack_float_GR1616(const GLfloat src[4], void *dst) /* MESA_FORMAT_G16R16_UNORM */ static void -pack_ubyte_RG1616(const GLubyte src[4], void *dst) +pack_ubyte_G16R16_UNORM(const GLubyte src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLushort r = UBYTE_TO_USHORT(src[RCOMP]); @@ -975,7 +975,7 @@ pack_ubyte_RG1616(const GLubyte src[4], void *dst) static void -pack_float_RG1616(const GLfloat src[4], void *dst) +pack_float_G16R16_UNORM(const GLfloat src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLushort r, g; @@ -988,7 +988,7 @@ pack_float_RG1616(const GLfloat src[4], void *dst) /* MESA_FORMAT_B10G10R10A2_UNORM */ static void -pack_ubyte_ARGB2101010(const GLubyte src[4], void *dst) +pack_ubyte_B10G10R10A2_UNORM(const GLubyte src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLushort r = UBYTE_TO_USHORT(src[RCOMP]); @@ -999,7 +999,7 @@ pack_ubyte_ARGB2101010(const GLubyte src[4], void *dst) } static void -pack_float_ARGB2101010(const GLfloat src[4], void *dst) +pack_float_B10G10R10A2_UNORM(const GLfloat src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLushort r, g, b, a; @@ -1014,7 +1014,7 @@ pack_float_ARGB2101010(const GLfloat src[4], void *dst) /* MESA_FORMAT_R10G10B10A2_UINT */ static void -pack_ubyte_ABGR2101010_UINT(const GLubyte src[4], void *dst) +pack_ubyte_R10G10B10A2_UINT(const GLubyte src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLushort r = UBYTE_TO_USHORT(src[RCOMP]); @@ -1025,7 +1025,7 @@ pack_ubyte_ABGR2101010_UINT(const GLubyte src[4], void *dst) } static void -pack_float_ABGR2101010_UINT(const GLfloat src[4], void *dst) +pack_float_R10G10B10A2_UINT(const GLfloat src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLushort r, g, b, a; @@ -1040,7 +1040,7 @@ pack_float_ABGR2101010_UINT(const GLfloat src[4], void *dst) /* MESA_FORMAT_BGR_SRGB8 */ static void -pack_ubyte_SRGB8(const GLubyte src[4], void *dst) +pack_ubyte_BGR_SRGB8(const GLubyte src[4], void *dst) { GLubyte *d = ((GLubyte *) dst); d[2] = linear_ubyte_to_srgb_ubyte(src[RCOMP]); @@ -1049,7 +1049,7 @@ pack_ubyte_SRGB8(const GLubyte src[4], void *dst) } static void -pack_float_SRGB8(const GLfloat src[4], void *dst) +pack_float_BGR_SRGB8(const GLfloat src[4], void *dst) { GLubyte *d = ((GLubyte *) dst); d[2] = linear_float_to_srgb_ubyte(src[RCOMP]); @@ -1061,7 +1061,7 @@ pack_float_SRGB8(const GLfloat src[4], void *dst) /* MESA_FORMAT_A8B8G8R8_SRGB */ static void -pack_ubyte_SRGBA8(const GLubyte src[4], void *dst) +pack_ubyte_A8B8G8R8_SRGB(const GLubyte src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLubyte r = linear_ubyte_to_srgb_ubyte(src[RCOMP]); @@ -1071,7 +1071,7 @@ pack_ubyte_SRGBA8(const GLubyte src[4], void *dst) } static void -pack_float_SRGBA8(const GLfloat src[4], void *dst) +pack_float_A8B8G8R8_SRGB(const GLfloat src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLubyte r, g, b, a; @@ -1086,7 +1086,7 @@ pack_float_SRGBA8(const GLfloat src[4], void *dst) /* MESA_FORMAT_B8G8R8A8_SRGB */ static void -pack_ubyte_SARGB8(const GLubyte src[4], void *dst) +pack_ubyte_B8G8R8A8_SRGB(const GLubyte src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLubyte r = linear_ubyte_to_srgb_ubyte(src[RCOMP]); @@ -1096,7 +1096,7 @@ pack_ubyte_SARGB8(const GLubyte src[4], void *dst) } static void -pack_float_SARGB8(const GLfloat src[4], void *dst) +pack_float_B8G8R8A8_SRGB(const GLfloat src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLubyte r, g, b, a; @@ -1111,7 +1111,7 @@ pack_float_SARGB8(const GLfloat src[4], void *dst) /* MESA_FORMAT_R8G8B8A8_SRGB */ static void -pack_ubyte_SABGR8(const GLubyte src[4], void *dst) +pack_ubyte_R8G8B8A8_SRGB(const GLubyte src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLubyte r = linear_ubyte_to_srgb_ubyte(src[RCOMP]); @@ -1121,7 +1121,7 @@ pack_ubyte_SABGR8(const GLubyte src[4], void *dst) } static void -pack_float_SABGR8(const GLfloat src[4], void *dst) +pack_float_R8G8B8A8_SRGB(const GLfloat src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLubyte r, g, b, a; @@ -1136,14 +1136,14 @@ pack_float_SABGR8(const GLfloat src[4], void *dst) /* MESA_FORMAT_L_SRGB8 */ static void -pack_ubyte_SL8(const GLubyte src[4], void *dst) +pack_ubyte_L_SRGB8(const GLubyte src[4], void *dst) { GLubyte *d = ((GLubyte *) dst); *d = linear_ubyte_to_srgb_ubyte(src[RCOMP]); } static void -pack_float_SL8(const GLfloat src[4], void *dst) +pack_float_L_SRGB8(const GLfloat src[4], void *dst) { GLubyte *d = ((GLubyte *) dst); GLubyte l = linear_float_to_srgb_ubyte(src[RCOMP]); @@ -1154,7 +1154,7 @@ pack_float_SL8(const GLfloat src[4], void *dst) /* MESA_FORMAT_L8A8_SRGB */ static void -pack_ubyte_SLA8(const GLubyte src[4], void *dst) +pack_ubyte_L8A8_SRGB(const GLubyte src[4], void *dst) { GLushort *d = ((GLushort *) dst); GLubyte l = linear_ubyte_to_srgb_ubyte(src[RCOMP]); @@ -1162,7 +1162,7 @@ pack_ubyte_SLA8(const GLubyte src[4], void *dst) } static void -pack_float_SLA8(const GLfloat src[4], void *dst) +pack_float_L8A8_SRGB(const GLfloat src[4], void *dst) { GLushort *d = ((GLushort *) dst); GLubyte a, l = linear_float_to_srgb_ubyte(src[RCOMP]); @@ -1262,14 +1262,14 @@ pack_float_RGB_FLOAT16(const GLfloat src[4], void *dst) /* MESA_FORMAT_A_FLOAT32 */ static void -pack_ubyte_ALPHA_FLOAT32(const GLubyte src[4], void *dst) +pack_ubyte_A_FLOAT32(const GLubyte src[4], void *dst) { GLfloat *d = ((GLfloat *) dst); d[0] = UBYTE_TO_FLOAT(src[ACOMP]); } static void -pack_float_ALPHA_FLOAT32(const GLfloat src[4], void *dst) +pack_float_A_FLOAT32(const GLfloat src[4], void *dst) { GLfloat *d = ((GLfloat *) dst); d[0] = src[ACOMP]; @@ -1279,48 +1279,48 @@ pack_float_ALPHA_FLOAT32(const GLfloat src[4], void *dst) /* MESA_FORMAT_A_FLOAT16 */ static void -pack_ubyte_ALPHA_FLOAT16(const GLubyte src[4], void *dst) +pack_ubyte_A_FLOAT16(const GLubyte src[4], void *dst) { GLhalfARB *d = ((GLhalfARB *) dst); d[0] = _mesa_float_to_half(UBYTE_TO_FLOAT(src[ACOMP])); } static void -pack_float_ALPHA_FLOAT16(const GLfloat src[4], void *dst) +pack_float_A_FLOAT16(const GLfloat src[4], void *dst) { GLhalfARB *d = ((GLhalfARB *) dst); d[0] = _mesa_float_to_half(src[ACOMP]); } -/* MESA_FORMAT_L_FLOAT32 (and INTENSITY_FLOAT32, R_FLOAT32) */ +/* MESA_FORMAT_L_FLOAT32 (and I_FLOAT32, R_FLOAT32) */ static void -pack_ubyte_LUMINANCE_FLOAT32(const GLubyte src[4], void *dst) +pack_ubyte_L_FLOAT32(const GLubyte src[4], void *dst) { GLfloat *d = ((GLfloat *) dst); d[0] = UBYTE_TO_FLOAT(src[RCOMP]); } static void -pack_float_LUMINANCE_FLOAT32(const GLfloat src[4], void *dst) +pack_float_L_FLOAT32(const GLfloat src[4], void *dst) { GLfloat *d = ((GLfloat *) dst); d[0] = src[RCOMP]; } -/* MESA_FORMAT_L_FLOAT16 (and INTENSITY_FLOAT16, R_FLOAT32) */ +/* MESA_FORMAT_L_FLOAT16 (and I_FLOAT16, R_FLOAT32) */ static void -pack_ubyte_LUMINANCE_FLOAT16(const GLubyte src[4], void *dst) +pack_ubyte_L_FLOAT16(const GLubyte src[4], void *dst) { GLhalfARB *d = ((GLhalfARB *) dst); d[0] = _mesa_float_to_half(UBYTE_TO_FLOAT(src[RCOMP])); } static void -pack_float_LUMINANCE_FLOAT16(const GLfloat src[4], void *dst) +pack_float_L_FLOAT16(const GLfloat src[4], void *dst) { GLhalfARB *d = ((GLhalfARB *) dst); d[0] = _mesa_float_to_half(src[RCOMP]); @@ -1330,7 +1330,7 @@ pack_float_LUMINANCE_FLOAT16(const GLfloat src[4], void *dst) /* MESA_FORMAT_LA_FLOAT32 */ static void -pack_ubyte_LUMINANCE_ALPHA_FLOAT32(const GLubyte src[4], void *dst) +pack_ubyte_LA_FLOAT32(const GLubyte src[4], void *dst) { GLfloat *d = ((GLfloat *) dst); d[0] = UBYTE_TO_FLOAT(src[RCOMP]); @@ -1338,7 +1338,7 @@ pack_ubyte_LUMINANCE_ALPHA_FLOAT32(const GLubyte src[4], void *dst) } static void -pack_float_LUMINANCE_ALPHA_FLOAT32(const GLfloat src[4], void *dst) +pack_float_LA_FLOAT32(const GLfloat src[4], void *dst) { GLfloat *d = ((GLfloat *) dst); d[0] = src[RCOMP]; @@ -1349,7 +1349,7 @@ pack_float_LUMINANCE_ALPHA_FLOAT32(const GLfloat src[4], void *dst) /* MESA_FORMAT_LA_FLOAT16 */ static void -pack_ubyte_LUMINANCE_ALPHA_FLOAT16(const GLubyte src[4], void *dst) +pack_ubyte_LA_FLOAT16(const GLubyte src[4], void *dst) { GLhalfARB *d = ((GLhalfARB *) dst); d[0] = _mesa_float_to_half(UBYTE_TO_FLOAT(src[RCOMP])); @@ -1357,7 +1357,7 @@ pack_ubyte_LUMINANCE_ALPHA_FLOAT16(const GLubyte src[4], void *dst) } static void -pack_float_LUMINANCE_ALPHA_FLOAT16(const GLfloat src[4], void *dst) +pack_float_LA_FLOAT16(const GLfloat src[4], void *dst) { GLhalfARB *d = ((GLhalfARB *) dst); d[0] = _mesa_float_to_half(src[RCOMP]); @@ -1453,7 +1453,7 @@ pack_float_RGBA_16(const GLfloat src[4], void *dst) */ static void -pack_float_SIGNED_R8(const GLfloat src[4], void *dst) +pack_float_R_SNORM8(const GLfloat src[4], void *dst) { GLbyte *d = (GLbyte *) dst; *d = FLOAT_TO_BYTE(CLAMP(src[RCOMP], -1.0f, 1.0f)); @@ -1465,7 +1465,7 @@ pack_float_SIGNED_R8(const GLfloat src[4], void *dst) */ static void -pack_float_SIGNED_RG88_REV(const GLfloat src[4], void *dst) +pack_float_R8G8_SNORM(const GLfloat src[4], void *dst) { GLushort *d = (GLushort *) dst; GLbyte r = FLOAT_TO_BYTE(CLAMP(src[RCOMP], -1.0f, 1.0f)); @@ -1479,7 +1479,7 @@ pack_float_SIGNED_RG88_REV(const GLfloat src[4], void *dst) */ static void -pack_float_SIGNED_RGBX8888(const GLfloat src[4], void *dst) +pack_float_X8B8G8R8_SNORM(const GLfloat src[4], void *dst) { GLuint *d = (GLuint *) dst; GLbyte r = FLOAT_TO_BYTE(CLAMP(src[RCOMP], -1.0f, 1.0f)); @@ -1495,7 +1495,7 @@ pack_float_SIGNED_RGBX8888(const GLfloat src[4], void *dst) */ static void -pack_float_SIGNED_RGBA8888(const GLfloat src[4], void *dst) +pack_float_A8B8G8R8_SNORM(const GLfloat src[4], void *dst) { GLuint *d = (GLuint *) dst; GLbyte r = FLOAT_TO_BYTE(CLAMP(src[RCOMP], -1.0f, 1.0f)); @@ -1511,7 +1511,7 @@ pack_float_SIGNED_RGBA8888(const GLfloat src[4], void *dst) */ static void -pack_float_SIGNED_RGBA8888_REV(const GLfloat src[4], void *dst) +pack_float_R8G8B8A8_SNORM(const GLfloat src[4], void *dst) { GLuint *d = (GLuint *) dst; GLbyte r = FLOAT_TO_BYTE(CLAMP(src[RCOMP], -1.0f, 1.0f)); @@ -1527,7 +1527,7 @@ pack_float_SIGNED_RGBA8888_REV(const GLfloat src[4], void *dst) */ static void -pack_float_SIGNED_R16(const GLfloat src[4], void *dst) +pack_float_R_SNORM16(const GLfloat src[4], void *dst) { GLshort *d = (GLshort *) dst; *d = FLOAT_TO_SHORT(CLAMP(src[RCOMP], -1.0f, 1.0f)); @@ -1539,7 +1539,7 @@ pack_float_SIGNED_R16(const GLfloat src[4], void *dst) */ static void -pack_float_SIGNED_GR1616(const GLfloat src[4], void *dst) +pack_float_R16G16_SNORM(const GLfloat src[4], void *dst) { GLuint *d = (GLuint *) dst; GLshort r = FLOAT_TO_SHORT(CLAMP(src[RCOMP], -1.0f, 1.0f)); @@ -1553,7 +1553,7 @@ pack_float_SIGNED_GR1616(const GLfloat src[4], void *dst) */ static void -pack_float_SIGNED_RGB_16(const GLfloat src[4], void *dst) +pack_float_RGB_SNORM16(const GLfloat src[4], void *dst) { GLshort *d = (GLshort *) dst; d[0] = FLOAT_TO_SHORT(CLAMP(src[RCOMP], -1.0f, 1.0f)); @@ -1567,7 +1567,7 @@ pack_float_SIGNED_RGB_16(const GLfloat src[4], void *dst) */ static void -pack_float_SIGNED_RGBA_16(const GLfloat src[4], void *dst) +pack_float_RGBA_SNORM16(const GLfloat src[4], void *dst) { GLshort *d = (GLshort *) dst; d[0] = FLOAT_TO_SHORT(CLAMP(src[RCOMP], -1.0f, 1.0f)); @@ -1582,7 +1582,7 @@ pack_float_SIGNED_RGBA_16(const GLfloat src[4], void *dst) */ static void -pack_float_SIGNED_A8(const GLfloat src[4], void *dst) +pack_float_A_SNORM8(const GLfloat src[4], void *dst) { GLbyte *d = (GLbyte *) dst; *d = FLOAT_TO_BYTE(CLAMP(src[ACOMP], -1.0f, 1.0f)); @@ -1594,7 +1594,7 @@ pack_float_SIGNED_A8(const GLfloat src[4], void *dst) */ static void -pack_float_SIGNED_L8(const GLfloat src[4], void *dst) +pack_float_L_SNORM8(const GLfloat src[4], void *dst) { GLbyte *d = (GLbyte *) dst; *d = FLOAT_TO_BYTE(CLAMP(src[RCOMP], -1.0f, 1.0f)); @@ -1606,7 +1606,7 @@ pack_float_SIGNED_L8(const GLfloat src[4], void *dst) */ static void -pack_float_SIGNED_AL88(const GLfloat src[4], void *dst) +pack_float_L8A8_SNORM(const GLfloat src[4], void *dst) { GLushort *d = (GLushort *) dst; GLbyte l = FLOAT_TO_BYTE(CLAMP(src[RCOMP], -1.0f, 1.0f)); @@ -1620,7 +1620,7 @@ pack_float_SIGNED_AL88(const GLfloat src[4], void *dst) */ static void -pack_float_SIGNED_A16(const GLfloat src[4], void *dst) +pack_float_A_SNORM16(const GLfloat src[4], void *dst) { GLshort *d = (GLshort *) dst; *d = FLOAT_TO_SHORT(CLAMP(src[ACOMP], -1.0f, 1.0f)); @@ -1632,7 +1632,7 @@ pack_float_SIGNED_A16(const GLfloat src[4], void *dst) */ static void -pack_float_SIGNED_L16(const GLfloat src[4], void *dst) +pack_float_L_SNORM16(const GLfloat src[4], void *dst) { GLshort *d = (GLshort *) dst; *d = FLOAT_TO_SHORT(CLAMP(src[RCOMP], -1.0f, 1.0f)); @@ -1644,7 +1644,7 @@ pack_float_SIGNED_L16(const GLfloat src[4], void *dst) */ static void -pack_float_SIGNED_AL1616(const GLfloat src[4], void *dst) +pack_float_LA_SNORM16(const GLfloat src[4], void *dst) { GLuint *d = (GLuint *) dst; GLshort l = FLOAT_TO_SHORT(CLAMP(src[RCOMP], -1.0f, 1.0f)); @@ -1658,14 +1658,14 @@ pack_float_SIGNED_AL1616(const GLfloat src[4], void *dst) */ static void -pack_float_RGB9_E5_FLOAT(const GLfloat src[4], void *dst) +pack_float_R9G9B9E5_FLOAT(const GLfloat src[4], void *dst) { GLuint *d = (GLuint *) dst; *d = float3_to_rgb9e5(src); } static void -pack_ubyte_RGB9_E5_FLOAT(const GLubyte src[4], void *dst) +pack_ubyte_R9G9B9E5_FLOAT(const GLubyte src[4], void *dst) { GLuint *d = (GLuint *) dst; GLfloat rgb[3]; @@ -1682,7 +1682,7 @@ pack_ubyte_RGB9_E5_FLOAT(const GLubyte src[4], void *dst) */ static void -pack_ubyte_R11_G11_B10_FLOAT(const GLubyte src[4], void *dst) +pack_ubyte_R11G11B10_FLOAT(const GLubyte src[4], void *dst) { GLuint *d = (GLuint *) dst; GLfloat rgb[3]; @@ -1693,7 +1693,7 @@ pack_ubyte_R11_G11_B10_FLOAT(const GLubyte src[4], void *dst) } static void -pack_float_R11_G11_B10_FLOAT(const GLfloat src[4], void *dst) +pack_float_R11G11B10_FLOAT(const GLfloat src[4], void *dst) { GLuint *d = (GLuint *) dst; *d = float3_to_r11g11b10f(src); @@ -1760,7 +1760,7 @@ pack_float_XBGR8888_SNORM(const GLfloat src[4], void *dst) */ static void -pack_float_XBGR8888_SRGB(const GLfloat src[4], void *dst) +pack_float_R8G8B8X8_SRGB(const GLfloat src[4], void *dst) { GLuint *d = (GLuint *) dst; GLubyte r = linear_float_to_srgb_ubyte(src[RCOMP]); @@ -1773,7 +1773,7 @@ pack_float_XBGR8888_SRGB(const GLfloat src[4], void *dst) /* MESA_FORMAT_B10G10R10X2_UNORM */ static void -pack_ubyte_XRGB2101010_UNORM(const GLubyte src[4], void *dst) +pack_ubyte_B10G10R10X2_UNORM(const GLubyte src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLushort r = UBYTE_TO_USHORT(src[RCOMP]); @@ -1783,7 +1783,7 @@ pack_ubyte_XRGB2101010_UNORM(const GLubyte src[4], void *dst) } static void -pack_float_XRGB2101010_UNORM(const GLfloat src[4], void *dst) +pack_float_B10G10R10X2_UNORM(const GLfloat src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLushort r, g, b; @@ -1797,7 +1797,7 @@ pack_float_XRGB2101010_UNORM(const GLfloat src[4], void *dst) /* MESA_FORMAT_RGBX_UNORM16 */ static void -pack_ubyte_XBGR16161616_UNORM(const GLubyte src[4], void *dst) +pack_ubyte_RGBX_UNORM16(const GLubyte src[4], void *dst) { GLushort *d = ((GLushort *) dst); d[0] = UBYTE_TO_USHORT(src[RCOMP]); @@ -1807,7 +1807,7 @@ pack_ubyte_XBGR16161616_UNORM(const GLubyte src[4], void *dst) } static void -pack_float_XBGR16161616_UNORM(const GLfloat src[4], void *dst) +pack_float_RGBX_UNORM16(const GLfloat src[4], void *dst) { GLushort *d = ((GLushort *) dst); UNCLAMPED_FLOAT_TO_USHORT(d[0], src[RCOMP]); @@ -1820,7 +1820,7 @@ pack_float_XBGR16161616_UNORM(const GLfloat src[4], void *dst) /* MESA_FORMAT_RGBX_SNORM16 */ static void -pack_float_XBGR16161616_SNORM(const GLfloat src[4], void *dst) +pack_float_RGBX_SNORM16(const GLfloat src[4], void *dst) { GLushort *d = ((GLushort *) dst); UNCLAMPED_FLOAT_TO_SHORT(d[0], src[RCOMP]); @@ -1845,7 +1845,7 @@ pack_float_XBGR16161616_FLOAT(const GLfloat src[4], void *dst) /* MESA_FORMAT_RGBX_FLOAT32 */ static void -pack_float_XBGR32323232_FLOAT(const GLfloat src[4], void *dst) +pack_float_RGBX_FLOAT32(const GLfloat src[4], void *dst) { GLfloat *d = ((GLfloat *) dst); d[0] = src[RCOMP]; @@ -1857,7 +1857,7 @@ pack_float_XBGR32323232_FLOAT(const GLfloat src[4], void *dst) /* MESA_FORMAT_R10G10B10A2_UNORM */ static void -pack_ubyte_ABGR2101010(const GLubyte src[4], void *dst) +pack_ubyte_R10G10B10A2_UNORM(const GLubyte src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLushort r = UBYTE_TO_USHORT(src[RCOMP]); @@ -1868,7 +1868,7 @@ pack_ubyte_ABGR2101010(const GLubyte src[4], void *dst) } static void -pack_float_ABGR2101010(const GLfloat src[4], void *dst) +pack_float_R10G10B10A2_UNORM(const GLfloat src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLushort r, g, b, a; @@ -1884,7 +1884,7 @@ pack_float_ABGR2101010(const GLfloat src[4], void *dst) */ static void -pack_float_SIGNED_RG88(const GLfloat src[4], void *dst) +pack_float_G8R8_SNORM(const GLfloat src[4], void *dst) { GLushort *d = (GLushort *) dst; GLbyte r = FLOAT_TO_BYTE(CLAMP(src[RCOMP], -1.0f, 1.0f)); @@ -1897,7 +1897,7 @@ pack_float_SIGNED_RG88(const GLfloat src[4], void *dst) */ static void -pack_float_SIGNED_RG1616(const GLfloat src[4], void *dst) +pack_float_G16R16_SNORM(const GLfloat src[4], void *dst) { GLuint *d = (GLuint *) dst; GLshort r = FLOAT_TO_SHORT(CLAMP(src[RCOMP], -1.0f, 1.0f)); @@ -1910,7 +1910,7 @@ pack_float_SIGNED_RG1616(const GLfloat src[4], void *dst) */ static void -pack_float_XRGB8888_SRGB(const GLfloat src[4], void *dst) +pack_float_B8G8R8X8_SRGB(const GLfloat src[4], void *dst) { GLuint *d = (GLuint *) dst; GLubyte r = linear_float_to_srgb_ubyte(src[RCOMP]); @@ -1933,45 +1933,45 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format) table[MESA_FORMAT_NONE] = NULL; - table[MESA_FORMAT_A8B8G8R8_UNORM] = pack_ubyte_RGBA8888; - table[MESA_FORMAT_R8G8B8A8_UNORM] = pack_ubyte_RGBA8888_REV; - table[MESA_FORMAT_B8G8R8A8_UNORM] = pack_ubyte_ARGB8888; - table[MESA_FORMAT_A8R8G8B8_UNORM] = pack_ubyte_ARGB8888_REV; - table[MESA_FORMAT_X8B8G8R8_UNORM] = pack_ubyte_RGBA8888; /* reused */ - table[MESA_FORMAT_R8G8B8X8_UNORM] = pack_ubyte_RGBA8888_REV; /* reused */ - table[MESA_FORMAT_B8G8R8X8_UNORM] = pack_ubyte_XRGB8888; - table[MESA_FORMAT_X8R8G8B8_UNORM] = pack_ubyte_XRGB8888_REV; - table[MESA_FORMAT_BGR_UNORM8] = pack_ubyte_RGB888; - table[MESA_FORMAT_RGB_UNORM8] = pack_ubyte_BGR888; - table[MESA_FORMAT_B5G6R5_UNORM] = pack_ubyte_RGB565; - table[MESA_FORMAT_R5G6B5_UNORM] = pack_ubyte_RGB565_REV; - table[MESA_FORMAT_B4G4R4A4_UNORM] = pack_ubyte_ARGB4444; - table[MESA_FORMAT_A4R4G4B4_UNORM] = pack_ubyte_ARGB4444_REV; - table[MESA_FORMAT_A1B5G5R5_UNORM] = pack_ubyte_RGBA5551; - table[MESA_FORMAT_B5G5R5A1_UNORM] = pack_ubyte_ARGB1555; - table[MESA_FORMAT_A1R5G5B5_UNORM] = pack_ubyte_ARGB1555_REV; - table[MESA_FORMAT_L4A4_UNORM] = pack_ubyte_AL44; - table[MESA_FORMAT_L8A8_UNORM] = pack_ubyte_AL88; - table[MESA_FORMAT_A8L8_UNORM] = pack_ubyte_AL88_REV; - table[MESA_FORMAT_L16A16_UNORM] = pack_ubyte_AL1616; - table[MESA_FORMAT_A16L16_UNORM] = pack_ubyte_AL1616_REV; - table[MESA_FORMAT_B2G3R3_UNORM] = pack_ubyte_RGB332; - table[MESA_FORMAT_A_UNORM8] = pack_ubyte_A8; - table[MESA_FORMAT_A_UNORM16] = pack_ubyte_A16; - table[MESA_FORMAT_L_UNORM8] = pack_ubyte_L8; - table[MESA_FORMAT_L_UNORM16] = pack_ubyte_L16; - table[MESA_FORMAT_I_UNORM8] = pack_ubyte_L8; /* reuse pack_ubyte_L8 */ - table[MESA_FORMAT_I_UNORM16] = pack_ubyte_L16; /* reuse pack_ubyte_L16 */ + table[MESA_FORMAT_A8B8G8R8_UNORM] = pack_ubyte_A8B8G8R8_UNORM; + table[MESA_FORMAT_R8G8B8A8_UNORM] = pack_ubyte_R8G8B8A8_UNORM; + table[MESA_FORMAT_B8G8R8A8_UNORM] = pack_ubyte_B8G8R8A8_UNORM; + table[MESA_FORMAT_A8R8G8B8_UNORM] = pack_ubyte_A8R8G8B8_UNORM; + table[MESA_FORMAT_X8B8G8R8_UNORM] = pack_ubyte_A8B8G8R8_UNORM; /* reused */ + table[MESA_FORMAT_R8G8B8X8_UNORM] = pack_ubyte_R8G8B8A8_UNORM; /* reused */ + table[MESA_FORMAT_B8G8R8X8_UNORM] = pack_ubyte_B8G8R8X8_UNORM; + table[MESA_FORMAT_X8R8G8B8_UNORM] = pack_ubyte_X8R8G8B8_UNORM; + table[MESA_FORMAT_BGR_UNORM8] = pack_ubyte_BGR_UNORM8; + table[MESA_FORMAT_RGB_UNORM8] = pack_ubyte_RGB_UNORM8; + table[MESA_FORMAT_B5G6R5_UNORM] = pack_ubyte_B5G6R5_UNORM; + table[MESA_FORMAT_R5G6B5_UNORM] = pack_ubyte_R5G6B5_UNORM; + table[MESA_FORMAT_B4G4R4A4_UNORM] = pack_ubyte_B4G4R4A4_UNORM; + table[MESA_FORMAT_A4R4G4B4_UNORM] = pack_ubyte_A4R4G4B4_UNORM; + table[MESA_FORMAT_A1B5G5R5_UNORM] = pack_ubyte_A1B5G5R5_UNORM; + table[MESA_FORMAT_B5G5R5A1_UNORM] = pack_ubyte_B5G5R5A1_UNORM; + table[MESA_FORMAT_A1R5G5B5_UNORM] = pack_ubyte_A1R5G5B5_UNORM; + table[MESA_FORMAT_L4A4_UNORM] = pack_ubyte_L4A4_UNORM; + table[MESA_FORMAT_L8A8_UNORM] = pack_ubyte_L8A8_UNORM; + table[MESA_FORMAT_A8L8_UNORM] = pack_ubyte_A8L8_UNORM; + table[MESA_FORMAT_L16A16_UNORM] = pack_ubyte_L16A16_UNORM; + table[MESA_FORMAT_A16L16_UNORM] = pack_ubyte_A16L16_UNORM; + table[MESA_FORMAT_B2G3R3_UNORM] = pack_ubyte_B2G3R3_UNORM; + table[MESA_FORMAT_A_UNORM8] = pack_ubyte_A_UNORM8; + table[MESA_FORMAT_A_UNORM16] = pack_ubyte_A_UNORM16; + table[MESA_FORMAT_L_UNORM8] = pack_ubyte_L_UNORM8; + table[MESA_FORMAT_L_UNORM16] = pack_ubyte_L_UNORM16; + table[MESA_FORMAT_I_UNORM8] = pack_ubyte_L_UNORM8; /* reuse pack_ubyte_L_UNORM8 */ + table[MESA_FORMAT_I_UNORM16] = pack_ubyte_L_UNORM16; /* reuse pack_ubyte_L_UNORM16 */ table[MESA_FORMAT_YCBCR] = pack_ubyte_YCBCR; table[MESA_FORMAT_YCBCR_REV] = pack_ubyte_YCBCR_REV; - table[MESA_FORMAT_R_UNORM8] = pack_ubyte_R8; - table[MESA_FORMAT_R8G8_UNORM] = pack_ubyte_GR88; - table[MESA_FORMAT_G8R8_UNORM] = pack_ubyte_RG88; - table[MESA_FORMAT_R_UNORM16] = pack_ubyte_R16; - table[MESA_FORMAT_R16G16_UNORM] = pack_ubyte_GR1616; - table[MESA_FORMAT_G16R16_UNORM] = pack_ubyte_RG1616; - table[MESA_FORMAT_B10G10R10A2_UNORM] = pack_ubyte_ARGB2101010; - table[MESA_FORMAT_R10G10B10A2_UINT] = pack_ubyte_ABGR2101010_UINT; + table[MESA_FORMAT_R_UNORM8] = pack_ubyte_R_UNORM8; + table[MESA_FORMAT_R8G8_UNORM] = pack_ubyte_R8G8_UNORM; + table[MESA_FORMAT_G8R8_UNORM] = pack_ubyte_G8R8_UNORM; + table[MESA_FORMAT_R_UNORM16] = pack_ubyte_R_UNORM16; + table[MESA_FORMAT_R16G16_UNORM] = pack_ubyte_R16G16_UNORM; + table[MESA_FORMAT_G16R16_UNORM] = pack_ubyte_G16R16_UNORM; + table[MESA_FORMAT_B10G10R10A2_UNORM] = pack_ubyte_B10G10R10A2_UNORM; + table[MESA_FORMAT_R10G10B10A2_UINT] = pack_ubyte_R10G10B10A2_UINT; /* should never convert RGBA to these formats */ table[MESA_FORMAT_S8_UINT_Z24_UNORM] = NULL; @@ -1983,12 +1983,12 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format) table[MESA_FORMAT_S_UINT8] = NULL; /* sRGB */ - table[MESA_FORMAT_BGR_SRGB8] = pack_ubyte_SRGB8; - table[MESA_FORMAT_A8B8G8R8_SRGB] = pack_ubyte_SRGBA8; - table[MESA_FORMAT_B8G8R8A8_SRGB] = pack_ubyte_SARGB8; - table[MESA_FORMAT_R8G8B8A8_SRGB] = pack_ubyte_SABGR8; - table[MESA_FORMAT_L_SRGB8] = pack_ubyte_SL8; - table[MESA_FORMAT_L8A8_SRGB] = pack_ubyte_SLA8; + table[MESA_FORMAT_BGR_SRGB8] = pack_ubyte_BGR_SRGB8; + table[MESA_FORMAT_A8B8G8R8_SRGB] = pack_ubyte_A8B8G8R8_SRGB; + table[MESA_FORMAT_B8G8R8A8_SRGB] = pack_ubyte_B8G8R8A8_SRGB; + table[MESA_FORMAT_R8G8B8A8_SRGB] = pack_ubyte_R8G8B8A8_SRGB; + table[MESA_FORMAT_L_SRGB8] = pack_ubyte_L_SRGB8; + table[MESA_FORMAT_L8A8_SRGB] = pack_ubyte_L8A8_SRGB; /* n/a */ table[MESA_FORMAT_SRGB_DXT1] = NULL; /* pack_ubyte_SRGB_DXT1; */ table[MESA_FORMAT_SRGBA_DXT1] = NULL; /* pack_ubyte_SRGBA_DXT1; */ @@ -2006,16 +2006,16 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format) table[MESA_FORMAT_RGBA_FLOAT16] = pack_ubyte_RGBA_FLOAT16; table[MESA_FORMAT_RGB_FLOAT32] = pack_ubyte_RGB_FLOAT32; table[MESA_FORMAT_RGB_FLOAT16] = pack_ubyte_RGB_FLOAT16; - table[MESA_FORMAT_A_FLOAT32] = pack_ubyte_ALPHA_FLOAT32; - table[MESA_FORMAT_A_FLOAT16] = pack_ubyte_ALPHA_FLOAT16; - table[MESA_FORMAT_L_FLOAT32] = pack_ubyte_LUMINANCE_FLOAT32; - table[MESA_FORMAT_L_FLOAT16] = pack_ubyte_LUMINANCE_FLOAT16; - table[MESA_FORMAT_LA_FLOAT32] = pack_ubyte_LUMINANCE_ALPHA_FLOAT32; - table[MESA_FORMAT_LA_FLOAT16] = pack_ubyte_LUMINANCE_ALPHA_FLOAT16; - table[MESA_FORMAT_I_FLOAT32] = pack_ubyte_LUMINANCE_FLOAT32; - table[MESA_FORMAT_I_FLOAT16] = pack_ubyte_LUMINANCE_FLOAT16; - table[MESA_FORMAT_R_FLOAT32] = pack_ubyte_LUMINANCE_FLOAT32; - table[MESA_FORMAT_R_FLOAT16] = pack_ubyte_LUMINANCE_FLOAT16; + table[MESA_FORMAT_A_FLOAT32] = pack_ubyte_A_FLOAT32; + table[MESA_FORMAT_A_FLOAT16] = pack_ubyte_A_FLOAT16; + table[MESA_FORMAT_L_FLOAT32] = pack_ubyte_L_FLOAT32; + table[MESA_FORMAT_L_FLOAT16] = pack_ubyte_L_FLOAT16; + table[MESA_FORMAT_LA_FLOAT32] = pack_ubyte_LA_FLOAT32; + table[MESA_FORMAT_LA_FLOAT16] = pack_ubyte_LA_FLOAT16; + table[MESA_FORMAT_I_FLOAT32] = pack_ubyte_L_FLOAT32; + table[MESA_FORMAT_I_FLOAT16] = pack_ubyte_L_FLOAT16; + table[MESA_FORMAT_R_FLOAT32] = pack_ubyte_L_FLOAT32; + table[MESA_FORMAT_R_FLOAT16] = pack_ubyte_L_FLOAT16; table[MESA_FORMAT_RG_FLOAT32] = pack_ubyte_RG_FLOAT32; table[MESA_FORMAT_RG_FLOAT16] = pack_ubyte_RG_FLOAT16; @@ -2053,8 +2053,8 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format) table[MESA_FORMAT_RGBA_UNORM16] = pack_ubyte_RGBA_16; - table[MESA_FORMAT_R9G9B9E5_FLOAT] = pack_ubyte_RGB9_E5_FLOAT; - table[MESA_FORMAT_R11G11B10_FLOAT] = pack_ubyte_R11_G11_B10_FLOAT; + table[MESA_FORMAT_R9G9B9E5_FLOAT] = pack_ubyte_R9G9B9E5_FLOAT; + table[MESA_FORMAT_R11G11B10_FLOAT] = pack_ubyte_R11G11B10_FLOAT; table[MESA_FORMAT_B4G4R4X4_UNORM] = pack_ubyte_XRGB4444_UNORM; table[MESA_FORMAT_B5G5R5X1_UNORM] = pack_ubyte_XRGB1555_UNORM; @@ -2062,8 +2062,8 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format) table[MESA_FORMAT_R8G8B8X8_SRGB] = NULL; table[MESA_FORMAT_RGBX_UINT8] = NULL; table[MESA_FORMAT_RGBX_SINT8] = NULL; - table[MESA_FORMAT_B10G10R10X2_UNORM] = pack_ubyte_XRGB2101010_UNORM; - table[MESA_FORMAT_RGBX_UNORM16] = pack_ubyte_XBGR16161616_UNORM; + table[MESA_FORMAT_B10G10R10X2_UNORM] = pack_ubyte_B10G10R10X2_UNORM; + table[MESA_FORMAT_RGBX_UNORM16] = pack_ubyte_RGBX_UNORM16; table[MESA_FORMAT_RGBX_SNORM16] = NULL; table[MESA_FORMAT_RGBX_FLOAT16] = NULL; table[MESA_FORMAT_RGBX_UINT16] = NULL; @@ -2072,7 +2072,7 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format) table[MESA_FORMAT_RGBX_UINT32] = NULL; table[MESA_FORMAT_RGBX_SINT32] = NULL; - table[MESA_FORMAT_R10G10B10A2_UNORM] = pack_ubyte_ABGR2101010; + table[MESA_FORMAT_R10G10B10A2_UNORM] = pack_ubyte_R10G10B10A2_UNORM; table[MESA_FORMAT_B8G8R8X8_SRGB] = NULL; @@ -2098,46 +2098,46 @@ _mesa_get_pack_float_rgba_function(mesa_format format) table[MESA_FORMAT_NONE] = NULL; - table[MESA_FORMAT_A8B8G8R8_UNORM] = pack_float_RGBA8888; - table[MESA_FORMAT_R8G8B8A8_UNORM] = pack_float_RGBA8888_REV; - table[MESA_FORMAT_B8G8R8A8_UNORM] = pack_float_ARGB8888; - table[MESA_FORMAT_A8R8G8B8_UNORM] = pack_float_ARGB8888_REV; - table[MESA_FORMAT_X8B8G8R8_UNORM] = pack_float_RGBA8888; /* reused */ - table[MESA_FORMAT_R8G8B8X8_UNORM] = pack_float_RGBA8888_REV; /* reused */ - table[MESA_FORMAT_B8G8R8X8_UNORM] = pack_float_XRGB8888; - table[MESA_FORMAT_X8R8G8B8_UNORM] = pack_float_XRGB8888_REV; - table[MESA_FORMAT_BGR_UNORM8] = pack_float_RGB888; - table[MESA_FORMAT_RGB_UNORM8] = pack_float_BGR888; - table[MESA_FORMAT_B5G6R5_UNORM] = pack_float_RGB565; - table[MESA_FORMAT_R5G6B5_UNORM] = pack_float_RGB565_REV; - table[MESA_FORMAT_B4G4R4A4_UNORM] = pack_float_ARGB4444; - table[MESA_FORMAT_A4R4G4B4_UNORM] = pack_float_ARGB4444_REV; - table[MESA_FORMAT_A1B5G5R5_UNORM] = pack_float_RGBA5551; - table[MESA_FORMAT_B5G5R5A1_UNORM] = pack_float_ARGB1555; - table[MESA_FORMAT_A1R5G5B5_UNORM] = pack_float_ARGB1555_REV; - - table[MESA_FORMAT_L4A4_UNORM] = pack_float_AL44; - table[MESA_FORMAT_L8A8_UNORM] = pack_float_AL88; - table[MESA_FORMAT_A8L8_UNORM] = pack_float_AL88_REV; - table[MESA_FORMAT_L16A16_UNORM] = pack_float_AL1616; - table[MESA_FORMAT_A16L16_UNORM] = pack_float_AL1616_REV; - table[MESA_FORMAT_B2G3R3_UNORM] = pack_float_RGB332; - table[MESA_FORMAT_A_UNORM8] = pack_float_A8; - table[MESA_FORMAT_A_UNORM16] = pack_float_A16; - table[MESA_FORMAT_L_UNORM8] = pack_float_L8; - table[MESA_FORMAT_L_UNORM16] = pack_float_L16; - table[MESA_FORMAT_I_UNORM8] = pack_float_L8; /* reuse pack_float_L8 */ - table[MESA_FORMAT_I_UNORM16] = pack_float_L16; /* reuse pack_float_L16 */ + table[MESA_FORMAT_A8B8G8R8_UNORM] = pack_float_A8B8G8R8_UNORM; + table[MESA_FORMAT_R8G8B8A8_UNORM] = pack_float_R8G8B8A8_UNORM; + table[MESA_FORMAT_B8G8R8A8_UNORM] = pack_float_B8G8R8A8_UNORM; + table[MESA_FORMAT_A8R8G8B8_UNORM] = pack_float_A8R8G8B8_UNORM; + table[MESA_FORMAT_X8B8G8R8_UNORM] = pack_float_A8B8G8R8_UNORM; /* reused */ + table[MESA_FORMAT_R8G8B8X8_UNORM] = pack_float_R8G8B8A8_UNORM; /* reused */ + table[MESA_FORMAT_B8G8R8X8_UNORM] = pack_float_B8G8R8X8_UNORM; + table[MESA_FORMAT_X8R8G8B8_UNORM] = pack_float_X8R8G8B8_UNORM; + table[MESA_FORMAT_BGR_UNORM8] = pack_float_BGR_UNORM8; + table[MESA_FORMAT_RGB_UNORM8] = pack_float_RGB_UNORM8; + table[MESA_FORMAT_B5G6R5_UNORM] = pack_float_B5G6R5_UNORM; + table[MESA_FORMAT_R5G6B5_UNORM] = pack_float_R5G6B5_UNORM; + table[MESA_FORMAT_B4G4R4A4_UNORM] = pack_float_B4G4R4A4_UNORM; + table[MESA_FORMAT_A4R4G4B4_UNORM] = pack_float_A4R4G4B4_UNORM; + table[MESA_FORMAT_A1B5G5R5_UNORM] = pack_float_A1B5G5R5_UNORM; + table[MESA_FORMAT_B5G5R5A1_UNORM] = pack_float_B5G5R5A1_UNORM; + table[MESA_FORMAT_A1R5G5B5_UNORM] = pack_float_A1R5G5B5_UNORM; + + table[MESA_FORMAT_L4A4_UNORM] = pack_float_L4A4_UNORM; + table[MESA_FORMAT_L8A8_UNORM] = pack_float_L8A8_UNORM; + table[MESA_FORMAT_A8L8_UNORM] = pack_float_A8L8_UNORM; + table[MESA_FORMAT_L16A16_UNORM] = pack_float_L16A16_UNORM; + table[MESA_FORMAT_A16L16_UNORM] = pack_float_A16L16_UNORM; + table[MESA_FORMAT_B2G3R3_UNORM] = pack_float_B2G3R3_UNORM; + table[MESA_FORMAT_A_UNORM8] = pack_float_A_UNORM8; + table[MESA_FORMAT_A_UNORM16] = pack_float_A_UNORM16; + table[MESA_FORMAT_L_UNORM8] = pack_float_L_UNORM8; + table[MESA_FORMAT_L_UNORM16] = pack_float_L_UNORM16; + table[MESA_FORMAT_I_UNORM8] = pack_float_L_UNORM8; /* reuse pack_float_L_UNORM8 */ + table[MESA_FORMAT_I_UNORM16] = pack_float_L_UNORM16; /* reuse pack_float_L_UNORM16 */ table[MESA_FORMAT_YCBCR] = pack_float_YCBCR; table[MESA_FORMAT_YCBCR_REV] = pack_float_YCBCR_REV; - table[MESA_FORMAT_R_UNORM8] = pack_float_R8; - table[MESA_FORMAT_R8G8_UNORM] = pack_float_GR88; - table[MESA_FORMAT_G8R8_UNORM] = pack_float_RG88; - table[MESA_FORMAT_R_UNORM16] = pack_float_R16; - table[MESA_FORMAT_R16G16_UNORM] = pack_float_GR1616; - table[MESA_FORMAT_G16R16_UNORM] = pack_float_RG1616; - table[MESA_FORMAT_B10G10R10A2_UNORM] = pack_float_ARGB2101010; - table[MESA_FORMAT_R10G10B10A2_UINT] = pack_float_ABGR2101010_UINT; + table[MESA_FORMAT_R_UNORM8] = pack_float_R_UNORM8; + table[MESA_FORMAT_R8G8_UNORM] = pack_float_R8G8_UNORM; + table[MESA_FORMAT_G8R8_UNORM] = pack_float_G8R8_UNORM; + table[MESA_FORMAT_R_UNORM16] = pack_float_R_UNORM16; + table[MESA_FORMAT_R16G16_UNORM] = pack_float_R16G16_UNORM; + table[MESA_FORMAT_G16R16_UNORM] = pack_float_G16R16_UNORM; + table[MESA_FORMAT_B10G10R10A2_UNORM] = pack_float_B10G10R10A2_UNORM; + table[MESA_FORMAT_R10G10B10A2_UINT] = pack_float_R10G10B10A2_UINT; /* should never convert RGBA to these formats */ table[MESA_FORMAT_S8_UINT_Z24_UNORM] = NULL; @@ -2148,12 +2148,12 @@ _mesa_get_pack_float_rgba_function(mesa_format format) table[MESA_FORMAT_Z_UNORM32] = NULL; table[MESA_FORMAT_S_UINT8] = NULL; - table[MESA_FORMAT_BGR_SRGB8] = pack_float_SRGB8; - table[MESA_FORMAT_A8B8G8R8_SRGB] = pack_float_SRGBA8; - table[MESA_FORMAT_B8G8R8A8_SRGB] = pack_float_SARGB8; - table[MESA_FORMAT_R8G8B8A8_SRGB] = pack_float_SABGR8; - table[MESA_FORMAT_L_SRGB8] = pack_float_SL8; - table[MESA_FORMAT_L8A8_SRGB] = pack_float_SLA8; + table[MESA_FORMAT_BGR_SRGB8] = pack_float_BGR_SRGB8; + table[MESA_FORMAT_A8B8G8R8_SRGB] = pack_float_A8B8G8R8_SRGB; + table[MESA_FORMAT_B8G8R8A8_SRGB] = pack_float_B8G8R8A8_SRGB; + table[MESA_FORMAT_R8G8B8A8_SRGB] = pack_float_R8G8B8A8_SRGB; + table[MESA_FORMAT_L_SRGB8] = pack_float_L_SRGB8; + table[MESA_FORMAT_L8A8_SRGB] = pack_float_L8A8_SRGB; /* n/a */ table[MESA_FORMAT_SRGB_DXT1] = NULL; @@ -2172,17 +2172,17 @@ _mesa_get_pack_float_rgba_function(mesa_format format) table[MESA_FORMAT_RGBA_FLOAT16] = pack_float_RGBA_FLOAT16; table[MESA_FORMAT_RGB_FLOAT32] = pack_float_RGB_FLOAT32; table[MESA_FORMAT_RGB_FLOAT16] = pack_float_RGB_FLOAT16; - table[MESA_FORMAT_A_FLOAT32] = pack_float_ALPHA_FLOAT32; - table[MESA_FORMAT_A_FLOAT16] = pack_float_ALPHA_FLOAT16; - table[MESA_FORMAT_L_FLOAT32] = pack_float_LUMINANCE_FLOAT32; - table[MESA_FORMAT_L_FLOAT16] = pack_float_LUMINANCE_FLOAT16; - table[MESA_FORMAT_LA_FLOAT32] = pack_float_LUMINANCE_ALPHA_FLOAT32; - table[MESA_FORMAT_LA_FLOAT16] = pack_float_LUMINANCE_ALPHA_FLOAT16; - - table[MESA_FORMAT_I_FLOAT32] = pack_float_LUMINANCE_FLOAT32; - table[MESA_FORMAT_I_FLOAT16] = pack_float_LUMINANCE_FLOAT16; - table[MESA_FORMAT_R_FLOAT32] = pack_float_LUMINANCE_FLOAT32; - table[MESA_FORMAT_R_FLOAT16] = pack_float_LUMINANCE_FLOAT16; + table[MESA_FORMAT_A_FLOAT32] = pack_float_A_FLOAT32; + table[MESA_FORMAT_A_FLOAT16] = pack_float_A_FLOAT16; + table[MESA_FORMAT_L_FLOAT32] = pack_float_L_FLOAT32; + table[MESA_FORMAT_L_FLOAT16] = pack_float_L_FLOAT16; + table[MESA_FORMAT_LA_FLOAT32] = pack_float_LA_FLOAT32; + table[MESA_FORMAT_LA_FLOAT16] = pack_float_LA_FLOAT16; + + table[MESA_FORMAT_I_FLOAT32] = pack_float_L_FLOAT32; + table[MESA_FORMAT_I_FLOAT16] = pack_float_L_FLOAT16; + table[MESA_FORMAT_R_FLOAT32] = pack_float_L_FLOAT32; + table[MESA_FORMAT_R_FLOAT16] = pack_float_L_FLOAT16; table[MESA_FORMAT_RG_FLOAT32] = pack_float_RG_FLOAT32; table[MESA_FORMAT_RG_FLOAT16] = pack_float_RG_FLOAT16; @@ -2198,49 +2198,49 @@ _mesa_get_pack_float_rgba_function(mesa_format format) table[MESA_FORMAT_RGBA_UNORM16] = pack_float_RGBA_16; - table[MESA_FORMAT_R_SNORM8] = pack_float_SIGNED_R8; - table[MESA_FORMAT_R8G8_SNORM] = pack_float_SIGNED_RG88_REV; - table[MESA_FORMAT_X8B8G8R8_SNORM] = pack_float_SIGNED_RGBX8888; - table[MESA_FORMAT_A8B8G8R8_SNORM] = pack_float_SIGNED_RGBA8888; - table[MESA_FORMAT_R8G8B8A8_SNORM] = pack_float_SIGNED_RGBA8888_REV; - table[MESA_FORMAT_R_SNORM16] = pack_float_SIGNED_R16; - table[MESA_FORMAT_R16G16_SNORM] = pack_float_SIGNED_GR1616; - table[MESA_FORMAT_RGB_SNORM16] = pack_float_SIGNED_RGB_16; - table[MESA_FORMAT_RGBA_SNORM16] = pack_float_SIGNED_RGBA_16; - table[MESA_FORMAT_A_SNORM8] = pack_float_SIGNED_A8; - table[MESA_FORMAT_L_SNORM8] = pack_float_SIGNED_L8; - table[MESA_FORMAT_L8A8_SNORM] = pack_float_SIGNED_AL88; - table[MESA_FORMAT_I_SNORM8] = pack_float_SIGNED_L8; /* reused */ - table[MESA_FORMAT_A_SNORM16] = pack_float_SIGNED_A16; - table[MESA_FORMAT_L_SNORM16] = pack_float_SIGNED_L16; - table[MESA_FORMAT_LA_SNORM16] = pack_float_SIGNED_AL1616; - table[MESA_FORMAT_I_SNORM16] = pack_float_SIGNED_L16; /* reused */ - - table[MESA_FORMAT_R9G9B9E5_FLOAT] = pack_float_RGB9_E5_FLOAT; - table[MESA_FORMAT_R11G11B10_FLOAT] = pack_float_R11_G11_B10_FLOAT; + table[MESA_FORMAT_R_SNORM8] = pack_float_R_SNORM8; + table[MESA_FORMAT_R8G8_SNORM] = pack_float_R8G8_SNORM; + table[MESA_FORMAT_X8B8G8R8_SNORM] = pack_float_X8B8G8R8_SNORM; + table[MESA_FORMAT_A8B8G8R8_SNORM] = pack_float_A8B8G8R8_SNORM; + table[MESA_FORMAT_R8G8B8A8_SNORM] = pack_float_R8G8B8A8_SNORM; + table[MESA_FORMAT_R_SNORM16] = pack_float_R_SNORM16; + table[MESA_FORMAT_R16G16_SNORM] = pack_float_R16G16_SNORM; + table[MESA_FORMAT_RGB_SNORM16] = pack_float_RGB_SNORM16; + table[MESA_FORMAT_RGBA_SNORM16] = pack_float_RGBA_SNORM16; + table[MESA_FORMAT_A_SNORM8] = pack_float_A_SNORM8; + table[MESA_FORMAT_L_SNORM8] = pack_float_L_SNORM8; + table[MESA_FORMAT_L8A8_SNORM] = pack_float_L8A8_SNORM; + table[MESA_FORMAT_I_SNORM8] = pack_float_L_SNORM8; /* reused */ + table[MESA_FORMAT_A_SNORM16] = pack_float_A_SNORM16; + table[MESA_FORMAT_L_SNORM16] = pack_float_L_SNORM16; + table[MESA_FORMAT_LA_SNORM16] = pack_float_LA_SNORM16; + table[MESA_FORMAT_I_SNORM16] = pack_float_L_SNORM16; /* reused */ + + table[MESA_FORMAT_R9G9B9E5_FLOAT] = pack_float_R9G9B9E5_FLOAT; + table[MESA_FORMAT_R11G11B10_FLOAT] = pack_float_R11G11B10_FLOAT; table[MESA_FORMAT_B4G4R4X4_UNORM] = pack_float_XRGB4444_UNORM; table[MESA_FORMAT_B5G5R5X1_UNORM] = pack_float_XRGB1555_UNORM; table[MESA_FORMAT_R8G8B8X8_SNORM] = pack_float_XBGR8888_SNORM; - table[MESA_FORMAT_R8G8B8X8_SRGB] = pack_float_XBGR8888_SRGB; + table[MESA_FORMAT_R8G8B8X8_SRGB] = pack_float_R8G8B8X8_SRGB; table[MESA_FORMAT_RGBX_UINT8] = NULL; table[MESA_FORMAT_RGBX_SINT8] = NULL; - table[MESA_FORMAT_B10G10R10X2_UNORM] = pack_float_XRGB2101010_UNORM; - table[MESA_FORMAT_RGBX_UNORM16] = pack_float_XBGR16161616_UNORM; - table[MESA_FORMAT_RGBX_SNORM16] = pack_float_XBGR16161616_SNORM; + table[MESA_FORMAT_B10G10R10X2_UNORM] = pack_float_B10G10R10X2_UNORM; + table[MESA_FORMAT_RGBX_UNORM16] = pack_float_RGBX_UNORM16; + table[MESA_FORMAT_RGBX_SNORM16] = pack_float_RGBX_SNORM16; table[MESA_FORMAT_RGBX_FLOAT16] = pack_float_XBGR16161616_FLOAT; table[MESA_FORMAT_RGBX_UINT16] = NULL; table[MESA_FORMAT_RGBX_SINT16] = NULL; - table[MESA_FORMAT_RGBX_FLOAT32] = pack_float_XBGR32323232_FLOAT; + table[MESA_FORMAT_RGBX_FLOAT32] = pack_float_RGBX_FLOAT32; table[MESA_FORMAT_RGBX_UINT32] = NULL; table[MESA_FORMAT_RGBX_SINT32] = NULL; - table[MESA_FORMAT_R10G10B10A2_UNORM] = pack_float_ABGR2101010; + table[MESA_FORMAT_R10G10B10A2_UNORM] = pack_float_R10G10B10A2_UNORM; - table[MESA_FORMAT_G8R8_SNORM] = pack_float_SIGNED_RG88; - table[MESA_FORMAT_G16R16_SNORM] = pack_float_SIGNED_RG1616; + table[MESA_FORMAT_G8R8_SNORM] = pack_float_G8R8_SNORM; + table[MESA_FORMAT_G16R16_SNORM] = pack_float_G16R16_SNORM; - table[MESA_FORMAT_B8G8R8X8_SRGB] = pack_float_XRGB8888_SRGB; + table[MESA_FORMAT_B8G8R8X8_SRGB] = pack_float_B8G8R8X8_SRGB; initialized = GL_TRUE; } @@ -2262,18 +2262,18 @@ get_pack_float_rgba_row_function(mesa_format format) */ memset(table, 0, sizeof(table)); - table[MESA_FORMAT_A8B8G8R8_UNORM] = pack_row_float_RGBA8888; - table[MESA_FORMAT_R8G8B8A8_UNORM] = pack_row_float_RGBA8888_REV; - table[MESA_FORMAT_B8G8R8A8_UNORM] = pack_row_float_ARGB8888; - table[MESA_FORMAT_A8R8G8B8_UNORM] = pack_row_float_ARGB8888_REV; - table[MESA_FORMAT_X8B8G8R8_UNORM] = pack_row_float_RGBA8888; /* reused */ - table[MESA_FORMAT_R8G8B8X8_UNORM] = pack_row_float_RGBA8888_REV; /* reused */ - table[MESA_FORMAT_B8G8R8X8_UNORM] = pack_row_float_XRGB8888; - table[MESA_FORMAT_X8R8G8B8_UNORM] = pack_row_float_XRGB8888_REV; - table[MESA_FORMAT_BGR_UNORM8] = pack_row_float_RGB888; - table[MESA_FORMAT_RGB_UNORM8] = pack_row_float_BGR888; - table[MESA_FORMAT_B5G6R5_UNORM] = pack_row_float_RGB565; - table[MESA_FORMAT_R5G6B5_UNORM] = pack_row_float_RGB565_REV; + table[MESA_FORMAT_A8B8G8R8_UNORM] = pack_row_float_A8B8G8R8_UNORM; + table[MESA_FORMAT_R8G8B8A8_UNORM] = pack_row_float_R8G8B8A8_UNORM; + table[MESA_FORMAT_B8G8R8A8_UNORM] = pack_row_float_B8G8R8A8_UNORM; + table[MESA_FORMAT_A8R8G8B8_UNORM] = pack_row_float_A8R8G8B8_UNORM; + table[MESA_FORMAT_X8B8G8R8_UNORM] = pack_row_float_A8B8G8R8_UNORM; /* reused */ + table[MESA_FORMAT_R8G8B8X8_UNORM] = pack_row_float_R8G8B8A8_UNORM; /* reused */ + table[MESA_FORMAT_B8G8R8X8_UNORM] = pack_row_float_B8G8R8X8_UNORM; + table[MESA_FORMAT_X8R8G8B8_UNORM] = pack_row_float_X8R8G8B8_UNORM; + table[MESA_FORMAT_BGR_UNORM8] = pack_row_float_BGR_UNORM8; + table[MESA_FORMAT_RGB_UNORM8] = pack_row_float_RGB_UNORM8; + table[MESA_FORMAT_B5G6R5_UNORM] = pack_row_float_B5G6R5_UNORM; + table[MESA_FORMAT_R5G6B5_UNORM] = pack_row_float_R5G6B5_UNORM; initialized = GL_TRUE; } @@ -2295,18 +2295,18 @@ get_pack_ubyte_rgba_row_function(mesa_format format) */ memset(table, 0, sizeof(table)); - table[MESA_FORMAT_A8B8G8R8_UNORM] = pack_row_ubyte_RGBA8888; - table[MESA_FORMAT_R8G8B8A8_UNORM] = pack_row_ubyte_RGBA8888_REV; - table[MESA_FORMAT_B8G8R8A8_UNORM] = pack_row_ubyte_ARGB8888; - table[MESA_FORMAT_A8R8G8B8_UNORM] = pack_row_ubyte_ARGB8888_REV; - table[MESA_FORMAT_X8B8G8R8_UNORM] = pack_row_ubyte_RGBA8888; /* reused */ - table[MESA_FORMAT_R8G8B8X8_UNORM] = pack_row_ubyte_RGBA8888_REV; /* reused */ - table[MESA_FORMAT_B8G8R8X8_UNORM] = pack_row_ubyte_XRGB8888; - table[MESA_FORMAT_X8R8G8B8_UNORM] = pack_row_ubyte_XRGB8888_REV; - table[MESA_FORMAT_BGR_UNORM8] = pack_row_ubyte_RGB888; - table[MESA_FORMAT_RGB_UNORM8] = pack_row_ubyte_BGR888; - table[MESA_FORMAT_B5G6R5_UNORM] = pack_row_ubyte_RGB565; - table[MESA_FORMAT_R5G6B5_UNORM] = pack_row_ubyte_RGB565_REV; + table[MESA_FORMAT_A8B8G8R8_UNORM] = pack_row_ubyte_A8B8G8R8_UNORM; + table[MESA_FORMAT_R8G8B8A8_UNORM] = pack_row_ubyte_R8G8B8A8_UNORM; + table[MESA_FORMAT_B8G8R8A8_UNORM] = pack_row_ubyte_B8G8R8A8_UNORM; + table[MESA_FORMAT_A8R8G8B8_UNORM] = pack_row_ubyte_A8R8G8B8_UNORM; + table[MESA_FORMAT_X8B8G8R8_UNORM] = pack_row_ubyte_A8B8G8R8_UNORM; /* reused */ + table[MESA_FORMAT_R8G8B8X8_UNORM] = pack_row_ubyte_R8G8B8A8_UNORM; /* reused */ + table[MESA_FORMAT_B8G8R8X8_UNORM] = pack_row_ubyte_B8G8R8X8_UNORM; + table[MESA_FORMAT_X8R8G8B8_UNORM] = pack_row_ubyte_X8R8G8B8_UNORM; + table[MESA_FORMAT_BGR_UNORM8] = pack_row_ubyte_BGR_UNORM8; + table[MESA_FORMAT_RGB_UNORM8] = pack_row_ubyte_RGB_UNORM8; + table[MESA_FORMAT_B5G6R5_UNORM] = pack_row_ubyte_B5G6R5_UNORM; + table[MESA_FORMAT_R5G6B5_UNORM] = pack_row_ubyte_R5G6B5_UNORM; initialized = GL_TRUE; } @@ -2425,7 +2425,7 @@ _mesa_pack_ubyte_rgba_rect(mesa_format format, GLuint width, GLuint height, **/ static void -pack_float_z_Z24_S8(const GLfloat *src, void *dst) +pack_float_S8_UINT_Z24_UNORM(const GLfloat *src, void *dst) { /* don't disturb the stencil values */ GLuint *d = ((GLuint *) dst); @@ -2437,7 +2437,7 @@ pack_float_z_Z24_S8(const GLfloat *src, void *dst) } static void -pack_float_z_S8_Z24(const GLfloat *src, void *dst) +pack_float_Z24_UNORM_S8_UINT(const GLfloat *src, void *dst) { /* don't disturb the stencil values */ GLuint *d = ((GLuint *) dst); @@ -2449,7 +2449,7 @@ pack_float_z_S8_Z24(const GLfloat *src, void *dst) } static void -pack_float_z_Z16(const GLfloat *src, void *dst) +pack_float_Z_UNORM16(const GLfloat *src, void *dst) { GLushort *d = ((GLushort *) dst); const GLfloat scale = (GLfloat) 0xffff; @@ -2457,7 +2457,7 @@ pack_float_z_Z16(const GLfloat *src, void *dst) } static void -pack_float_z_Z32(const GLfloat *src, void *dst) +pack_float_Z_UNORM32(const GLfloat *src, void *dst) { GLuint *d = ((GLuint *) dst); const GLdouble scale = (GLdouble) 0xffffffff; @@ -2465,7 +2465,7 @@ pack_float_z_Z32(const GLfloat *src, void *dst) } static void -pack_float_z_Z32_FLOAT(const GLfloat *src, void *dst) +pack_float_Z_FLOAT32(const GLfloat *src, void *dst) { GLfloat *d = (GLfloat *) dst; *d = *src; @@ -2477,17 +2477,17 @@ _mesa_get_pack_float_z_func(mesa_format format) switch (format) { case MESA_FORMAT_S8_UINT_Z24_UNORM: case MESA_FORMAT_X8_UINT_Z24_UNORM: - return pack_float_z_Z24_S8; + return pack_float_S8_UINT_Z24_UNORM; case MESA_FORMAT_Z24_UNORM_S8_UINT: case MESA_FORMAT_Z24_UNORM_X8_UINT: - return pack_float_z_S8_Z24; + return pack_float_Z24_UNORM_S8_UINT; case MESA_FORMAT_Z_UNORM16: - return pack_float_z_Z16; + return pack_float_Z_UNORM16; case MESA_FORMAT_Z_UNORM32: - return pack_float_z_Z32; + return pack_float_Z_UNORM32; case MESA_FORMAT_Z_FLOAT32: case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: - return pack_float_z_Z32_FLOAT; + return pack_float_Z_FLOAT32; default: _mesa_problem(NULL, "unexpected format in _mesa_get_pack_float_z_func()"); @@ -2503,7 +2503,7 @@ _mesa_get_pack_float_z_func(mesa_format format) **/ static void -pack_uint_z_Z24_S8(const GLuint *src, void *dst) +pack_uint_S8_UINT_Z24_UNORM(const GLuint *src, void *dst) { /* don't disturb the stencil values */ GLuint *d = ((GLuint *) dst); @@ -2513,7 +2513,7 @@ pack_uint_z_Z24_S8(const GLuint *src, void *dst) } static void -pack_uint_z_S8_Z24(const GLuint *src, void *dst) +pack_uint_Z24_UNORM_S8_UINT(const GLuint *src, void *dst) { /* don't disturb the stencil values */ GLuint *d = ((GLuint *) dst); @@ -2523,21 +2523,21 @@ pack_uint_z_S8_Z24(const GLuint *src, void *dst) } static void -pack_uint_z_Z16(const GLuint *src, void *dst) +pack_uint_Z_UNORM16(const GLuint *src, void *dst) { GLushort *d = ((GLushort *) dst); *d = *src >> 16; } static void -pack_uint_z_Z32(const GLuint *src, void *dst) +pack_uint_Z_UNORM32(const GLuint *src, void *dst) { GLuint *d = ((GLuint *) dst); *d = *src; } static void -pack_uint_z_Z32_FLOAT(const GLuint *src, void *dst) +pack_uint_Z_FLOAT32(const GLuint *src, void *dst) { GLuint *d = ((GLuint *) dst); const GLdouble scale = 1.0 / (GLdouble) 0xffffffff; @@ -2547,7 +2547,7 @@ pack_uint_z_Z32_FLOAT(const GLuint *src, void *dst) } static void -pack_uint_z_Z32_FLOAT_X24S8(const GLuint *src, void *dst) +pack_uint_Z_FLOAT32_X24S8(const GLuint *src, void *dst) { GLfloat *d = ((GLfloat *) dst); const GLdouble scale = 1.0 / (GLdouble) 0xffffffff; @@ -2562,18 +2562,18 @@ _mesa_get_pack_uint_z_func(mesa_format format) switch (format) { case MESA_FORMAT_S8_UINT_Z24_UNORM: case MESA_FORMAT_X8_UINT_Z24_UNORM: - return pack_uint_z_Z24_S8; + return pack_uint_S8_UINT_Z24_UNORM; case MESA_FORMAT_Z24_UNORM_S8_UINT: case MESA_FORMAT_Z24_UNORM_X8_UINT: - return pack_uint_z_S8_Z24; + return pack_uint_Z24_UNORM_S8_UINT; case MESA_FORMAT_Z_UNORM16: - return pack_uint_z_Z16; + return pack_uint_Z_UNORM16; case MESA_FORMAT_Z_UNORM32: - return pack_uint_z_Z32; + return pack_uint_Z_UNORM32; case MESA_FORMAT_Z_FLOAT32: - return pack_uint_z_Z32_FLOAT; + return pack_uint_Z_FLOAT32; case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: - return pack_uint_z_Z32_FLOAT_X24S8; + return pack_uint_Z_FLOAT32_X24S8; default: _mesa_problem(NULL, "unexpected format in _mesa_get_pack_uint_z_func()"); return NULL; diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c index f85c875e4..2ef2e31d6 100644 --- a/mesalib/src/mesa/main/format_unpack.c +++ b/mesalib/src/mesa/main/format_unpack.c @@ -89,7 +89,7 @@ typedef void (*unpack_rgba_func)(const void *src, GLfloat dst[][4], GLuint n); static void -unpack_RGBA8888(const void *src, GLfloat dst[][4], GLuint n) +unpack_A8B8G8R8_UNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -102,7 +102,7 @@ unpack_RGBA8888(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_RGBA8888_REV(const void *src, GLfloat dst[][4], GLuint n) +unpack_R8G8B8A8_UNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -115,7 +115,7 @@ unpack_RGBA8888_REV(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_ARGB8888(const void *src, GLfloat dst[][4], GLuint n) +unpack_B8G8R8A8_UNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -128,7 +128,7 @@ unpack_ARGB8888(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_ARGB8888_REV(const void *src, GLfloat dst[][4], GLuint n) +unpack_A8R8G8B8_UNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -167,7 +167,7 @@ unpack_RGBX8888_REV(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_XRGB8888(const void *src, GLfloat dst[][4], GLuint n) +unpack_B8G8R8X8_UNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -180,7 +180,7 @@ unpack_XRGB8888(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_XRGB8888_REV(const void *src, GLfloat dst[][4], GLuint n) +unpack_X8R8G8B8_UNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -193,7 +193,7 @@ unpack_XRGB8888_REV(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_RGB888(const void *src, GLfloat dst[][4], GLuint n) +unpack_BGR_UNORM8(const void *src, GLfloat dst[][4], GLuint n) { const GLubyte *s = (const GLubyte *) src; GLuint i; @@ -206,7 +206,7 @@ unpack_RGB888(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_BGR888(const void *src, GLfloat dst[][4], GLuint n) +unpack_RGB_UNORM8(const void *src, GLfloat dst[][4], GLuint n) { const GLubyte *s = (const GLubyte *) src; GLuint i; @@ -219,7 +219,7 @@ unpack_BGR888(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_RGB565(const void *src, GLfloat dst[][4], GLuint n) +unpack_B5G6R5_UNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -232,7 +232,7 @@ unpack_RGB565(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_RGB565_REV(const void *src, GLfloat dst[][4], GLuint n) +unpack_R5G6B5_UNORM(const void *src, GLfloat dst[][4], GLuint n) { /* Warning: this function does not match the current Mesa definition * of MESA_FORMAT_R5G6B5_UNORM. @@ -249,7 +249,7 @@ unpack_RGB565_REV(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_ARGB4444(const void *src, GLfloat dst[][4], GLuint n) +unpack_B4G4R4A4_UNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -262,7 +262,7 @@ unpack_ARGB4444(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_ARGB4444_REV(const void *src, GLfloat dst[][4], GLuint n) +unpack_A4R4G4B4_UNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -275,7 +275,7 @@ unpack_ARGB4444_REV(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_RGBA5551(const void *src, GLfloat dst[][4], GLuint n) +unpack_A1B5G5R5_UNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -288,7 +288,7 @@ unpack_RGBA5551(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_ARGB1555(const void *src, GLfloat dst[][4], GLuint n) +unpack_B5G5R5A1_UNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -301,7 +301,7 @@ unpack_ARGB1555(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_ARGB1555_REV(const void *src, GLfloat dst[][4], GLuint n) +unpack_A1R5G5B5_UNORM(const void *src, GLfloat dst[][4], GLuint n) { /* Warning: this function does not match the current Mesa definition * of MESA_FORMAT_A1R5G5B5_UNORM. @@ -318,7 +318,7 @@ unpack_ARGB1555_REV(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_AL44(const void *src, GLfloat dst[][4], GLuint n) +unpack_L4A4_UNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLubyte *s = ((const GLubyte *) src); GLuint i; @@ -331,7 +331,7 @@ unpack_AL44(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_AL88(const void *src, GLfloat dst[][4], GLuint n) +unpack_L8A8_UNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -344,7 +344,7 @@ unpack_AL88(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_AL88_REV(const void *src, GLfloat dst[][4], GLuint n) +unpack_A8L8_UNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -357,7 +357,7 @@ unpack_AL88_REV(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_AL1616(const void *src, GLfloat dst[][4], GLuint n) +unpack_L16A16_UNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -370,7 +370,7 @@ unpack_AL1616(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_AL1616_REV(const void *src, GLfloat dst[][4], GLuint n) +unpack_A16L16_UNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -383,7 +383,7 @@ unpack_AL1616_REV(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_RGB332(const void *src, GLfloat dst[][4], GLuint n) +unpack_B2G3R3_UNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLubyte *s = ((const GLubyte *) src); GLuint i; @@ -397,7 +397,7 @@ unpack_RGB332(const void *src, GLfloat dst[][4], GLuint n) static void -unpack_A8(const void *src, GLfloat dst[][4], GLuint n) +unpack_A_UNORM8(const void *src, GLfloat dst[][4], GLuint n) { const GLubyte *s = ((const GLubyte *) src); GLuint i; @@ -410,7 +410,7 @@ unpack_A8(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_A16(const void *src, GLfloat dst[][4], GLuint n) +unpack_A_UNORM16(const void *src, GLfloat dst[][4], GLuint n) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -423,7 +423,7 @@ unpack_A16(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_L8(const void *src, GLfloat dst[][4], GLuint n) +unpack_L_UNORM8(const void *src, GLfloat dst[][4], GLuint n) { const GLubyte *s = ((const GLubyte *) src); GLuint i; @@ -436,7 +436,7 @@ unpack_L8(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_L16(const void *src, GLfloat dst[][4], GLuint n) +unpack_L_UNORM16(const void *src, GLfloat dst[][4], GLuint n) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -449,7 +449,7 @@ unpack_L16(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_I8(const void *src, GLfloat dst[][4], GLuint n) +unpack_I_UNORM8(const void *src, GLfloat dst[][4], GLuint n) { const GLubyte *s = ((const GLubyte *) src); GLuint i; @@ -462,7 +462,7 @@ unpack_I8(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_I16(const void *src, GLfloat dst[][4], GLuint n) +unpack_I_UNORM16(const void *src, GLfloat dst[][4], GLuint n) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -525,7 +525,7 @@ unpack_YCBCR_REV(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_R8(const void *src, GLfloat dst[][4], GLuint n) +unpack_R_UNORM8(const void *src, GLfloat dst[][4], GLuint n) { const GLubyte *s = ((const GLubyte *) src); GLuint i; @@ -538,7 +538,7 @@ unpack_R8(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_GR88(const void *src, GLfloat dst[][4], GLuint n) +unpack_R8G8_UNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -551,7 +551,7 @@ unpack_GR88(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_RG88(const void *src, GLfloat dst[][4], GLuint n) +unpack_G8R8_UNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -564,7 +564,7 @@ unpack_RG88(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_R16(const void *src, GLfloat dst[][4], GLuint n) +unpack_R_UNORM16(const void *src, GLfloat dst[][4], GLuint n) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -577,7 +577,7 @@ unpack_R16(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_GR1616(const void *src, GLfloat dst[][4], GLuint n) +unpack_R16G16_UNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -590,7 +590,7 @@ unpack_GR1616(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_RG1616(const void *src, GLfloat dst[][4], GLuint n) +unpack_G16R16_UNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -603,7 +603,7 @@ unpack_RG1616(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_ARGB2101010(const void *src, GLfloat dst[][4], GLuint n) +unpack_B10G10R10A2_UNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -617,7 +617,7 @@ unpack_ARGB2101010(const void *src, GLfloat dst[][4], GLuint n) static void -unpack_ARGB2101010_UINT(const void *src, GLfloat dst[][4], GLuint n) +unpack_B10G10R10A2_UINT(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = (const GLuint *) src; GLuint i; @@ -631,7 +631,7 @@ unpack_ARGB2101010_UINT(const void *src, GLfloat dst[][4], GLuint n) static void -unpack_ABGR2101010_UINT(const void *src, GLfloat dst[][4], GLuint n) +unpack_R10G10B10A2_UINT(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -717,20 +717,20 @@ unpack_Z32(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_Z32_FLOAT(const void *src, GLfloat dst[][4], GLuint n) +unpack_Z32_FLOAT_X24S8(const void *src, GLfloat dst[][4], GLuint n) { - const GLfloat *s = ((const GLfloat *) src); + const struct z32f_x24s8 *s = (const struct z32f_x24s8 *) src; GLuint i; for (i = 0; i < n; i++) { dst[i][0] = dst[i][1] = - dst[i][2] = s[i * 2]; + dst[i][2] = s[i].z; dst[i][3] = 1.0F; } } static void -unpack_Z32_FLOAT_X24S8(const void *src, GLfloat dst[][4], GLuint n) +unpack_Z32_FLOAT(const void *src, GLfloat dst[][4], GLuint n) { const GLfloat *s = ((const GLfloat *) src); GLuint i; @@ -758,7 +758,7 @@ unpack_S8(const void *src, GLfloat dst[][4], GLuint n) static void -unpack_SRGB8(const void *src, GLfloat dst[][4], GLuint n) +unpack_BGR_SRGB8(const void *src, GLfloat dst[][4], GLuint n) { const GLubyte *s = (const GLubyte *) src; GLuint i; @@ -771,7 +771,7 @@ unpack_SRGB8(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_SRGBA8(const void *src, GLfloat dst[][4], GLuint n) +unpack_A8B8G8R8_SRGB(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -784,7 +784,7 @@ unpack_SRGBA8(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_SARGB8(const void *src, GLfloat dst[][4], GLuint n) +unpack_B8G8R8A8_SRGB(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -797,7 +797,7 @@ unpack_SARGB8(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_SABGR8(const void *src, GLfloat dst[][4], GLuint n) +unpack_R8G8B8A8_SRGB(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -810,7 +810,7 @@ unpack_SABGR8(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_SL8(const void *src, GLfloat dst[][4], GLuint n) +unpack_L_SRGB8(const void *src, GLfloat dst[][4], GLuint n) { const GLubyte *s = ((const GLubyte *) src); GLuint i; @@ -823,7 +823,7 @@ unpack_SL8(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_SLA8(const void *src, GLfloat dst[][4], GLuint n) +unpack_L8A8_SRGB(const void *src, GLfloat dst[][4], GLuint n) { const GLushort *s = (const GLushort *) src; GLuint i; @@ -939,7 +939,7 @@ unpack_RGB_FLOAT16(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_ALPHA_FLOAT32(const void *src, GLfloat dst[][4], GLuint n) +unpack_A_FLOAT32(const void *src, GLfloat dst[][4], GLuint n) { const GLfloat *s = (const GLfloat *) src; GLuint i; @@ -952,7 +952,7 @@ unpack_ALPHA_FLOAT32(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_ALPHA_FLOAT16(const void *src, GLfloat dst[][4], GLuint n) +unpack_A_FLOAT16(const void *src, GLfloat dst[][4], GLuint n) { const GLhalfARB *s = (const GLhalfARB *) src; GLuint i; @@ -965,7 +965,7 @@ unpack_ALPHA_FLOAT16(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_LUMINANCE_FLOAT32(const void *src, GLfloat dst[][4], GLuint n) +unpack_L_FLOAT32(const void *src, GLfloat dst[][4], GLuint n) { const GLfloat *s = (const GLfloat *) src; GLuint i; @@ -978,7 +978,7 @@ unpack_LUMINANCE_FLOAT32(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_LUMINANCE_FLOAT16(const void *src, GLfloat dst[][4], GLuint n) +unpack_L_FLOAT16(const void *src, GLfloat dst[][4], GLuint n) { const GLhalfARB *s = (const GLhalfARB *) src; GLuint i; @@ -991,7 +991,7 @@ unpack_LUMINANCE_FLOAT16(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_LUMINANCE_ALPHA_FLOAT32(const void *src, GLfloat dst[][4], GLuint n) +unpack_LA_FLOAT32(const void *src, GLfloat dst[][4], GLuint n) { const GLfloat *s = (const GLfloat *) src; GLuint i; @@ -1004,7 +1004,7 @@ unpack_LUMINANCE_ALPHA_FLOAT32(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_LUMINANCE_ALPHA_FLOAT16(const void *src, GLfloat dst[][4], GLuint n) +unpack_LA_FLOAT16(const void *src, GLfloat dst[][4], GLuint n) { const GLhalfARB *s = (const GLhalfARB *) src; GLuint i; @@ -1017,7 +1017,7 @@ unpack_LUMINANCE_ALPHA_FLOAT16(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_INTENSITY_FLOAT32(const void *src, GLfloat dst[][4], GLuint n) +unpack_I_FLOAT32(const void *src, GLfloat dst[][4], GLuint n) { const GLfloat *s = (const GLfloat *) src; GLuint i; @@ -1030,7 +1030,7 @@ unpack_INTENSITY_FLOAT32(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_INTENSITY_FLOAT16(const void *src, GLfloat dst[][4], GLuint n) +unpack_I_FLOAT16(const void *src, GLfloat dst[][4], GLuint n) { const GLhalfARB *s = (const GLhalfARB *) src; GLuint i; @@ -1721,7 +1721,7 @@ unpack_DUDV8(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_SIGNED_R8(const void *src, GLfloat dst[][4], GLuint n) +unpack_R_SNORM8(const void *src, GLfloat dst[][4], GLuint n) { const GLbyte *s = ((const GLbyte *) src); GLuint i; @@ -1734,7 +1734,7 @@ unpack_SIGNED_R8(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_SIGNED_RG88_REV(const void *src, GLfloat dst[][4], GLuint n) +unpack_R8G8_SNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -1747,7 +1747,7 @@ unpack_SIGNED_RG88_REV(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_SIGNED_RGBX8888(const void *src, GLfloat dst[][4], GLuint n) +unpack_X8B8G8R8_SNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -1760,7 +1760,7 @@ unpack_SIGNED_RGBX8888(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_SIGNED_RGBA8888(const void *src, GLfloat dst[][4], GLuint n) +unpack_A8B8G8R8_SNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -1773,7 +1773,7 @@ unpack_SIGNED_RGBA8888(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_SIGNED_RGBA8888_REV(const void *src, GLfloat dst[][4], GLuint n) +unpack_R8G8B8A8_SNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -1786,7 +1786,7 @@ unpack_SIGNED_RGBA8888_REV(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_SIGNED_R16(const void *src, GLfloat dst[][4], GLuint n) +unpack_R_SNORM16(const void *src, GLfloat dst[][4], GLuint n) { const GLshort *s = ((const GLshort *) src); GLuint i; @@ -1799,7 +1799,7 @@ unpack_SIGNED_R16(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_SIGNED_GR1616(const void *src, GLfloat dst[][4], GLuint n) +unpack_R16G16_SNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -1812,7 +1812,7 @@ unpack_SIGNED_GR1616(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_SIGNED_RGB_16(const void *src, GLfloat dst[][4], GLuint n) +unpack_RGB_SNORM16(const void *src, GLfloat dst[][4], GLuint n) { const GLshort *s = (const GLshort *) src; GLuint i; @@ -1825,7 +1825,7 @@ unpack_SIGNED_RGB_16(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_SIGNED_RGBA_16(const void *src, GLfloat dst[][4], GLuint n) +unpack_RGBA_SNORM16(const void *src, GLfloat dst[][4], GLuint n) { const GLshort *s = (const GLshort *) src; GLuint i; @@ -1967,7 +1967,7 @@ unpack_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1(const void *src, GLfloat dst[][4], } static void -unpack_SIGNED_A8(const void *src, GLfloat dst[][4], GLuint n) +unpack_A_SNORM8(const void *src, GLfloat dst[][4], GLuint n) { const GLbyte *s = ((const GLbyte *) src); GLuint i; @@ -1980,7 +1980,7 @@ unpack_SIGNED_A8(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_SIGNED_L8(const void *src, GLfloat dst[][4], GLuint n) +unpack_L_SNORM8(const void *src, GLfloat dst[][4], GLuint n) { const GLbyte *s = ((const GLbyte *) src); GLuint i; @@ -1993,7 +1993,7 @@ unpack_SIGNED_L8(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_SIGNED_AL88(const void *src, GLfloat dst[][4], GLuint n) +unpack_L8A8_SNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLshort *s = ((const GLshort *) src); GLuint i; @@ -2006,7 +2006,7 @@ unpack_SIGNED_AL88(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_SIGNED_I8(const void *src, GLfloat dst[][4], GLuint n) +unpack_I_SNORM8(const void *src, GLfloat dst[][4], GLuint n) { const GLbyte *s = ((const GLbyte *) src); GLuint i; @@ -2019,7 +2019,7 @@ unpack_SIGNED_I8(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_SIGNED_A16(const void *src, GLfloat dst[][4], GLuint n) +unpack_A_SNORM16(const void *src, GLfloat dst[][4], GLuint n) { const GLshort *s = ((const GLshort *) src); GLuint i; @@ -2032,7 +2032,7 @@ unpack_SIGNED_A16(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_SIGNED_L16(const void *src, GLfloat dst[][4], GLuint n) +unpack_L_SNORM16(const void *src, GLfloat dst[][4], GLuint n) { const GLshort *s = ((const GLshort *) src); GLuint i; @@ -2045,7 +2045,7 @@ unpack_SIGNED_L16(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_SIGNED_AL1616(const void *src, GLfloat dst[][4], GLuint n) +unpack_LA_SNORM16(const void *src, GLfloat dst[][4], GLuint n) { const GLshort *s = (const GLshort *) src; GLuint i; @@ -2058,7 +2058,7 @@ unpack_SIGNED_AL1616(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_SIGNED_I16(const void *src, GLfloat dst[][4], GLuint n) +unpack_I_SNORM16(const void *src, GLfloat dst[][4], GLuint n) { const GLshort *s = ((const GLshort *) src); GLuint i; @@ -2071,7 +2071,7 @@ unpack_SIGNED_I16(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_RGB9_E5_FLOAT(const void *src, GLfloat dst[][4], GLuint n) +unpack_R9G9B9E5_FLOAT(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = (const GLuint *) src; GLuint i; @@ -2082,7 +2082,7 @@ unpack_RGB9_E5_FLOAT(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_R11_G11_B10_FLOAT(const void *src, GLfloat dst[][4], GLuint n) +unpack_R11G11B10_FLOAT(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = (const GLuint *) src; GLuint i; @@ -2132,7 +2132,7 @@ unpack_XBGR8888_SNORM(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_XBGR8888_SRGB(const void *src, GLfloat dst[][4], GLuint n) +unpack_R8G8B8X8_SRGB(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -2171,7 +2171,7 @@ unpack_XBGR8888_SINT(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_XRGB2101010_UNORM(const void *src, GLfloat dst[][4], GLuint n) +unpack_B10G10R10X2_UNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -2184,7 +2184,7 @@ unpack_XRGB2101010_UNORM(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_XBGR16161616_UNORM(const void *src, GLfloat dst[][4], GLuint n) +unpack_RGBX_UNORM16(const void *src, GLfloat dst[][4], GLuint n) { const GLushort *s = (const GLushort *) src; GLuint i; @@ -2197,7 +2197,7 @@ unpack_XBGR16161616_UNORM(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_XBGR16161616_SNORM(const void *src, GLfloat dst[][4], GLuint n) +unpack_RGBX_SNORM16(const void *src, GLfloat dst[][4], GLuint n) { const GLshort *s = (const GLshort *) src; GLuint i; @@ -2249,7 +2249,7 @@ unpack_XBGR16161616_SINT(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_XBGR32323232_FLOAT(const void *src, GLfloat dst[][4], GLuint n) +unpack_RGBX_FLOAT32(const void *src, GLfloat dst[][4], GLuint n) { const GLfloat *s = (const GLfloat *) src; GLuint i; @@ -2288,7 +2288,7 @@ unpack_XBGR32323232_SINT(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_ABGR2101010(const void *src, GLfloat dst[][4], GLuint n) +unpack_R10G10B10A2_UNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -2301,7 +2301,7 @@ unpack_ABGR2101010(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_SIGNED_RG88(const void *src, GLfloat dst[][4], GLuint n) +unpack_G8R8_SNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -2314,7 +2314,7 @@ unpack_SIGNED_RG88(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_SIGNED_RG1616(const void *src, GLfloat dst[][4], GLuint n) +unpack_G16R16_SNORM(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -2327,7 +2327,7 @@ unpack_SIGNED_RG1616(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_XRGB8888_SRGB(const void *src, GLfloat dst[][4], GLuint n) +unpack_B8G8R8X8_SRGB(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -2351,46 +2351,46 @@ get_unpack_rgba_function(mesa_format format) if (!initialized) { table[MESA_FORMAT_NONE] = NULL; - table[MESA_FORMAT_A8B8G8R8_UNORM] = unpack_RGBA8888; - table[MESA_FORMAT_R8G8B8A8_UNORM] = unpack_RGBA8888_REV; - table[MESA_FORMAT_B8G8R8A8_UNORM] = unpack_ARGB8888; - table[MESA_FORMAT_A8R8G8B8_UNORM] = unpack_ARGB8888_REV; + table[MESA_FORMAT_A8B8G8R8_UNORM] = unpack_A8B8G8R8_UNORM; + table[MESA_FORMAT_R8G8B8A8_UNORM] = unpack_R8G8B8A8_UNORM; + table[MESA_FORMAT_B8G8R8A8_UNORM] = unpack_B8G8R8A8_UNORM; + table[MESA_FORMAT_A8R8G8B8_UNORM] = unpack_A8R8G8B8_UNORM; table[MESA_FORMAT_X8B8G8R8_UNORM] = unpack_RGBX8888; table[MESA_FORMAT_R8G8B8X8_UNORM] = unpack_RGBX8888_REV; - table[MESA_FORMAT_B8G8R8X8_UNORM] = unpack_XRGB8888; - table[MESA_FORMAT_X8R8G8B8_UNORM] = unpack_XRGB8888_REV; - table[MESA_FORMAT_BGR_UNORM8] = unpack_RGB888; - table[MESA_FORMAT_RGB_UNORM8] = unpack_BGR888; - table[MESA_FORMAT_B5G6R5_UNORM] = unpack_RGB565; - table[MESA_FORMAT_R5G6B5_UNORM] = unpack_RGB565_REV; - table[MESA_FORMAT_B4G4R4A4_UNORM] = unpack_ARGB4444; - table[MESA_FORMAT_A4R4G4B4_UNORM] = unpack_ARGB4444_REV; - table[MESA_FORMAT_A1B5G5R5_UNORM] = unpack_RGBA5551; - table[MESA_FORMAT_B5G5R5A1_UNORM] = unpack_ARGB1555; - table[MESA_FORMAT_A1R5G5B5_UNORM] = unpack_ARGB1555_REV; - table[MESA_FORMAT_L4A4_UNORM] = unpack_AL44; - table[MESA_FORMAT_L8A8_UNORM] = unpack_AL88; - table[MESA_FORMAT_A8L8_UNORM] = unpack_AL88_REV; - table[MESA_FORMAT_L16A16_UNORM] = unpack_AL1616; - table[MESA_FORMAT_A16L16_UNORM] = unpack_AL1616_REV; - table[MESA_FORMAT_B2G3R3_UNORM] = unpack_RGB332; - table[MESA_FORMAT_A_UNORM8] = unpack_A8; - table[MESA_FORMAT_A_UNORM16] = unpack_A16; - table[MESA_FORMAT_L_UNORM8] = unpack_L8; - table[MESA_FORMAT_L_UNORM16] = unpack_L16; - table[MESA_FORMAT_I_UNORM8] = unpack_I8; - table[MESA_FORMAT_I_UNORM16] = unpack_I16; + table[MESA_FORMAT_B8G8R8X8_UNORM] = unpack_B8G8R8X8_UNORM; + table[MESA_FORMAT_X8R8G8B8_UNORM] = unpack_X8R8G8B8_UNORM; + table[MESA_FORMAT_BGR_UNORM8] = unpack_BGR_UNORM8; + table[MESA_FORMAT_RGB_UNORM8] = unpack_RGB_UNORM8; + table[MESA_FORMAT_B5G6R5_UNORM] = unpack_B5G6R5_UNORM; + table[MESA_FORMAT_R5G6B5_UNORM] = unpack_R5G6B5_UNORM; + table[MESA_FORMAT_B4G4R4A4_UNORM] = unpack_B4G4R4A4_UNORM; + table[MESA_FORMAT_A4R4G4B4_UNORM] = unpack_A4R4G4B4_UNORM; + table[MESA_FORMAT_A1B5G5R5_UNORM] = unpack_A1B5G5R5_UNORM; + table[MESA_FORMAT_B5G5R5A1_UNORM] = unpack_B5G5R5A1_UNORM; + table[MESA_FORMAT_A1R5G5B5_UNORM] = unpack_A1R5G5B5_UNORM; + table[MESA_FORMAT_L4A4_UNORM] = unpack_L4A4_UNORM; + table[MESA_FORMAT_L8A8_UNORM] = unpack_L8A8_UNORM; + table[MESA_FORMAT_A8L8_UNORM] = unpack_A8L8_UNORM; + table[MESA_FORMAT_L16A16_UNORM] = unpack_L16A16_UNORM; + table[MESA_FORMAT_A16L16_UNORM] = unpack_A16L16_UNORM; + table[MESA_FORMAT_B2G3R3_UNORM] = unpack_B2G3R3_UNORM; + table[MESA_FORMAT_A_UNORM8] = unpack_A_UNORM8; + table[MESA_FORMAT_A_UNORM16] = unpack_A_UNORM16; + table[MESA_FORMAT_L_UNORM8] = unpack_L_UNORM8; + table[MESA_FORMAT_L_UNORM16] = unpack_L_UNORM16; + table[MESA_FORMAT_I_UNORM8] = unpack_I_UNORM8; + table[MESA_FORMAT_I_UNORM16] = unpack_I_UNORM16; table[MESA_FORMAT_YCBCR] = unpack_YCBCR; table[MESA_FORMAT_YCBCR_REV] = unpack_YCBCR_REV; - table[MESA_FORMAT_R_UNORM8] = unpack_R8; - table[MESA_FORMAT_R8G8_UNORM] = unpack_GR88; - table[MESA_FORMAT_G8R8_UNORM] = unpack_RG88; - table[MESA_FORMAT_R_UNORM16] = unpack_R16; - table[MESA_FORMAT_R16G16_UNORM] = unpack_GR1616; - table[MESA_FORMAT_G16R16_UNORM] = unpack_RG1616; - table[MESA_FORMAT_B10G10R10A2_UNORM] = unpack_ARGB2101010; - table[MESA_FORMAT_B10G10R10A2_UINT] = unpack_ARGB2101010_UINT; - table[MESA_FORMAT_R10G10B10A2_UINT] = unpack_ABGR2101010_UINT; + table[MESA_FORMAT_R_UNORM8] = unpack_R_UNORM8; + table[MESA_FORMAT_R8G8_UNORM] = unpack_R8G8_UNORM; + table[MESA_FORMAT_G8R8_UNORM] = unpack_G8R8_UNORM; + table[MESA_FORMAT_R_UNORM16] = unpack_R_UNORM16; + table[MESA_FORMAT_R16G16_UNORM] = unpack_R16G16_UNORM; + table[MESA_FORMAT_G16R16_UNORM] = unpack_G16R16_UNORM; + table[MESA_FORMAT_B10G10R10A2_UNORM] = unpack_B10G10R10A2_UNORM; + table[MESA_FORMAT_B10G10R10A2_UINT] = unpack_B10G10R10A2_UINT; + table[MESA_FORMAT_R10G10B10A2_UINT] = unpack_R10G10B10A2_UINT; table[MESA_FORMAT_S8_UINT_Z24_UNORM] = unpack_Z24_S8; table[MESA_FORMAT_Z24_UNORM_S8_UINT] = unpack_S8_Z24; table[MESA_FORMAT_Z_UNORM16] = unpack_Z16; @@ -2398,12 +2398,12 @@ get_unpack_rgba_function(mesa_format format) table[MESA_FORMAT_X8_UINT_Z24_UNORM] = unpack_Z24_X8; table[MESA_FORMAT_Z_UNORM32] = unpack_Z32; table[MESA_FORMAT_S_UINT8] = unpack_S8; - table[MESA_FORMAT_BGR_SRGB8] = unpack_SRGB8; - table[MESA_FORMAT_A8B8G8R8_SRGB] = unpack_SRGBA8; - table[MESA_FORMAT_B8G8R8A8_SRGB] = unpack_SARGB8; - table[MESA_FORMAT_R8G8B8A8_SRGB] = unpack_SABGR8; - table[MESA_FORMAT_L_SRGB8] = unpack_SL8; - table[MESA_FORMAT_L8A8_SRGB] = unpack_SLA8; + table[MESA_FORMAT_BGR_SRGB8] = unpack_BGR_SRGB8; + table[MESA_FORMAT_A8B8G8R8_SRGB] = unpack_A8B8G8R8_SRGB; + table[MESA_FORMAT_B8G8R8A8_SRGB] = unpack_B8G8R8A8_SRGB; + table[MESA_FORMAT_R8G8B8A8_SRGB] = unpack_R8G8B8A8_SRGB; + table[MESA_FORMAT_L_SRGB8] = unpack_L_SRGB8; + table[MESA_FORMAT_L8A8_SRGB] = unpack_L8A8_SRGB; table[MESA_FORMAT_SRGB_DXT1] = unpack_SRGB_DXT1; table[MESA_FORMAT_SRGBA_DXT1] = unpack_SRGBA_DXT1; table[MESA_FORMAT_SRGBA_DXT3] = unpack_SRGBA_DXT3; @@ -2420,14 +2420,14 @@ get_unpack_rgba_function(mesa_format format) table[MESA_FORMAT_RGBA_FLOAT16] = unpack_RGBA_FLOAT16; table[MESA_FORMAT_RGB_FLOAT32] = unpack_RGB_FLOAT32; table[MESA_FORMAT_RGB_FLOAT16] = unpack_RGB_FLOAT16; - table[MESA_FORMAT_A_FLOAT32] = unpack_ALPHA_FLOAT32; - table[MESA_FORMAT_A_FLOAT16] = unpack_ALPHA_FLOAT16; - table[MESA_FORMAT_L_FLOAT32] = unpack_LUMINANCE_FLOAT32; - table[MESA_FORMAT_L_FLOAT16] = unpack_LUMINANCE_FLOAT16; - table[MESA_FORMAT_LA_FLOAT32] = unpack_LUMINANCE_ALPHA_FLOAT32; - table[MESA_FORMAT_LA_FLOAT16] = unpack_LUMINANCE_ALPHA_FLOAT16; - table[MESA_FORMAT_I_FLOAT32] = unpack_INTENSITY_FLOAT32; - table[MESA_FORMAT_I_FLOAT16] = unpack_INTENSITY_FLOAT16; + table[MESA_FORMAT_A_FLOAT32] = unpack_A_FLOAT32; + table[MESA_FORMAT_A_FLOAT16] = unpack_A_FLOAT16; + table[MESA_FORMAT_L_FLOAT32] = unpack_L_FLOAT32; + table[MESA_FORMAT_L_FLOAT16] = unpack_L_FLOAT16; + table[MESA_FORMAT_LA_FLOAT32] = unpack_LA_FLOAT32; + table[MESA_FORMAT_LA_FLOAT16] = unpack_LA_FLOAT16; + table[MESA_FORMAT_I_FLOAT32] = unpack_I_FLOAT32; + table[MESA_FORMAT_I_FLOAT16] = unpack_I_FLOAT16; table[MESA_FORMAT_R_FLOAT32] = unpack_R_FLOAT32; table[MESA_FORMAT_R_FLOAT16] = unpack_R_FLOAT16; table[MESA_FORMAT_RG_FLOAT32] = unpack_RG_FLOAT32; @@ -2487,15 +2487,15 @@ get_unpack_rgba_function(mesa_format format) table[MESA_FORMAT_RGBA_UINT32] = unpack_RGBA_UINT32; table[MESA_FORMAT_DUDV8] = unpack_DUDV8; - table[MESA_FORMAT_R_SNORM8] = unpack_SIGNED_R8; - table[MESA_FORMAT_R8G8_SNORM] = unpack_SIGNED_RG88_REV; - table[MESA_FORMAT_X8B8G8R8_SNORM] = unpack_SIGNED_RGBX8888; - table[MESA_FORMAT_A8B8G8R8_SNORM] = unpack_SIGNED_RGBA8888; - table[MESA_FORMAT_R8G8B8A8_SNORM] = unpack_SIGNED_RGBA8888_REV; - table[MESA_FORMAT_R_SNORM16] = unpack_SIGNED_R16; - table[MESA_FORMAT_R16G16_SNORM] = unpack_SIGNED_GR1616; - table[MESA_FORMAT_RGB_SNORM16] = unpack_SIGNED_RGB_16; - table[MESA_FORMAT_RGBA_SNORM16] = unpack_SIGNED_RGBA_16; + table[MESA_FORMAT_R_SNORM8] = unpack_R_SNORM8; + table[MESA_FORMAT_R8G8_SNORM] = unpack_R8G8_SNORM; + table[MESA_FORMAT_X8B8G8R8_SNORM] = unpack_X8B8G8R8_SNORM; + table[MESA_FORMAT_A8B8G8R8_SNORM] = unpack_A8B8G8R8_SNORM; + table[MESA_FORMAT_R8G8B8A8_SNORM] = unpack_R8G8B8A8_SNORM; + table[MESA_FORMAT_R_SNORM16] = unpack_R_SNORM16; + table[MESA_FORMAT_R16G16_SNORM] = unpack_R16G16_SNORM; + table[MESA_FORMAT_RGB_SNORM16] = unpack_RGB_SNORM16; + table[MESA_FORMAT_RGBA_SNORM16] = unpack_RGBA_SNORM16; table[MESA_FORMAT_RGBA_UNORM16] = unpack_RGBA_16; table[MESA_FORMAT_R_RGTC1_UNORM] = unpack_RED_RGTC1; @@ -2521,17 +2521,17 @@ get_unpack_rgba_function(mesa_format format) unpack_ETC2_RGB8_PUNCHTHROUGH_ALPHA1; table[MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1] = unpack_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1; - table[MESA_FORMAT_A_SNORM8] = unpack_SIGNED_A8; - table[MESA_FORMAT_L_SNORM8] = unpack_SIGNED_L8; - table[MESA_FORMAT_L8A8_SNORM] = unpack_SIGNED_AL88; - table[MESA_FORMAT_I_SNORM8] = unpack_SIGNED_I8; - table[MESA_FORMAT_A_SNORM16] = unpack_SIGNED_A16; - table[MESA_FORMAT_L_SNORM16] = unpack_SIGNED_L16; - table[MESA_FORMAT_LA_SNORM16] = unpack_SIGNED_AL1616; - table[MESA_FORMAT_I_SNORM16] = unpack_SIGNED_I16; - - table[MESA_FORMAT_R9G9B9E5_FLOAT] = unpack_RGB9_E5_FLOAT; - table[MESA_FORMAT_R11G11B10_FLOAT] = unpack_R11_G11_B10_FLOAT; + table[MESA_FORMAT_A_SNORM8] = unpack_A_SNORM8; + table[MESA_FORMAT_L_SNORM8] = unpack_L_SNORM8; + table[MESA_FORMAT_L8A8_SNORM] = unpack_L8A8_SNORM; + table[MESA_FORMAT_I_SNORM8] = unpack_I_SNORM8; + table[MESA_FORMAT_A_SNORM16] = unpack_A_SNORM16; + table[MESA_FORMAT_L_SNORM16] = unpack_L_SNORM16; + table[MESA_FORMAT_LA_SNORM16] = unpack_LA_SNORM16; + table[MESA_FORMAT_I_SNORM16] = unpack_I_SNORM16; + + table[MESA_FORMAT_R9G9B9E5_FLOAT] = unpack_R9G9B9E5_FLOAT; + table[MESA_FORMAT_R11G11B10_FLOAT] = unpack_R11G11B10_FLOAT; table[MESA_FORMAT_Z_FLOAT32] = unpack_Z32_FLOAT; table[MESA_FORMAT_Z32_FLOAT_S8X24_UINT] = unpack_Z32_FLOAT_X24S8; @@ -2539,25 +2539,25 @@ get_unpack_rgba_function(mesa_format format) table[MESA_FORMAT_B4G4R4X4_UNORM] = unpack_XRGB4444_UNORM; table[MESA_FORMAT_B5G5R5X1_UNORM] = unpack_XRGB1555_UNORM; table[MESA_FORMAT_R8G8B8X8_SNORM] = unpack_XBGR8888_SNORM; - table[MESA_FORMAT_R8G8B8X8_SRGB] = unpack_XBGR8888_SRGB; + table[MESA_FORMAT_R8G8B8X8_SRGB] = unpack_R8G8B8X8_SRGB; table[MESA_FORMAT_RGBX_UINT8] = unpack_XBGR8888_UINT; table[MESA_FORMAT_RGBX_SINT8] = unpack_XBGR8888_SINT; - table[MESA_FORMAT_B10G10R10X2_UNORM] = unpack_XRGB2101010_UNORM; - table[MESA_FORMAT_RGBX_UNORM16] = unpack_XBGR16161616_UNORM; - table[MESA_FORMAT_RGBX_SNORM16] = unpack_XBGR16161616_SNORM; + table[MESA_FORMAT_B10G10R10X2_UNORM] = unpack_B10G10R10X2_UNORM; + table[MESA_FORMAT_RGBX_UNORM16] = unpack_RGBX_UNORM16; + table[MESA_FORMAT_RGBX_SNORM16] = unpack_RGBX_SNORM16; table[MESA_FORMAT_RGBX_FLOAT16] = unpack_XBGR16161616_FLOAT; table[MESA_FORMAT_RGBX_UINT16] = unpack_XBGR16161616_UINT; table[MESA_FORMAT_RGBX_SINT16] = unpack_XBGR16161616_SINT; - table[MESA_FORMAT_RGBX_FLOAT32] = unpack_XBGR32323232_FLOAT; + table[MESA_FORMAT_RGBX_FLOAT32] = unpack_RGBX_FLOAT32; table[MESA_FORMAT_RGBX_UINT32] = unpack_XBGR32323232_UINT; table[MESA_FORMAT_RGBX_SINT32] = unpack_XBGR32323232_SINT; - table[MESA_FORMAT_R10G10B10A2_UNORM] = unpack_ABGR2101010; + table[MESA_FORMAT_R10G10B10A2_UNORM] = unpack_R10G10B10A2_UNORM; - table[MESA_FORMAT_G8R8_SNORM] = unpack_SIGNED_RG88; - table[MESA_FORMAT_G16R16_SNORM] = unpack_SIGNED_RG1616; + table[MESA_FORMAT_G8R8_SNORM] = unpack_G8R8_SNORM; + table[MESA_FORMAT_G16R16_SNORM] = unpack_G16R16_SNORM; - table[MESA_FORMAT_B8G8R8X8_SRGB] = unpack_XRGB8888_SRGB; + table[MESA_FORMAT_B8G8R8X8_SRGB] = unpack_B8G8R8X8_SRGB; initialized = GL_TRUE; } @@ -2589,7 +2589,7 @@ _mesa_unpack_rgba_row(mesa_format format, GLuint n, static void -unpack_ubyte_RGBA8888(const void *src, GLubyte dst[][4], GLuint n) +unpack_ubyte_A8B8G8R8_UNORM(const void *src, GLubyte dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -2602,7 +2602,7 @@ unpack_ubyte_RGBA8888(const void *src, GLubyte dst[][4], GLuint n) } static void -unpack_ubyte_RGBA8888_REV(const void *src, GLubyte dst[][4], GLuint n) +unpack_ubyte_R8G8B8A8_UNORM(const void *src, GLubyte dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -2615,7 +2615,7 @@ unpack_ubyte_RGBA8888_REV(const void *src, GLubyte dst[][4], GLuint n) } static void -unpack_ubyte_ARGB8888(const void *src, GLubyte dst[][4], GLuint n) +unpack_ubyte_B8G8R8A8_UNORM(const void *src, GLubyte dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -2628,7 +2628,7 @@ unpack_ubyte_ARGB8888(const void *src, GLubyte dst[][4], GLuint n) } static void -unpack_ubyte_ARGB8888_REV(const void *src, GLubyte dst[][4], GLuint n) +unpack_ubyte_A8R8G8B8_UNORM(const void *src, GLubyte dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -2667,7 +2667,7 @@ unpack_ubyte_RGBX8888_REV(const void *src, GLubyte dst[][4], GLuint n) } static void -unpack_ubyte_XRGB8888(const void *src, GLubyte dst[][4], GLuint n) +unpack_ubyte_B8G8R8X8_UNORM(const void *src, GLubyte dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -2680,7 +2680,7 @@ unpack_ubyte_XRGB8888(const void *src, GLubyte dst[][4], GLuint n) } static void -unpack_ubyte_XRGB8888_REV(const void *src, GLubyte dst[][4], GLuint n) +unpack_ubyte_X8R8G8B8_UNORM(const void *src, GLubyte dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -2693,7 +2693,7 @@ unpack_ubyte_XRGB8888_REV(const void *src, GLubyte dst[][4], GLuint n) } static void -unpack_ubyte_RGB888(const void *src, GLubyte dst[][4], GLuint n) +unpack_ubyte_BGR_UNORM8(const void *src, GLubyte dst[][4], GLuint n) { const GLubyte *s = (const GLubyte *) src; GLuint i; @@ -2706,7 +2706,7 @@ unpack_ubyte_RGB888(const void *src, GLubyte dst[][4], GLuint n) } static void -unpack_ubyte_BGR888(const void *src, GLubyte dst[][4], GLuint n) +unpack_ubyte_RGB_UNORM8(const void *src, GLubyte dst[][4], GLuint n) { const GLubyte *s = (const GLubyte *) src; GLuint i; @@ -2719,7 +2719,7 @@ unpack_ubyte_BGR888(const void *src, GLubyte dst[][4], GLuint n) } static void -unpack_ubyte_RGB565(const void *src, GLubyte dst[][4], GLuint n) +unpack_ubyte_B5G6R5_UNORM(const void *src, GLubyte dst[][4], GLuint n) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -2732,7 +2732,7 @@ unpack_ubyte_RGB565(const void *src, GLubyte dst[][4], GLuint n) } static void -unpack_ubyte_RGB565_REV(const void *src, GLubyte dst[][4], GLuint n) +unpack_ubyte_R5G6B5_UNORM(const void *src, GLubyte dst[][4], GLuint n) { /* Warning: this function does not match the current Mesa definition * of MESA_FORMAT_R5G6B5_UNORM. @@ -2749,7 +2749,7 @@ unpack_ubyte_RGB565_REV(const void *src, GLubyte dst[][4], GLuint n) } static void -unpack_ubyte_ARGB4444(const void *src, GLubyte dst[][4], GLuint n) +unpack_ubyte_B4G4R4A4_UNORM(const void *src, GLubyte dst[][4], GLuint n) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -2762,7 +2762,7 @@ unpack_ubyte_ARGB4444(const void *src, GLubyte dst[][4], GLuint n) } static void -unpack_ubyte_ARGB4444_REV(const void *src, GLubyte dst[][4], GLuint n) +unpack_ubyte_A4R4G4B4_UNORM(const void *src, GLubyte dst[][4], GLuint n) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -2775,7 +2775,7 @@ unpack_ubyte_ARGB4444_REV(const void *src, GLubyte dst[][4], GLuint n) } static void -unpack_ubyte_RGBA5551(const void *src, GLubyte dst[][4], GLuint n) +unpack_ubyte_A1B5G5R5_UNORM(const void *src, GLubyte dst[][4], GLuint n) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -2788,7 +2788,7 @@ unpack_ubyte_RGBA5551(const void *src, GLubyte dst[][4], GLuint n) } static void -unpack_ubyte_ARGB1555(const void *src, GLubyte dst[][4], GLuint n) +unpack_ubyte_B5G5R5A1_UNORM(const void *src, GLubyte dst[][4], GLuint n) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -2801,7 +2801,7 @@ unpack_ubyte_ARGB1555(const void *src, GLubyte dst[][4], GLuint n) } static void -unpack_ubyte_ARGB1555_REV(const void *src, GLubyte dst[][4], GLuint n) +unpack_ubyte_A1R5G5B5_UNORM(const void *src, GLubyte dst[][4], GLuint n) { /* Warning: this function does not match the current Mesa definition * of MESA_FORMAT_A1R5G5B5_UNORM. @@ -2818,7 +2818,7 @@ unpack_ubyte_ARGB1555_REV(const void *src, GLubyte dst[][4], GLuint n) } static void -unpack_ubyte_AL44(const void *src, GLubyte dst[][4], GLuint n) +unpack_ubyte_L4A4_UNORM(const void *src, GLubyte dst[][4], GLuint n) { const GLubyte *s = ((const GLubyte *) src); GLuint i; @@ -2831,7 +2831,7 @@ unpack_ubyte_AL44(const void *src, GLubyte dst[][4], GLuint n) } static void -unpack_ubyte_AL88(const void *src, GLubyte dst[][4], GLuint n) +unpack_ubyte_L8A8_UNORM(const void *src, GLubyte dst[][4], GLuint n) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -2844,7 +2844,7 @@ unpack_ubyte_AL88(const void *src, GLubyte dst[][4], GLuint n) } static void -unpack_ubyte_AL88_REV(const void *src, GLubyte dst[][4], GLuint n) +unpack_ubyte_A8L8_UNORM(const void *src, GLubyte dst[][4], GLuint n) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -2857,7 +2857,7 @@ unpack_ubyte_AL88_REV(const void *src, GLubyte dst[][4], GLuint n) } static void -unpack_ubyte_RGB332(const void *src, GLubyte dst[][4], GLuint n) +unpack_ubyte_B2G3R3_UNORM(const void *src, GLubyte dst[][4], GLuint n) { const GLubyte *s = ((const GLubyte *) src); GLuint i; @@ -2870,7 +2870,7 @@ unpack_ubyte_RGB332(const void *src, GLubyte dst[][4], GLuint n) } static void -unpack_ubyte_A8(const void *src, GLubyte dst[][4], GLuint n) +unpack_ubyte_A_UNORM8(const void *src, GLubyte dst[][4], GLuint n) { const GLubyte *s = ((const GLubyte *) src); GLuint i; @@ -2883,7 +2883,7 @@ unpack_ubyte_A8(const void *src, GLubyte dst[][4], GLuint n) } static void -unpack_ubyte_L8(const void *src, GLubyte dst[][4], GLuint n) +unpack_ubyte_L_UNORM8(const void *src, GLubyte dst[][4], GLuint n) { const GLubyte *s = ((const GLubyte *) src); GLuint i; @@ -2897,7 +2897,7 @@ unpack_ubyte_L8(const void *src, GLubyte dst[][4], GLuint n) static void -unpack_ubyte_I8(const void *src, GLubyte dst[][4], GLuint n) +unpack_ubyte_I_UNORM8(const void *src, GLubyte dst[][4], GLuint n) { const GLubyte *s = ((const GLubyte *) src); GLuint i; @@ -2910,7 +2910,7 @@ unpack_ubyte_I8(const void *src, GLubyte dst[][4], GLuint n) } static void -unpack_ubyte_R8(const void *src, GLubyte dst[][4], GLuint n) +unpack_ubyte_R_UNORM8(const void *src, GLubyte dst[][4], GLuint n) { const GLubyte *s = ((const GLubyte *) src); GLuint i; @@ -2923,7 +2923,7 @@ unpack_ubyte_R8(const void *src, GLubyte dst[][4], GLuint n) } static void -unpack_ubyte_GR88(const void *src, GLubyte dst[][4], GLuint n) +unpack_ubyte_R8G8_UNORM(const void *src, GLubyte dst[][4], GLuint n) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -2936,7 +2936,7 @@ unpack_ubyte_GR88(const void *src, GLubyte dst[][4], GLuint n) } static void -unpack_ubyte_RG88(const void *src, GLubyte dst[][4], GLuint n) +unpack_ubyte_G8R8_UNORM(const void *src, GLubyte dst[][4], GLuint n) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -2959,16 +2959,16 @@ _mesa_unpack_ubyte_rgba_row(mesa_format format, GLuint n, { switch (format) { case MESA_FORMAT_A8B8G8R8_UNORM: - unpack_ubyte_RGBA8888(src, dst, n); + unpack_ubyte_A8B8G8R8_UNORM(src, dst, n); break; case MESA_FORMAT_R8G8B8A8_UNORM: - unpack_ubyte_RGBA8888_REV(src, dst, n); + unpack_ubyte_R8G8B8A8_UNORM(src, dst, n); break; case MESA_FORMAT_B8G8R8A8_UNORM: - unpack_ubyte_ARGB8888(src, dst, n); + unpack_ubyte_B8G8R8A8_UNORM(src, dst, n); break; case MESA_FORMAT_A8R8G8B8_UNORM: - unpack_ubyte_ARGB8888_REV(src, dst, n); + unpack_ubyte_A8R8G8B8_UNORM(src, dst, n); break; case MESA_FORMAT_X8B8G8R8_UNORM: unpack_ubyte_RGBX8888(src, dst, n); @@ -2977,67 +2977,67 @@ _mesa_unpack_ubyte_rgba_row(mesa_format format, GLuint n, unpack_ubyte_RGBX8888_REV(src, dst, n); break; case MESA_FORMAT_B8G8R8X8_UNORM: - unpack_ubyte_XRGB8888(src, dst, n); + unpack_ubyte_B8G8R8X8_UNORM(src, dst, n); break; case MESA_FORMAT_X8R8G8B8_UNORM: - unpack_ubyte_XRGB8888_REV(src, dst, n); + unpack_ubyte_X8R8G8B8_UNORM(src, dst, n); break; case MESA_FORMAT_BGR_UNORM8: - unpack_ubyte_RGB888(src, dst, n); + unpack_ubyte_BGR_UNORM8(src, dst, n); break; case MESA_FORMAT_RGB_UNORM8: - unpack_ubyte_BGR888(src, dst, n); + unpack_ubyte_RGB_UNORM8(src, dst, n); break; case MESA_FORMAT_B5G6R5_UNORM: - unpack_ubyte_RGB565(src, dst, n); + unpack_ubyte_B5G6R5_UNORM(src, dst, n); break; case MESA_FORMAT_R5G6B5_UNORM: - unpack_ubyte_RGB565_REV(src, dst, n); + unpack_ubyte_R5G6B5_UNORM(src, dst, n); break; case MESA_FORMAT_B4G4R4A4_UNORM: - unpack_ubyte_ARGB4444(src, dst, n); + unpack_ubyte_B4G4R4A4_UNORM(src, dst, n); break; case MESA_FORMAT_A4R4G4B4_UNORM: - unpack_ubyte_ARGB4444_REV(src, dst, n); + unpack_ubyte_A4R4G4B4_UNORM(src, dst, n); break; case MESA_FORMAT_A1B5G5R5_UNORM: - unpack_ubyte_RGBA5551(src, dst, n); + unpack_ubyte_A1B5G5R5_UNORM(src, dst, n); break; case MESA_FORMAT_B5G5R5A1_UNORM: - unpack_ubyte_ARGB1555(src, dst, n); + unpack_ubyte_B5G5R5A1_UNORM(src, dst, n); break; case MESA_FORMAT_A1R5G5B5_UNORM: - unpack_ubyte_ARGB1555_REV(src, dst, n); + unpack_ubyte_A1R5G5B5_UNORM(src, dst, n); break; case MESA_FORMAT_L4A4_UNORM: - unpack_ubyte_AL44(src, dst, n); + unpack_ubyte_L4A4_UNORM(src, dst, n); break; case MESA_FORMAT_L8A8_UNORM: - unpack_ubyte_AL88(src, dst, n); + unpack_ubyte_L8A8_UNORM(src, dst, n); break; case MESA_FORMAT_A8L8_UNORM: - unpack_ubyte_AL88_REV(src, dst, n); + unpack_ubyte_A8L8_UNORM(src, dst, n); break; case MESA_FORMAT_B2G3R3_UNORM: - unpack_ubyte_RGB332(src, dst, n); + unpack_ubyte_B2G3R3_UNORM(src, dst, n); break; case MESA_FORMAT_A_UNORM8: - unpack_ubyte_A8(src, dst, n); + unpack_ubyte_A_UNORM8(src, dst, n); break; case MESA_FORMAT_L_UNORM8: - unpack_ubyte_L8(src, dst, n); + unpack_ubyte_L_UNORM8(src, dst, n); break; case MESA_FORMAT_I_UNORM8: - unpack_ubyte_I8(src, dst, n); + unpack_ubyte_I_UNORM8(src, dst, n); break; case MESA_FORMAT_R_UNORM8: - unpack_ubyte_R8(src, dst, n); + unpack_ubyte_R_UNORM8(src, dst, n); break; case MESA_FORMAT_R8G8_UNORM: - unpack_ubyte_GR88(src, dst, n); + unpack_ubyte_R8G8_UNORM(src, dst, n); break; case MESA_FORMAT_G8R8_UNORM: - unpack_ubyte_RG88(src, dst, n); + unpack_ubyte_G8R8_UNORM(src, dst, n); break; default: /* get float values, convert to ubyte */ @@ -3123,7 +3123,7 @@ unpack_int_rgba_RGBA_INT8(const GLbyte *src, GLuint dst[][4], GLuint n) } static void -unpack_int_rgba_ARGB8888(const GLbyte *src, GLuint dst[][4], GLuint n) +unpack_int_rgba_B8G8R8A8_UNORM(const GLbyte *src, GLuint dst[][4], GLuint n) { unsigned int i; @@ -3136,7 +3136,7 @@ unpack_int_rgba_ARGB8888(const GLbyte *src, GLuint dst[][4], GLuint n) } static void -unpack_int_rgba_XRGB8888(const GLbyte *src, GLuint dst[][4], GLuint n) +unpack_int_rgba_B8G8R8X8_UNORM(const GLbyte *src, GLuint dst[][4], GLuint n) { unsigned int i; @@ -3560,7 +3560,7 @@ unpack_int_rgba_INTENSITY_INT8(const GLbyte *src, GLuint dst[][4], GLuint n) } static void -unpack_int_rgba_ARGB2101010_UINT(const GLuint *src, GLuint dst[][4], GLuint n) +unpack_int_rgba_B10G10R10A2_UINT(const GLuint *src, GLuint dst[][4], GLuint n) { unsigned int i; @@ -3574,7 +3574,7 @@ unpack_int_rgba_ARGB2101010_UINT(const GLuint *src, GLuint dst[][4], GLuint n) } static void -unpack_int_rgba_ABGR2101010_UINT(const GLuint *src, GLuint dst[][4], GLuint n) +unpack_int_rgba_R10G10B10A2_UINT(const GLuint *src, GLuint dst[][4], GLuint n) { unsigned int i; @@ -3588,7 +3588,7 @@ unpack_int_rgba_ABGR2101010_UINT(const GLuint *src, GLuint dst[][4], GLuint n) } static void -unpack_int_rgba_ARGB2101010(const GLuint *src, GLuint dst[][4], GLuint n) +unpack_int_rgba_B10G10R10A2_UNORM(const GLuint *src, GLuint dst[][4], GLuint n) { unsigned int i; @@ -3667,7 +3667,7 @@ unpack_int_rgba_XBGR32323232_UINT(const GLuint *src, GLuint dst[][4], GLuint n) } static void -unpack_int_rgba_ABGR2101010(const GLuint *src, GLuint dst[][4], GLuint n) +unpack_int_rgba_R10G10B10A2_UNORM(const GLuint *src, GLuint dst[][4], GLuint n) { unsigned int i; @@ -3708,11 +3708,11 @@ _mesa_unpack_uint_rgba_row(mesa_format format, GLuint n, break; case MESA_FORMAT_B8G8R8A8_UNORM: - unpack_int_rgba_ARGB8888(src, dst, n); + unpack_int_rgba_B8G8R8A8_UNORM(src, dst, n); break; case MESA_FORMAT_B8G8R8X8_UNORM: - unpack_int_rgba_XRGB8888(src, dst, n); + unpack_int_rgba_B8G8R8X8_UNORM(src, dst, n); break; case MESA_FORMAT_RGB_UINT32: @@ -3848,15 +3848,15 @@ _mesa_unpack_uint_rgba_row(mesa_format format, GLuint n, break; case MESA_FORMAT_B10G10R10A2_UINT: - unpack_int_rgba_ARGB2101010_UINT(src, dst, n); + unpack_int_rgba_B10G10R10A2_UINT(src, dst, n); break; case MESA_FORMAT_R10G10B10A2_UINT: - unpack_int_rgba_ABGR2101010_UINT(src, dst, n); + unpack_int_rgba_R10G10B10A2_UINT(src, dst, n); break; case MESA_FORMAT_B10G10R10A2_UNORM: - unpack_int_rgba_ARGB2101010(src, dst, n); + unpack_int_rgba_B10G10R10A2_UNORM(src, dst, n); break; case MESA_FORMAT_RGBX_UINT8: @@ -3881,7 +3881,7 @@ _mesa_unpack_uint_rgba_row(mesa_format format, GLuint n, break; case MESA_FORMAT_R10G10B10A2_UNORM: - unpack_int_rgba_ABGR2101010(src, dst, n); + unpack_int_rgba_R10G10B10A2_UNORM(src, dst, n); break; default: @@ -3963,7 +3963,7 @@ unpack_float_z_X8_Z24(GLuint n, const void *src, GLfloat *dst) } static void -unpack_float_z_Z16(GLuint n, const void *src, GLfloat *dst) +unpack_float_Z_UNORM16(GLuint n, const void *src, GLfloat *dst) { const GLushort *s = ((const GLushort *) src); GLuint i; @@ -3973,7 +3973,7 @@ unpack_float_z_Z16(GLuint n, const void *src, GLfloat *dst) } static void -unpack_float_z_Z32(GLuint n, const void *src, GLfloat *dst) +unpack_float_Z_UNORM32(GLuint n, const void *src, GLfloat *dst) { const GLuint *s = ((const GLuint *) src); GLuint i; @@ -4020,10 +4020,10 @@ _mesa_unpack_float_z_row(mesa_format format, GLuint n, unpack = unpack_float_z_X8_Z24; break; case MESA_FORMAT_Z_UNORM16: - unpack = unpack_float_z_Z16; + unpack = unpack_float_Z_UNORM16; break; case MESA_FORMAT_Z_UNORM32: - unpack = unpack_float_z_Z32; + unpack = unpack_float_Z_UNORM32; break; case MESA_FORMAT_Z_FLOAT32: unpack = unpack_float_z_Z32F; @@ -4067,7 +4067,7 @@ unpack_uint_z_X8_Z24(const void *src, GLuint *dst, GLuint n) } static void -unpack_uint_z_Z16(const void *src, GLuint *dst, GLuint n) +unpack_uint_Z_UNORM16(const void *src, GLuint *dst, GLuint n) { const GLushort *s = ((const GLushort *)src); GLuint i; @@ -4077,13 +4077,13 @@ unpack_uint_z_Z16(const void *src, GLuint *dst, GLuint n) } static void -unpack_uint_z_Z32(const void *src, GLuint *dst, GLuint n) +unpack_uint_Z_UNORM32(const void *src, GLuint *dst, GLuint n) { memcpy(dst, src, n * sizeof(GLuint)); } static void -unpack_uint_z_Z32_FLOAT(const void *src, GLuint *dst, GLuint n) +unpack_uint_Z_FLOAT32(const void *src, GLuint *dst, GLuint n) { const float *s = (const float *)src; GLuint i; @@ -4093,7 +4093,7 @@ unpack_uint_z_Z32_FLOAT(const void *src, GLuint *dst, GLuint n) } static void -unpack_uint_z_Z32_FLOAT_X24S8(const void *src, GLuint *dst, GLuint n) +unpack_uint_Z_FLOAT32_X24S8(const void *src, GLuint *dst, GLuint n) { const struct z32f_x24s8 *s = (const struct z32f_x24s8 *) src; GLuint i; @@ -4125,16 +4125,16 @@ _mesa_unpack_uint_z_row(mesa_format format, GLuint n, unpack = unpack_uint_z_X8_Z24; break; case MESA_FORMAT_Z_UNORM16: - unpack = unpack_uint_z_Z16; + unpack = unpack_uint_Z_UNORM16; break; case MESA_FORMAT_Z_UNORM32: - unpack = unpack_uint_z_Z32; + unpack = unpack_uint_Z_UNORM32; break; case MESA_FORMAT_Z_FLOAT32: - unpack = unpack_uint_z_Z32_FLOAT; + unpack = unpack_uint_Z_FLOAT32; break; case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: - unpack = unpack_uint_z_Z32_FLOAT_X24S8; + unpack = unpack_uint_Z_FLOAT32_X24S8; break; default: _mesa_problem(NULL, "bad format %s in _mesa_unpack_uint_z_row", diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c index fb2501c69..4fb1f116b 100644 --- a/mesalib/src/mesa/main/formats.c +++ b/mesalib/src/mesa/main/formats.c @@ -3153,9 +3153,9 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format, case MESA_FORMAT_L_UNORM16: return format == GL_LUMINANCE && type == GL_UNSIGNED_SHORT && !swapBytes; case MESA_FORMAT_I_UNORM8: - return format == GL_RED && type == GL_UNSIGNED_BYTE; + return format == GL_INTENSITY && type == GL_UNSIGNED_BYTE; case MESA_FORMAT_I_UNORM16: - return format == GL_RED && type == GL_UNSIGNED_SHORT && !swapBytes; + return format == GL_INTENSITY && type == GL_UNSIGNED_SHORT && !swapBytes; case MESA_FORMAT_YCBCR: return format == GL_YCBCR_MESA && @@ -3247,9 +3247,9 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format, return format == GL_LUMINANCE_ALPHA && type == GL_HALF_FLOAT && !swapBytes; case MESA_FORMAT_I_FLOAT32: - return format == GL_RED && type == GL_FLOAT && !swapBytes; + return format == GL_INTENSITY && type == GL_FLOAT && !swapBytes; case MESA_FORMAT_I_FLOAT16: - return format == GL_RED && type == GL_HALF_FLOAT && !swapBytes; + return format == GL_INTENSITY && type == GL_HALF_FLOAT && !swapBytes; case MESA_FORMAT_R_FLOAT32: return format == GL_RED && type == GL_FLOAT && !swapBytes; @@ -3277,17 +3277,13 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format, return format == GL_ALPHA_INTEGER && type == GL_INT && !swapBytes; case MESA_FORMAT_I_UINT8: - return format == GL_RED_INTEGER && type == GL_UNSIGNED_BYTE; case MESA_FORMAT_I_UINT16: - return format == GL_RED_INTEGER && type == GL_UNSIGNED_SHORT && !swapBytes; case MESA_FORMAT_I_UINT32: - return format == GL_RED_INTEGER && type == GL_UNSIGNED_INT && !swapBytes; case MESA_FORMAT_I_SINT8: - return format == GL_RED_INTEGER && type == GL_BYTE; case MESA_FORMAT_I_SINT16: - return format == GL_RED_INTEGER && type == GL_SHORT && !swapBytes; case MESA_FORMAT_I_SINT32: - return format == GL_RED_INTEGER && type == GL_INT && !swapBytes; + /* GL_INTENSITY_INTEGER_EXT doesn't exist. */ + return GL_FALSE; case MESA_FORMAT_L_UINT8: return format == GL_LUMINANCE_INTEGER_EXT && type == GL_UNSIGNED_BYTE; @@ -3454,7 +3450,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format, return format == GL_LUMINANCE_ALPHA && type == GL_BYTE && littleEndian && !swapBytes; case MESA_FORMAT_I_SNORM8: - return format == GL_RED && type == GL_BYTE; + return format == GL_INTENSITY && type == GL_BYTE; case MESA_FORMAT_A_SNORM16: return format == GL_ALPHA && type == GL_SHORT && !swapBytes; case MESA_FORMAT_L_SNORM16: @@ -3463,7 +3459,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format, return format == GL_LUMINANCE_ALPHA && type == GL_SHORT && littleEndian && !swapBytes; case MESA_FORMAT_I_SNORM16: - return format == GL_RED && type == GL_SHORT && littleEndian && + return format == GL_INTENSITY && type == GL_SHORT && littleEndian && !swapBytes; case MESA_FORMAT_B10G10R10A2_UINT: diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c index 88cf202df..6d9579008 100644 --- a/mesalib/src/mesa/main/get.c +++ b/mesalib/src/mesa/main/get.c @@ -387,6 +387,7 @@ EXTRA_EXT(ARB_texture_cube_map_array); EXTRA_EXT(ARB_texture_buffer_range); EXTRA_EXT(ARB_texture_multisample); EXTRA_EXT(ARB_texture_gather); +EXTRA_EXT(ARB_separate_shader_objects); EXTRA_EXT(ARB_shader_atomic_counters); EXTRA_EXT(ARB_draw_indirect); EXTRA_EXT(ARB_shader_image_load_store); @@ -873,6 +874,18 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu v->value_int = ctx->TransformFeedback.CurrentObject->Name; break; case GL_CURRENT_PROGRAM: + /* The Changelog of the ARB_separate_shader_objects spec says: + * + * 24 25 Jul 2011 pbrown Remove the language erroneously deleting + * CURRENT_PROGRAM. In the EXT extension, this + * token was aliased to ACTIVE_PROGRAM_EXT, and + * was used to indicate the last program set by + * either ActiveProgramEXT or UseProgram. In + * the ARB extension, the SSO active programs + * are now program pipeline object state and + * CURRENT_PROGRAM should still be used to query + * the last program set by UseProgram (bug 7822). + */ v->value_int = ctx->Shader.ActiveProgram ? ctx->Shader.ActiveProgram->Name : 0; break; @@ -1002,6 +1015,14 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu case GL_DRAW_INDIRECT_BUFFER_BINDING: v->value_int = ctx->DrawIndirectBuffer->Name; break; + /* GL_ARB_separate_shader_objects */ + case GL_PROGRAM_PIPELINE_BINDING: + if (ctx->Pipeline.Current) { + v->value_int = ctx->Pipeline.Current->Name; + } else { + v->value_int = 0; + } + break; } } diff --git a/mesalib/src/mesa/main/get_hash_params.py b/mesalib/src/mesa/main/get_hash_params.py index 674d0032a..06d0bbacc 100644 --- a/mesalib/src/mesa/main/get_hash_params.py +++ b/mesalib/src/mesa/main/get_hash_params.py @@ -726,6 +726,9 @@ descriptor=[ [ "MAX_PROGRAM_TEXTURE_GATHER_OFFSET", "CONTEXT_INT(Const.MaxProgramTextureGatherOffset), extra_ARB_texture_gather"], [ "MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB", "CONTEXT_INT(Const.MaxProgramTextureGatherComponents), extra_ARB_texture_gather"], +# GL_ARB_separate_shader_objects + [ "PROGRAM_PIPELINE_BINDING", "LOC_CUSTOM, TYPE_INT, GL_PROGRAM_PIPELINE_BINDING, extra_ARB_separate_shader_objects" ], + # GL_ARB_shader_atomic_counters [ "ATOMIC_COUNTER_BUFFER_BINDING", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_shader_atomic_counters" ], [ "MAX_ATOMIC_COUNTER_BUFFER_BINDINGS", "CONTEXT_INT(Const.MaxAtomicBufferBindings), extra_ARB_shader_atomic_counters" ], diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index c6d90c579..33cb88881 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -2807,6 +2807,10 @@ struct gl_pipeline_object GLbitfield Flags; /**< Mask of GLSL_x flags */ GLboolean EverBound; /**< Has the pipeline object been created */ + + GLboolean Validated; /**< Pipeline Validation status */ + + GLchar *InfoLog; }; /** @@ -2817,6 +2821,9 @@ struct gl_pipeline_shader_state /** Currently bound pipeline object. See _mesa_BindProgramPipeline() */ struct gl_pipeline_object *Current; + /* Default Object to ensure that _Shader is never NULL */ + struct gl_pipeline_object *Default; + /** Pipeline objects */ struct _mesa_HashTable *Objects; }; @@ -4123,6 +4130,26 @@ struct gl_context struct gl_pipeline_shader_state Pipeline; /**< GLSL pipeline shader object state */ struct gl_pipeline_object Shader; /**< GLSL shader object state */ + + /** + * Current active shader pipeline state + * + * Almost all internal users want ::_Shader instead of ::Shader. The + * exceptions are bits of legacy GLSL API that do not know about separate + * shader objects. + * + * If a program is active via \c glUseProgram, this will point to + * \c ::Shader. + * + * If a program pipeline is active via \c glBindProgramPipeline, this will + * point to \c ::Pipeline.Current. + * + * If neither a program nor a program pipeline is active, this will point to + * \c ::Pipeline.Default. This ensures that \c ::_Shader will never be + * \c NULL. + */ + struct gl_pipeline_object *_Shader; + struct gl_shader_compiler_options ShaderCompilerOptions[MESA_SHADER_STAGES]; struct gl_query_state Query; /**< occlusion, timer queries */ diff --git a/mesalib/src/mesa/main/pipelineobj.c b/mesalib/src/mesa/main/pipelineobj.c index 27012df72..f55251e06 100644 --- a/mesalib/src/mesa/main/pipelineobj.c +++ b/mesalib/src/mesa/main/pipelineobj.c @@ -80,6 +80,7 @@ _mesa_new_pipeline_object(struct gl_context *ctx, GLuint name) mtx_init(&obj->Mutex, mtx_plain); obj->RefCount = 1; obj->Flags = _mesa_get_shader_flags(); + obj->InfoLog = NULL; } return obj; @@ -94,6 +95,10 @@ _mesa_init_pipeline(struct gl_context *ctx) ctx->Pipeline.Objects = _mesa_NewHashTable(); ctx->Pipeline.Current = NULL; + + /* Install a default Pipeline */ + ctx->Pipeline.Default = _mesa_new_pipeline_object(ctx, 0); + _mesa_reference_pipeline_object(ctx, &ctx->_Shader, ctx->Pipeline.Default); } @@ -117,6 +122,10 @@ _mesa_free_pipeline_data(struct gl_context *ctx) { _mesa_HashDeleteAll(ctx->Pipeline.Objects, delete_pipelineobj_cb, ctx); _mesa_DeleteHashTable(ctx->Pipeline.Objects); + + _mesa_reference_pipeline_object(ctx, &ctx->_Shader, NULL); + _mesa_delete_pipeline_object(ctx, ctx->Pipeline.Default); + } /** @@ -214,6 +223,109 @@ _mesa_reference_pipeline_object_(struct gl_context *ctx, void GLAPIENTRY _mesa_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program) { + GET_CURRENT_CONTEXT(ctx); + + struct gl_pipeline_object *pipe = lookup_pipeline_object(ctx, pipeline); + struct gl_shader_program *shProg = NULL; + GLbitfield any_valid_stages; + + if (!pipe) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glUseProgramStages(pipeline)"); + return; + } + + /* Object is created by any Pipeline call but glGenProgramPipelines, + * glIsProgramPipeline and GetProgramPipelineInfoLog + */ + pipe->EverBound = GL_TRUE; + + /* Section 2.11.4 (Program Pipeline Objects) of the OpenGL 4.1 spec says: + * + * "If stages is not the special value ALL_SHADER_BITS, and has a bit + * set that is not recognized, the error INVALID_VALUE is generated." + * + * NOT YET SUPPORTED: + * GL_TESS_CONTROL_SHADER_BIT + * GL_TESS_EVALUATION_SHADER_BIT + */ + any_valid_stages = GL_VERTEX_SHADER_BIT | GL_FRAGMENT_SHADER_BIT; + if (_mesa_has_geometry_shaders(ctx)) + any_valid_stages |= GL_GEOMETRY_SHADER_BIT; + + if (stages != GL_ALL_SHADER_BITS && (stages & ~any_valid_stages) != 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glUseProgramStages(Stages)"); + return; + } + + /* Section 2.17.2 (Transform Feedback Primitive Capture) of the OpenGL 4.1 + * spec says: + * + * "The error INVALID_OPERATION is generated: + * + * ... + * + * - by UseProgramStages if the program pipeline object it refers + * to is current and the current transform feedback object is + * active and not paused; + */ + if (ctx->_Shader == pipe) { + if (_mesa_is_xfb_active_and_unpaused(ctx)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glUseProgramStages(transform feedback active)"); + return; + } + } + + if (program) { + shProg = _mesa_lookup_shader_program_err(ctx, program, + "glUseProgramStages"); + if (shProg == NULL) + return; + + /* Section 2.11.4 (Program Pipeline Objects) of the OpenGL 4.1 spec + * says: + * + * "If the program object named by program was linked without the + * PROGRAM_SEPARABLE parameter set, or was not linked successfully, + * the error INVALID_OPERATION is generated and the corresponding + * shader stages in the pipeline program pipeline object are not + * modified." + */ + if (!shProg->LinkStatus) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glUseProgramStages(program not linked)"); + return; + } + + if (!shProg->SeparateShader) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glUseProgramStages(program wasn't linked with the " + "PROGRAM_SEPARABLE flag)"); + return; + } + } + + /* Enable individual stages from the program as requested by the + * application. If there is no shader for a requested stage in the + * program, _mesa_use_shader_program will enable fixed-function processing + * as dictated by the spec. + * + * Section 2.11.4 (Program Pipeline Objects) of the OpenGL 4.1 spec + * says: + * + * "If UseProgramStages is called with program set to zero or with a + * program object that contains no executable code for the given + * stages, it is as if the pipeline object has no programmable stage + * configured for the indicated shader stages." + */ + if ((stages & GL_VERTEX_SHADER_BIT) != 0) + _mesa_use_shader_program(ctx, GL_VERTEX_SHADER, shProg, pipe); + + if ((stages & GL_FRAGMENT_SHADER_BIT) != 0) + _mesa_use_shader_program(ctx, GL_FRAGMENT_SHADER, shProg, pipe); + + if ((stages & GL_GEOMETRY_SHADER_BIT) != 0) + _mesa_use_shader_program(ctx, GL_GEOMETRY_SHADER, shProg, pipe); } /** @@ -259,6 +371,75 @@ _mesa_ActiveShaderProgram(GLuint pipeline, GLuint program) void GLAPIENTRY _mesa_BindProgramPipeline(GLuint pipeline) { + GET_CURRENT_CONTEXT(ctx); + struct gl_pipeline_object *newObj = NULL; + + /* Rebinding the same pipeline object: no change. + */ + if (ctx->_Shader->Name == pipeline) + return; + + /* Section 2.17.2 (Transform Feedback Primitive Capture) of the OpenGL 4.1 + * spec says: + * + * "The error INVALID_OPERATION is generated: + * + * ... + * + * - by BindProgramPipeline if the current transform feedback + * object is active and not paused; + */ + if (_mesa_is_xfb_active_and_unpaused(ctx)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBindProgramPipeline(transform feedback active)"); + return; + } + + /* Get pointer to new pipeline object (newObj) + */ + if (pipeline) { + /* non-default pipeline object */ + newObj = lookup_pipeline_object(ctx, pipeline); + if (!newObj) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBindProgramPipeline(non-gen name)"); + return; + } + + /* Object is created by any Pipeline call but glGenProgramPipelines, + * glIsProgramPipeline and GetProgramPipelineInfoLog + */ + newObj->EverBound = GL_TRUE; + } + + /* First bind the Pipeline to pipeline binding point */ + _mesa_reference_pipeline_object(ctx, &ctx->Pipeline.Current, newObj); + + /* Section 2.11.3 (Program Objects) of the OpenGL 4.1 spec says: + * + * "If there is a current program object established by UseProgram, + * that program is considered current for all stages. Otherwise, if + * there is a bound program pipeline object (see section 2.11.4), the + * program bound to the appropriate stage of the pipeline object is + * considered current." + */ + if (&ctx->Shader != ctx->_Shader) { + if (pipeline) { + /* Bound the pipeline to the current program and + * restore the pipeline state + */ + _mesa_reference_pipeline_object(ctx, &ctx->_Shader, newObj); + } else { + /* Unbind the pipeline */ + _mesa_reference_pipeline_object(ctx, &ctx->_Shader, + ctx->Pipeline.Default); + } + + FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); + + if (ctx->Driver.UseProgram) + ctx->Driver.UseProgram(ctx, NULL); + } } /** @@ -393,14 +574,10 @@ _mesa_GetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params) *params = pipe->ActiveProgram ? pipe->ActiveProgram->Name : 0; return; case GL_INFO_LOG_LENGTH: - /* FINISHME: Implement the info log. - */ - *params = 0; + *params = pipe->InfoLog ? strlen(pipe->InfoLog) + 1 : 0; return; case GL_VALIDATE_STATUS: - /* FINISHME: Implement validation status. - */ - *params = 0; + *params = pipe->Validated; return; case GL_VERTEX_SHADER: *params = pipe->CurrentProgram[MESA_SHADER_VERTEX] @@ -430,16 +607,223 @@ _mesa_GetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params) _mesa_lookup_enum_by_nr(pname)); } +/** + * Determines whether every stage in a linked program is active in the + * specified pipeline. + */ +static bool +program_stages_all_active(struct gl_pipeline_object *pipe, + const struct gl_shader_program *prog) +{ + unsigned i; + bool status = true; + + if (!prog) + return true; + + for (i = 0; i < MESA_SHADER_STAGES; i++) { + if (prog->_LinkedShaders[i]) { + if (pipe->CurrentProgram[i]) { + if (prog->Name != pipe->CurrentProgram[i]->Name) { + status = false; + } + } else { + status = false; + } + } + } + + if (!status) { + pipe->InfoLog = ralloc_asprintf(pipe, + "Program %d is not active for all " + "shaders that was linked", + prog->Name); + } + + return status; +} + +extern GLboolean +_mesa_validate_program_pipeline(struct gl_context* ctx, + struct gl_pipeline_object *pipe, + GLboolean IsBound) +{ + unsigned i; + + pipe->Validated = GL_FALSE; + + /* Release and reset the info log. + */ + if (pipe->InfoLog != NULL) + ralloc_free(pipe->InfoLog); + + pipe->InfoLog = NULL; + + /* Section 2.11.11 (Shader Execution), subheading "Validation," of the + * OpenGL 4.1 spec says: + * + * "[INVALID_OPERATION] is generated by any command that transfers + * vertices to the GL if: + * + * - A program object is active for at least one, but not all of + * the shader stages that were present when the program was + * linked." + * + * For each possible program stage, verify that the program bound to that + * stage has all of its stages active. In other words, if the program + * bound to the vertex stage also has a fragment shader, the fragment + * shader must also be bound to the fragment stage. + */ + for (i = 0; i < MESA_SHADER_STAGES; i++) { + if (!program_stages_all_active(pipe, pipe->CurrentProgram[i])) { + goto err; + } + } + + /* Section 2.11.11 (Shader Execution), subheading "Validation," of the + * OpenGL 4.1 spec says: + * + * "[INVALID_OPERATION] is generated by any command that transfers + * vertices to the GL if: + * + * ... + * + * - One program object is active for at least two shader stages + * and a second program is active for a shader stage between two + * stages for which the first program was active." + * + * Without Tesselation, the only case where this can occur is the geometry + * shader between the fragment shader and vertex shader. + */ + if (pipe->CurrentProgram[MESA_SHADER_GEOMETRY] + && pipe->CurrentProgram[MESA_SHADER_FRAGMENT] + && pipe->CurrentProgram[MESA_SHADER_VERTEX]) { + if (pipe->CurrentProgram[MESA_SHADER_VERTEX]->Name == pipe->CurrentProgram[MESA_SHADER_FRAGMENT]->Name && + pipe->CurrentProgram[MESA_SHADER_GEOMETRY]->Name != pipe->CurrentProgram[MESA_SHADER_VERTEX]->Name) { + pipe->InfoLog = + ralloc_asprintf(pipe, + "Program %d is active for geometry stage between " + "two stages for which another program %d is " + "active", + pipe->CurrentProgram[MESA_SHADER_GEOMETRY]->Name, + pipe->CurrentProgram[MESA_SHADER_VERTEX]->Name); + goto err; + } + } + + /* Section 2.11.11 (Shader Execution), subheading "Validation," of the + * OpenGL 4.1 spec says: + * + * "[INVALID_OPERATION] is generated by any command that transfers + * vertices to the GL if: + * + * ... + * + * - There is an active program for tessellation control, + * tessellation evaluation, or geometry stages with corresponding + * executable shader, but there is no active program with + * executable vertex shader." + */ + if (!pipe->CurrentProgram[MESA_SHADER_VERTEX] + && pipe->CurrentProgram[MESA_SHADER_GEOMETRY]) { + pipe->InfoLog = ralloc_strdup(pipe, "Program lacks a vertex shader"); + goto err; + } + + /* Section 2.11.11 (Shader Execution), subheading "Validation," of the + * OpenGL 4.1 spec says: + * + * "[INVALID_OPERATION] is generated by any command that transfers + * vertices to the GL if: + * + * ... + * + * - There is no current program object specified by UseProgram, + * there is a current program pipeline object, and the current + * program for any shader stage has been relinked since being + * applied to the pipeline object via UseProgramStages with the + * PROGRAM_SEPARABLE parameter set to FALSE. + */ + for (i = 0; i < MESA_SHADER_STAGES; i++) { + if (pipe->CurrentProgram[i] && !pipe->CurrentProgram[i]->SeparateShader) { + pipe->InfoLog = ralloc_asprintf(pipe, + "Program %d was relinked without " + "PROGRAM_SEPARABLE state", + pipe->CurrentProgram[i]->Name); + goto err; + } + } + + /* Section 2.11.11 (Shader Execution), subheading "Validation," of the + * OpenGL 4.1 spec says: + * + * "[INVALID_OPERATION] is generated by any command that transfers + * vertices to the GL if: + * + * ... + * + * - Any two active samplers in the current program object are of + * different types, but refer to the same texture image unit. + * + * - The number of active samplers in the program exceeds the + * maximum number of texture image units allowed." + */ + if (!_mesa_sampler_uniforms_pipeline_are_valid(pipe)) + goto err; + + pipe->Validated = GL_TRUE; + return GL_TRUE; + +err: + if (IsBound) + _mesa_error(ctx, GL_INVALID_OPERATION, + "glValidateProgramPipeline failed to validate the pipeline"); + + return GL_FALSE; +} + /** * Check compatibility of pipeline's program */ void GLAPIENTRY _mesa_ValidateProgramPipeline(GLuint pipeline) { + GET_CURRENT_CONTEXT(ctx); + + struct gl_pipeline_object *pipe = lookup_pipeline_object(ctx, pipeline); + + if (!pipe) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glValidateProgramPipeline(pipeline)"); + return; + } + + _mesa_validate_program_pipeline(ctx, pipe, + (ctx->_Shader->Name == pipe->Name)); } void GLAPIENTRY _mesa_GetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog) { + GET_CURRENT_CONTEXT(ctx); + + struct gl_pipeline_object *pipe = lookup_pipeline_object(ctx, pipeline); + + if (!pipe) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glGetProgramPipelineInfoLog(pipeline)"); + return; + } + + if (bufSize < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glGetProgramPipelineInfoLog(bufSize)"); + return; + } + + if (pipe->InfoLog) + _mesa_copy_string(infoLog, bufSize, length, pipe->InfoLog); + else + *length = 0; } diff --git a/mesalib/src/mesa/main/pipelineobj.h b/mesalib/src/mesa/main/pipelineobj.h index 46d5fab42..ceaf4f14c 100644 --- a/mesalib/src/mesa/main/pipelineobj.h +++ b/mesalib/src/mesa/main/pipelineobj.h @@ -59,6 +59,9 @@ _mesa_reference_pipeline_object(struct gl_context *ctx, _mesa_reference_pipeline_object_(ctx, ptr, obj); } +extern GLboolean +_mesa_validate_program_pipeline(struct gl_context * ctx, struct gl_pipeline_object *pipe, GLboolean IsBound); + extern void GLAPIENTRY _mesa_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program); diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c index 5060cbb0b..1c8e6b4cf 100644 --- a/mesalib/src/mesa/main/shaderapi.c +++ b/mesalib/src/mesa/main/shaderapi.c @@ -44,6 +44,7 @@ #include "main/hash.h" #include "main/hash_table.h" #include "main/mtypes.h" +#include "main/pipelineobj.h" #include "main/shaderapi.h" #include "main/shaderobj.h" #include "main/transformfeedback.h" @@ -144,6 +145,8 @@ _mesa_free_shader_state(struct gl_context *ctx) _mesa_reference_shader_program(ctx, &ctx->Shader.ActiveProgram, NULL); /* Extended for ARB_separate_shader_objects */ + _mesa_reference_pipeline_object(ctx, &ctx->_Shader, NULL); + assert(ctx->Shader.RefCount == 1); mtx_destroy(&ctx->Shader.Mutex); } @@ -465,8 +468,8 @@ static GLuint get_handle(struct gl_context *ctx, GLenum pname) { if (pname == GL_PROGRAM_OBJECT_ARB) { - if (ctx->Shader.ActiveProgram) - return ctx->Shader.ActiveProgram->Name; + if (ctx->_Shader->ActiveProgram) + return ctx->_Shader->ActiveProgram->Name; else return 0; } @@ -837,7 +840,7 @@ compile_shader(struct gl_context *ctx, GLuint shaderObj) */ sh->CompileStatus = GL_FALSE; } else { - if (ctx->Shader.Flags & GLSL_DUMP) { + if (ctx->_Shader->Flags & GLSL_DUMP) { fprintf(stderr, "GLSL source for %s shader %d:\n", _mesa_shader_stage_to_string(sh->Stage), sh->Name); fprintf(stderr, "%s\n", sh->Source); @@ -849,11 +852,11 @@ compile_shader(struct gl_context *ctx, GLuint shaderObj) */ _mesa_glsl_compile_shader(ctx, sh, false, false); - if (ctx->Shader.Flags & GLSL_LOG) { + if (ctx->_Shader->Flags & GLSL_LOG) { _mesa_write_shader_to_file(sh); } - if (ctx->Shader.Flags & GLSL_DUMP) { + if (ctx->_Shader->Flags & GLSL_DUMP) { if (sh->CompileStatus) { fprintf(stderr, "GLSL IR for shader %d:\n", sh->Name); _mesa_print_ir(stderr, sh->ir, NULL); @@ -871,7 +874,7 @@ compile_shader(struct gl_context *ctx, GLuint shaderObj) } if (!sh->CompileStatus) { - if (ctx->Shader.Flags & GLSL_DUMP_ON_ERROR) { + if (ctx->_Shader->Flags & GLSL_DUMP_ON_ERROR) { fprintf(stderr, "GLSL source for %s shader %d:\n", _mesa_shader_stage_to_string(sh->Stage), sh->Name); fprintf(stderr, "%s\n", sh->Source); @@ -879,7 +882,7 @@ compile_shader(struct gl_context *ctx, GLuint shaderObj) fflush(stderr); } - if (ctx->Shader.Flags & GLSL_REPORT_ERRORS) { + if (ctx->_Shader->Flags & GLSL_REPORT_ERRORS) { _mesa_debug(ctx, "Error compiling shader %u:\n%s\n", sh->Name, sh->InfoLog); } @@ -915,7 +918,7 @@ link_program(struct gl_context *ctx, GLuint program) _mesa_glsl_link_shader(ctx, shProg); if (shProg->LinkStatus == GL_FALSE && - (ctx->Shader.Flags & GLSL_REPORT_ERRORS)) { + (ctx->_Shader->Flags & GLSL_REPORT_ERRORS)) { _mesa_debug(ctx, "Error linking program %u:\n%s\n", shProg->Name, shProg->InfoLog); } @@ -986,17 +989,21 @@ _mesa_active_program(struct gl_context *ctx, struct gl_shader_program *shProg, */ static void use_shader_program(struct gl_context *ctx, GLenum type, - struct gl_shader_program *shProg) + struct gl_shader_program *shProg, + struct gl_pipeline_object *shTarget) { struct gl_shader_program **target; gl_shader_stage stage = _mesa_shader_enum_to_shader_stage(type); - target = &ctx->Shader.CurrentProgram[stage]; + target = &shTarget->CurrentProgram[stage]; if ((shProg == NULL) || (shProg->_LinkedShaders[stage] == NULL)) shProg = NULL; if (*target != shProg) { - FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); + /* Program is current, flush it */ + if (shTarget == ctx->_Shader) { + FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); + } /* If the shader is also bound as the current rendering shader, unbind * it from that binding point as well. This ensures that the correct @@ -1013,9 +1020,9 @@ use_shader_program(struct gl_context *ctx, GLenum type, /* Empty for now. */ break; case GL_FRAGMENT_SHADER: - if (*target == ctx->Shader._CurrentFragmentProgram) { + if (*target == ctx->_Shader->_CurrentFragmentProgram) { _mesa_reference_shader_program(ctx, - &ctx->Shader._CurrentFragmentProgram, + &ctx->_Shader->_CurrentFragmentProgram, NULL); } break; @@ -1032,10 +1039,10 @@ use_shader_program(struct gl_context *ctx, GLenum type, void _mesa_use_program(struct gl_context *ctx, struct gl_shader_program *shProg) { - use_shader_program(ctx, GL_VERTEX_SHADER, shProg); - use_shader_program(ctx, GL_GEOMETRY_SHADER_ARB, shProg); - use_shader_program(ctx, GL_FRAGMENT_SHADER, shProg); - use_shader_program(ctx, GL_COMPUTE_SHADER, shProg); + use_shader_program(ctx, GL_VERTEX_SHADER, shProg, &ctx->Shader); + use_shader_program(ctx, GL_GEOMETRY_SHADER_ARB, shProg, &ctx->Shader); + use_shader_program(ctx, GL_FRAGMENT_SHADER, shProg, &ctx->Shader); + use_shader_program(ctx, GL_COMPUTE_SHADER, shProg, &ctx->Shader); _mesa_active_program(ctx, shProg, "glUseProgram"); if (ctx->Driver.UseProgram) @@ -1533,7 +1540,7 @@ _mesa_UseProgram(GLhandleARB program) } /* debug code */ - if (ctx->Shader.Flags & GLSL_USE_PROG) { + if (ctx->_Shader->Flags & GLSL_USE_PROG) { print_shader_info(shProg); } } @@ -1541,7 +1548,31 @@ _mesa_UseProgram(GLhandleARB program) shProg = NULL; } - _mesa_use_program(ctx, shProg); + /* The "Dependencies on EXT_separate_shader_objects" section of the + * ARB_separate_shader_object spec says: + * + * "The executable code for an individual shader stage is taken from + * the current program for that stage. If there is a current program + * object for any shader stage or for uniform updates established by + * UseProgram, UseShaderProgramEXT, or ActiveProgramEXT, the current + * program for that stage (if any) is considered current. Otherwise, + * if there is a bound program pipeline object ..." + */ + if (program) { + /* Attach shader state to the binding point */ + _mesa_reference_pipeline_object(ctx, &ctx->_Shader, &ctx->Shader); + /* Update the program */ + _mesa_use_program(ctx, shProg); + } else { + /* Must be done first: detach the progam */ + _mesa_use_program(ctx, shProg); + /* Unattach shader_state binding point */ + _mesa_reference_pipeline_object(ctx, &ctx->_Shader, ctx->Pipeline.Default); + /* If a pipeline was bound, rebind it */ + if (ctx->Pipeline.Current) { + _mesa_BindProgramPipeline(ctx->Pipeline.Current->Name); + } + } } @@ -1773,9 +1804,10 @@ _mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value) void _mesa_use_shader_program(struct gl_context *ctx, GLenum type, - struct gl_shader_program *shProg) + struct gl_shader_program *shProg, + struct gl_pipeline_object *shTarget) { - use_shader_program(ctx, type, shProg); + use_shader_program(ctx, type, shProg, shTarget); if (ctx->Driver.UseProgram) ctx->Driver.UseProgram(ctx, shProg); @@ -1815,7 +1847,41 @@ _mesa_UseShaderProgramEXT(GLenum type, GLuint program) } } - _mesa_use_shader_program(ctx, type, shProg); + /* The "Dependencies on EXT_separate_shader_objects" section of the + * ARB_separate_shader_object spec says: + * + * "The executable code for an individual shader stage is taken from + * the current program for that stage. If there is a current program + * object for any shader stage or for uniform updates established by + * UseProgram, UseShaderProgramEXT, or ActiveProgramEXT, the current + * program for that stage (if any) is considered current. Otherwise, + * if there is a bound program pipeline object ..." + */ + if (program) { + /* Attach shader state to the binding point */ + _mesa_reference_pipeline_object(ctx, &ctx->_Shader, &ctx->Shader); + /* Update the program */ + _mesa_use_shader_program(ctx, type, shProg, ctx->_Shader); + } else { + /* Must be done first: detach the progam */ + _mesa_use_shader_program(ctx, type, shProg, ctx->_Shader); + + /* Nothing remains current */ + if (!ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX] && + !ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY] && + !ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT] && + !ctx->Shader.ActiveProgram) { + + /* Unattach shader_state binding point */ + _mesa_reference_pipeline_object(ctx, &ctx->_Shader, + ctx->Pipeline.Default); + + /* If a pipeline was bound, rebind it */ + if (ctx->Pipeline.Current) { + _mesa_BindProgramPipeline(ctx->Pipeline.Current->Name); + } + } + } } @@ -1830,7 +1896,39 @@ _mesa_ActiveProgramEXT(GLuint program) ? _mesa_lookup_shader_program_err(ctx, program, "glActiveProgramEXT") : NULL; - _mesa_active_program(ctx, shProg, "glActiveProgramEXT"); + /* The "Dependencies on EXT_separate_shader_objects" section of the + * ARB_separate_shader_object spec says: + * + * "The executable code for an individual shader stage is taken from + * the current program for that stage. If there is a current program + * object for any shader stage or for uniform updates established by + * UseProgram, UseShaderProgramEXT, or ActiveProgramEXT, the current + * program for that stage (if any) is considered current. Otherwise, + * if there is a bound program pipeline object ..." + */ + if (shProg != NULL) { + /* Attach shader state to the binding point */ + _mesa_reference_pipeline_object(ctx, &ctx->_Shader, &ctx->Shader); + _mesa_active_program(ctx, shProg, "glActiveProgramEXT"); + } else { + /* Must be done first: unset the current active progam */ + _mesa_active_program(ctx, shProg, "glActiveProgramEXT"); + + /* Nothing remains current */ + if (!ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX] && + !ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY] && + !ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT] && + !ctx->Shader.ActiveProgram) { + + /* Unattach shader_state binding point */ + _mesa_reference_pipeline_object(ctx, &ctx->_Shader, ctx->Pipeline.Default); + /* If a pipeline was bound, rebind it */ + if (ctx->Pipeline.Current) { + _mesa_BindProgramPipeline(ctx->Pipeline.Current->Name); + } + } + } + return; } diff --git a/mesalib/src/mesa/main/shaderapi.h b/mesalib/src/mesa/main/shaderapi.h index 44426cc65..17b05b313 100644 --- a/mesalib/src/mesa/main/shaderapi.h +++ b/mesalib/src/mesa/main/shaderapi.h @@ -202,7 +202,8 @@ _mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value); void _mesa_use_shader_program(struct gl_context *ctx, GLenum type, - struct gl_shader_program *shProg); + struct gl_shader_program *shProg, + struct gl_pipeline_object *shTarget); extern void GLAPIENTRY _mesa_UseShaderProgramEXT(GLenum type, GLuint program); diff --git a/mesalib/src/mesa/main/state.c b/mesalib/src/mesa/main/state.c index 0866a140f..c122c16aa 100644 --- a/mesalib/src/mesa/main/state.c +++ b/mesalib/src/mesa/main/state.c @@ -95,11 +95,11 @@ static GLbitfield update_program(struct gl_context *ctx) { const struct gl_shader_program *vsProg = - ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX]; + ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX]; const struct gl_shader_program *gsProg = - ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]; + ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]; struct gl_shader_program *fsProg = - ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT]; + ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT]; const struct gl_vertex_program *prevVP = ctx->VertexProgram._Current; const struct gl_fragment_program *prevFP = ctx->FragmentProgram._Current; const struct gl_geometry_program *prevGP = ctx->GeometryProgram._Current; @@ -125,7 +125,7 @@ update_program(struct gl_context *ctx) && fsProg->_LinkedShaders[MESA_SHADER_FRAGMENT]) { /* Use GLSL fragment shader */ _mesa_reference_shader_program(ctx, - &ctx->Shader._CurrentFragmentProgram, + &ctx->_Shader->_CurrentFragmentProgram, fsProg); _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, gl_fragment_program(fsProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program)); @@ -135,7 +135,7 @@ update_program(struct gl_context *ctx) else if (ctx->FragmentProgram._Enabled) { /* Use user-defined fragment program */ _mesa_reference_shader_program(ctx, - &ctx->Shader._CurrentFragmentProgram, + &ctx->_Shader->_CurrentFragmentProgram, NULL); _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, ctx->FragmentProgram.Current); @@ -147,7 +147,7 @@ update_program(struct gl_context *ctx) struct gl_shader_program *f = _mesa_get_fixed_func_fragment_program(ctx); _mesa_reference_shader_program(ctx, - &ctx->Shader._CurrentFragmentProgram, + &ctx->_Shader->_CurrentFragmentProgram, f); _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, gl_fragment_program(f->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program)); @@ -310,7 +310,7 @@ update_multisample(struct gl_context *ctx) static void update_twoside(struct gl_context *ctx) { - if (ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX] || + if (ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX] || ctx->VertexProgram._Enabled) { ctx->VertexProgram._TwoSideEnabled = ctx->VertexProgram.TwoSideEnabled; } else { diff --git a/mesalib/src/mesa/main/texstate.c b/mesalib/src/mesa/main/texstate.c index 08725f601..fcae878cf 100644 --- a/mesalib/src/mesa/main/texstate.c +++ b/mesalib/src/mesa/main/texstate.c @@ -532,9 +532,9 @@ update_texture_state( struct gl_context *ctx ) int i; for (i = 0; i < MESA_SHADER_STAGES; i++) { - if (ctx->Shader.CurrentProgram[i] && - ctx->Shader.CurrentProgram[i]->LinkStatus) { - prog[i] = ctx->Shader.CurrentProgram[i]->_LinkedShaders[i]->Program; + if (ctx->_Shader->CurrentProgram[i] && + ctx->_Shader->CurrentProgram[i]->LinkStatus) { + prog[i] = ctx->_Shader->CurrentProgram[i]->_LinkedShaders[i]->Program; } else { if (i == MESA_SHADER_FRAGMENT && ctx->FragmentProgram._Enabled) prog[i] = &ctx->FragmentProgram.Current->Base; diff --git a/mesalib/src/mesa/main/transformfeedback.c b/mesalib/src/mesa/main/transformfeedback.c index 6b9565ca3..abeb25e87 100644 --- a/mesalib/src/mesa/main/transformfeedback.c +++ b/mesalib/src/mesa/main/transformfeedback.c @@ -388,8 +388,8 @@ get_xfb_source(struct gl_context *ctx) { int i; for (i = MESA_SHADER_GEOMETRY; i >= MESA_SHADER_VERTEX; i--) { - if (ctx->Shader.CurrentProgram[i] != NULL) - return ctx->Shader.CurrentProgram[i]; + if (ctx->_Shader->CurrentProgram[i] != NULL) + return ctx->_Shader->CurrentProgram[i]; } return NULL; } diff --git a/mesalib/src/mesa/main/uniform_query.cpp b/mesalib/src/mesa/main/uniform_query.cpp index fa13ef9fe..5f1af0873 100644 --- a/mesalib/src/mesa/main/uniform_query.cpp +++ b/mesalib/src/mesa/main/uniform_query.cpp @@ -698,7 +698,7 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg, return; } - if (ctx->Shader.Flags & GLSL_UNIFORMS) { + if (ctx->_Shader->Flags & GLSL_UNIFORMS) { log_uniform(values, basicType, components, 1, count, false, shProg, location, uni); } @@ -920,7 +920,7 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg, } } - if (ctx->Shader.Flags & GLSL_UNIFORMS) { + if (ctx->_Shader->Flags & GLSL_UNIFORMS) { log_uniform(values, GLSL_TYPE_FLOAT, components, vectors, count, bool(transpose), shProg, location, uni); } @@ -1089,3 +1089,80 @@ _mesa_sampler_uniforms_are_valid(const struct gl_shader_program *shProg, return true; } + +extern "C" bool +_mesa_sampler_uniforms_pipeline_are_valid(struct gl_pipeline_object *pipeline) +{ + /* Section 2.11.11 (Shader Execution), subheading "Validation," of the + * OpenGL 4.1 spec says: + * + * "[INVALID_OPERATION] is generated by any command that transfers + * vertices to the GL if: + * + * ... + * + * - Any two active samplers in the current program object are of + * different types, but refer to the same texture image unit. + * + * - The number of active samplers in the program exceeds the + * maximum number of texture image units allowed." + */ + unsigned active_samplers = 0; + const struct gl_shader_program **shProg = + (const struct gl_shader_program **) pipeline->CurrentProgram; + + const glsl_type *unit_types[MAX_COMBINED_TEXTURE_IMAGE_UNITS]; + memset(unit_types, 0, sizeof(unit_types)); + + for (unsigned idx = 0; idx < ARRAY_SIZE(pipeline->CurrentProgram); idx++) { + if (!shProg[idx]) + continue; + + for (unsigned i = 0; i < shProg[idx]->NumUserUniformStorage; i++) { + const struct gl_uniform_storage *const storage = + &shProg[idx]->UniformStorage[i]; + const glsl_type *const t = (storage->type->is_array()) + ? storage->type->fields.array : storage->type; + + if (!t->is_sampler()) + continue; + + active_samplers++; + + const unsigned count = MAX2(1, storage->type->array_size()); + for (unsigned j = 0; j < count; j++) { + const unsigned unit = storage->storage[j].i; + + /* The types of the samplers associated with a particular texture + * unit must be an exact match. Page 74 (page 89 of the PDF) of + * the OpenGL 3.3 core spec says: + * + * "It is not allowed to have variables of different sampler + * types pointing to the same texture image unit within a + * program object." + */ + if (unit_types[unit] == NULL) { + unit_types[unit] = t; + } else if (unit_types[unit] != t) { + pipeline->InfoLog = + ralloc_asprintf(pipeline, + "Texture unit %d is accessed both as %s " + "and %s", + unit, unit_types[unit]->name, t->name); + return false; + } + } + } + } + + if (active_samplers > MAX_COMBINED_TEXTURE_IMAGE_UNITS) { + pipeline->InfoLog = + ralloc_asprintf(pipeline, + "the number of active samplers %d exceed the " + "maximum %d", + active_samplers, MAX_COMBINED_TEXTURE_IMAGE_UNITS); + return false; + } + + return true; +} diff --git a/mesalib/src/mesa/main/uniforms.c b/mesalib/src/mesa/main/uniforms.c index e9b374b0d..1daade428 100644 --- a/mesalib/src/mesa/main/uniforms.c +++ b/mesalib/src/mesa/main/uniforms.c @@ -137,7 +137,7 @@ void GLAPIENTRY _mesa_Uniform1f(GLint location, GLfloat v0) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, 1, &v0, GL_FLOAT); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, &v0, GL_FLOAT); } void GLAPIENTRY @@ -147,7 +147,7 @@ _mesa_Uniform2f(GLint location, GLfloat v0, GLfloat v1) GLfloat v[2]; v[0] = v0; v[1] = v1; - _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, 1, v, GL_FLOAT_VEC2); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_FLOAT_VEC2); } void GLAPIENTRY @@ -158,7 +158,7 @@ _mesa_Uniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) v[0] = v0; v[1] = v1; v[2] = v2; - _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, 1, v, GL_FLOAT_VEC3); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_FLOAT_VEC3); } void GLAPIENTRY @@ -171,14 +171,14 @@ _mesa_Uniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, v[1] = v1; v[2] = v2; v[3] = v3; - _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, 1, v, GL_FLOAT_VEC4); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_FLOAT_VEC4); } void GLAPIENTRY _mesa_Uniform1i(GLint location, GLint v0) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, 1, &v0, GL_INT); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, &v0, GL_INT); } void GLAPIENTRY @@ -188,7 +188,7 @@ _mesa_Uniform2i(GLint location, GLint v0, GLint v1) GLint v[2]; v[0] = v0; v[1] = v1; - _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, 1, v, GL_INT_VEC2); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_INT_VEC2); } void GLAPIENTRY @@ -199,7 +199,7 @@ _mesa_Uniform3i(GLint location, GLint v0, GLint v1, GLint v2) v[0] = v0; v[1] = v1; v[2] = v2; - _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, 1, v, GL_INT_VEC3); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_INT_VEC3); } void GLAPIENTRY @@ -211,63 +211,63 @@ _mesa_Uniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) v[1] = v1; v[2] = v2; v[3] = v3; - _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, 1, v, GL_INT_VEC4); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_INT_VEC4); } void GLAPIENTRY _mesa_Uniform1fv(GLint location, GLsizei count, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, count, value, GL_FLOAT); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_FLOAT); } void GLAPIENTRY _mesa_Uniform2fv(GLint location, GLsizei count, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, count, value, GL_FLOAT_VEC2); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_FLOAT_VEC2); } void GLAPIENTRY _mesa_Uniform3fv(GLint location, GLsizei count, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, count, value, GL_FLOAT_VEC3); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_FLOAT_VEC3); } void GLAPIENTRY _mesa_Uniform4fv(GLint location, GLsizei count, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, count, value, GL_FLOAT_VEC4); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_FLOAT_VEC4); } void GLAPIENTRY _mesa_Uniform1iv(GLint location, GLsizei count, const GLint * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, count, value, GL_INT); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_INT); } void GLAPIENTRY _mesa_Uniform2iv(GLint location, GLsizei count, const GLint * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, count, value, GL_INT_VEC2); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_INT_VEC2); } void GLAPIENTRY _mesa_Uniform3iv(GLint location, GLsizei count, const GLint * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, count, value, GL_INT_VEC3); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_INT_VEC3); } void GLAPIENTRY _mesa_Uniform4iv(GLint location, GLsizei count, const GLint * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, count, value, GL_INT_VEC4); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_INT_VEC4); } /** Same as above with direct state access **/ @@ -467,7 +467,7 @@ void GLAPIENTRY _mesa_Uniform1ui(GLint location, GLuint v0) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, 1, &v0, GL_UNSIGNED_INT); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, &v0, GL_UNSIGNED_INT); } void GLAPIENTRY @@ -477,7 +477,7 @@ _mesa_Uniform2ui(GLint location, GLuint v0, GLuint v1) GLuint v[2]; v[0] = v0; v[1] = v1; - _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, 1, v, GL_UNSIGNED_INT_VEC2); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_UNSIGNED_INT_VEC2); } void GLAPIENTRY @@ -488,7 +488,7 @@ _mesa_Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2) v[0] = v0; v[1] = v1; v[2] = v2; - _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, 1, v, GL_UNSIGNED_INT_VEC3); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_UNSIGNED_INT_VEC3); } void GLAPIENTRY @@ -500,35 +500,35 @@ _mesa_Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) v[1] = v1; v[2] = v2; v[3] = v3; - _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, 1, v, GL_UNSIGNED_INT_VEC4); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_UNSIGNED_INT_VEC4); } void GLAPIENTRY _mesa_Uniform1uiv(GLint location, GLsizei count, const GLuint *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, count, value, GL_UNSIGNED_INT); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_UNSIGNED_INT); } void GLAPIENTRY _mesa_Uniform2uiv(GLint location, GLsizei count, const GLuint *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, count, value, GL_UNSIGNED_INT_VEC2); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_UNSIGNED_INT_VEC2); } void GLAPIENTRY _mesa_Uniform3uiv(GLint location, GLsizei count, const GLuint *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, count, value, GL_UNSIGNED_INT_VEC3); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_UNSIGNED_INT_VEC3); } void GLAPIENTRY _mesa_Uniform4uiv(GLint location, GLsizei count, const GLuint *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, count, value, GL_UNSIGNED_INT_VEC4); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_UNSIGNED_INT_VEC4); } @@ -538,7 +538,7 @@ _mesa_UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform_matrix(ctx, ctx->Shader.ActiveProgram, + _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram, 2, 2, location, count, transpose, value); } @@ -547,7 +547,7 @@ _mesa_UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform_matrix(ctx, ctx->Shader.ActiveProgram, + _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram, 3, 3, location, count, transpose, value); } @@ -556,7 +556,7 @@ _mesa_UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform_matrix(ctx, ctx->Shader.ActiveProgram, + _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram, 4, 4, location, count, transpose, value); } @@ -703,7 +703,7 @@ _mesa_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform_matrix(ctx, ctx->Shader.ActiveProgram, + _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram, 2, 3, location, count, transpose, value); } @@ -712,7 +712,7 @@ _mesa_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform_matrix(ctx, ctx->Shader.ActiveProgram, + _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram, 3, 2, location, count, transpose, value); } @@ -721,7 +721,7 @@ _mesa_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform_matrix(ctx, ctx->Shader.ActiveProgram, + _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram, 2, 4, location, count, transpose, value); } @@ -730,7 +730,7 @@ _mesa_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform_matrix(ctx, ctx->Shader.ActiveProgram, + _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram, 4, 2, location, count, transpose, value); } @@ -739,7 +739,7 @@ _mesa_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform_matrix(ctx, ctx->Shader.ActiveProgram, + _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram, 3, 4, location, count, transpose, value); } @@ -748,7 +748,7 @@ _mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform_matrix(ctx, ctx->Shader.ActiveProgram, + _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram, 4, 3, location, count, transpose, value); } diff --git a/mesalib/src/mesa/main/uniforms.h b/mesalib/src/mesa/main/uniforms.h index d7afdc106..c8b555cbe 100644 --- a/mesalib/src/mesa/main/uniforms.h +++ b/mesalib/src/mesa/main/uniforms.h @@ -300,6 +300,8 @@ _mesa_update_shader_textures_used(struct gl_shader_program *shProg, extern bool _mesa_sampler_uniforms_are_valid(const struct gl_shader_program *shProg, char *errMsg, size_t errMsgLength); +extern bool +_mesa_sampler_uniforms_pipeline_are_valid(struct gl_pipeline_object *); extern const struct gl_program_parameter * get_uniform_parameter(struct gl_shader_program *shProg, GLint index); diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c index b4b6fa9be..b88d70018 100644 --- a/mesalib/src/mesa/main/varray.c +++ b/mesalib/src/mesa/main/varray.c @@ -1223,7 +1223,7 @@ _mesa_MultiDrawArrays( GLenum mode, const GLint *first, for (i = 0; i < primcount; i++) { if (count[i] > 0) { - CALL_DrawArrays(ctx->Exec, (mode, first[i], count[i])); + CALL_DrawArrays(ctx->CurrentDispatch, (mode, first[i], count[i])); } } } @@ -1243,7 +1243,7 @@ _mesa_MultiModeDrawArraysIBM( const GLenum * mode, const GLint * first, for ( i = 0 ; i < primcount ; i++ ) { if ( count[i] > 0 ) { GLenum m = *((GLenum *) ((GLubyte *) mode + i * modestride)); - CALL_DrawArrays(ctx->Exec, ( m, first[i], count[i] )); + CALL_DrawArrays(ctx->CurrentDispatch, ( m, first[i], count[i] )); } } } @@ -1265,7 +1265,8 @@ _mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count, for ( i = 0 ; i < primcount ; i++ ) { if ( count[i] > 0 ) { GLenum m = *((GLenum *) ((GLubyte *) mode + i * modestride)); - CALL_DrawElements(ctx->Exec, ( m, count[i], type, indices[i] )); + CALL_DrawElements(ctx->CurrentDispatch, ( m, count[i], type, + indices[i] )); } } } diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp index 9919874a6..95987107f 100644 --- a/mesalib/src/mesa/program/ir_to_mesa.cpp +++ b/mesalib/src/mesa/program/ir_to_mesa.cpp @@ -2917,7 +2917,7 @@ get_mesa_program(struct gl_context *ctx, set_branchtargets(&v, mesa_instructions, num_instructions); - if (ctx->Shader.Flags & GLSL_DUMP) { + if (ctx->_Shader->Flags & GLSL_DUMP) { fprintf(stderr, "\n"); fprintf(stderr, "GLSL IR for linked %s program %d:\n", target_string, shader_program->Name); @@ -2953,7 +2953,7 @@ get_mesa_program(struct gl_context *ctx, _mesa_reference_program(ctx, &shader->Program, prog); - if ((ctx->Shader.Flags & GLSL_NO_OPT) == 0) { + if ((ctx->_Shader->Flags & GLSL_NO_OPT) == 0) { _mesa_optimize_program(ctx, prog); } @@ -3096,7 +3096,7 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) } } - if (ctx->Shader.Flags & GLSL_DUMP) { + if (ctx->_Shader->Flags & GLSL_DUMP) { if (!prog->LinkStatus) { fprintf(stderr, "GLSL shader program %d failed to link\n", prog->Name); } diff --git a/mesalib/src/mesa/state_tracker/st_atom_clip.c b/mesalib/src/mesa/state_tracker/st_atom_clip.c index 274b36a62..f82c1332a 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_clip.c +++ b/mesalib/src/mesa/state_tracker/st_atom_clip.c @@ -52,7 +52,7 @@ static void update_clip( struct st_context *st ) /* if we have a vertex shader that writes clip vertex we need to pass the pre-projection transformed coordinates into the driver. */ if (st->vp) { - if (ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX]) + if (ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX]) use_eye = TRUE; } diff --git a/mesalib/src/mesa/state_tracker/st_atom_constbuf.c b/mesalib/src/mesa/state_tracker/st_atom_constbuf.c index a5013ed2c..7984bf742 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_constbuf.c +++ b/mesalib/src/mesa/state_tracker/st_atom_constbuf.c @@ -219,7 +219,7 @@ static void st_bind_ubos(struct st_context *st, static void bind_vs_ubos(struct st_context *st) { struct gl_shader_program *prog = - st->ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX]; + st->ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX]; if (!prog) return; @@ -239,7 +239,7 @@ const struct st_tracked_state st_bind_vs_ubos = { static void bind_fs_ubos(struct st_context *st) { struct gl_shader_program *prog = - st->ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT]; + st->ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT]; if (!prog) return; @@ -259,7 +259,7 @@ const struct st_tracked_state st_bind_fs_ubos = { static void bind_gs_ubos(struct st_context *st) { struct gl_shader_program *prog = - st->ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]; + st->ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]; if (!prog) return; diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c index 75e6face4..c9bffce4f 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_texture.c +++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c @@ -50,91 +50,165 @@ /** - * Combine depth texture mode with "swizzle" so that depth mode swizzling - * takes place before texture swizzling, and return the resulting swizzle. - * If the format is not a depth format, return "swizzle" unchanged. - * - * \param format PIPE_FORMAT_*. - * \param swizzle Texture swizzle, a bitmask computed using MAKE_SWIZZLE4. - * \param depthmode One of GL_LUMINANCE, GL_INTENSITY, GL_ALPHA, GL_RED. + * Return swizzle1(swizzle2) */ -static GLuint -apply_depthmode(enum pipe_format format, GLuint swizzle, GLenum depthmode) +static unsigned +swizzle_swizzle(unsigned swizzle1, unsigned swizzle2) { - const struct util_format_description *desc = - util_format_description(format); - unsigned char swiz[4]; - unsigned i; - - if (desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS || - desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_NONE) { - /* Not a depth format. */ - return swizzle; + unsigned i, swz[4]; + + for (i = 0; i < 4; i++) { + unsigned s = GET_SWZ(swizzle1, i); + switch (s) { + case SWIZZLE_X: + case SWIZZLE_Y: + case SWIZZLE_Z: + case SWIZZLE_W: + swz[i] = GET_SWZ(swizzle2, s); + break; + case SWIZZLE_ZERO: + swz[i] = SWIZZLE_ZERO; + break; + case SWIZZLE_ONE: + swz[i] = SWIZZLE_ONE; + break; + default: + assert(!"Bad swizzle term"); + swz[i] = SWIZZLE_X; + } } - for (i = 0; i < 4; i++) - swiz[i] = GET_SWZ(swizzle, i); + return MAKE_SWIZZLE4(swz[0], swz[1], swz[2], swz[3]); +} - switch (depthmode) { - case GL_LUMINANCE: - /* Rewrite reads from W to ONE, and reads from XYZ to XXX. */ - for (i = 0; i < 4; i++) - if (swiz[i] == SWIZZLE_W) - swiz[i] = SWIZZLE_ONE; - else if (swiz[i] < SWIZZLE_W) - swiz[i] = SWIZZLE_X; - break; +/** + * Given a user-specified texture base format, the actual gallium texture + * format and the current GL_DEPTH_MODE, return a texture swizzle. + * + * Consider the case where the user requests a GL_RGB internal texture + * format the driver actually uses an RGBA format. The A component should + * be ignored and sampling from the texture should always return (r,g,b,1). + * But if we rendered to the texture we might have written A values != 1. + * By sampling the texture with a ".xyz1" swizzle we'll get the expected A=1. + * This function computes the texture swizzle needed to get the expected + * values. + * + * In the case of depth textures, the GL_DEPTH_MODE state determines the + * texture swizzle. + * + * This result must be composed with the user-specified swizzle to get + * the final swizzle. + */ +static unsigned +compute_texture_format_swizzle(GLenum baseFormat, GLenum depthMode, + enum pipe_format actualFormat) +{ + switch (baseFormat) { + case GL_RGBA: + return SWIZZLE_XYZW; + case GL_RGB: + if (util_format_has_alpha(actualFormat)) + return MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ONE); + else + return SWIZZLE_XYZW; + case GL_RG: + if (util_format_get_nr_components(actualFormat) > 2) + return MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_ZERO, SWIZZLE_ONE); + else + return SWIZZLE_XYZW; + case GL_RED: + if (util_format_get_nr_components(actualFormat) > 1) + return MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_ZERO, + SWIZZLE_ZERO, SWIZZLE_ONE); + else + return SWIZZLE_XYZW; + case GL_ALPHA: + if (util_format_get_nr_components(actualFormat) > 1) + return MAKE_SWIZZLE4(SWIZZLE_ZERO, SWIZZLE_ZERO, + SWIZZLE_ZERO, SWIZZLE_W); + else + return SWIZZLE_XYZW; + case GL_LUMINANCE: + if (util_format_get_nr_components(actualFormat) > 1) + return MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_ONE); + else + return SWIZZLE_XYZW; + case GL_LUMINANCE_ALPHA: + if (util_format_get_nr_components(actualFormat) > 2) + return MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_W); + else + return SWIZZLE_XYZW; + case GL_INTENSITY: + if (util_format_get_nr_components(actualFormat) > 1) + return SWIZZLE_XXXX; + else + return SWIZZLE_XYZW; + case GL_STENCIL_INDEX: + return SWIZZLE_XYZW; + case GL_DEPTH_STENCIL: + /* fall-through */ + case GL_DEPTH_COMPONENT: + /* Now examine the depth mode */ + switch (depthMode) { + case GL_LUMINANCE: + return MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_ONE); case GL_INTENSITY: - /* Rewrite reads from XYZW to XXXX. */ - for (i = 0; i < 4; i++) - if (swiz[i] <= SWIZZLE_W) - swiz[i] = SWIZZLE_X; - break; - + return MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X); case GL_ALPHA: - /* Rewrite reads from W to X, and reads from XYZ to 000. */ - for (i = 0; i < 4; i++) - if (swiz[i] == SWIZZLE_W) - swiz[i] = SWIZZLE_X; - else if (swiz[i] < SWIZZLE_W) - swiz[i] = SWIZZLE_ZERO; - break; + return MAKE_SWIZZLE4(SWIZZLE_ZERO, SWIZZLE_ZERO, + SWIZZLE_ZERO, SWIZZLE_X); case GL_RED: - /* Rewrite reads W to 1, XYZ to X00 */ - for (i = 0; i < 4; i++) - if (swiz[i] == SWIZZLE_W) - swiz[i] = SWIZZLE_ONE; - else if (swiz[i] == SWIZZLE_Y || swiz[i] == SWIZZLE_Z) - swiz[i] = SWIZZLE_ZERO; - break; + return MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_ZERO, + SWIZZLE_ZERO, SWIZZLE_ONE); + default: + assert(!"Unexpected depthMode"); + return SWIZZLE_XYZW; + } + default: + assert(!"Unexpected baseFormat"); + return SWIZZLE_XYZW; } - - return MAKE_SWIZZLE4(swiz[0], swiz[1], swiz[2], swiz[3]); } +static unsigned +get_texture_format_swizzle(const struct st_texture_object *stObj) +{ + const struct gl_texture_image *texImage = + stObj->base.Image[0][stObj->base.BaseLevel]; + unsigned tex_swizzle; + + if (texImage) { + tex_swizzle = compute_texture_format_swizzle(texImage->_BaseFormat, + stObj->base.DepthMode, + stObj->pt->format); + } + else { + tex_swizzle = SWIZZLE_XYZW; + } + + /* Combine the texture format swizzle with user's swizzle */ + return swizzle_swizzle(stObj->base._Swizzle, tex_swizzle); +} + + /** - * Return TRUE if the swizzling described by "swizzle" and - * "depthmode" (for depth textures only) is different from the swizzling - * set in the given sampler view. + * Return TRUE if the texture's sampler view swizzle is equal to + * the texture's swizzle. * - * \param sv A sampler view. - * \param swizzle Texture swizzle, a bitmask computed using MAKE_SWIZZLE4. - * \param depthmode One of GL_LUMINANCE, GL_INTENSITY, GL_ALPHA. + * \param stObj the st texture object, */ static boolean -check_sampler_swizzle(struct pipe_sampler_view *sv, - GLuint swizzle, GLenum depthmode) +check_sampler_swizzle(const struct st_texture_object *stObj) { - swizzle = apply_depthmode(sv->texture->format, swizzle, depthmode); - - if ((sv->swizzle_r != GET_SWZ(swizzle, 0)) || - (sv->swizzle_g != GET_SWZ(swizzle, 1)) || - (sv->swizzle_b != GET_SWZ(swizzle, 2)) || - (sv->swizzle_a != GET_SWZ(swizzle, 3))) - return TRUE; - return FALSE; + const struct pipe_sampler_view *sv = stObj->sampler_view; + unsigned swizzle = get_texture_format_swizzle(stObj); + + return ((sv->swizzle_r != GET_SWZ(swizzle, 0)) || + (sv->swizzle_g != GET_SWZ(swizzle, 1)) || + (sv->swizzle_b != GET_SWZ(swizzle, 2)) || + (sv->swizzle_a != GET_SWZ(swizzle, 3))); } @@ -145,9 +219,7 @@ st_create_texture_sampler_view_from_stobj(struct pipe_context *pipe, enum pipe_format format) { struct pipe_sampler_view templ; - GLuint swizzle = apply_depthmode(stObj->pt->format, - stObj->base._Swizzle, - stObj->base.DepthMode); + unsigned swizzle = get_texture_format_swizzle(stObj); u_sampler_view_default_template(&templ, stObj->pt, @@ -260,9 +332,7 @@ update_single_texture(struct st_context *st, /* if sampler view has changed dereference it */ if (stObj->sampler_view) { - if (check_sampler_swizzle(stObj->sampler_view, - stObj->base._Swizzle, - stObj->base.DepthMode) || + if (check_sampler_swizzle(stObj) || (view_format != stObj->sampler_view->format) || stObj->base.BaseLevel != stObj->sampler_view->u.tex.first_level) { pipe_sampler_view_release(pipe, &stObj->sampler_view); diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c index 2b3636151..6119cc275 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c @@ -1364,7 +1364,7 @@ blit_copy_pixels(struct gl_context *ctx, GLint srcx, GLint srcy, !ctx->Stencil.Enabled && !ctx->FragmentProgram.Enabled && !ctx->VertexProgram.Enabled && - !ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT] && + !ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT] && ctx->DrawBuffer->_NumColorDrawBuffers == 1 && !ctx->Query.CondRenderQuery && !ctx->Query.CurrentOcclusionObject) { diff --git a/mesalib/src/mesa/state_tracker/st_cb_queryobj.c b/mesalib/src/mesa/state_tracker/st_cb_queryobj.c index 5186a5157..78a737094 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_queryobj.c +++ b/mesalib/src/mesa/state_tracker/st_cb_queryobj.c @@ -141,7 +141,13 @@ st_BeginQuery(struct gl_context *ctx, struct gl_query_object *q) stq->pq = pipe->create_query(pipe, type); stq->type = type; } - pipe->begin_query(pipe, stq->pq); + if (stq->pq) { + pipe->begin_query(pipe, stq->pq); + } + else { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBeginQuery"); + return; + } } assert(stq->type == type); } @@ -162,7 +168,8 @@ st_EndQuery(struct gl_context *ctx, struct gl_query_object *q) stq->type = PIPE_QUERY_TIMESTAMP; } - pipe->end_query(pipe, stq->pq); + if (stq->pq) + pipe->end_query(pipe, stq->pq); } @@ -171,6 +178,13 @@ get_query_result(struct pipe_context *pipe, struct st_query_object *stq, boolean wait) { + if (!stq->pq) { + /* Only needed in case we failed to allocate the gallium query earlier. + * Return TRUE so we don't spin on this forever. + */ + return TRUE; + } + if (!pipe->get_query_result(pipe, stq->pq, wait, diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c index 0ffc76263..807a86fdf 100644 --- a/mesalib/src/mesa/state_tracker/st_context.c +++ b/mesalib/src/mesa/state_tracker/st_context.c @@ -33,6 +33,7 @@ #include "main/shaderobj.h" #include "main/version.h" #include "main/vtxfmt.h" +#include "main/hash.h" #include "program/prog_cache.h" #include "vbo/vbo.h" #include "glapi/glapi.h" @@ -66,6 +67,7 @@ #include "st_gen_mipmap.h" #include "st_program.h" #include "st_vdpau.h" +#include "st_texture.h" #include "pipe/p_context.h" #include "util/u_inlines.h" #include "util/u_upload_mgr.h" @@ -280,6 +282,19 @@ static void st_destroy_context_priv( struct st_context *st ) free( st ); } + +/** + * Callback to release the sampler view attached to a texture object. + * Called by _mesa_HashWalk(). + */ +static void +destroy_tex_sampler_cb(GLuint id, void *data, void *userData) +{ + struct gl_texture_object *texObj = (struct gl_texture_object *) data; + struct st_context *st = (struct st_context *) userData; + + st_texture_release_sampler_view(st, st_texture_object(texObj)); +} void st_destroy_context( struct st_context *st ) { @@ -288,6 +303,8 @@ void st_destroy_context( struct st_context *st ) struct gl_context *ctx = st->ctx; GLuint i; + _mesa_HashWalk(ctx->Shared->TexObjects, destroy_tex_sampler_cb, st); + /* need to unbind and destroy CSO objects before anything else */ cso_release_all(st->cso_context); diff --git a/mesalib/src/mesa/state_tracker/st_draw.c b/mesalib/src/mesa/state_tracker/st_draw.c index dba5870a0..c8189faad 100644 --- a/mesalib/src/mesa/state_tracker/st_draw.c +++ b/mesalib/src/mesa/state_tracker/st_draw.c @@ -131,7 +131,7 @@ setup_index_buffer(struct st_context *st, static void check_uniforms(struct gl_context *ctx) { - struct gl_shader_program **shProg = ctx->Shader.CurrentProgram; + struct gl_shader_program **shProg = ctx->_Shader->CurrentProgram; unsigned j; for (j = 0; j < 3; j++) { diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index a9e75d8a6..f019a55c2 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -5198,7 +5198,7 @@ get_mesa_program(struct gl_context *ctx, /* Write the END instruction. */ v->emit(NULL, TGSI_OPCODE_END); - if (ctx->Shader.Flags & GLSL_DUMP) { + if (ctx->_Shader->Flags & GLSL_DUMP) { printf("\n"); printf("GLSL IR for linked %s program %d:\n", _mesa_shader_stage_to_string(shader->Stage), diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c index 692a57008..2f0ec32f5 100644 --- a/mesalib/src/mesa/state_tracker/st_program.c +++ b/mesalib/src/mesa/state_tracker/st_program.c @@ -1204,7 +1204,7 @@ st_get_gp_variant(struct st_context *st, void st_print_shaders(struct gl_context *ctx) { - struct gl_shader_program **shProg = ctx->Shader.CurrentProgram; + struct gl_shader_program **shProg = ctx->_Shader->CurrentProgram; unsigned j; for (j = 0; j < 3; j++) { diff --git a/mesalib/src/mesa/state_tracker/st_texture.c b/mesalib/src/mesa/state_tracker/st_texture.c index b5ccc76d4..a3b345356 100644 --- a/mesalib/src/mesa/state_tracker/st_texture.c +++ b/mesalib/src/mesa/state_tracker/st_texture.c @@ -412,3 +412,10 @@ st_create_color_map_texture(struct gl_context *ctx) return pt; } +void +st_texture_release_sampler_view(struct st_context *st, + struct st_texture_object *stObj) +{ + if (stObj->sampler_view && stObj->sampler_view->context == st->pipe) + pipe_sampler_view_reference(&stObj->sampler_view, NULL); +} diff --git a/mesalib/src/mesa/state_tracker/st_texture.h b/mesalib/src/mesa/state_tracker/st_texture.h index bce2a0934..b4a27a00a 100644 --- a/mesalib/src/mesa/state_tracker/st_texture.h +++ b/mesalib/src/mesa/state_tracker/st_texture.h @@ -227,4 +227,8 @@ st_texture_image_copy(struct pipe_context *pipe, extern struct pipe_resource * st_create_color_map_texture(struct gl_context *ctx); +extern void +st_texture_release_sampler_view(struct st_context *st, + struct st_texture_object *stObj); + #endif diff --git a/mesalib/src/mesa/swrast/s_fragprog.c b/mesalib/src/mesa/swrast/s_fragprog.c index fa45fa97a..21699f3ea 100644 --- a/mesalib/src/mesa/swrast/s_fragprog.c +++ b/mesalib/src/mesa/swrast/s_fragprog.c @@ -182,7 +182,7 @@ init_machine(struct gl_context *ctx, struct gl_program_machine *machine, machine->Samplers = program->Base.SamplerUnits; /* if running a GLSL program (not ARB_fragment_program) */ - if (ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT]) { + if (ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT]) { /* Store front/back facing value */ machine->Attribs[VARYING_SLOT_FACE][col][0] = 1.0F - span->facing; } -- cgit v1.2.3