aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src')
-rw-r--r--mesalib/src/glsl/ast_to_hir.cpp13
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.h4
-rw-r--r--mesalib/src/glsl/ir_print_visitor.cpp45
-rw-r--r--mesalib/src/glsl/ir_print_visitor.h177
-rw-r--r--mesalib/src/glsl/ir_validate.cpp15
-rw-r--r--mesalib/src/glsl/ir_variable.cpp1085
-rw-r--r--mesalib/src/mapi/glapi/gen/GL3x.xml4
-rw-r--r--mesalib/src/mapi/glapi/glapi_mapi_tmp.h6
-rw-r--r--mesalib/src/mapi/glapi/glapitable.h2
-rw-r--r--mesalib/src/mapi/glapi/glapitemp.h2
-rw-r--r--mesalib/src/mesa/main/api_arrayelt.c272
-rw-r--r--mesalib/src/mesa/main/compiler.h30
-rw-r--r--mesalib/src/mesa/main/dlist.c2
-rw-r--r--mesalib/src/mesa/main/glapidispatch.h2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_blit.c3
15 files changed, 873 insertions, 789 deletions
diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp
index 344d76b57..5e1851c11 100644
--- a/mesalib/src/glsl/ast_to_hir.cpp
+++ b/mesalib/src/glsl/ast_to_hir.cpp
@@ -1577,7 +1577,7 @@ ast_expression::hir(exec_list *instructions,
*/
ir_variable *v = array->whole_variable_referenced();
if (v != NULL)
- v->max_array_access = array->type->array_size();
+ v->max_array_access = array->type->array_size() - 1;
}
}
@@ -2676,17 +2676,24 @@ ast_declarator_list::hir(exec_list *instructions,
* preceded by one of these precision qualifiers [...] Literal
* constants do not have precision qualifiers. Neither do Boolean
* variables.
+ *
+ * In GLSL ES, sampler types are also allowed.
+ *
+ * From page 87 of the GLSL ES spec:
+ * "RESOLUTION: Allow sampler types to take a precision qualifier."
*/
if (this->type->specifier->precision != ast_precision_none
&& !var->type->is_float()
&& !var->type->is_integer()
+ && !(var->type->is_sampler() && state->es_shader)
&& !(var->type->is_array()
&& (var->type->fields.array->is_float()
|| var->type->fields.array->is_integer()))) {
_mesa_glsl_error(&loc, state,
- "precision qualifiers apply only to floating point "
- "and integer types");
+ "precision qualifiers apply only to floating point"
+ "%s types", state->es_shader ? ", integer, and sampler"
+ : "and integer");
}
/* Process the initializer and add its instructions to a temporary
diff --git a/mesalib/src/glsl/glsl_parser_extras.h b/mesalib/src/glsl/glsl_parser_extras.h
index 6351413f1..59515b5c3 100644
--- a/mesalib/src/glsl/glsl_parser_extras.h
+++ b/mesalib/src/glsl/glsl_parser_extras.h
@@ -272,8 +272,8 @@ extern "C" {
extern int preprocess(void *ctx, const char **shader, char **info_log,
const struct gl_extensions *extensions, int api);
-extern void _mesa_destroy_shader_compiler();
-extern void _mesa_destroy_shader_compiler_caches();
+extern void _mesa_destroy_shader_compiler(void);
+extern void _mesa_destroy_shader_compiler_caches(void);
#ifdef __cplusplus
}
diff --git a/mesalib/src/glsl/ir_print_visitor.cpp b/mesalib/src/glsl/ir_print_visitor.cpp
index 3c5c4fd20..ba95103ea 100644
--- a/mesalib/src/glsl/ir_print_visitor.cpp
+++ b/mesalib/src/glsl/ir_print_visitor.cpp
@@ -25,6 +25,10 @@
#include "glsl_types.h"
#include "glsl_parser_extras.h"
+extern "C" {
+#include "program/hash_table.h"
+}
+
static void print_type(const glsl_type *t);
void
@@ -67,6 +71,21 @@ _mesa_print_ir(exec_list *instructions,
printf("\n)");
}
+ir_print_visitor::ir_print_visitor()
+{
+ indentation = 0;
+ printable_names =
+ hash_table_ctor(32, hash_table_pointer_hash, hash_table_pointer_compare);
+ symbols = _mesa_symbol_table_ctor();
+ mem_ctx = ralloc_context(NULL);
+}
+
+ir_print_visitor::~ir_print_visitor()
+{
+ hash_table_dtor(printable_names);
+ _mesa_symbol_table_dtor(symbols);
+ ralloc_free(mem_ctx);
+}
void ir_print_visitor::indent(void)
{
@@ -74,6 +93,26 @@ void ir_print_visitor::indent(void)
printf(" ");
}
+const char *
+ir_print_visitor::unique_name(ir_variable *var)
+{
+ /* Do we already have a name for this variable? */
+ const char *name = (const char *) hash_table_find(this->printable_names, var);
+ if (name != NULL)
+ return name;
+
+ /* If there's no conflict, just use the original name */
+ if (_mesa_symbol_table_find_symbol(this->symbols, -1, var->name) == NULL) {
+ name = var->name;
+ } else {
+ static unsigned i = 1;
+ name = ralloc_asprintf(this->mem_ctx, "%s@%u", var->name, ++i);
+ }
+ hash_table_insert(this->printable_names, (void *) name, var);
+ _mesa_symbol_table_add_symbol(this->symbols, -1, name, var);
+ return name;
+}
+
static void
print_type(const glsl_type *t)
{
@@ -104,12 +143,13 @@ void ir_print_visitor::visit(ir_variable *ir)
cent, inv, mode[ir->mode], interp[ir->interpolation]);
print_type(ir->type);
- printf(" %s@%p)", ir->name, (void *) ir);
+ printf(" %s)", unique_name(ir));
}
void ir_print_visitor::visit(ir_function_signature *ir)
{
+ _mesa_symbol_table_push_scope(symbols);
printf("(signature ");
indentation++;
@@ -148,6 +188,7 @@ void ir_print_visitor::visit(ir_function_signature *ir)
indent();
printf("))\n");
indentation--;
+ _mesa_symbol_table_pop_scope(symbols);
}
@@ -265,7 +306,7 @@ void ir_print_visitor::visit(ir_swizzle *ir)
void ir_print_visitor::visit(ir_dereference_variable *ir)
{
ir_variable *var = ir->variable_referenced();
- printf("(var_ref %s@%p) ", var->name, (void *) var);
+ printf("(var_ref %s) ", unique_name(var));
}
diff --git a/mesalib/src/glsl/ir_print_visitor.h b/mesalib/src/glsl/ir_print_visitor.h
index 4feeb8c18..ec4d00843 100644
--- a/mesalib/src/glsl/ir_print_visitor.h
+++ b/mesalib/src/glsl/ir_print_visitor.h
@@ -1,83 +1,94 @@
-/* -*- c++ -*- */
-/*
- * Copyright © 2010 Intel Corporation
- *
- * 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
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * 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 NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS 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.
- */
-
-#pragma once
-#ifndef IR_PRINT_VISITOR_H
-#define IR_PRINT_VISITOR_H
-
-#include "ir.h"
-#include "ir_visitor.h"
-
-extern void _mesa_print_ir(exec_list *instructions,
- struct _mesa_glsl_parse_state *state);
-
-/**
- * Abstract base class of visitors of IR instruction trees
- */
-class ir_print_visitor : public ir_visitor {
-public:
- ir_print_visitor()
- {
- indentation = 0;
- }
-
- virtual ~ir_print_visitor()
- {
- /* empty */
- }
-
- void indent(void);
-
- /**
- * \name Visit methods
- *
- * As typical for the visitor pattern, there must be one \c visit method for
- * each concrete subclass of \c ir_instruction. Virtual base classes within
- * the hierarchy should not have \c visit methods.
- */
- /*@{*/
- virtual void visit(ir_variable *);
- virtual void visit(ir_function_signature *);
- virtual void visit(ir_function *);
- virtual void visit(ir_expression *);
- virtual void visit(ir_texture *);
- virtual void visit(ir_swizzle *);
- virtual void visit(ir_dereference_variable *);
- virtual void visit(ir_dereference_array *);
- virtual void visit(ir_dereference_record *);
- virtual void visit(ir_assignment *);
- virtual void visit(ir_constant *);
- virtual void visit(ir_call *);
- virtual void visit(ir_return *);
- virtual void visit(ir_discard *);
- virtual void visit(ir_if *);
- virtual void visit(ir_loop *);
- virtual void visit(ir_loop_jump *);
- /*@}*/
-
-private:
- int indentation;
-};
-
-#endif /* IR_PRINT_VISITOR_H */
+/* -*- c++ -*- */
+/*
+ * Copyright © 2010 Intel Corporation
+ *
+ * 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
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * 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 NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ */
+
+#pragma once
+#ifndef IR_PRINT_VISITOR_H
+#define IR_PRINT_VISITOR_H
+
+#include "ir.h"
+#include "ir_visitor.h"
+
+extern "C" {
+#include "program/symbol_table.h"
+}
+
+extern void _mesa_print_ir(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state);
+
+/**
+ * Abstract base class of visitors of IR instruction trees
+ */
+class ir_print_visitor : public ir_visitor {
+public:
+ ir_print_visitor();
+ virtual ~ir_print_visitor();
+
+ void indent(void);
+
+ /**
+ * \name Visit methods
+ *
+ * As typical for the visitor pattern, there must be one \c visit method for
+ * each concrete subclass of \c ir_instruction. Virtual base classes within
+ * the hierarchy should not have \c visit methods.
+ */
+ /*@{*/
+ virtual void visit(ir_variable *);
+ virtual void visit(ir_function_signature *);
+ virtual void visit(ir_function *);
+ virtual void visit(ir_expression *);
+ virtual void visit(ir_texture *);
+ virtual void visit(ir_swizzle *);
+ virtual void visit(ir_dereference_variable *);
+ virtual void visit(ir_dereference_array *);
+ virtual void visit(ir_dereference_record *);
+ virtual void visit(ir_assignment *);
+ virtual void visit(ir_constant *);
+ virtual void visit(ir_call *);
+ virtual void visit(ir_return *);
+ virtual void visit(ir_discard *);
+ virtual void visit(ir_if *);
+ virtual void visit(ir_loop *);
+ virtual void visit(ir_loop_jump *);
+ /*@}*/
+
+private:
+ /**
+ * Fetch/generate a unique name for ir_variable.
+ *
+ * GLSL IR permits multiple ir_variables to share the same name. This works
+ * fine until we try to print it, when we really need a unique one.
+ */
+ const char *unique_name(ir_variable *var);
+
+ /** A mapping from ir_variable * -> unique printable names. */
+ hash_table *printable_names;
+ _mesa_symbol_table *symbols;
+
+ void *mem_ctx;
+
+ int indentation;
+};
+
+#endif /* IR_PRINT_VISITOR_H */
diff --git a/mesalib/src/glsl/ir_validate.cpp b/mesalib/src/glsl/ir_validate.cpp
index fe6ef8145..7757f5ecd 100644
--- a/mesalib/src/glsl/ir_validate.cpp
+++ b/mesalib/src/glsl/ir_validate.cpp
@@ -473,6 +473,21 @@ ir_validate::visit(ir_variable *ir)
assert(ralloc_parent(ir->name) == ir);
hash_table_insert(ht, ir, ir);
+
+
+ /* If a variable is an array, verify that the maximum array index is in
+ * bounds. There was once an error in AST-to-HIR conversion that set this
+ * to be out of bounds.
+ */
+ if (ir->type->array_size() > 0) {
+ if (ir->max_array_access >= ir->type->length) {
+ printf("ir_variable has maximum access out of bounds (%d vs %d)\n",
+ ir->max_array_access, ir->type->length - 1);
+ ir->print();
+ abort();
+ }
+ }
+
return visit_continue;
}
diff --git a/mesalib/src/glsl/ir_variable.cpp b/mesalib/src/glsl/ir_variable.cpp
index 18a3e0fb0..a9a2e4c70 100644
--- a/mesalib/src/glsl/ir_variable.cpp
+++ b/mesalib/src/glsl/ir_variable.cpp
@@ -1,541 +1,544 @@
-/*
- * Copyright © 2010 Intel Corporation
- *
- * 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
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * 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 NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS 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.
- */
-
-#include "ir.h"
-#include "glsl_parser_extras.h"
-#include "glsl_symbol_table.h"
-#include "builtin_variables.h"
-
-static void generate_ARB_draw_buffers_variables(exec_list *,
- struct _mesa_glsl_parse_state *,
- bool, _mesa_glsl_parser_targets);
-
-static void
-generate_ARB_draw_instanced_variables(exec_list *,
- struct _mesa_glsl_parse_state *,
- bool, _mesa_glsl_parser_targets);
-
-static ir_variable *
-add_variable(const char *name, enum ir_variable_mode mode, int slot,
- const glsl_type *type, exec_list *instructions,
- glsl_symbol_table *symtab)
-{
- ir_variable *var = new(symtab) ir_variable(type, name, mode);
-
- switch (var->mode) {
- case ir_var_auto:
- case ir_var_in:
- case ir_var_const_in:
- case ir_var_uniform:
- case ir_var_system_value:
- var->read_only = true;
- break;
- case ir_var_inout:
- case ir_var_out:
- break;
- default:
- assert(0);
- break;
- }
-
- var->location = slot;
- var->explicit_location = (slot >= 0);
-
- /* Once the variable is created an initialized, add it to the symbol table
- * and add the declaration to the IR stream.
- */
- instructions->push_tail(var);
-
- symtab->add_variable(var);
- return var;
-}
-
-static ir_variable *
-add_uniform(exec_list *instructions,
- struct _mesa_glsl_parse_state *state,
- const char *name, const glsl_type *type)
-{
- return add_variable(name, ir_var_uniform, -1, type, instructions,
- state->symbols);
-}
-
-static void
-add_builtin_variable(const builtin_variable *proto, exec_list *instructions,
- glsl_symbol_table *symtab)
-{
- /* Create a new variable declaration from the description supplied by
- * the caller.
- */
- const glsl_type *const type = symtab->get_type(proto->type);
-
- assert(type != NULL);
-
- add_variable(proto->name, proto->mode, proto->slot, type, instructions,
- symtab);
-}
-
-static void
-add_builtin_constant(exec_list *instructions,
- struct _mesa_glsl_parse_state *state,
- const char *name, int value)
-{
- ir_variable *const var = add_variable(name, ir_var_auto,
- -1, glsl_type::int_type,
- instructions, state->symbols);
- var->constant_value = new(var) ir_constant(value);
-}
-
-/* Several constants in GLSL ES have different names than normal desktop GLSL.
- * Therefore, this function should only be called on the ES path.
- */
-static void
-generate_100ES_uniforms(exec_list *instructions,
- struct _mesa_glsl_parse_state *state)
-{
- add_builtin_constant(instructions, state, "gl_MaxVertexAttribs",
- state->Const.MaxVertexAttribs);
- add_builtin_constant(instructions, state, "gl_MaxVertexUniformVectors",
- state->Const.MaxVertexUniformComponents);
- add_builtin_constant(instructions, state, "gl_MaxVaryingVectors",
- state->Const.MaxVaryingFloats / 4);
- add_builtin_constant(instructions, state, "gl_MaxVertexTextureImageUnits",
- state->Const.MaxVertexTextureImageUnits);
- add_builtin_constant(instructions, state, "gl_MaxCombinedTextureImageUnits",
- state->Const.MaxCombinedTextureImageUnits);
- add_builtin_constant(instructions, state, "gl_MaxTextureImageUnits",
- state->Const.MaxTextureImageUnits);
- add_builtin_constant(instructions, state, "gl_MaxFragmentUniformVectors",
- state->Const.MaxFragmentUniformComponents);
-
- add_uniform(instructions, state, "gl_DepthRange",
- state->symbols->get_type("gl_DepthRangeParameters"));
-}
-
-static void
-generate_110_uniforms(exec_list *instructions,
- struct _mesa_glsl_parse_state *state)
-{
- for (unsigned i = 0
- ; i < Elements(builtin_110_deprecated_uniforms)
- ; i++) {
- add_builtin_variable(& builtin_110_deprecated_uniforms[i],
- instructions, state->symbols);
- }
-
- add_builtin_constant(instructions, state, "gl_MaxLights",
- state->Const.MaxLights);
- add_builtin_constant(instructions, state, "gl_MaxClipPlanes",
- state->Const.MaxClipPlanes);
- add_builtin_constant(instructions, state, "gl_MaxTextureUnits",
- state->Const.MaxTextureUnits);
- add_builtin_constant(instructions, state, "gl_MaxTextureCoords",
- state->Const.MaxTextureCoords);
- add_builtin_constant(instructions, state, "gl_MaxVertexAttribs",
- state->Const.MaxVertexAttribs);
- add_builtin_constant(instructions, state, "gl_MaxVertexUniformComponents",
- state->Const.MaxVertexUniformComponents);
- add_builtin_constant(instructions, state, "gl_MaxVaryingFloats",
- state->Const.MaxVaryingFloats);
- add_builtin_constant(instructions, state, "gl_MaxVertexTextureImageUnits",
- state->Const.MaxVertexTextureImageUnits);
- add_builtin_constant(instructions, state, "gl_MaxCombinedTextureImageUnits",
- state->Const.MaxCombinedTextureImageUnits);
- add_builtin_constant(instructions, state, "gl_MaxTextureImageUnits",
- state->Const.MaxTextureImageUnits);
- add_builtin_constant(instructions, state, "gl_MaxFragmentUniformComponents",
- state->Const.MaxFragmentUniformComponents);
-
- const glsl_type *const mat4_array_type =
- glsl_type::get_array_instance(glsl_type::mat4_type,
- state->Const.MaxTextureCoords);
-
- add_uniform(instructions, state, "gl_TextureMatrix", mat4_array_type);
- add_uniform(instructions, state, "gl_TextureMatrixInverse", mat4_array_type);
- add_uniform(instructions, state, "gl_TextureMatrixTranspose", mat4_array_type);
- add_uniform(instructions, state, "gl_TextureMatrixInverseTranspose", mat4_array_type);
-
- add_uniform(instructions, state, "gl_DepthRange",
- state->symbols->get_type("gl_DepthRangeParameters"));
-
- add_uniform(instructions, state, "gl_ClipPlane",
- glsl_type::get_array_instance(glsl_type::vec4_type,
- state->Const.MaxClipPlanes));
- add_uniform(instructions, state, "gl_Point",
- state->symbols->get_type("gl_PointParameters"));
-
- const glsl_type *const material_parameters_type =
- state->symbols->get_type("gl_MaterialParameters");
- add_uniform(instructions, state, "gl_FrontMaterial", material_parameters_type);
- add_uniform(instructions, state, "gl_BackMaterial", material_parameters_type);
-
- const glsl_type *const light_source_array_type =
- glsl_type::get_array_instance(state->symbols->get_type("gl_LightSourceParameters"), state->Const.MaxLights);
-
- add_uniform(instructions, state, "gl_LightSource", light_source_array_type);
-
- const glsl_type *const light_model_products_type =
- state->symbols->get_type("gl_LightModelProducts");
- add_uniform(instructions, state, "gl_FrontLightModelProduct",
- light_model_products_type);
- add_uniform(instructions, state, "gl_BackLightModelProduct",
- light_model_products_type);
-
- const glsl_type *const light_products_type =
- glsl_type::get_array_instance(state->symbols->get_type("gl_LightProducts"),
- state->Const.MaxLights);
- add_uniform(instructions, state, "gl_FrontLightProduct", light_products_type);
- add_uniform(instructions, state, "gl_BackLightProduct", light_products_type);
-
- add_uniform(instructions, state, "gl_TextureEnvColor",
- glsl_type::get_array_instance(glsl_type::vec4_type,
- state->Const.MaxTextureUnits));
-
- const glsl_type *const texcoords_vec4 =
- glsl_type::get_array_instance(glsl_type::vec4_type,
- state->Const.MaxTextureCoords);
- add_uniform(instructions, state, "gl_EyePlaneS", texcoords_vec4);
- add_uniform(instructions, state, "gl_EyePlaneT", texcoords_vec4);
- add_uniform(instructions, state, "gl_EyePlaneR", texcoords_vec4);
- add_uniform(instructions, state, "gl_EyePlaneQ", texcoords_vec4);
- add_uniform(instructions, state, "gl_ObjectPlaneS", texcoords_vec4);
- add_uniform(instructions, state, "gl_ObjectPlaneT", texcoords_vec4);
- add_uniform(instructions, state, "gl_ObjectPlaneR", texcoords_vec4);
- add_uniform(instructions, state, "gl_ObjectPlaneQ", texcoords_vec4);
-
- add_uniform(instructions, state, "gl_Fog",
- state->symbols->get_type("gl_FogParameters"));
-}
-
-/* This function should only be called for ES, not desktop GL. */
-static void
-generate_100ES_vs_variables(exec_list *instructions,
- struct _mesa_glsl_parse_state *state)
-{
- for (unsigned i = 0; i < Elements(builtin_core_vs_variables); i++) {
- add_builtin_variable(& builtin_core_vs_variables[i],
- instructions, state->symbols);
- }
-
- generate_100ES_uniforms(instructions, state);
-
- generate_ARB_draw_buffers_variables(instructions, state, false,
- vertex_shader);
-}
-
-
-static void
-generate_110_vs_variables(exec_list *instructions,
- struct _mesa_glsl_parse_state *state)
-{
- for (unsigned i = 0; i < Elements(builtin_core_vs_variables); i++) {
- add_builtin_variable(& builtin_core_vs_variables[i],
- instructions, state->symbols);
- }
-
- for (unsigned i = 0
- ; i < Elements(builtin_110_deprecated_vs_variables)
- ; i++) {
- add_builtin_variable(& builtin_110_deprecated_vs_variables[i],
- instructions, state->symbols);
- }
- generate_110_uniforms(instructions, state);
-
- /* From page 54 (page 60 of the PDF) of the GLSL 1.20 spec:
- *
- * "As with all arrays, indices used to subscript gl_TexCoord must
- * either be an integral constant expressions, or this array must be
- * re-declared by the shader with a size. The size can be at most
- * gl_MaxTextureCoords. Using indexes close to 0 may aid the
- * implementation in preserving varying resources."
- */
- const glsl_type *const vec4_array_type =
- glsl_type::get_array_instance(glsl_type::vec4_type, 0);
-
- add_variable("gl_TexCoord", ir_var_out, VERT_RESULT_TEX0, vec4_array_type,
- instructions, state->symbols);
-
- generate_ARB_draw_buffers_variables(instructions, state, false,
- vertex_shader);
-}
-
-
-static void
-generate_120_vs_variables(exec_list *instructions,
- struct _mesa_glsl_parse_state *state)
-{
- /* GLSL version 1.20 did not add any built-in variables in the vertex
- * shader.
- */
- generate_110_vs_variables(instructions, state);
-}
-
-
-static void
-generate_130_vs_variables(exec_list *instructions,
- struct _mesa_glsl_parse_state *state)
-{
- generate_120_vs_variables(instructions, state);
-
- for (unsigned i = 0; i < Elements(builtin_130_vs_variables); i++) {
- add_builtin_variable(& builtin_130_vs_variables[i],
- instructions, state->symbols);
- }
-
- const glsl_type *const clip_distance_array_type =
- glsl_type::get_array_instance(glsl_type::float_type,
- state->Const.MaxClipPlanes);
-
- /* FINISHME: gl_ClipDistance needs a real location assigned. */
- add_variable("gl_ClipDistance", ir_var_out, -1, clip_distance_array_type,
- instructions, state->symbols);
-
-}
-
-
-static void
-initialize_vs_variables(exec_list *instructions,
- struct _mesa_glsl_parse_state *state)
-{
-
- switch (state->language_version) {
- case 100:
- generate_100ES_vs_variables(instructions, state);
- break;
- case 110:
- generate_110_vs_variables(instructions, state);
- break;
- case 120:
- generate_120_vs_variables(instructions, state);
- break;
- case 130:
- generate_130_vs_variables(instructions, state);
- break;
- }
-
- if (state->ARB_draw_instanced_enable)
- generate_ARB_draw_instanced_variables(instructions, state, false,
- vertex_shader);
-}
-
-
-/* This function should only be called for ES, not desktop GL. */
-static void
-generate_100ES_fs_variables(exec_list *instructions,
- struct _mesa_glsl_parse_state *state)
-{
- for (unsigned i = 0; i < Elements(builtin_core_fs_variables); i++) {
- add_builtin_variable(& builtin_core_fs_variables[i],
- instructions, state->symbols);
- }
-
- for (unsigned i = 0; i < Elements(builtin_100ES_fs_variables); i++) {
- add_builtin_variable(& builtin_100ES_fs_variables[i],
- instructions, state->symbols);
- }
-
- generate_100ES_uniforms(instructions, state);
-
- generate_ARB_draw_buffers_variables(instructions, state, false,
- fragment_shader);
-}
-
-static void
-generate_110_fs_variables(exec_list *instructions,
- struct _mesa_glsl_parse_state *state)
-{
- for (unsigned i = 0; i < Elements(builtin_core_fs_variables); i++) {
- add_builtin_variable(& builtin_core_fs_variables[i],
- instructions, state->symbols);
- }
-
- for (unsigned i = 0; i < Elements(builtin_110_fs_variables); i++) {
- add_builtin_variable(& builtin_110_fs_variables[i],
- instructions, state->symbols);
- }
-
- for (unsigned i = 0
- ; i < Elements(builtin_110_deprecated_fs_variables)
- ; i++) {
- add_builtin_variable(& builtin_110_deprecated_fs_variables[i],
- instructions, state->symbols);
- }
- generate_110_uniforms(instructions, state);
-
- /* From page 54 (page 60 of the PDF) of the GLSL 1.20 spec:
- *
- * "As with all arrays, indices used to subscript gl_TexCoord must
- * either be an integral constant expressions, or this array must be
- * re-declared by the shader with a size. The size can be at most
- * gl_MaxTextureCoords. Using indexes close to 0 may aid the
- * implementation in preserving varying resources."
- */
- const glsl_type *const vec4_array_type =
- glsl_type::get_array_instance(glsl_type::vec4_type, 0);
-
- add_variable("gl_TexCoord", ir_var_in, FRAG_ATTRIB_TEX0, vec4_array_type,
- instructions, state->symbols);
-
- generate_ARB_draw_buffers_variables(instructions, state, false,
- fragment_shader);
-}
-
-
-static void
-generate_ARB_draw_buffers_variables(exec_list *instructions,
- struct _mesa_glsl_parse_state *state,
- bool warn, _mesa_glsl_parser_targets target)
-{
- /* gl_MaxDrawBuffers is available in all shader stages.
- */
- ir_variable *const mdb =
- add_variable("gl_MaxDrawBuffers", ir_var_auto, -1,
- glsl_type::int_type, instructions, state->symbols);
-
- if (warn)
- mdb->warn_extension = "GL_ARB_draw_buffers";
-
- mdb->constant_value = new(mdb)
- ir_constant(int(state->Const.MaxDrawBuffers));
-
-
- /* gl_FragData is only available in the fragment shader.
- */
- if (target == fragment_shader) {
- const glsl_type *const vec4_array_type =
- glsl_type::get_array_instance(glsl_type::vec4_type,
- state->Const.MaxDrawBuffers);
-
- ir_variable *const fd =
- add_variable("gl_FragData", ir_var_out, FRAG_RESULT_DATA0,
- vec4_array_type, instructions, state->symbols);
-
- if (warn)
- fd->warn_extension = "GL_ARB_draw_buffers";
- }
-}
-
-
-static void
-generate_ARB_draw_instanced_variables(exec_list *instructions,
- struct _mesa_glsl_parse_state *state,
- bool warn,
- _mesa_glsl_parser_targets target)
-{
- /* gl_InstanceIDARB is only available in the vertex shader.
- */
- if (target == vertex_shader) {
- ir_variable *const inst =
- add_variable("gl_InstanceIDARB", ir_var_system_value,
- SYSTEM_VALUE_INSTANCE_ID,
- glsl_type::int_type, instructions, state->symbols);
-
- if (warn)
- inst->warn_extension = "GL_ARB_draw_instanced";
- }
-}
-
-
-static void
-generate_ARB_shader_stencil_export_variables(exec_list *instructions,
- struct _mesa_glsl_parse_state *state,
- bool warn)
-{
- /* gl_FragStencilRefARB is only available in the fragment shader.
- */
- ir_variable *const fd =
- add_variable("gl_FragStencilRefARB", ir_var_out, FRAG_RESULT_STENCIL,
- glsl_type::int_type, instructions, state->symbols);
-
- if (warn)
- fd->warn_extension = "GL_ARB_shader_stencil_export";
-}
-
-static void
-generate_120_fs_variables(exec_list *instructions,
- struct _mesa_glsl_parse_state *state)
-{
- generate_110_fs_variables(instructions, state);
-
- for (unsigned i = 0
- ; i < Elements(builtin_120_fs_variables)
- ; i++) {
- add_builtin_variable(& builtin_120_fs_variables[i],
- instructions, state->symbols);
- }
-}
-
-static void
-generate_130_fs_variables(exec_list *instructions,
- struct _mesa_glsl_parse_state *state)
-{
- generate_120_fs_variables(instructions, state);
-
- const glsl_type *const clip_distance_array_type =
- glsl_type::get_array_instance(glsl_type::float_type,
- state->Const.MaxClipPlanes);
-
- /* FINISHME: gl_ClipDistance needs a real location assigned. */
- add_variable("gl_ClipDistance", ir_var_in, -1, clip_distance_array_type,
- instructions, state->symbols);
-}
-
-static void
-initialize_fs_variables(exec_list *instructions,
- struct _mesa_glsl_parse_state *state)
-{
-
- switch (state->language_version) {
- case 100:
- generate_100ES_fs_variables(instructions, state);
- break;
- case 110:
- generate_110_fs_variables(instructions, state);
- break;
- case 120:
- generate_120_fs_variables(instructions, state);
- break;
- case 130:
- generate_130_fs_variables(instructions, state);
- break;
- }
-
- if (state->ARB_shader_stencil_export_enable)
- generate_ARB_shader_stencil_export_variables(instructions, state,
- state->ARB_shader_stencil_export_warn);
-}
-
-void
-_mesa_glsl_initialize_variables(exec_list *instructions,
- struct _mesa_glsl_parse_state *state)
-{
- switch (state->target) {
- case vertex_shader:
- initialize_vs_variables(instructions, state);
- break;
- case geometry_shader:
- break;
- case fragment_shader:
- initialize_fs_variables(instructions, state);
- break;
- }
-}
+/*
+ * Copyright © 2010 Intel Corporation
+ *
+ * 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
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * 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 NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ */
+
+#include "ir.h"
+#include "glsl_parser_extras.h"
+#include "glsl_symbol_table.h"
+#include "builtin_variables.h"
+
+static void generate_ARB_draw_buffers_variables(exec_list *,
+ struct _mesa_glsl_parse_state *,
+ bool, _mesa_glsl_parser_targets);
+
+static void
+generate_ARB_draw_instanced_variables(exec_list *,
+ struct _mesa_glsl_parse_state *,
+ bool, _mesa_glsl_parser_targets);
+
+static ir_variable *
+add_variable(exec_list *instructions, glsl_symbol_table *symtab,
+ const char *name, const glsl_type *type,
+ enum ir_variable_mode mode, int slot)
+{
+ ir_variable *var = new(symtab) ir_variable(type, name, mode);
+
+ switch (var->mode) {
+ case ir_var_auto:
+ case ir_var_in:
+ case ir_var_const_in:
+ case ir_var_uniform:
+ case ir_var_system_value:
+ var->read_only = true;
+ break;
+ case ir_var_inout:
+ case ir_var_out:
+ break;
+ default:
+ assert(0);
+ break;
+ }
+
+ var->location = slot;
+ var->explicit_location = (slot >= 0);
+
+ /* Once the variable is created an initialized, add it to the symbol table
+ * and add the declaration to the IR stream.
+ */
+ instructions->push_tail(var);
+
+ symtab->add_variable(var);
+ return var;
+}
+
+static ir_variable *
+add_uniform(exec_list *instructions, glsl_symbol_table *symtab,
+ const char *name, const glsl_type *type)
+{
+ return add_variable(instructions, symtab, name, type, ir_var_uniform, -1);
+}
+
+static void
+add_builtin_variable(exec_list *instructions, glsl_symbol_table *symtab,
+ const builtin_variable *proto)
+{
+ /* Create a new variable declaration from the description supplied by
+ * the caller.
+ */
+ const glsl_type *const type = symtab->get_type(proto->type);
+
+ assert(type != NULL);
+
+ add_variable(instructions, symtab, proto->name, type, proto->mode,
+ proto->slot);
+}
+
+static void
+add_builtin_constant(exec_list *instructions, glsl_symbol_table *symtab,
+ const char *name, int value)
+{
+ ir_variable *const var = add_variable(instructions, symtab,
+ name, glsl_type::int_type,
+ ir_var_auto, -1);
+ var->constant_value = new(var) ir_constant(value);
+}
+
+/* Several constants in GLSL ES have different names than normal desktop GLSL.
+ * Therefore, this function should only be called on the ES path.
+ */
+static void
+generate_100ES_uniforms(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+ glsl_symbol_table *const symtab = state->symbols;
+
+ add_builtin_constant(instructions, symtab, "gl_MaxVertexAttribs",
+ state->Const.MaxVertexAttribs);
+ add_builtin_constant(instructions, symtab, "gl_MaxVertexUniformVectors",
+ state->Const.MaxVertexUniformComponents);
+ add_builtin_constant(instructions, symtab, "gl_MaxVaryingVectors",
+ state->Const.MaxVaryingFloats / 4);
+ add_builtin_constant(instructions, symtab, "gl_MaxVertexTextureImageUnits",
+ state->Const.MaxVertexTextureImageUnits);
+ add_builtin_constant(instructions, symtab, "gl_MaxCombinedTextureImageUnits",
+ state->Const.MaxCombinedTextureImageUnits);
+ add_builtin_constant(instructions, symtab, "gl_MaxTextureImageUnits",
+ state->Const.MaxTextureImageUnits);
+ add_builtin_constant(instructions, symtab, "gl_MaxFragmentUniformVectors",
+ state->Const.MaxFragmentUniformComponents);
+
+ add_uniform(instructions, symtab, "gl_DepthRange",
+ state->symbols->get_type("gl_DepthRangeParameters"));
+}
+
+static void
+generate_110_uniforms(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+ glsl_symbol_table *const symtab = state->symbols;
+
+ for (unsigned i = 0
+ ; i < Elements(builtin_110_deprecated_uniforms)
+ ; i++) {
+ add_builtin_variable(instructions, symtab,
+ & builtin_110_deprecated_uniforms[i]);
+ }
+
+ add_builtin_constant(instructions, symtab, "gl_MaxLights",
+ state->Const.MaxLights);
+ add_builtin_constant(instructions, symtab, "gl_MaxClipPlanes",
+ state->Const.MaxClipPlanes);
+ add_builtin_constant(instructions, symtab, "gl_MaxTextureUnits",
+ state->Const.MaxTextureUnits);
+ add_builtin_constant(instructions, symtab, "gl_MaxTextureCoords",
+ state->Const.MaxTextureCoords);
+ add_builtin_constant(instructions, symtab, "gl_MaxVertexAttribs",
+ state->Const.MaxVertexAttribs);
+ add_builtin_constant(instructions, symtab, "gl_MaxVertexUniformComponents",
+ state->Const.MaxVertexUniformComponents);
+ add_builtin_constant(instructions, symtab, "gl_MaxVaryingFloats",
+ state->Const.MaxVaryingFloats);
+ add_builtin_constant(instructions, symtab, "gl_MaxVertexTextureImageUnits",
+ state->Const.MaxVertexTextureImageUnits);
+ add_builtin_constant(instructions, symtab, "gl_MaxCombinedTextureImageUnits",
+ state->Const.MaxCombinedTextureImageUnits);
+ add_builtin_constant(instructions, symtab, "gl_MaxTextureImageUnits",
+ state->Const.MaxTextureImageUnits);
+ add_builtin_constant(instructions, symtab, "gl_MaxFragmentUniformComponents",
+ state->Const.MaxFragmentUniformComponents);
+
+ const glsl_type *const mat4_array_type =
+ glsl_type::get_array_instance(glsl_type::mat4_type,
+ state->Const.MaxTextureCoords);
+
+ add_uniform(instructions, symtab, "gl_TextureMatrix", mat4_array_type);
+ add_uniform(instructions, symtab, "gl_TextureMatrixInverse", mat4_array_type);
+ add_uniform(instructions, symtab, "gl_TextureMatrixTranspose", mat4_array_type);
+ add_uniform(instructions, symtab, "gl_TextureMatrixInverseTranspose", mat4_array_type);
+
+ add_uniform(instructions, symtab, "gl_DepthRange",
+ symtab->get_type("gl_DepthRangeParameters"));
+
+ add_uniform(instructions, symtab, "gl_ClipPlane",
+ glsl_type::get_array_instance(glsl_type::vec4_type,
+ state->Const.MaxClipPlanes));
+ add_uniform(instructions, symtab, "gl_Point",
+ symtab->get_type("gl_PointParameters"));
+
+ const glsl_type *const material_parameters_type =
+ symtab->get_type("gl_MaterialParameters");
+ add_uniform(instructions, symtab, "gl_FrontMaterial", material_parameters_type);
+ add_uniform(instructions, symtab, "gl_BackMaterial", material_parameters_type);
+
+ const glsl_type *const light_source_array_type =
+ glsl_type::get_array_instance(symtab->get_type("gl_LightSourceParameters"), state->Const.MaxLights);
+
+ add_uniform(instructions, symtab, "gl_LightSource", light_source_array_type);
+
+ const glsl_type *const light_model_products_type =
+ symtab->get_type("gl_LightModelProducts");
+ add_uniform(instructions, symtab, "gl_FrontLightModelProduct",
+ light_model_products_type);
+ add_uniform(instructions, symtab, "gl_BackLightModelProduct",
+ light_model_products_type);
+
+ const glsl_type *const light_products_type =
+ glsl_type::get_array_instance(symtab->get_type("gl_LightProducts"),
+ state->Const.MaxLights);
+ add_uniform(instructions, symtab, "gl_FrontLightProduct", light_products_type);
+ add_uniform(instructions, symtab, "gl_BackLightProduct", light_products_type);
+
+ add_uniform(instructions, symtab, "gl_TextureEnvColor",
+ glsl_type::get_array_instance(glsl_type::vec4_type,
+ state->Const.MaxTextureUnits));
+
+ const glsl_type *const texcoords_vec4 =
+ glsl_type::get_array_instance(glsl_type::vec4_type,
+ state->Const.MaxTextureCoords);
+ add_uniform(instructions, symtab, "gl_EyePlaneS", texcoords_vec4);
+ add_uniform(instructions, symtab, "gl_EyePlaneT", texcoords_vec4);
+ add_uniform(instructions, symtab, "gl_EyePlaneR", texcoords_vec4);
+ add_uniform(instructions, symtab, "gl_EyePlaneQ", texcoords_vec4);
+ add_uniform(instructions, symtab, "gl_ObjectPlaneS", texcoords_vec4);
+ add_uniform(instructions, symtab, "gl_ObjectPlaneT", texcoords_vec4);
+ add_uniform(instructions, symtab, "gl_ObjectPlaneR", texcoords_vec4);
+ add_uniform(instructions, symtab, "gl_ObjectPlaneQ", texcoords_vec4);
+
+ add_uniform(instructions, symtab, "gl_Fog",
+ symtab->get_type("gl_FogParameters"));
+}
+
+/* This function should only be called for ES, not desktop GL. */
+static void
+generate_100ES_vs_variables(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+ for (unsigned i = 0; i < Elements(builtin_core_vs_variables); i++) {
+ add_builtin_variable(instructions, state->symbols,
+ & builtin_core_vs_variables[i]);
+ }
+
+ generate_100ES_uniforms(instructions, state);
+
+ generate_ARB_draw_buffers_variables(instructions, state, false,
+ vertex_shader);
+}
+
+
+static void
+generate_110_vs_variables(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+ for (unsigned i = 0; i < Elements(builtin_core_vs_variables); i++) {
+ add_builtin_variable(instructions, state->symbols,
+ & builtin_core_vs_variables[i]);
+ }
+
+ for (unsigned i = 0
+ ; i < Elements(builtin_110_deprecated_vs_variables)
+ ; i++) {
+ add_builtin_variable(instructions, state->symbols,
+ & builtin_110_deprecated_vs_variables[i]);
+ }
+ generate_110_uniforms(instructions, state);
+
+ /* From page 54 (page 60 of the PDF) of the GLSL 1.20 spec:
+ *
+ * "As with all arrays, indices used to subscript gl_TexCoord must
+ * either be an integral constant expressions, or this array must be
+ * re-declared by the shader with a size. The size can be at most
+ * gl_MaxTextureCoords. Using indexes close to 0 may aid the
+ * implementation in preserving varying resources."
+ */
+ const glsl_type *const vec4_array_type =
+ glsl_type::get_array_instance(glsl_type::vec4_type, 0);
+
+ add_variable(instructions, state->symbols,
+ "gl_TexCoord", vec4_array_type, ir_var_out, VERT_RESULT_TEX0);
+
+ generate_ARB_draw_buffers_variables(instructions, state, false,
+ vertex_shader);
+}
+
+
+static void
+generate_120_vs_variables(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+ /* GLSL version 1.20 did not add any built-in variables in the vertex
+ * shader.
+ */
+ generate_110_vs_variables(instructions, state);
+}
+
+
+static void
+generate_130_vs_variables(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+ generate_120_vs_variables(instructions, state);
+
+ for (unsigned i = 0; i < Elements(builtin_130_vs_variables); i++) {
+ add_builtin_variable(instructions, state->symbols,
+ & builtin_130_vs_variables[i]);
+ }
+
+ const glsl_type *const clip_distance_array_type =
+ glsl_type::get_array_instance(glsl_type::float_type,
+ state->Const.MaxClipPlanes);
+
+ /* FINISHME: gl_ClipDistance needs a real location assigned. */
+ add_variable(instructions, state->symbols,
+ "gl_ClipDistance", clip_distance_array_type, ir_var_out, -1);
+
+}
+
+
+static void
+initialize_vs_variables(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+
+ switch (state->language_version) {
+ case 100:
+ generate_100ES_vs_variables(instructions, state);
+ break;
+ case 110:
+ generate_110_vs_variables(instructions, state);
+ break;
+ case 120:
+ generate_120_vs_variables(instructions, state);
+ break;
+ case 130:
+ generate_130_vs_variables(instructions, state);
+ break;
+ }
+
+ if (state->ARB_draw_instanced_enable)
+ generate_ARB_draw_instanced_variables(instructions, state, false,
+ vertex_shader);
+}
+
+
+/* This function should only be called for ES, not desktop GL. */
+static void
+generate_100ES_fs_variables(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+ for (unsigned i = 0; i < Elements(builtin_core_fs_variables); i++) {
+ add_builtin_variable(instructions, state->symbols,
+ & builtin_core_fs_variables[i]);
+ }
+
+ for (unsigned i = 0; i < Elements(builtin_100ES_fs_variables); i++) {
+ add_builtin_variable(instructions, state->symbols,
+ & builtin_100ES_fs_variables[i]);
+ }
+
+ generate_100ES_uniforms(instructions, state);
+
+ generate_ARB_draw_buffers_variables(instructions, state, false,
+ fragment_shader);
+}
+
+static void
+generate_110_fs_variables(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+ for (unsigned i = 0; i < Elements(builtin_core_fs_variables); i++) {
+ add_builtin_variable(instructions, state->symbols,
+ & builtin_core_fs_variables[i]);
+ }
+
+ for (unsigned i = 0; i < Elements(builtin_110_fs_variables); i++) {
+ add_builtin_variable(instructions, state->symbols,
+ & builtin_110_fs_variables[i]);
+ }
+
+ for (unsigned i = 0
+ ; i < Elements(builtin_110_deprecated_fs_variables)
+ ; i++) {
+ add_builtin_variable(instructions, state->symbols,
+ & builtin_110_deprecated_fs_variables[i]);
+ }
+ generate_110_uniforms(instructions, state);
+
+ /* From page 54 (page 60 of the PDF) of the GLSL 1.20 spec:
+ *
+ * "As with all arrays, indices used to subscript gl_TexCoord must
+ * either be an integral constant expressions, or this array must be
+ * re-declared by the shader with a size. The size can be at most
+ * gl_MaxTextureCoords. Using indexes close to 0 may aid the
+ * implementation in preserving varying resources."
+ */
+ const glsl_type *const vec4_array_type =
+ glsl_type::get_array_instance(glsl_type::vec4_type, 0);
+
+ add_variable(instructions, state->symbols,
+ "gl_TexCoord", vec4_array_type, ir_var_in, FRAG_ATTRIB_TEX0);
+
+ generate_ARB_draw_buffers_variables(instructions, state, false,
+ fragment_shader);
+}
+
+
+static void
+generate_ARB_draw_buffers_variables(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state,
+ bool warn, _mesa_glsl_parser_targets target)
+{
+ /* gl_MaxDrawBuffers is available in all shader stages.
+ */
+ ir_variable *const mdb =
+ add_variable(instructions, state->symbols,
+ "gl_MaxDrawBuffers", glsl_type::int_type, ir_var_auto, -1);
+
+ if (warn)
+ mdb->warn_extension = "GL_ARB_draw_buffers";
+
+ mdb->constant_value = new(mdb)
+ ir_constant(int(state->Const.MaxDrawBuffers));
+
+
+ /* gl_FragData is only available in the fragment shader.
+ */
+ if (target == fragment_shader) {
+ const glsl_type *const vec4_array_type =
+ glsl_type::get_array_instance(glsl_type::vec4_type,
+ state->Const.MaxDrawBuffers);
+
+ ir_variable *const fd =
+ add_variable(instructions, state->symbols,
+ "gl_FragData", vec4_array_type,
+ ir_var_out, FRAG_RESULT_DATA0);
+
+ if (warn)
+ fd->warn_extension = "GL_ARB_draw_buffers";
+ }
+}
+
+
+static void
+generate_ARB_draw_instanced_variables(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state,
+ bool warn,
+ _mesa_glsl_parser_targets target)
+{
+ /* gl_InstanceIDARB is only available in the vertex shader.
+ */
+ if (target == vertex_shader) {
+ ir_variable *const inst =
+ add_variable(instructions, state->symbols,
+ "gl_InstanceIDARB", glsl_type::int_type,
+ ir_var_system_value, SYSTEM_VALUE_INSTANCE_ID);
+
+ if (warn)
+ inst->warn_extension = "GL_ARB_draw_instanced";
+ }
+}
+
+
+static void
+generate_ARB_shader_stencil_export_variables(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state,
+ bool warn)
+{
+ /* gl_FragStencilRefARB is only available in the fragment shader.
+ */
+ ir_variable *const fd =
+ add_variable(instructions, state->symbols,
+ "gl_FragStencilRefARB", glsl_type::int_type,
+ ir_var_out, FRAG_RESULT_STENCIL);
+
+ if (warn)
+ fd->warn_extension = "GL_ARB_shader_stencil_export";
+}
+
+static void
+generate_120_fs_variables(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+ generate_110_fs_variables(instructions, state);
+
+ for (unsigned i = 0
+ ; i < Elements(builtin_120_fs_variables)
+ ; i++) {
+ add_builtin_variable(instructions, state->symbols,
+ & builtin_120_fs_variables[i]);
+ }
+}
+
+static void
+generate_130_fs_variables(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+ generate_120_fs_variables(instructions, state);
+
+ const glsl_type *const clip_distance_array_type =
+ glsl_type::get_array_instance(glsl_type::float_type,
+ state->Const.MaxClipPlanes);
+
+ /* FINISHME: gl_ClipDistance needs a real location assigned. */
+ add_variable(instructions, state->symbols,
+ "gl_ClipDistance", clip_distance_array_type, ir_var_in, -1);
+}
+
+static void
+initialize_fs_variables(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+
+ switch (state->language_version) {
+ case 100:
+ generate_100ES_fs_variables(instructions, state);
+ break;
+ case 110:
+ generate_110_fs_variables(instructions, state);
+ break;
+ case 120:
+ generate_120_fs_variables(instructions, state);
+ break;
+ case 130:
+ generate_130_fs_variables(instructions, state);
+ break;
+ }
+
+ if (state->ARB_shader_stencil_export_enable)
+ generate_ARB_shader_stencil_export_variables(instructions, state,
+ state->ARB_shader_stencil_export_warn);
+}
+
+void
+_mesa_glsl_initialize_variables(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+ switch (state->target) {
+ case vertex_shader:
+ initialize_vs_variables(instructions, state);
+ break;
+ case geometry_shader:
+ break;
+ case fragment_shader:
+ initialize_fs_variables(instructions, state);
+ break;
+ }
+}
diff --git a/mesalib/src/mapi/glapi/gen/GL3x.xml b/mesalib/src/mapi/glapi/gen/GL3x.xml
index da6af5c8b..148635c37 100644
--- a/mesalib/src/mapi/glapi/gen/GL3x.xml
+++ b/mesalib/src/mapi/glapi/gen/GL3x.xml
@@ -133,8 +133,8 @@
<function name="ClearBufferfi" offset="assign">
<param name="buffer" type="GLenum"/>
<param name="drawbuffer" type="GLint"/>
- <param name="depth" type="const GLfloat"/>
- <param name="stencil" type="const GLint"/>
+ <param name="depth" type="GLfloat"/>
+ <param name="stencil" type="GLint"/>
</function>
<function name="GetStringi" offset="assign">
diff --git a/mesalib/src/mapi/glapi/glapi_mapi_tmp.h b/mesalib/src/mapi/glapi/glapi_mapi_tmp.h
index 0c6ecff3d..62440a708 100644
--- a/mesalib/src/mapi/glapi/glapi_mapi_tmp.h
+++ b/mesalib/src/mapi/glapi/glapi_mapi_tmp.h
@@ -522,7 +522,7 @@ GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix3x4fv)(GLint location, GLsizei cou
GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix4x2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
GLAPI void APIENTRY GLAPI_PREFIX(UniformMatrix4x3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
GLAPI void APIENTRY GLAPI_PREFIX(ClampColor)(GLenum target, GLenum clamp);
-GLAPI void APIENTRY GLAPI_PREFIX(ClearBufferfi)(GLenum buffer, GLint drawbuffer, const GLfloat depth, const GLint stencil);
+GLAPI void APIENTRY GLAPI_PREFIX(ClearBufferfi)(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
GLAPI void APIENTRY GLAPI_PREFIX(ClearBufferfv)(GLenum buffer, GLint drawbuffer, const GLfloat *value);
GLAPI void APIENTRY GLAPI_PREFIX(ClearBufferiv)(GLenum buffer, GLint drawbuffer, const GLint *value);
GLAPI void APIENTRY GLAPI_PREFIX(ClearBufferuiv)(GLenum buffer, GLint drawbuffer, const GLuint *value);
@@ -4751,11 +4751,11 @@ GLAPI void APIENTRY GLAPI_PREFIX(ClampColor)(GLenum target, GLenum clamp)
((void (APIENTRY *)(GLenum target, GLenum clamp)) _func)(target, clamp);
}
-GLAPI void APIENTRY GLAPI_PREFIX(ClearBufferfi)(GLenum buffer, GLint drawbuffer, const GLfloat depth, const GLint stencil)
+GLAPI void APIENTRY GLAPI_PREFIX(ClearBufferfi)(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
{
const struct mapi_table *_tbl = entry_current_get();
mapi_func _func = ((const mapi_func *) _tbl)[431];
- ((void (APIENTRY *)(GLenum buffer, GLint drawbuffer, const GLfloat depth, const GLint stencil)) _func)(buffer, drawbuffer, depth, stencil);
+ ((void (APIENTRY *)(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)) _func)(buffer, drawbuffer, depth, stencil);
}
GLAPI void APIENTRY GLAPI_PREFIX(ClearBufferfv)(GLenum buffer, GLint drawbuffer, const GLfloat *value)
diff --git a/mesalib/src/mapi/glapi/glapitable.h b/mesalib/src/mapi/glapi/glapitable.h
index 9b419ba77..e5110ecfc 100644
--- a/mesalib/src/mapi/glapi/glapitable.h
+++ b/mesalib/src/mapi/glapi/glapitable.h
@@ -471,7 +471,7 @@ struct _glapi_table
void (GLAPIENTRYP UniformMatrix4x2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 428 */
void (GLAPIENTRYP UniformMatrix4x3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 429 */
void (GLAPIENTRYP ClampColor)(GLenum target, GLenum clamp); /* 430 */
- void (GLAPIENTRYP ClearBufferfi)(GLenum buffer, GLint drawbuffer, const GLfloat depth, const GLint stencil); /* 431 */
+ void (GLAPIENTRYP ClearBufferfi)(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); /* 431 */
void (GLAPIENTRYP ClearBufferfv)(GLenum buffer, GLint drawbuffer, const GLfloat * value); /* 432 */
void (GLAPIENTRYP ClearBufferiv)(GLenum buffer, GLint drawbuffer, const GLint * value); /* 433 */
void (GLAPIENTRYP ClearBufferuiv)(GLenum buffer, GLint drawbuffer, const GLuint * value); /* 434 */
diff --git a/mesalib/src/mapi/glapi/glapitemp.h b/mesalib/src/mapi/glapi/glapitemp.h
index 4101a63d3..5f6b91f2c 100644
--- a/mesalib/src/mapi/glapi/glapitemp.h
+++ b/mesalib/src/mapi/glapi/glapitemp.h
@@ -2637,7 +2637,7 @@ KEYWORD1 void KEYWORD2 NAME(ClampColor)(GLenum target, GLenum clamp)
DISPATCH(ClampColor, (target, clamp), (F, "glClampColor(0x%x, 0x%x);\n", target, clamp));
}
-KEYWORD1 void KEYWORD2 NAME(ClearBufferfi)(GLenum buffer, GLint drawbuffer, const GLfloat depth, const GLint stencil)
+KEYWORD1 void KEYWORD2 NAME(ClearBufferfi)(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
{
DISPATCH(ClearBufferfi, (buffer, drawbuffer, depth, stencil), (F, "glClearBufferfi(0x%x, %d, %f, %d);\n", buffer, drawbuffer, depth, stencil));
}
diff --git a/mesalib/src/mesa/main/api_arrayelt.c b/mesalib/src/mesa/main/api_arrayelt.c
index 3c59e9be3..ed0361742 100644
--- a/mesalib/src/mesa/main/api_arrayelt.c
+++ b/mesalib/src/mesa/main/api_arrayelt.c
@@ -175,31 +175,31 @@ static int FogCoordFuncs[NUM_TYPES];
/* GL_BYTE attributes */
-static void
+static void GLAPIENTRY
VertexAttrib1NbvNV(GLuint index, const GLbyte *v)
{
CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0])));
}
-static void
+static void GLAPIENTRY
VertexAttrib1bvNV(GLuint index, const GLbyte *v)
{
CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0]));
}
-static void
+static void GLAPIENTRY
VertexAttrib2NbvNV(GLuint index, const GLbyte *v)
{
CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1])));
}
-static void
+static void GLAPIENTRY
VertexAttrib2bvNV(GLuint index, const GLbyte *v)
{
CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
}
-static void
+static void GLAPIENTRY
VertexAttrib3NbvNV(GLuint index, const GLbyte *v)
{
CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]),
@@ -207,13 +207,13 @@ VertexAttrib3NbvNV(GLuint index, const GLbyte *v)
BYTE_TO_FLOAT(v[2])));
}
-static void
+static void GLAPIENTRY
VertexAttrib3bvNV(GLuint index, const GLbyte *v)
{
CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
}
-static void
+static void GLAPIENTRY
VertexAttrib4NbvNV(GLuint index, const GLbyte *v)
{
CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]),
@@ -222,7 +222,7 @@ VertexAttrib4NbvNV(GLuint index, const GLbyte *v)
BYTE_TO_FLOAT(v[3])));
}
-static void
+static void GLAPIENTRY
VertexAttrib4bvNV(GLuint index, const GLbyte *v)
{
CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
@@ -230,46 +230,46 @@ VertexAttrib4bvNV(GLuint index, const GLbyte *v)
/* GL_UNSIGNED_BYTE attributes */
-static void
+static void GLAPIENTRY
VertexAttrib1NubvNV(GLuint index, const GLubyte *v)
{
CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0])));
}
-static void
+static void GLAPIENTRY
VertexAttrib1ubvNV(GLuint index, const GLubyte *v)
{
CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0]));
}
-static void
+static void GLAPIENTRY
VertexAttrib2NubvNV(GLuint index, const GLubyte *v)
{
CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]),
UBYTE_TO_FLOAT(v[1])));
}
-static void
+static void GLAPIENTRY
VertexAttrib2ubvNV(GLuint index, const GLubyte *v)
{
CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
}
-static void
+static void GLAPIENTRY
VertexAttrib3NubvNV(GLuint index, const GLubyte *v)
{
CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]),
UBYTE_TO_FLOAT(v[1]),
UBYTE_TO_FLOAT(v[2])));
}
-static void
+static void GLAPIENTRY
VertexAttrib3ubvNV(GLuint index, const GLubyte *v)
{
CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0],
(GLfloat)v[1], (GLfloat)v[2]));
}
-static void
+static void GLAPIENTRY
VertexAttrib4NubvNV(GLuint index, const GLubyte *v)
{
CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]),
@@ -278,7 +278,7 @@ VertexAttrib4NubvNV(GLuint index, const GLubyte *v)
UBYTE_TO_FLOAT(v[3])));
}
-static void
+static void GLAPIENTRY
VertexAttrib4ubvNV(GLuint index, const GLubyte *v)
{
CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0],
@@ -288,32 +288,32 @@ VertexAttrib4ubvNV(GLuint index, const GLubyte *v)
/* GL_SHORT attributes */
-static void
+static void GLAPIENTRY
VertexAttrib1NsvNV(GLuint index, const GLshort *v)
{
CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0])));
}
-static void
+static void GLAPIENTRY
VertexAttrib1svNV(GLuint index, const GLshort *v)
{
CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0]));
}
-static void
+static void GLAPIENTRY
VertexAttrib2NsvNV(GLuint index, const GLshort *v)
{
CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]),
SHORT_TO_FLOAT(v[1])));
}
-static void
+static void GLAPIENTRY
VertexAttrib2svNV(GLuint index, const GLshort *v)
{
CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
}
-static void
+static void GLAPIENTRY
VertexAttrib3NsvNV(GLuint index, const GLshort *v)
{
CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]),
@@ -321,14 +321,14 @@ VertexAttrib3NsvNV(GLuint index, const GLshort *v)
SHORT_TO_FLOAT(v[2])));
}
-static void
+static void GLAPIENTRY
VertexAttrib3svNV(GLuint index, const GLshort *v)
{
CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1],
(GLfloat)v[2]));
}
-static void
+static void GLAPIENTRY
VertexAttrib4NsvNV(GLuint index, const GLshort *v)
{
CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]),
@@ -337,7 +337,7 @@ VertexAttrib4NsvNV(GLuint index, const GLshort *v)
SHORT_TO_FLOAT(v[3])));
}
-static void
+static void GLAPIENTRY
VertexAttrib4svNV(GLuint index, const GLshort *v)
{
CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1],
@@ -346,33 +346,33 @@ VertexAttrib4svNV(GLuint index, const GLshort *v)
/* GL_UNSIGNED_SHORT attributes */
-static void
+static void GLAPIENTRY
VertexAttrib1NusvNV(GLuint index, const GLushort *v)
{
CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0])));
}
-static void
+static void GLAPIENTRY
VertexAttrib1usvNV(GLuint index, const GLushort *v)
{
CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0]));
}
-static void
+static void GLAPIENTRY
VertexAttrib2NusvNV(GLuint index, const GLushort *v)
{
CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]),
USHORT_TO_FLOAT(v[1])));
}
-static void
+static void GLAPIENTRY
VertexAttrib2usvNV(GLuint index, const GLushort *v)
{
CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0],
(GLfloat)v[1]));
}
-static void
+static void GLAPIENTRY
VertexAttrib3NusvNV(GLuint index, const GLushort *v)
{
CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]),
@@ -380,14 +380,14 @@ VertexAttrib3NusvNV(GLuint index, const GLushort *v)
USHORT_TO_FLOAT(v[2])));
}
-static void
+static void GLAPIENTRY
VertexAttrib3usvNV(GLuint index, const GLushort *v)
{
CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1],
(GLfloat)v[2]));
}
-static void
+static void GLAPIENTRY
VertexAttrib4NusvNV(GLuint index, const GLushort *v)
{
CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]),
@@ -396,7 +396,7 @@ VertexAttrib4NusvNV(GLuint index, const GLushort *v)
USHORT_TO_FLOAT(v[3])));
}
-static void
+static void GLAPIENTRY
VertexAttrib4usvNV(GLuint index, const GLushort *v)
{
CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1],
@@ -405,32 +405,32 @@ VertexAttrib4usvNV(GLuint index, const GLushort *v)
/* GL_INT attributes */
-static void
+static void GLAPIENTRY
VertexAttrib1NivNV(GLuint index, const GLint *v)
{
CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0])));
}
-static void
+static void GLAPIENTRY
VertexAttrib1ivNV(GLuint index, const GLint *v)
{
CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0]));
}
-static void
+static void GLAPIENTRY
VertexAttrib2NivNV(GLuint index, const GLint *v)
{
CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]),
INT_TO_FLOAT(v[1])));
}
-static void
+static void GLAPIENTRY
VertexAttrib2ivNV(GLuint index, const GLint *v)
{
CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
}
-static void
+static void GLAPIENTRY
VertexAttrib3NivNV(GLuint index, const GLint *v)
{
CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]),
@@ -438,14 +438,14 @@ VertexAttrib3NivNV(GLuint index, const GLint *v)
INT_TO_FLOAT(v[2])));
}
-static void
+static void GLAPIENTRY
VertexAttrib3ivNV(GLuint index, const GLint *v)
{
CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1],
(GLfloat)v[2]));
}
-static void
+static void GLAPIENTRY
VertexAttrib4NivNV(GLuint index, const GLint *v)
{
CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]),
@@ -454,7 +454,7 @@ VertexAttrib4NivNV(GLuint index, const GLint *v)
INT_TO_FLOAT(v[3])));
}
-static void
+static void GLAPIENTRY
VertexAttrib4ivNV(GLuint index, const GLint *v)
{
CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1],
@@ -463,33 +463,33 @@ VertexAttrib4ivNV(GLuint index, const GLint *v)
/* GL_UNSIGNED_INT attributes */
-static void
+static void GLAPIENTRY
VertexAttrib1NuivNV(GLuint index, const GLuint *v)
{
CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0])));
}
-static void
+static void GLAPIENTRY
VertexAttrib1uivNV(GLuint index, const GLuint *v)
{
CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0]));
}
-static void
+static void GLAPIENTRY
VertexAttrib2NuivNV(GLuint index, const GLuint *v)
{
CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]),
UINT_TO_FLOAT(v[1])));
}
-static void
+static void GLAPIENTRY
VertexAttrib2uivNV(GLuint index, const GLuint *v)
{
CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0],
(GLfloat)v[1]));
}
-static void
+static void GLAPIENTRY
VertexAttrib3NuivNV(GLuint index, const GLuint *v)
{
CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]),
@@ -497,14 +497,14 @@ VertexAttrib3NuivNV(GLuint index, const GLuint *v)
UINT_TO_FLOAT(v[2])));
}
-static void
+static void GLAPIENTRY
VertexAttrib3uivNV(GLuint index, const GLuint *v)
{
CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1],
(GLfloat)v[2]));
}
-static void
+static void GLAPIENTRY
VertexAttrib4NuivNV(GLuint index, const GLuint *v)
{
CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]),
@@ -513,7 +513,7 @@ VertexAttrib4NuivNV(GLuint index, const GLuint *v)
UINT_TO_FLOAT(v[3])));
}
-static void
+static void GLAPIENTRY
VertexAttrib4uivNV(GLuint index, const GLuint *v)
{
CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1],
@@ -522,25 +522,25 @@ VertexAttrib4uivNV(GLuint index, const GLuint *v)
/* GL_FLOAT attributes */
-static void
+static void GLAPIENTRY
VertexAttrib1fvNV(GLuint index, const GLfloat *v)
{
CALL_VertexAttrib1fvNV(GET_DISPATCH(), (index, v));
}
-static void
+static void GLAPIENTRY
VertexAttrib2fvNV(GLuint index, const GLfloat *v)
{
CALL_VertexAttrib2fvNV(GET_DISPATCH(), (index, v));
}
-static void
+static void GLAPIENTRY
VertexAttrib3fvNV(GLuint index, const GLfloat *v)
{
CALL_VertexAttrib3fvNV(GET_DISPATCH(), (index, v));
}
-static void
+static void GLAPIENTRY
VertexAttrib4fvNV(GLuint index, const GLfloat *v)
{
CALL_VertexAttrib4fvNV(GET_DISPATCH(), (index, v));
@@ -548,25 +548,25 @@ VertexAttrib4fvNV(GLuint index, const GLfloat *v)
/* GL_DOUBLE attributes */
-static void
+static void GLAPIENTRY
VertexAttrib1dvNV(GLuint index, const GLdouble *v)
{
CALL_VertexAttrib1dvNV(GET_DISPATCH(), (index, v));
}
-static void
+static void GLAPIENTRY
VertexAttrib2dvNV(GLuint index, const GLdouble *v)
{
CALL_VertexAttrib2dvNV(GET_DISPATCH(), (index, v));
}
-static void
+static void GLAPIENTRY
VertexAttrib3dvNV(GLuint index, const GLdouble *v)
{
CALL_VertexAttrib3dvNV(GET_DISPATCH(), (index, v));
}
-static void
+static void GLAPIENTRY
VertexAttrib4dvNV(GLuint index, const GLdouble *v)
{
CALL_VertexAttrib4dvNV(GET_DISPATCH(), (index, v));
@@ -680,31 +680,31 @@ static attrib_func AttribFuncsNV[2][4][NUM_TYPES] = {
/* GL_BYTE attributes */
-static void
+static void GLAPIENTRY
VertexAttrib1NbvARB(GLuint index, const GLbyte *v)
{
CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0])));
}
-static void
+static void GLAPIENTRY
VertexAttrib1bvARB(GLuint index, const GLbyte *v)
{
CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0]));
}
-static void
+static void GLAPIENTRY
VertexAttrib2NbvARB(GLuint index, const GLbyte *v)
{
CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1])));
}
-static void
+static void GLAPIENTRY
VertexAttrib2bvARB(GLuint index, const GLbyte *v)
{
CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
}
-static void
+static void GLAPIENTRY
VertexAttrib3NbvARB(GLuint index, const GLbyte *v)
{
CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]),
@@ -712,13 +712,13 @@ VertexAttrib3NbvARB(GLuint index, const GLbyte *v)
BYTE_TO_FLOAT(v[2])));
}
-static void
+static void GLAPIENTRY
VertexAttrib3bvARB(GLuint index, const GLbyte *v)
{
CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
}
-static void
+static void GLAPIENTRY
VertexAttrib4NbvARB(GLuint index, const GLbyte *v)
{
CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]),
@@ -727,7 +727,7 @@ VertexAttrib4NbvARB(GLuint index, const GLbyte *v)
BYTE_TO_FLOAT(v[3])));
}
-static void
+static void GLAPIENTRY
VertexAttrib4bvARB(GLuint index, const GLbyte *v)
{
CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
@@ -735,19 +735,19 @@ VertexAttrib4bvARB(GLuint index, const GLbyte *v)
/* GL_UNSIGNED_BYTE attributes */
-static void
+static void GLAPIENTRY
VertexAttrib1NubvARB(GLuint index, const GLubyte *v)
{
CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0])));
}
-static void
+static void GLAPIENTRY
VertexAttrib1ubvARB(GLuint index, const GLubyte *v)
{
CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0]));
}
-static void
+static void GLAPIENTRY
VertexAttrib2NubvARB(GLuint index, const GLubyte *v)
{
CALL_VertexAttrib2fARB(GET_DISPATCH(), (index,
@@ -755,14 +755,14 @@ VertexAttrib2NubvARB(GLuint index, const GLubyte *v)
UBYTE_TO_FLOAT(v[1])));
}
-static void
+static void GLAPIENTRY
VertexAttrib2ubvARB(GLuint index, const GLubyte *v)
{
CALL_VertexAttrib2fARB(GET_DISPATCH(), (index,
(GLfloat)v[0], (GLfloat)v[1]));
}
-static void
+static void GLAPIENTRY
VertexAttrib3NubvARB(GLuint index, const GLubyte *v)
{
CALL_VertexAttrib3fARB(GET_DISPATCH(), (index,
@@ -770,7 +770,7 @@ VertexAttrib3NubvARB(GLuint index, const GLubyte *v)
UBYTE_TO_FLOAT(v[1]),
UBYTE_TO_FLOAT(v[2])));
}
-static void
+static void GLAPIENTRY
VertexAttrib3ubvARB(GLuint index, const GLubyte *v)
{
CALL_VertexAttrib3fARB(GET_DISPATCH(), (index,
@@ -779,7 +779,7 @@ VertexAttrib3ubvARB(GLuint index, const GLubyte *v)
(GLfloat)v[2]));
}
-static void
+static void GLAPIENTRY
VertexAttrib4NubvARB(GLuint index, const GLubyte *v)
{
CALL_VertexAttrib4fARB(GET_DISPATCH(),
@@ -790,7 +790,7 @@ VertexAttrib4NubvARB(GLuint index, const GLubyte *v)
UBYTE_TO_FLOAT(v[3])));
}
-static void
+static void GLAPIENTRY
VertexAttrib4ubvARB(GLuint index, const GLubyte *v)
{
CALL_VertexAttrib4fARB(GET_DISPATCH(),
@@ -801,19 +801,19 @@ VertexAttrib4ubvARB(GLuint index, const GLubyte *v)
/* GL_SHORT attributes */
-static void
+static void GLAPIENTRY
VertexAttrib1NsvARB(GLuint index, const GLshort *v)
{
CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0])));
}
-static void
+static void GLAPIENTRY
VertexAttrib1svARB(GLuint index, const GLshort *v)
{
CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0]));
}
-static void
+static void GLAPIENTRY
VertexAttrib2NsvARB(GLuint index, const GLshort *v)
{
CALL_VertexAttrib2fARB(GET_DISPATCH(),
@@ -821,14 +821,14 @@ VertexAttrib2NsvARB(GLuint index, const GLshort *v)
SHORT_TO_FLOAT(v[1])));
}
-static void
+static void GLAPIENTRY
VertexAttrib2svARB(GLuint index, const GLshort *v)
{
CALL_VertexAttrib2fARB(GET_DISPATCH(),
(index, (GLfloat)v[0], (GLfloat)v[1]));
}
-static void
+static void GLAPIENTRY
VertexAttrib3NsvARB(GLuint index, const GLshort *v)
{
CALL_VertexAttrib3fARB(GET_DISPATCH(),
@@ -838,7 +838,7 @@ VertexAttrib3NsvARB(GLuint index, const GLshort *v)
SHORT_TO_FLOAT(v[2])));
}
-static void
+static void GLAPIENTRY
VertexAttrib3svARB(GLuint index, const GLshort *v)
{
CALL_VertexAttrib3fARB(GET_DISPATCH(),
@@ -846,7 +846,7 @@ VertexAttrib3svARB(GLuint index, const GLshort *v)
(GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
}
-static void
+static void GLAPIENTRY
VertexAttrib4NsvARB(GLuint index, const GLshort *v)
{
CALL_VertexAttrib4fARB(GET_DISPATCH(),
@@ -857,7 +857,7 @@ VertexAttrib4NsvARB(GLuint index, const GLshort *v)
SHORT_TO_FLOAT(v[3])));
}
-static void
+static void GLAPIENTRY
VertexAttrib4svARB(GLuint index, const GLshort *v)
{
CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1],
@@ -866,33 +866,33 @@ VertexAttrib4svARB(GLuint index, const GLshort *v)
/* GL_UNSIGNED_SHORT attributes */
-static void
+static void GLAPIENTRY
VertexAttrib1NusvARB(GLuint index, const GLushort *v)
{
CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0])));
}
-static void
+static void GLAPIENTRY
VertexAttrib1usvARB(GLuint index, const GLushort *v)
{
CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0]));
}
-static void
+static void GLAPIENTRY
VertexAttrib2NusvARB(GLuint index, const GLushort *v)
{
CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]),
USHORT_TO_FLOAT(v[1])));
}
-static void
+static void GLAPIENTRY
VertexAttrib2usvARB(GLuint index, const GLushort *v)
{
CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0],
(GLfloat)v[1]));
}
-static void
+static void GLAPIENTRY
VertexAttrib3NusvARB(GLuint index, const GLushort *v)
{
CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]),
@@ -900,14 +900,14 @@ VertexAttrib3NusvARB(GLuint index, const GLushort *v)
USHORT_TO_FLOAT(v[2])));
}
-static void
+static void GLAPIENTRY
VertexAttrib3usvARB(GLuint index, const GLushort *v)
{
CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0],
(GLfloat)v[1], (GLfloat)v[2]));
}
-static void
+static void GLAPIENTRY
VertexAttrib4NusvARB(GLuint index, const GLushort *v)
{
CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]),
@@ -916,7 +916,7 @@ VertexAttrib4NusvARB(GLuint index, const GLushort *v)
USHORT_TO_FLOAT(v[3])));
}
-static void
+static void GLAPIENTRY
VertexAttrib4usvARB(GLuint index, const GLushort *v)
{
CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
@@ -924,33 +924,33 @@ VertexAttrib4usvARB(GLuint index, const GLushort *v)
/* GL_INT attributes */
-static void
+static void GLAPIENTRY
VertexAttrib1NivARB(GLuint index, const GLint *v)
{
CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0])));
}
-static void
+static void GLAPIENTRY
VertexAttrib1ivARB(GLuint index, const GLint *v)
{
CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0]));
}
-static void
+static void GLAPIENTRY
VertexAttrib2NivARB(GLuint index, const GLint *v)
{
CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]),
INT_TO_FLOAT(v[1])));
}
-static void
+static void GLAPIENTRY
VertexAttrib2ivARB(GLuint index, const GLint *v)
{
CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0],
(GLfloat)v[1]));
}
-static void
+static void GLAPIENTRY
VertexAttrib3NivARB(GLuint index, const GLint *v)
{
CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]),
@@ -958,14 +958,14 @@ VertexAttrib3NivARB(GLuint index, const GLint *v)
INT_TO_FLOAT(v[2])));
}
-static void
+static void GLAPIENTRY
VertexAttrib3ivARB(GLuint index, const GLint *v)
{
CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0],
(GLfloat)v[1], (GLfloat)v[2]));
}
-static void
+static void GLAPIENTRY
VertexAttrib4NivARB(GLuint index, const GLint *v)
{
CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]),
@@ -974,7 +974,7 @@ VertexAttrib4NivARB(GLuint index, const GLint *v)
INT_TO_FLOAT(v[3])));
}
-static void
+static void GLAPIENTRY
VertexAttrib4ivARB(GLuint index, const GLint *v)
{
CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1],
@@ -983,33 +983,33 @@ VertexAttrib4ivARB(GLuint index, const GLint *v)
/* GL_UNSIGNED_INT attributes */
-static void
+static void GLAPIENTRY
VertexAttrib1NuivARB(GLuint index, const GLuint *v)
{
CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0])));
}
-static void
+static void GLAPIENTRY
VertexAttrib1uivARB(GLuint index, const GLuint *v)
{
CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0]));
}
-static void
+static void GLAPIENTRY
VertexAttrib2NuivARB(GLuint index, const GLuint *v)
{
CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]),
UINT_TO_FLOAT(v[1])));
}
-static void
+static void GLAPIENTRY
VertexAttrib2uivARB(GLuint index, const GLuint *v)
{
CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0],
(GLfloat)v[1]));
}
-static void
+static void GLAPIENTRY
VertexAttrib3NuivARB(GLuint index, const GLuint *v)
{
CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]),
@@ -1017,14 +1017,14 @@ VertexAttrib3NuivARB(GLuint index, const GLuint *v)
UINT_TO_FLOAT(v[2])));
}
-static void
+static void GLAPIENTRY
VertexAttrib3uivARB(GLuint index, const GLuint *v)
{
CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0],
(GLfloat)v[1], (GLfloat)v[2]));
}
-static void
+static void GLAPIENTRY
VertexAttrib4NuivARB(GLuint index, const GLuint *v)
{
CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]),
@@ -1033,7 +1033,7 @@ VertexAttrib4NuivARB(GLuint index, const GLuint *v)
UINT_TO_FLOAT(v[3])));
}
-static void
+static void GLAPIENTRY
VertexAttrib4uivARB(GLuint index, const GLuint *v)
{
CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1],
@@ -1042,25 +1042,25 @@ VertexAttrib4uivARB(GLuint index, const GLuint *v)
/* GL_FLOAT attributes */
-static void
+static void GLAPIENTRY
VertexAttrib1fvARB(GLuint index, const GLfloat *v)
{
CALL_VertexAttrib1fvARB(GET_DISPATCH(), (index, v));
}
-static void
+static void GLAPIENTRY
VertexAttrib2fvARB(GLuint index, const GLfloat *v)
{
CALL_VertexAttrib2fvARB(GET_DISPATCH(), (index, v));
}
-static void
+static void GLAPIENTRY
VertexAttrib3fvARB(GLuint index, const GLfloat *v)
{
CALL_VertexAttrib3fvARB(GET_DISPATCH(), (index, v));
}
-static void
+static void GLAPIENTRY
VertexAttrib4fvARB(GLuint index, const GLfloat *v)
{
CALL_VertexAttrib4fvARB(GET_DISPATCH(), (index, v));
@@ -1068,25 +1068,25 @@ VertexAttrib4fvARB(GLuint index, const GLfloat *v)
/* GL_DOUBLE attributes */
-static void
+static void GLAPIENTRY
VertexAttrib1dvARB(GLuint index, const GLdouble *v)
{
CALL_VertexAttrib1dvARB(GET_DISPATCH(), (index, v));
}
-static void
+static void GLAPIENTRY
VertexAttrib2dvARB(GLuint index, const GLdouble *v)
{
CALL_VertexAttrib2dvARB(GET_DISPATCH(), (index, v));
}
-static void
+static void GLAPIENTRY
VertexAttrib3dvARB(GLuint index, const GLdouble *v)
{
CALL_VertexAttrib3dvARB(GET_DISPATCH(), (index, v));
}
-static void
+static void GLAPIENTRY
VertexAttrib4dvARB(GLuint index, const GLdouble *v)
{
CALL_VertexAttrib4dvARB(GET_DISPATCH(), (index, v));
@@ -1096,50 +1096,50 @@ VertexAttrib4dvARB(GLuint index, const GLdouble *v)
/**
* Integer-valued attributes
*/
-static void
+static void GLAPIENTRY
VertexAttribI1bv(GLuint index, const GLbyte *v)
{
CALL_VertexAttribI1iEXT(GET_DISPATCH(), (index, v[0]));
}
-static void
+static void GLAPIENTRY
VertexAttribI2bv(GLuint index, const GLbyte *v)
{
CALL_VertexAttribI2iEXT(GET_DISPATCH(), (index, v[0], v[1]));
}
-static void
+static void GLAPIENTRY
VertexAttribI3bv(GLuint index, const GLbyte *v)
{
CALL_VertexAttribI3iEXT(GET_DISPATCH(), (index, v[0], v[1], v[2]));
}
-static void
+static void GLAPIENTRY
VertexAttribI4bv(GLuint index, const GLbyte *v)
{
CALL_VertexAttribI4bvEXT(GET_DISPATCH(), (index, v));
}
-static void
+static void GLAPIENTRY
VertexAttribI1ubv(GLuint index, const GLubyte *v)
{
CALL_VertexAttribI1uiEXT(GET_DISPATCH(), (index, v[0]));
}
-static void
+static void GLAPIENTRY
VertexAttribI2ubv(GLuint index, const GLubyte *v)
{
CALL_VertexAttribI2uiEXT(GET_DISPATCH(), (index, v[0], v[1]));
}
-static void
+static void GLAPIENTRY
VertexAttribI3ubv(GLuint index, const GLubyte *v)
{
CALL_VertexAttribI3uiEXT(GET_DISPATCH(), (index, v[0], v[1], v[2]));
}
-static void
+static void GLAPIENTRY
VertexAttribI4ubv(GLuint index, const GLubyte *v)
{
CALL_VertexAttribI4ubvEXT(GET_DISPATCH(), (index, v));
@@ -1147,50 +1147,50 @@ VertexAttribI4ubv(GLuint index, const GLubyte *v)
-static void
+static void GLAPIENTRY
VertexAttribI1sv(GLuint index, const GLshort *v)
{
CALL_VertexAttribI1iEXT(GET_DISPATCH(), (index, v[0]));
}
-static void
+static void GLAPIENTRY
VertexAttribI2sv(GLuint index, const GLshort *v)
{
CALL_VertexAttribI2iEXT(GET_DISPATCH(), (index, v[0], v[1]));
}
-static void
+static void GLAPIENTRY
VertexAttribI3sv(GLuint index, const GLshort *v)
{
CALL_VertexAttribI3iEXT(GET_DISPATCH(), (index, v[0], v[1], v[2]));
}
-static void
+static void GLAPIENTRY
VertexAttribI4sv(GLuint index, const GLshort *v)
{
CALL_VertexAttribI4svEXT(GET_DISPATCH(), (index, v));
}
-static void
+static void GLAPIENTRY
VertexAttribI1usv(GLuint index, const GLushort *v)
{
CALL_VertexAttribI1uiEXT(GET_DISPATCH(), (index, v[0]));
}
-static void
+static void GLAPIENTRY
VertexAttribI2usv(GLuint index, const GLushort *v)
{
CALL_VertexAttribI2uiEXT(GET_DISPATCH(), (index, v[0], v[1]));
}
-static void
+static void GLAPIENTRY
VertexAttribI3usv(GLuint index, const GLushort *v)
{
CALL_VertexAttribI3uiEXT(GET_DISPATCH(), (index, v[0], v[1], v[2]));
}
-static void
+static void GLAPIENTRY
VertexAttribI4usv(GLuint index, const GLushort *v)
{
CALL_VertexAttribI4usvEXT(GET_DISPATCH(), (index, v));
@@ -1198,50 +1198,50 @@ VertexAttribI4usv(GLuint index, const GLushort *v)
-static void
+static void GLAPIENTRY
VertexAttribI1iv(GLuint index, const GLint *v)
{
CALL_VertexAttribI1iEXT(GET_DISPATCH(), (index, v[0]));
}
-static void
+static void GLAPIENTRY
VertexAttribI2iv(GLuint index, const GLint *v)
{
CALL_VertexAttribI2iEXT(GET_DISPATCH(), (index, v[0], v[1]));
}
-static void
+static void GLAPIENTRY
VertexAttribI3iv(GLuint index, const GLint *v)
{
CALL_VertexAttribI3iEXT(GET_DISPATCH(), (index, v[0], v[1], v[2]));
}
-static void
+static void GLAPIENTRY
VertexAttribI4iv(GLuint index, const GLint *v)
{
CALL_VertexAttribI4ivEXT(GET_DISPATCH(), (index, v));
}
-static void
+static void GLAPIENTRY
VertexAttribI1uiv(GLuint index, const GLuint *v)
{
CALL_VertexAttribI1uiEXT(GET_DISPATCH(), (index, v[0]));
}
-static void
+static void GLAPIENTRY
VertexAttribI2uiv(GLuint index, const GLuint *v)
{
CALL_VertexAttribI2uiEXT(GET_DISPATCH(), (index, v[0], v[1]));
}
-static void
+static void GLAPIENTRY
VertexAttribI3uiv(GLuint index, const GLuint *v)
{
CALL_VertexAttribI3uiEXT(GET_DISPATCH(), (index, v[0], v[1], v[2]));
}
-static void
+static void GLAPIENTRY
VertexAttribI4uiv(GLuint index, const GLuint *v)
{
CALL_VertexAttribI4uivEXT(GET_DISPATCH(), (index, v));
diff --git a/mesalib/src/mesa/main/compiler.h b/mesalib/src/mesa/main/compiler.h
index c1d773b18..f2b344fd1 100644
--- a/mesalib/src/mesa/main/compiler.h
+++ b/mesalib/src/mesa/main/compiler.h
@@ -149,12 +149,14 @@ extern "C" {
* We also need to define a USED attribute, so the optimizer doesn't
* inline a static function that we later use in an alias. - ajax
*/
-#if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
-# define PUBLIC __attribute__((visibility("default")))
-# define USED __attribute__((used))
-#else
-# define PUBLIC
-# define USED
+#ifndef PUBLIC
+# if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+# define PUBLIC __attribute__((visibility("default")))
+# define USED __attribute__((used))
+# else
+# define PUBLIC
+# define USED
+# endif
#endif
@@ -173,15 +175,17 @@ extern "C" {
* __builtin_expect macros
*/
#if !defined(__GNUC__)
-# define __builtin_expect(x, y) x
+# define __builtin_expect(x, y) (x)
#endif
-#ifdef __GNUC__
-#define likely(x) __builtin_expect(!!(x), 1)
-#define unlikely(x) __builtin_expect(!!(x), 0)
-#else
-#define likely(x) !!(x)
-#define unlikely(x) !!(x)
+#ifndef likely
+# ifdef __GNUC__
+# define likely(x) __builtin_expect(!!(x), 1)
+# define unlikely(x) __builtin_expect(!!(x), 0)
+# else
+# define likely(x) (x)
+# define unlikely(x) (x)
+# endif
#endif
/**
diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c
index 3c8474591..3a963b981 100644
--- a/mesalib/src/mesa/main/dlist.c
+++ b/mesalib/src/mesa/main/dlist.c
@@ -7036,7 +7036,7 @@ save_VertexAttribDivisor(GLuint index, GLuint divisor)
/* GL_NV_texture_barrier */
static void
-save_TextureBarrierNV()
+save_TextureBarrierNV(void)
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
diff --git a/mesalib/src/mesa/main/glapidispatch.h b/mesalib/src/mesa/main/glapidispatch.h
index ae7f80d89..809f84904 100644
--- a/mesalib/src/mesa/main/glapidispatch.h
+++ b/mesalib/src/mesa/main/glapidispatch.h
@@ -3227,7 +3227,7 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ];
#define CALL_ClampColor(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum)), _gloffset_ClampColor, parameters)
#define GET_ClampColor(disp) GET_by_offset(disp, _gloffset_ClampColor)
#define SET_ClampColor(disp, fn) SET_by_offset(disp, _gloffset_ClampColor, fn)
-#define CALL_ClearBufferfi(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, const GLfloat, const GLint)), _gloffset_ClearBufferfi, parameters)
+#define CALL_ClearBufferfi(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLfloat, GLint)), _gloffset_ClearBufferfi, parameters)
#define GET_ClearBufferfi(disp) GET_by_offset(disp, _gloffset_ClearBufferfi)
#define SET_ClearBufferfi(disp, fn) SET_by_offset(disp, _gloffset_ClearBufferfi, fn)
#define CALL_ClearBufferfv(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, const GLfloat *)), _gloffset_ClearBufferfv, parameters)
diff --git a/mesalib/src/mesa/state_tracker/st_cb_blit.c b/mesalib/src/mesa/state_tracker/st_cb_blit.c
index 39499450d..4c3d561a4 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_blit.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_blit.c
@@ -39,6 +39,7 @@
#include "st_texture.h"
#include "st_cb_blit.h"
#include "st_cb_fbo.h"
+#include "st_atom.h"
#include "util/u_blit.h"
@@ -75,6 +76,8 @@ st_BlitFramebuffer(struct gl_context *ctx,
struct gl_framebuffer *readFB = ctx->ReadBuffer;
struct gl_framebuffer *drawFB = ctx->DrawBuffer;
+ st_validate_state(st);
+
if (!_mesa_clip_blit(ctx, &srcX0, &srcY0, &srcX1, &srcY1,
&dstX0, &dstY0, &dstX1, &dstY1)) {
return; /* nothing to draw/blit */