diff options
author | marha <marha@users.sourceforge.net> | 2014-01-26 20:19:23 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-01-26 20:19:23 +0100 |
commit | 5f455179ae4b279a82d99a7a3dabe61f58c42ad6 (patch) | |
tree | fdecec022cf1b8b782b90a64c14e374fa6d400cb /mesalib/src | |
parent | 78d84bd03c744b0ed420c450dd2807904ccaef21 (diff) | |
parent | 30af30b78075159fce477ae99cc72540133714d0 (diff) | |
download | vcxsrv-5f455179ae4b279a82d99a7a3dabe61f58c42ad6.tar.gz vcxsrv-5f455179ae4b279a82d99a7a3dabe61f58c42ad6.tar.bz2 vcxsrv-5f455179ae4b279a82d99a7a3dabe61f58c42ad6.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
xserver randrproto libxtrans fontconfig libxcb xcb-proto mesa git update 26 Jan 2014
Conflicts:
X11/xtrans/Xtrans.c
xorg-server/dix/dispatch.c
xorg-server/os/xdmcp.c
Diffstat (limited to 'mesalib/src')
103 files changed, 3521 insertions, 1845 deletions
diff --git a/mesalib/src/gallium/auxiliary/hud/hud_context.c b/mesalib/src/gallium/auxiliary/hud/hud_context.c index c4a4f1877..465013cb8 100644 --- a/mesalib/src/gallium/auxiliary/hud/hud_context.c +++ b/mesalib/src/gallium/auxiliary/hud/hud_context.c @@ -479,7 +479,7 @@ hud_draw(struct hud_context *hud, struct pipe_resource *tex) } /* unmap the uploader's vertex buffer before drawing */ - u_upload_flush(hud->uploader); + u_upload_unmap(hud->uploader); /* draw accumulated vertices for background quads */ cso_set_fragment_shader_handle(hud->cso, hud->fs_color); diff --git a/mesalib/src/gallium/auxiliary/util/u_format.h b/mesalib/src/gallium/auxiliary/util/u_format.h index 0fbaf4cc1..5f86e2d2c 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format.h +++ b/mesalib/src/gallium/auxiliary/util/u_format.h @@ -872,6 +872,9 @@ util_format_get_component_bits(enum pipe_format format, static INLINE enum pipe_format util_format_srgb(enum pipe_format format) { + if (util_format_is_srgb(format)) + return format; + switch (format) { case PIPE_FORMAT_L8_UNORM: return PIPE_FORMAT_L8_SRGB; diff --git a/mesalib/src/gallium/auxiliary/util/u_upload_mgr.c b/mesalib/src/gallium/auxiliary/util/u_upload_mgr.c index 6859751c5..7349d0068 100644 --- a/mesalib/src/gallium/auxiliary/util/u_upload_mgr.c +++ b/mesalib/src/gallium/auxiliary/util/u_upload_mgr.c @@ -87,16 +87,8 @@ void u_upload_unmap( struct u_upload_mgr *upload ) } } -/* Release old buffer. - * - * This must usually be called prior to firing the command stream - * which references the upload buffer, as many memory managers will - * cause subsequent maps of a fired buffer to wait. - * - * Can improve this with a change to pipe_buffer_write to use the - * DONT_WAIT bit, but for now, it's easiest just to grab a new buffer. - */ -void u_upload_flush( struct u_upload_mgr *upload ) + +static void u_upload_release_buffer(struct u_upload_mgr *upload) { /* Unmap and unreference the upload buffer. */ u_upload_unmap(upload); @@ -107,7 +99,7 @@ void u_upload_flush( struct u_upload_mgr *upload ) void u_upload_destroy( struct u_upload_mgr *upload ) { - u_upload_flush( upload ); + u_upload_release_buffer( upload ); FREE( upload ); } @@ -120,7 +112,7 @@ u_upload_alloc_buffer( struct u_upload_mgr *upload, /* Release the old buffer, if present: */ - u_upload_flush( upload ); + u_upload_release_buffer( upload ); /* Allocate a new one: */ diff --git a/mesalib/src/gallium/auxiliary/util/u_upload_mgr.h b/mesalib/src/gallium/auxiliary/util/u_upload_mgr.h index 82215a556..63bf30e38 100644 --- a/mesalib/src/gallium/auxiliary/util/u_upload_mgr.h +++ b/mesalib/src/gallium/auxiliary/util/u_upload_mgr.h @@ -57,16 +57,6 @@ struct u_upload_mgr *u_upload_create( struct pipe_context *pipe, void u_upload_destroy( struct u_upload_mgr *upload ); /** - * Unmap and release old upload buffer. - * - * This is like u_upload_unmap() except the upload buffer is released for - * recycling. This should be called on real hardware flushes on systems - * that don't support the PIPE_TRANSFER_UNSYNCHRONIZED flag, as otherwise - * the next u_upload_buffer will cause a sync on the buffer. - */ -void u_upload_flush( struct u_upload_mgr *upload ); - -/** * Unmap upload buffer * * \param upload Upload manager diff --git a/mesalib/src/glsl/Makefile.sources b/mesalib/src/glsl/Makefile.sources index 2e81dedda..e69c1ac61 100644 --- a/mesalib/src/glsl/Makefile.sources +++ b/mesalib/src/glsl/Makefile.sources @@ -99,6 +99,7 @@ LIBGLSL_FILES = \ $(GLSL_SRCDIR)/opt_structure_splitting.cpp \ $(GLSL_SRCDIR)/opt_swizzle_swizzle.cpp \ $(GLSL_SRCDIR)/opt_tree_grafting.cpp \ + $(GLSL_SRCDIR)/opt_vectorize.cpp \ $(GLSL_SRCDIR)/s_expression.cpp \ $(GLSL_SRCDIR)/strtod.c diff --git a/mesalib/src/glsl/ast.h b/mesalib/src/glsl/ast.h index 344277803..502490200 100644 --- a/mesalib/src/glsl/ast.h +++ b/mesalib/src/glsl/ast.h @@ -280,6 +280,43 @@ private: bool cons; }; +class ast_array_specifier : public ast_node { +public: + /** Unsized array specifier ([]) */ + explicit ast_array_specifier(const struct YYLTYPE &locp) + : dimension_count(1), is_unsized_array(true) + { + set_location(locp); + } + + /** Sized array specifier ([dim]) */ + ast_array_specifier(const struct YYLTYPE &locp, ast_expression *dim) + : dimension_count(1), is_unsized_array(false) + { + set_location(locp); + array_dimensions.push_tail(&dim->link); + } + + void add_dimension(ast_expression *dim) + { + array_dimensions.push_tail(&dim->link); + dimension_count++; + } + + virtual void print(void) const; + + /* Count including sized and unsized dimensions */ + unsigned dimension_count; + + /* If true, this means that the array has an unsized outermost dimension. */ + bool is_unsized_array; + + /* This list contains objects of type ast_node containing the + * sized dimensions only, in outermost-to-innermost order. + */ + exec_list array_dimensions; +}; + /** * C-style aggregate initialization class * @@ -300,7 +337,16 @@ public: /* empty */ } - ast_type_specifier *constructor_type; + /** + * glsl_type of the aggregate, which is inferred from the LHS of whatever + * the aggregate is being used to initialize. This can't be inferred at + * parse time (since the parser deals with ast_type_specifiers, not + * glsl_types), so the parser leaves it NULL. However, the ast-to-hir + * conversion code makes sure to fill it in with the appropriate type + * before hir() is called. + */ + const glsl_type *constructor_type; + virtual ir_rvalue *hir(exec_list *instructions, struct _mesa_glsl_parse_state *state); }; @@ -329,14 +375,14 @@ public: class ast_declaration : public ast_node { public: - ast_declaration(const char *identifier, bool is_array, ast_expression *array_size, - ast_expression *initializer); + ast_declaration(const char *identifier, + ast_array_specifier *array_specifier, + ast_expression *initializer); virtual void print(void) const; const char *identifier; - - bool is_array; - ast_expression *array_size; + + ast_array_specifier *array_specifier; ast_expression *initializer; }; @@ -545,10 +591,10 @@ public: * Use only if the objects are allocated from the same context and will not * be modified. Zeros the inherited ast_node's fields. */ - ast_type_specifier(const ast_type_specifier *that, bool is_array, - ast_expression *array_size) + ast_type_specifier(const ast_type_specifier *that, + ast_array_specifier *array_specifier) : ast_node(), type_name(that->type_name), structure(that->structure), - is_array(is_array), array_size(array_size), + array_specifier(array_specifier), default_precision(that->default_precision) { /* empty */ @@ -556,8 +602,7 @@ public: /** Construct a type specifier from a type name */ ast_type_specifier(const char *name) - : type_name(name), structure(NULL), - is_array(false), array_size(NULL), + : type_name(name), structure(NULL), array_specifier(NULL), default_precision(ast_precision_none) { /* empty */ @@ -565,8 +610,7 @@ public: /** Construct a type specifier from a structure definition */ ast_type_specifier(ast_struct_specifier *s) - : type_name(s->name), structure(s), - is_array(false), array_size(NULL), + : type_name(s->name), structure(s), array_specifier(NULL), default_precision(ast_precision_none) { /* empty */ @@ -583,8 +627,7 @@ public: const char *type_name; ast_struct_specifier *structure; - bool is_array; - ast_expression *array_size; + ast_array_specifier *array_specifier; /** For precision statements, this is the given precision; otherwise none. */ unsigned default_precision:2; @@ -637,8 +680,7 @@ public: ast_parameter_declarator() : type(NULL), identifier(NULL), - is_array(false), - array_size(NULL), + array_specifier(NULL), formal_parameter(false), is_void(false) { @@ -652,8 +694,7 @@ public: ast_fully_specified_type *type; const char *identifier; - bool is_array; - ast_expression *array_size; + ast_array_specifier *array_specifier; static void parameters_to_hir(exec_list *ast_parameters, bool formal, exec_list *ir_parameters, @@ -900,13 +941,10 @@ class ast_interface_block : public ast_node { public: ast_interface_block(ast_type_qualifier layout, const char *instance_name, - bool is_array, - ast_expression *array_size) + ast_array_specifier *array_specifier) : layout(layout), block_name(NULL), instance_name(instance_name), - is_array(is_array), array_size(array_size) + array_specifier(array_specifier) { - if (!is_array) - assert(array_size == NULL); } virtual ir_rvalue *hir(exec_list *instructions, @@ -927,21 +965,12 @@ public: exec_list declarations; /** - * True if the block is declared as an array - * - * \note - * A block can only be an array if it also has an instance name. If this - * field is true, ::instance_name must also not be \c NULL. - */ - bool is_array; - - /** * Declared array size of the block instance * * If the block is not declared as an array or if the block instance array * is unsized, this field will be \c NULL. */ - ast_expression *array_size; + ast_array_specifier *array_specifier; }; @@ -982,9 +1011,8 @@ _mesa_ast_array_index_to_hir(void *mem_ctx, YYLTYPE &loc, YYLTYPE &idx_loc); extern void -_mesa_ast_set_aggregate_type(const ast_type_specifier *type, - ast_expression *expr, - _mesa_glsl_parse_state *state); +_mesa_ast_set_aggregate_type(const glsl_type *type, + ast_expression *expr); void emit_function(_mesa_glsl_parse_state *state, ir_function *f); diff --git a/mesalib/src/glsl/ast_array_index.cpp b/mesalib/src/glsl/ast_array_index.cpp index a5f23206a..f3b060ea6 100644 --- a/mesalib/src/glsl/ast_array_index.cpp +++ b/mesalib/src/glsl/ast_array_index.cpp @@ -25,6 +25,19 @@ #include "glsl_types.h" #include "ir.h" +void +ast_array_specifier::print(void) const +{ + if (this->is_unsized_array) { + printf("[ ] "); + } + + foreach_list_typed (ast_node, array_dimension, link, &this->array_dimensions) { + printf("[ "); + array_dimension->print(); + printf("] "); + } +} /** * If \c ir is a reference to an array for which we are tracking the max array diff --git a/mesalib/src/glsl/ast_function.cpp b/mesalib/src/glsl/ast_function.cpp index 2d05d0723..4c5b0e4aa 100644 --- a/mesalib/src/glsl/ast_function.cpp +++ b/mesalib/src/glsl/ast_function.cpp @@ -1687,14 +1687,12 @@ ast_aggregate_initializer::hir(exec_list *instructions, { void *ctx = state; YYLTYPE loc = this->get_location(); - const char *name; if (!this->constructor_type) { _mesa_glsl_error(&loc, state, "type of C-style initializer unknown"); return ir_rvalue::error_value(ctx); } - const glsl_type *const constructor_type = - this->constructor_type->glsl_type(&name, state); + const glsl_type *const constructor_type = this->constructor_type; if (!state->ARB_shading_language_420pack_enable) { _mesa_glsl_error(&loc, state, "C-style initialization requires the " @@ -1702,12 +1700,12 @@ ast_aggregate_initializer::hir(exec_list *instructions, return ir_rvalue::error_value(ctx); } - if (this->constructor_type->is_array) { + if (constructor_type->is_array()) { return process_array_constructor(instructions, constructor_type, &loc, &this->expressions, state); } - if (this->constructor_type->structure) { + if (constructor_type->is_record()) { return process_record_constructor(instructions, constructor_type, &loc, &this->expressions, state); } diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp index 4cc8eb18d..1bfb4e531 100644 --- a/mesalib/src/glsl/ast_to_hir.cpp +++ b/mesalib/src/glsl/ast_to_hir.cpp @@ -740,14 +740,15 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state, { void *ctx = state; bool error_emitted = (lhs->type->is_error() || rhs->type->is_error()); + ir_rvalue *extract_channel = NULL; /* If the assignment LHS comes back as an ir_binop_vector_extract * expression, move it to the RHS as an ir_triop_vector_insert. */ if (lhs->ir_type == ir_type_expression) { - ir_expression *const expr = lhs->as_expression(); + ir_expression *const lhs_expr = lhs->as_expression(); - if (unlikely(expr->operation == ir_binop_vector_extract)) { + if (unlikely(lhs_expr->operation == ir_binop_vector_extract)) { ir_rvalue *new_rhs = validate_assignment(state, lhs_loc, lhs->type, rhs, is_initializer); @@ -755,12 +756,24 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state, if (new_rhs == NULL) { return lhs; } else { + /* This converts: + * - LHS: (expression float vector_extract <vec> <channel>) + * - RHS: <scalar> + * into: + * - LHS: <vec> + * - RHS: (expression vec2 vector_insert <vec> <channel> <scalar>) + * + * The LHS type is now a vector instead of a scalar. Since GLSL + * allows assignments to be used as rvalues, we need to re-extract + * the channel from assignment_temp when returning the rvalue. + */ + extract_channel = lhs_expr->operands[1]; rhs = new(ctx) ir_expression(ir_triop_vector_insert, - expr->operands[0]->type, - expr->operands[0], + lhs_expr->operands[0]->type, + lhs_expr->operands[0], new_rhs, - expr->operands[1]); - lhs = expr->operands[0]->clone(ctx, NULL); + extract_channel); + lhs = lhs_expr->operands[0]->clone(ctx, NULL); } } } @@ -830,8 +843,10 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state, rhs->type->array_size()); d->type = var->type; } - mark_whole_array_access(rhs); - mark_whole_array_access(lhs); + if (lhs->type->is_array()) { + mark_whole_array_access(rhs); + mark_whole_array_access(lhs); + } } /* Most callers of do_assignment (assign, add_assign, pre_inc/dec, @@ -854,6 +869,11 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state, if (!error_emitted) instructions->push_tail(new(ctx) ir_assignment(lhs, deref_var)); + if (extract_channel) { + return new(ctx) ir_expression(ir_binop_vector_extract, + new(ctx) ir_dereference_variable(var), + extract_channel->clone(ctx, NULL)); + } return new(ctx) ir_dereference_variable(var); } @@ -1771,64 +1791,108 @@ ast_compound_statement::hir(exec_list *instructions, return NULL; } +/** + * Evaluate the given exec_node (which should be an ast_node representing + * a single array dimension) and return its integer value. + */ +static const unsigned +process_array_size(exec_node *node, + struct _mesa_glsl_parse_state *state) +{ + exec_list dummy_instructions; + + ast_node *array_size = exec_node_data(ast_node, node, link); + ir_rvalue *const ir = array_size->hir(& dummy_instructions, + state); + YYLTYPE loc = array_size->get_location(); + + if (ir == NULL) { + _mesa_glsl_error(& loc, state, + "array size could not be resolved"); + return 0; + } + + if (!ir->type->is_integer()) { + _mesa_glsl_error(& loc, state, + "array size must be integer type"); + return 0; + } + + if (!ir->type->is_scalar()) { + _mesa_glsl_error(& loc, state, + "array size must be scalar type"); + return 0; + } + + ir_constant *const size = ir->constant_expression_value(); + if (size == NULL) { + _mesa_glsl_error(& loc, state, "array size must be a " + "constant valued expression"); + return 0; + } + + if (size->value.i[0] <= 0) { + _mesa_glsl_error(& loc, state, "array size must be > 0"); + return 0; + } + + assert(size->type == ir->type); + + /* If the array size is const (and we've verified that + * it is) then no instructions should have been emitted + * when we converted it to HIR. If they were emitted, + * then either the array size isn't const after all, or + * we are emitting unnecessary instructions. + */ + assert(dummy_instructions.is_empty()); + + return size->value.u[0]; +} static const glsl_type * -process_array_type(YYLTYPE *loc, const glsl_type *base, ast_node *array_size, - struct _mesa_glsl_parse_state *state) +process_array_type(YYLTYPE *loc, const glsl_type *base, + ast_array_specifier *array_specifier, + struct _mesa_glsl_parse_state *state) { - unsigned length = 0; + const glsl_type *array_type = base; - if (base == NULL) - return glsl_type::error_type; + if (array_specifier != NULL) { + if (base->is_array()) { - /* From page 19 (page 25) of the GLSL 1.20 spec: - * - * "Only one-dimensional arrays may be declared." - */ - if (base->is_array()) { - _mesa_glsl_error(loc, state, - "invalid array of `%s' (only one-dimensional arrays " - "may be declared)", - base->name); - return glsl_type::error_type; - } + /* From page 19 (page 25) of the GLSL 1.20 spec: + * + * "Only one-dimensional arrays may be declared." + */ + if (!state->ARB_arrays_of_arrays_enable) { + _mesa_glsl_error(loc, state, + "invalid array of `%s'" + "GL_ARB_arrays_of_arrays " + "required for defining arrays of arrays", + base->name); + return glsl_type::error_type; + } - if (array_size != NULL) { - exec_list dummy_instructions; - ir_rvalue *const ir = array_size->hir(& dummy_instructions, state); - YYLTYPE loc = array_size->get_location(); + if (base->length == 0) { + _mesa_glsl_error(loc, state, + "only the outermost array dimension can " + "be unsized", + base->name); + return glsl_type::error_type; + } + } - if (ir != NULL) { - if (!ir->type->is_integer()) { - _mesa_glsl_error(& loc, state, "array size must be integer type"); - } else if (!ir->type->is_scalar()) { - _mesa_glsl_error(& loc, state, "array size must be scalar type"); - } else { - ir_constant *const size = ir->constant_expression_value(); - - if (size == NULL) { - _mesa_glsl_error(& loc, state, "array size must be a " - "constant valued expression"); - } else if (size->value.i[0] <= 0) { - _mesa_glsl_error(& loc, state, "array size must be > 0"); - } else { - assert(size->type == ir->type); - length = size->value.u[0]; - - /* If the array size is const (and we've verified that - * it is) then no instructions should have been emitted - * when we converted it to HIR. If they were emitted, - * then either the array size isn't const after all, or - * we are emitting unnecessary instructions. - */ - assert(dummy_instructions.is_empty()); - } - } + for (exec_node *node = array_specifier->array_dimensions.tail_pred; + !node->is_head_sentinel(); node = node->prev) { + unsigned array_size = process_array_size(node, state); + array_type = glsl_type::get_array_instance(array_type, + array_size); } + + if (array_specifier->is_unsized_array) + array_type = glsl_type::get_array_instance(array_type, 0); } - const glsl_type *array_type = glsl_type::get_array_instance(base, length); - return array_type != NULL ? array_type : glsl_type::error_type; + return array_type; } @@ -1841,10 +1905,8 @@ ast_type_specifier::glsl_type(const char **name, type = state->symbols->get_type(this->type_name); *name = this->type_name; - if (this->is_array) { - YYLTYPE loc = this->get_location(); - type = process_array_type(&loc, type, this->array_size, state); - } + YYLTYPE loc = this->get_location(); + type = process_array_type(&loc, type, this->array_specifier, state); return type; } @@ -2593,6 +2655,13 @@ process_initializer(ir_variable *var, ast_declaration *decl, ? "attribute" : "varying"); } + /* If the initializer is an ast_aggregate_initializer, recursively store + * type information from the LHS into it, so that its hir() function can do + * type checking. + */ + if (decl->initializer->oper == ast_aggregate) + _mesa_ast_set_aggregate_type(var->type, decl->initializer); + ir_dereference *const lhs = new(state) ir_dereference_variable(var); ir_rvalue *rhs = decl->initializer->hir(initializer_instructions, state); @@ -2823,8 +2892,7 @@ ast_declarator_list::hir(exec_list *instructions, } foreach_list_typed (ast_declaration, decl, link, &this->declarations) { - assert(!decl->is_array); - assert(decl->array_size == NULL); + assert(decl->array_specifier == NULL); assert(decl->initializer == NULL); ir_variable *const earlier = @@ -2959,14 +3027,8 @@ ast_declarator_list::hir(exec_list *instructions, continue; } - if (decl->is_array) { - var_type = process_array_type(&loc, decl_type, decl->array_size, - state); - if (var_type->is_error()) - continue; - } else { - var_type = decl_type; - } + var_type = process_array_type(&loc, decl_type, decl->array_specifier, + state); var = new(ctx) ir_variable(var_type, decl->identifier, ir_var_auto); @@ -3098,8 +3160,9 @@ ast_declarator_list::hir(exec_list *instructions, * vectors. Vertex shader inputs cannot be arrays or * structures." */ - const glsl_type *check_type = var->type->is_array() - ? var->type->fields.array : var->type; + const glsl_type *check_type = var->type; + while (check_type->is_array()) + check_type = check_type->element_type(); switch (check_type->base_type) { case GLSL_TYPE_FLOAT: @@ -3523,9 +3586,7 @@ ast_parameter_declarator::hir(exec_list *instructions, /* This only handles "vec4 foo[..]". The earlier specifier->glsl_type(...) * call already handled the "vec4[..] foo" case. */ - if (this->is_array) { - type = process_array_type(&loc, type, this->array_size, state); - } + type = process_array_type(&loc, type, this->array_specifier, state); if (!type->is_error() && type->is_unsized_array()) { _mesa_glsl_error(&loc, state, "arrays passed as parameters must have " @@ -4463,7 +4524,7 @@ ast_type_specifier::hir(exec_list *instructions, return NULL; } - if (this->is_array) { + if (this->array_specifier != NULL) { _mesa_glsl_error(&loc, state, "default precision statements do not apply to " "arrays"); @@ -4653,10 +4714,8 @@ ast_process_structure_or_interface_block(exec_list *instructions, "members"); } - if (decl->is_array) { - field_type = process_array_type(&loc, decl_type, decl->array_size, - state); - } + field_type = process_array_type(&loc, decl_type, + decl->array_specifier, state); fields[i].type = field_type; fields[i].name = decl->identifier; fields[i].location = -1; @@ -4882,7 +4941,7 @@ ast_interface_block::hir(exec_list *instructions, _mesa_shader_stage_to_string(state->stage)); } if (this->instance_name == NULL || - strcmp(this->instance_name, "gl_in") != 0 || !this->is_array) { + strcmp(this->instance_name, "gl_in") != 0 || this->array_specifier == NULL) { _mesa_glsl_error(&loc, state, "gl_PerVertex input must be redeclared as " "gl_in[]"); @@ -4984,7 +5043,7 @@ ast_interface_block::hir(exec_list *instructions, * variable (or input block, see interface blocks below) needs to be * declared as an array. */ - if (state->stage == MESA_SHADER_GEOMETRY && !this->is_array && + if (state->stage == MESA_SHADER_GEOMETRY && this->array_specifier == NULL && var_mode == ir_var_shader_in) { _mesa_glsl_error(&loc, state, "geometry shader inputs must be arrays"); } @@ -5018,7 +5077,7 @@ ast_interface_block::hir(exec_list *instructions, ir_variable *var; - if (this->is_array) { + if (this->array_specifier != NULL) { /* Section 4.3.7 (Interface Blocks) of the GLSL 1.50 spec says: * * For uniform blocks declared an array, each individual array @@ -5038,7 +5097,7 @@ ast_interface_block::hir(exec_list *instructions, * interface array size *doesn't* need to be specified is on a * geometry shader input. */ - if (this->array_size == NULL && + if (this->array_specifier->is_unsized_array && (state->stage != MESA_SHADER_GEOMETRY || !this->layout.flags.q.in)) { _mesa_glsl_error(&loc, state, "only geometry shader inputs may be unsized " @@ -5047,7 +5106,7 @@ ast_interface_block::hir(exec_list *instructions, } const glsl_type *block_array_type = - process_array_type(&loc, block_type, this->array_size, state); + process_array_type(&loc, block_type, this->array_specifier, state); var = new(state) ir_variable(block_array_type, this->instance_name, @@ -5079,7 +5138,7 @@ ast_interface_block::hir(exec_list *instructions, /* In order to have an array size, the block must also be declared with * an instane name. */ - assert(!this->is_array); + assert(this->array_specifier == NULL); for (unsigned i = 0; i < num_variables; i++) { ir_variable *var = diff --git a/mesalib/src/glsl/ast_type.cpp b/mesalib/src/glsl/ast_type.cpp index d758bfa1f..637da0dfb 100644 --- a/mesalib/src/glsl/ast_type.cpp +++ b/mesalib/src/glsl/ast_type.cpp @@ -32,14 +32,8 @@ ast_type_specifier::print(void) const printf("%s ", type_name); } - if (is_array) { - printf("[ "); - - if (array_size) { - array_size->print(); - } - - printf("] "); + if (array_specifier) { + array_specifier->print(); } } diff --git a/mesalib/src/glsl/builtin_functions.cpp b/mesalib/src/glsl/builtin_functions.cpp index b1065f48d..ed58ddddb 100755 --- a/mesalib/src/glsl/builtin_functions.cpp +++ b/mesalib/src/glsl/builtin_functions.cpp @@ -576,20 +576,9 @@ private: ir_function_signature *_atomic_op(const char *intrinsic, builtin_available_predicate avail); - ir_function_signature *_min3(builtin_available_predicate avail, - const glsl_type *x_type, - const glsl_type *y_type, - const glsl_type *z_type); - - ir_function_signature *_max3(builtin_available_predicate avail, - const glsl_type *x_type, - const glsl_type *y_type, - const glsl_type *z_type); - - ir_function_signature *_mid3(builtin_available_predicate avail, - const glsl_type *x_type, - const glsl_type *y_type, - const glsl_type *z_type); + B1(min3) + B1(max3) + B1(mid3) #undef B0 #undef B1 @@ -2128,54 +2117,54 @@ builtin_builder::create_builtins() NULL); add_function("min3", - _min3(shader_trinary_minmax, glsl_type::float_type, glsl_type::float_type, glsl_type::float_type), - _min3(shader_trinary_minmax, glsl_type::vec2_type, glsl_type::vec2_type, glsl_type::vec2_type), - _min3(shader_trinary_minmax, glsl_type::vec3_type, glsl_type::vec3_type, glsl_type::vec3_type), - _min3(shader_trinary_minmax, glsl_type::vec4_type, glsl_type::vec4_type, glsl_type::vec4_type), - - _min3(shader_trinary_minmax, glsl_type::int_type, glsl_type::int_type, glsl_type::int_type), - _min3(shader_trinary_minmax, glsl_type::ivec2_type, glsl_type::ivec2_type, glsl_type::ivec2_type), - _min3(shader_trinary_minmax, glsl_type::ivec3_type, glsl_type::ivec3_type, glsl_type::ivec3_type), - _min3(shader_trinary_minmax, glsl_type::ivec4_type, glsl_type::ivec4_type, glsl_type::ivec4_type), - - _min3(shader_trinary_minmax, glsl_type::uint_type, glsl_type::uint_type, glsl_type::uint_type), - _min3(shader_trinary_minmax, glsl_type::uvec2_type, glsl_type::uvec2_type, glsl_type::uvec2_type), - _min3(shader_trinary_minmax, glsl_type::uvec3_type, glsl_type::uvec3_type, glsl_type::uvec3_type), - _min3(shader_trinary_minmax, glsl_type::uvec4_type, glsl_type::uvec4_type, glsl_type::uvec4_type), + _min3(glsl_type::float_type), + _min3(glsl_type::vec2_type), + _min3(glsl_type::vec3_type), + _min3(glsl_type::vec4_type), + + _min3(glsl_type::int_type), + _min3(glsl_type::ivec2_type), + _min3(glsl_type::ivec3_type), + _min3(glsl_type::ivec4_type), + + _min3(glsl_type::uint_type), + _min3(glsl_type::uvec2_type), + _min3(glsl_type::uvec3_type), + _min3(glsl_type::uvec4_type), NULL); add_function("max3", - _max3(shader_trinary_minmax, glsl_type::float_type, glsl_type::float_type, glsl_type::float_type), - _max3(shader_trinary_minmax, glsl_type::vec2_type, glsl_type::vec2_type, glsl_type::vec2_type), - _max3(shader_trinary_minmax, glsl_type::vec3_type, glsl_type::vec3_type, glsl_type::vec3_type), - _max3(shader_trinary_minmax, glsl_type::vec4_type, glsl_type::vec4_type, glsl_type::vec4_type), - - _max3(shader_trinary_minmax, glsl_type::int_type, glsl_type::int_type, glsl_type::int_type), - _max3(shader_trinary_minmax, glsl_type::ivec2_type, glsl_type::ivec2_type, glsl_type::ivec2_type), - _max3(shader_trinary_minmax, glsl_type::ivec3_type, glsl_type::ivec3_type, glsl_type::ivec3_type), - _max3(shader_trinary_minmax, glsl_type::ivec4_type, glsl_type::ivec4_type, glsl_type::ivec4_type), - - _max3(shader_trinary_minmax, glsl_type::uint_type, glsl_type::uint_type, glsl_type::uint_type), - _max3(shader_trinary_minmax, glsl_type::uvec2_type, glsl_type::uvec2_type, glsl_type::uvec2_type), - _max3(shader_trinary_minmax, glsl_type::uvec3_type, glsl_type::uvec3_type, glsl_type::uvec3_type), - _max3(shader_trinary_minmax, glsl_type::uvec4_type, glsl_type::uvec4_type, glsl_type::uvec4_type), + _max3(glsl_type::float_type), + _max3(glsl_type::vec2_type), + _max3(glsl_type::vec3_type), + _max3(glsl_type::vec4_type), + + _max3(glsl_type::int_type), + _max3(glsl_type::ivec2_type), + _max3(glsl_type::ivec3_type), + _max3(glsl_type::ivec4_type), + + _max3(glsl_type::uint_type), + _max3(glsl_type::uvec2_type), + _max3(glsl_type::uvec3_type), + _max3(glsl_type::uvec4_type), NULL); add_function("mid3", - _mid3(shader_trinary_minmax, glsl_type::float_type, glsl_type::float_type, glsl_type::float_type), - _mid3(shader_trinary_minmax, glsl_type::vec2_type, glsl_type::vec2_type, glsl_type::vec2_type), - _mid3(shader_trinary_minmax, glsl_type::vec3_type, glsl_type::vec3_type, glsl_type::vec3_type), - _mid3(shader_trinary_minmax, glsl_type::vec4_type, glsl_type::vec4_type, glsl_type::vec4_type), - - _mid3(shader_trinary_minmax, glsl_type::int_type, glsl_type::int_type, glsl_type::int_type), - _mid3(shader_trinary_minmax, glsl_type::ivec2_type, glsl_type::ivec2_type, glsl_type::ivec2_type), - _mid3(shader_trinary_minmax, glsl_type::ivec3_type, glsl_type::ivec3_type, glsl_type::ivec3_type), - _mid3(shader_trinary_minmax, glsl_type::ivec4_type, glsl_type::ivec4_type, glsl_type::ivec4_type), - - _mid3(shader_trinary_minmax, glsl_type::uint_type, glsl_type::uint_type, glsl_type::uint_type), - _mid3(shader_trinary_minmax, glsl_type::uvec2_type, glsl_type::uvec2_type, glsl_type::uvec2_type), - _mid3(shader_trinary_minmax, glsl_type::uvec3_type, glsl_type::uvec3_type, glsl_type::uvec3_type), - _mid3(shader_trinary_minmax, glsl_type::uvec4_type, glsl_type::uvec4_type, glsl_type::uvec4_type), + _mid3(glsl_type::float_type), + _mid3(glsl_type::vec2_type), + _mid3(glsl_type::vec3_type), + _mid3(glsl_type::vec4_type), + + _mid3(glsl_type::int_type), + _mid3(glsl_type::ivec2_type), + _mid3(glsl_type::ivec3_type), + _mid3(glsl_type::ivec4_type), + + _mid3(glsl_type::uint_type), + _mid3(glsl_type::uvec2_type), + _mid3(glsl_type::uvec3_type), + _mid3(glsl_type::uvec4_type), NULL); #undef F @@ -4064,14 +4053,12 @@ builtin_builder::_atomic_op(const char *intrinsic, } ir_function_signature * -builtin_builder::_min3(builtin_available_predicate avail, - const glsl_type *x_type, const glsl_type *y_type, - const glsl_type *z_type) +builtin_builder::_min3(const glsl_type *type) { - ir_variable *x = in_var(x_type, "x"); - ir_variable *y = in_var(y_type, "y"); - ir_variable *z = in_var(z_type, "z"); - MAKE_SIG(x_type, avail, 3, x, y, z); + ir_variable *x = in_var(type, "x"); + ir_variable *y = in_var(type, "y"); + ir_variable *z = in_var(type, "z"); + MAKE_SIG(type, shader_trinary_minmax, 3, x, y, z); ir_expression *min3 = min2(x, min2(y,z)); body.emit(ret(min3)); @@ -4080,14 +4067,12 @@ builtin_builder::_min3(builtin_available_predicate avail, } ir_function_signature * -builtin_builder::_max3(builtin_available_predicate avail, - const glsl_type *x_type, const glsl_type *y_type, - const glsl_type *z_type) +builtin_builder::_max3(const glsl_type *type) { - ir_variable *x = in_var(x_type, "x"); - ir_variable *y = in_var(y_type, "y"); - ir_variable *z = in_var(z_type, "z"); - MAKE_SIG(x_type, avail, 3, x, y, z); + ir_variable *x = in_var(type, "x"); + ir_variable *y = in_var(type, "y"); + ir_variable *z = in_var(type, "z"); + MAKE_SIG(type, shader_trinary_minmax, 3, x, y, z); ir_expression *max3 = max2(x, max2(y,z)); body.emit(ret(max3)); @@ -4096,14 +4081,12 @@ builtin_builder::_max3(builtin_available_predicate avail, } ir_function_signature * -builtin_builder::_mid3(builtin_available_predicate avail, - const glsl_type *x_type, const glsl_type *y_type, - const glsl_type *z_type) +builtin_builder::_mid3(const glsl_type *type) { - ir_variable *x = in_var(x_type, "x"); - ir_variable *y = in_var(y_type, "y"); - ir_variable *z = in_var(z_type, "z"); - MAKE_SIG(x_type, avail, 3, x, y, z); + ir_variable *x = in_var(type, "x"); + ir_variable *y = in_var(type, "y"); + ir_variable *z = in_var(type, "z"); + MAKE_SIG(type, shader_trinary_minmax, 3, x, y, z); ir_expression *mid3 = max2(min2(x, y), max2(min2(x, z), min2(y, z))); body.emit(ret(mid3)); diff --git a/mesalib/src/glsl/builtin_variables.cpp b/mesalib/src/glsl/builtin_variables.cpp index f630923ed..d6bc3c073 100644 --- a/mesalib/src/glsl/builtin_variables.cpp +++ b/mesalib/src/glsl/builtin_variables.cpp @@ -780,6 +780,8 @@ void builtin_variable_generator::generate_gs_special_vars() { add_output(VARYING_SLOT_LAYER, int_t, "gl_Layer"); + if (state->ARB_viewport_array_enable) + add_output(VARYING_SLOT_VIEWPORT, int_t, "gl_ViewportIndex"); /* Although gl_PrimitiveID appears in tessellation control and tessellation * evaluation shaders, it has a different function there than it has in diff --git a/mesalib/src/glsl/glcpp/glcpp-parse.y b/mesalib/src/glsl/glcpp/glcpp-parse.y index 55c498195..184e5c237 100644 --- a/mesalib/src/glsl/glcpp/glcpp-parse.y +++ b/mesalib/src/glsl/glcpp/glcpp-parse.y @@ -30,7 +30,6 @@ #include "glcpp.h" #include "main/core.h" /* for struct gl_extensions */ -#include "main/mtypes.h" /* for gl_api enum */ static void yyerror (YYLTYPE *locp, glcpp_parser_t *parser, const char *error); @@ -135,7 +134,7 @@ _glcpp_parser_skip_stack_pop (glcpp_parser_t *parser, YYLTYPE *loc); static void _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t version, - const char *ident); + const char *ident, bool explicitly_set); static int glcpp_parser_lex (YYSTYPE *yylval, YYLTYPE *yylloc, glcpp_parser_t *parser); @@ -194,12 +193,15 @@ line: control_line { ralloc_asprintf_rewrite_tail (&parser->output, &parser->output_length, "\n"); } -| HASH_LINE pp_tokens NEWLINE { +| HASH_LINE { + glcpp_parser_resolve_version(parser); + } pp_tokens NEWLINE { + if (parser->skip_stack == NULL || parser->skip_stack->type == SKIP_NO_SKIP) { _glcpp_parser_expand_and_lex_from (parser, - LINE_EXPANDED, $2); + LINE_EXPANDED, $3); } } | text_line { @@ -238,25 +240,35 @@ expanded_line: } ; -control_line: - HASH_DEFINE OBJ_IDENTIFIER replacement_list NEWLINE { - _define_object_macro (parser, & @2, $2, $3); +define: + OBJ_IDENTIFIER replacement_list NEWLINE { + _define_object_macro (parser, & @1, $1, $2); } -| HASH_DEFINE FUNC_IDENTIFIER '(' ')' replacement_list NEWLINE { - _define_function_macro (parser, & @2, $2, NULL, $5); +| FUNC_IDENTIFIER '(' ')' replacement_list NEWLINE { + _define_function_macro (parser, & @1, $1, NULL, $4); } -| HASH_DEFINE FUNC_IDENTIFIER '(' identifier_list ')' replacement_list NEWLINE { - _define_function_macro (parser, & @2, $2, $4, $6); +| FUNC_IDENTIFIER '(' identifier_list ')' replacement_list NEWLINE { + _define_function_macro (parser, & @1, $1, $3, $5); } -| HASH_UNDEF IDENTIFIER NEWLINE { - macro_t *macro = hash_table_find (parser->defines, $2); +; + +control_line: + HASH_DEFINE { + glcpp_parser_resolve_version(parser); + } define +| HASH_UNDEF { + glcpp_parser_resolve_version(parser); + } IDENTIFIER NEWLINE { + macro_t *macro = hash_table_find (parser->defines, $3); if (macro) { - hash_table_remove (parser->defines, $2); + hash_table_remove (parser->defines, $3); ralloc_free (macro); } - ralloc_free ($2); + ralloc_free ($3); } -| HASH_IF conditional_tokens NEWLINE { +| HASH_IF { + glcpp_parser_resolve_version(parser); + } conditional_tokens NEWLINE { /* Be careful to only evaluate the 'if' expression if * we are not skipping. When we are skipping, we * simply push a new 0-valued 'if' onto the skip @@ -268,7 +280,7 @@ control_line: parser->skip_stack->type == SKIP_NO_SKIP) { _glcpp_parser_expand_and_lex_from (parser, - IF_EXPANDED, $2); + IF_EXPANDED, $3); } else { @@ -286,15 +298,19 @@ control_line: } _glcpp_parser_skip_stack_push_if (parser, & @1, 0); } -| HASH_IFDEF IDENTIFIER junk NEWLINE { - macro_t *macro = hash_table_find (parser->defines, $2); - ralloc_free ($2); +| HASH_IFDEF { + glcpp_parser_resolve_version(parser); + } IDENTIFIER junk NEWLINE { + macro_t *macro = hash_table_find (parser->defines, $3); + ralloc_free ($3); _glcpp_parser_skip_stack_push_if (parser, & @1, macro != NULL); } -| HASH_IFNDEF IDENTIFIER junk NEWLINE { - macro_t *macro = hash_table_find (parser->defines, $2); - ralloc_free ($2); - _glcpp_parser_skip_stack_push_if (parser, & @1, macro == NULL); +| HASH_IFNDEF { + glcpp_parser_resolve_version(parser); + } IDENTIFIER junk NEWLINE { + macro_t *macro = hash_table_find (parser->defines, $3); + ralloc_free ($3); + _glcpp_parser_skip_stack_push_if (parser, & @2, macro == NULL); } | HASH_ELIF conditional_tokens NEWLINE { /* Be careful to only evaluate the 'elif' expression @@ -358,12 +374,14 @@ control_line: _glcpp_parser_skip_stack_pop (parser, & @1); } NEWLINE | HASH_VERSION integer_constant NEWLINE { - _glcpp_parser_handle_version_declaration(parser, $2, NULL); + _glcpp_parser_handle_version_declaration(parser, $2, NULL, true); } | HASH_VERSION integer_constant IDENTIFIER NEWLINE { - _glcpp_parser_handle_version_declaration(parser, $2, $3); + _glcpp_parser_handle_version_declaration(parser, $2, $3, true); + } +| HASH NEWLINE { + glcpp_parser_resolve_version(parser); } -| HASH NEWLINE ; integer_constant: @@ -1168,10 +1186,9 @@ static void add_builtin_define(glcpp_parser_t *parser, } glcpp_parser_t * -glcpp_parser_create (const struct gl_extensions *extensions, int api) +glcpp_parser_create (const struct gl_extensions *extensions) { glcpp_parser_t *parser; - int language_version; parser = ralloc (NULL, glcpp_parser_t); @@ -1197,99 +1214,14 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api) parser->info_log_length = 0; parser->error = 0; + parser->extensions = extensions; + parser->version_resolved = false; + parser->has_new_line_number = 0; parser->new_line_number = 1; parser->has_new_source_number = 0; parser->new_source_number = 0; - parser->is_gles = false; - - /* Add pre-defined macros. */ - if (api == API_OPENGLES2) { - parser->is_gles = true; - add_builtin_define(parser, "GL_ES", 1); - - if (extensions != NULL) { - if (extensions->OES_EGL_image_external) - add_builtin_define(parser, "GL_OES_EGL_image_external", 1); - } - } else { - add_builtin_define(parser, "GL_ARB_draw_buffers", 1); - add_builtin_define(parser, "GL_ARB_texture_rectangle", 1); - - if (extensions != NULL) { - if (extensions->EXT_texture_array) { - add_builtin_define(parser, "GL_EXT_texture_array", 1); - } - - if (extensions->ARB_fragment_coord_conventions) - add_builtin_define(parser, "GL_ARB_fragment_coord_conventions", - 1); - - if (extensions->ARB_explicit_attrib_location) - add_builtin_define(parser, "GL_ARB_explicit_attrib_location", 1); - - if (extensions->ARB_shader_texture_lod) - add_builtin_define(parser, "GL_ARB_shader_texture_lod", 1); - - if (extensions->ARB_draw_instanced) - add_builtin_define(parser, "GL_ARB_draw_instanced", 1); - - if (extensions->ARB_conservative_depth) { - add_builtin_define(parser, "GL_AMD_conservative_depth", 1); - add_builtin_define(parser, "GL_ARB_conservative_depth", 1); - } - - if (extensions->ARB_shader_bit_encoding) - add_builtin_define(parser, "GL_ARB_shader_bit_encoding", 1); - - if (extensions->ARB_uniform_buffer_object) - add_builtin_define(parser, "GL_ARB_uniform_buffer_object", 1); - - if (extensions->ARB_texture_cube_map_array) - add_builtin_define(parser, "GL_ARB_texture_cube_map_array", 1); - - if (extensions->ARB_shading_language_packing) - add_builtin_define(parser, "GL_ARB_shading_language_packing", 1); - - if (extensions->ARB_texture_multisample) - add_builtin_define(parser, "GL_ARB_texture_multisample", 1); - - if (extensions->ARB_texture_query_levels) - add_builtin_define(parser, "GL_ARB_texture_query_levels", 1); - - if (extensions->ARB_texture_query_lod) - add_builtin_define(parser, "GL_ARB_texture_query_lod", 1); - - if (extensions->ARB_gpu_shader5) - add_builtin_define(parser, "GL_ARB_gpu_shader5", 1); - - if (extensions->AMD_vertex_shader_layer) - add_builtin_define(parser, "GL_AMD_vertex_shader_layer", 1); - - if (extensions->ARB_shading_language_420pack) - add_builtin_define(parser, "GL_ARB_shading_language_420pack", 1); - - if (extensions->ARB_sample_shading) - add_builtin_define(parser, "GL_ARB_sample_shading", 1); - - if (extensions->EXT_shader_integer_mix) - add_builtin_define(parser, "GL_EXT_shader_integer_mix", 1); - - if (extensions->ARB_texture_gather) - add_builtin_define(parser, "GL_ARB_texture_gather", 1); - - if (extensions->ARB_shader_atomic_counters) - add_builtin_define(parser, "GL_ARB_shader_atomic_counters", 1); - - if (extensions->AMD_shader_trinary_minmax) - add_builtin_define(parser, "GL_AMD_shader_trinary_minmax", 1); - } - } - - language_version = 110; - add_builtin_define(parser, "__VERSION__", language_version); - return parser; } @@ -2087,24 +2019,106 @@ _glcpp_parser_skip_stack_pop (glcpp_parser_t *parser, YYLTYPE *loc) static void _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t version, - const char *es_identifier) + const char *es_identifier, + bool explicitly_set) { - macro_t *macro = hash_table_find (parser->defines, "__VERSION__"); - if (macro) { - hash_table_remove (parser->defines, "__VERSION__"); - ralloc_free (macro); - } + const struct gl_extensions *extensions = parser->extensions; + + parser->version_resolved = true; + add_builtin_define (parser, "__VERSION__", version); - /* If we didn't have a GLES context to begin with, (indicated - * by parser->api), then the version declaration here might - * indicate GLES. */ - if (! parser->is_gles && - (version == 100 || - (es_identifier && (strcmp(es_identifier, "es") == 0)))) - { - parser->is_gles = true; - add_builtin_define (parser, "GL_ES", 1); + parser->is_gles = (version == 100) || + (es_identifier && + (strcmp(es_identifier, "es") == 0)); + + /* Add pre-defined macros. */ + if (parser->is_gles) { + add_builtin_define(parser, "GL_ES", 1); + + if (extensions != NULL) { + if (extensions->OES_EGL_image_external) + add_builtin_define(parser, "GL_OES_EGL_image_external", 1); + } + } else { + add_builtin_define(parser, "GL_ARB_draw_buffers", 1); + add_builtin_define(parser, "GL_ARB_texture_rectangle", 1); + + if (extensions != NULL) { + if (extensions->EXT_texture_array) + add_builtin_define(parser, "GL_EXT_texture_array", 1); + + if (extensions->ARB_arrays_of_arrays) + add_builtin_define(parser, "GL_ARB_arrays_of_arrays", 1); + + if (extensions->ARB_fragment_coord_conventions) + add_builtin_define(parser, "GL_ARB_fragment_coord_conventions", + 1); + + if (extensions->ARB_explicit_attrib_location) + add_builtin_define(parser, "GL_ARB_explicit_attrib_location", 1); + + if (extensions->ARB_shader_texture_lod) + add_builtin_define(parser, "GL_ARB_shader_texture_lod", 1); + + if (extensions->ARB_draw_instanced) + add_builtin_define(parser, "GL_ARB_draw_instanced", 1); + + if (extensions->ARB_conservative_depth) { + add_builtin_define(parser, "GL_AMD_conservative_depth", 1); + add_builtin_define(parser, "GL_ARB_conservative_depth", 1); + } + + if (extensions->ARB_shader_bit_encoding) + add_builtin_define(parser, "GL_ARB_shader_bit_encoding", 1); + + if (extensions->ARB_uniform_buffer_object) + add_builtin_define(parser, "GL_ARB_uniform_buffer_object", 1); + + if (extensions->ARB_texture_cube_map_array) + add_builtin_define(parser, "GL_ARB_texture_cube_map_array", 1); + + if (extensions->ARB_shading_language_packing) + add_builtin_define(parser, "GL_ARB_shading_language_packing", 1); + + if (extensions->ARB_texture_multisample) + add_builtin_define(parser, "GL_ARB_texture_multisample", 1); + + if (extensions->ARB_texture_query_levels) + add_builtin_define(parser, "GL_ARB_texture_query_levels", 1); + + if (extensions->ARB_texture_query_lod) + add_builtin_define(parser, "GL_ARB_texture_query_lod", 1); + + if (extensions->ARB_gpu_shader5) + add_builtin_define(parser, "GL_ARB_gpu_shader5", 1); + + if (extensions->AMD_vertex_shader_layer) + add_builtin_define(parser, "GL_AMD_vertex_shader_layer", 1); + + if (extensions->ARB_shading_language_420pack) + add_builtin_define(parser, "GL_ARB_shading_language_420pack", 1); + + if (extensions->ARB_sample_shading) + add_builtin_define(parser, "GL_ARB_sample_shading", 1); + + if (extensions->ARB_texture_gather) + add_builtin_define(parser, "GL_ARB_texture_gather", 1); + + if (extensions->ARB_shader_atomic_counters) + add_builtin_define(parser, "GL_ARB_shader_atomic_counters", 1); + + if (extensions->AMD_shader_trinary_minmax) + add_builtin_define(parser, "GL_AMD_shader_trinary_minmax", 1); + + if (extensions->ARB_viewport_array) + add_builtin_define(parser, "GL_ARB_viewport_array", 1); + } + } + + if (extensions != NULL) { + if (extensions->EXT_shader_integer_mix) + add_builtin_define(parser, "GL_EXT_shader_integer_mix", 1); } if (version >= 150) @@ -2118,8 +2132,23 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio if (version >= 130 || parser->is_gles) add_builtin_define (parser, "GL_FRAGMENT_PRECISION_HIGH", 1); - ralloc_asprintf_rewrite_tail (&parser->output, &parser->output_length, - "#version %" PRIiMAX "%s%s", version, - es_identifier ? " " : "", - es_identifier ? es_identifier : ""); + if (explicitly_set) { + ralloc_asprintf_rewrite_tail (&parser->output, &parser->output_length, + "#version %" PRIiMAX "%s%s", version, + es_identifier ? " " : "", + es_identifier ? es_identifier : ""); + } +} + +/* GLSL version is no version is explicitly specified. */ +#define IMPLICIT_GLSL_VERSION 110 + +void +glcpp_parser_resolve_version(glcpp_parser_t *parser) +{ + if (parser->version_resolved) + return; + + _glcpp_parser_handle_version_declaration(parser, IMPLICIT_GLSL_VERSION, + NULL, false); } diff --git a/mesalib/src/glsl/glcpp/glcpp.c b/mesalib/src/glsl/glcpp/glcpp.c index 13a32fd7d..b632f1715 100644 --- a/mesalib/src/glsl/glcpp/glcpp.c +++ b/mesalib/src/glsl/glcpp/glcpp.c @@ -109,7 +109,6 @@ load_text_file(void *ctx, const char *filename) static void init_fake_gl_context (struct gl_context *gl_ctx) { - gl_ctx->API = API_OPENGL_COMPAT; gl_ctx->Const.DisableGLSLLineContinuations = false; } diff --git a/mesalib/src/glsl/glcpp/glcpp.h b/mesalib/src/glsl/glcpp/glcpp.h index 85f3fdcd2..4aa200a63 100644 --- a/mesalib/src/glsl/glcpp/glcpp.h +++ b/mesalib/src/glsl/glcpp/glcpp.h @@ -182,6 +182,8 @@ struct glcpp_parser { size_t output_length; size_t info_log_length; int error; + const struct gl_extensions *extensions; + bool version_resolved; bool has_new_line_number; int new_line_number; bool has_new_source_number; @@ -192,7 +194,7 @@ struct glcpp_parser { struct gl_extensions; glcpp_parser_t * -glcpp_parser_create (const struct gl_extensions *extensions, int api); +glcpp_parser_create (const struct gl_extensions *extensions); int glcpp_parser_parse (glcpp_parser_t *parser); @@ -200,6 +202,9 @@ glcpp_parser_parse (glcpp_parser_t *parser); void glcpp_parser_destroy (glcpp_parser_t *parser); +void +glcpp_parser_resolve_version(glcpp_parser_t *parser); + int glcpp_preprocess(void *ralloc_ctx, const char **shader, char **info_log, const struct gl_extensions *extensions, struct gl_context *g_ctx); diff --git a/mesalib/src/glsl/glcpp/pp.c b/mesalib/src/glsl/glcpp/pp.c index 7e1b6c689..637a58f9c 100644 --- a/mesalib/src/glsl/glcpp/pp.c +++ b/mesalib/src/glsl/glcpp/pp.c @@ -139,7 +139,7 @@ glcpp_preprocess(void *ralloc_ctx, const char **shader, char **info_log, const struct gl_extensions *extensions, struct gl_context *gl_ctx) { int errors; - glcpp_parser_t *parser = glcpp_parser_create (extensions, gl_ctx->API); + glcpp_parser_t *parser = glcpp_parser_create (extensions); if (! gl_ctx->Const.DisableGLSLLineContinuations) *shader = remove_line_continuations(parser, *shader); @@ -151,6 +151,8 @@ glcpp_preprocess(void *ralloc_ctx, const char **shader, char **info_log, if (parser->skip_stack) glcpp_error (&parser->skip_stack->loc, parser, "Unterminated #if\n"); + glcpp_parser_resolve_version(parser); + ralloc_strcat(info_log, parser->info_log); ralloc_steal(ralloc_ctx, parser->output); diff --git a/mesalib/src/glsl/glsl_parser.yy b/mesalib/src/glsl/glsl_parser.yy index 52f674b63..5d8dfac02 100644 --- a/mesalib/src/glsl/glsl_parser.yy +++ b/mesalib/src/glsl/glsl_parser.yy @@ -98,6 +98,7 @@ static bool match_layout_qualifier(const char *s1, const char *s2, ast_node *node; ast_type_specifier *type_specifier; + ast_array_specifier *array_specifier; ast_fully_specified_type *fully_specified_type; ast_function *function; ast_parameter_declarator *parameter_declarator; @@ -203,6 +204,7 @@ static bool match_layout_qualifier(const char *s1, const char *s2, %type <type_qualifier> interface_qualifier %type <type_specifier> type_specifier %type <type_specifier> type_specifier_nonarray +%type <array_specifier> array_specifier %type <identifier> basic_type_specifier_nonarray %type <fully_specified_type> fully_specified_type %type <function> function_prototype @@ -881,7 +883,7 @@ parameter_declarator: $$->type->specifier = $1; $$->identifier = $2; } - | type_specifier any_identifier '[' constant_expression ']' + | type_specifier any_identifier array_specifier { void *ctx = state; $$ = new(ctx) ast_parameter_declarator(); @@ -890,8 +892,7 @@ parameter_declarator: $$->type->set_location(yylloc); $$->type->specifier = $1; $$->identifier = $2; - $$->is_array = true; - $$->array_size = $4; + $$->array_specifier = $3; } ; @@ -977,76 +978,42 @@ init_declarator_list: | init_declarator_list ',' any_identifier { void *ctx = state; - ast_declaration *decl = new(ctx) ast_declaration($3, false, NULL, NULL); + ast_declaration *decl = new(ctx) ast_declaration($3, NULL, NULL); decl->set_location(yylloc); $$ = $1; $$->declarations.push_tail(&decl->link); state->symbols->add_variable(new(state) ir_variable(NULL, $3, ir_var_auto)); } - | init_declarator_list ',' any_identifier '[' ']' + | init_declarator_list ',' any_identifier array_specifier { void *ctx = state; - ast_declaration *decl = new(ctx) ast_declaration($3, true, NULL, NULL); + ast_declaration *decl = new(ctx) ast_declaration($3, $4, NULL); decl->set_location(yylloc); $$ = $1; $$->declarations.push_tail(&decl->link); state->symbols->add_variable(new(state) ir_variable(NULL, $3, ir_var_auto)); } - | init_declarator_list ',' any_identifier '[' constant_expression ']' + | init_declarator_list ',' any_identifier array_specifier '=' initializer { void *ctx = state; - ast_declaration *decl = new(ctx) ast_declaration($3, true, $5, NULL); + ast_declaration *decl = new(ctx) ast_declaration($3, $4, $6); decl->set_location(yylloc); $$ = $1; $$->declarations.push_tail(&decl->link); state->symbols->add_variable(new(state) ir_variable(NULL, $3, ir_var_auto)); } - | init_declarator_list ',' any_identifier '[' ']' '=' initializer - { - void *ctx = state; - ast_declaration *decl = new(ctx) ast_declaration($3, true, NULL, $7); - decl->set_location(yylloc); - - $$ = $1; - $$->declarations.push_tail(&decl->link); - state->symbols->add_variable(new(state) ir_variable(NULL, $3, ir_var_auto)); - if ($7->oper == ast_aggregate) { - ast_aggregate_initializer *ai = (ast_aggregate_initializer *)$7; - ast_type_specifier *type = new(ctx) ast_type_specifier($1->type->specifier, true, NULL); - _mesa_ast_set_aggregate_type(type, ai, state); - } - } - | init_declarator_list ',' any_identifier '[' constant_expression ']' '=' initializer - { - void *ctx = state; - ast_declaration *decl = new(ctx) ast_declaration($3, true, $5, $8); - decl->set_location(yylloc); - - $$ = $1; - $$->declarations.push_tail(&decl->link); - state->symbols->add_variable(new(state) ir_variable(NULL, $3, ir_var_auto)); - if ($8->oper == ast_aggregate) { - ast_aggregate_initializer *ai = (ast_aggregate_initializer *)$8; - ast_type_specifier *type = new(ctx) ast_type_specifier($1->type->specifier, true, $5); - _mesa_ast_set_aggregate_type(type, ai, state); - } - } | init_declarator_list ',' any_identifier '=' initializer { void *ctx = state; - ast_declaration *decl = new(ctx) ast_declaration($3, false, NULL, $5); + ast_declaration *decl = new(ctx) ast_declaration($3, NULL, $5); decl->set_location(yylloc); $$ = $1; $$->declarations.push_tail(&decl->link); state->symbols->add_variable(new(state) ir_variable(NULL, $3, ir_var_auto)); - if ($5->oper == ast_aggregate) { - ast_aggregate_initializer *ai = (ast_aggregate_initializer *)$5; - _mesa_ast_set_aggregate_type($1->type->specifier, ai, state); - } } ; @@ -1062,74 +1029,43 @@ single_declaration: | fully_specified_type any_identifier { void *ctx = state; - ast_declaration *decl = new(ctx) ast_declaration($2, false, NULL, NULL); + ast_declaration *decl = new(ctx) ast_declaration($2, NULL, NULL); $$ = new(ctx) ast_declarator_list($1); $$->set_location(yylloc); $$->declarations.push_tail(&decl->link); } - | fully_specified_type any_identifier '[' ']' + | fully_specified_type any_identifier array_specifier { void *ctx = state; - ast_declaration *decl = new(ctx) ast_declaration($2, true, NULL, NULL); + ast_declaration *decl = new(ctx) ast_declaration($2, $3, NULL); $$ = new(ctx) ast_declarator_list($1); $$->set_location(yylloc); $$->declarations.push_tail(&decl->link); } - | fully_specified_type any_identifier '[' constant_expression ']' + | fully_specified_type any_identifier array_specifier '=' initializer { void *ctx = state; - ast_declaration *decl = new(ctx) ast_declaration($2, true, $4, NULL); + ast_declaration *decl = new(ctx) ast_declaration($2, $3, $5); $$ = new(ctx) ast_declarator_list($1); $$->set_location(yylloc); $$->declarations.push_tail(&decl->link); } - | fully_specified_type any_identifier '[' ']' '=' initializer - { - void *ctx = state; - ast_declaration *decl = new(ctx) ast_declaration($2, true, NULL, $6); - - $$ = new(ctx) ast_declarator_list($1); - $$->set_location(yylloc); - $$->declarations.push_tail(&decl->link); - if ($6->oper == ast_aggregate) { - ast_aggregate_initializer *ai = (ast_aggregate_initializer *)$6; - ast_type_specifier *type = new(ctx) ast_type_specifier($1->specifier, true, NULL); - _mesa_ast_set_aggregate_type(type, ai, state); - } - } - | fully_specified_type any_identifier '[' constant_expression ']' '=' initializer - { - void *ctx = state; - ast_declaration *decl = new(ctx) ast_declaration($2, true, $4, $7); - - $$ = new(ctx) ast_declarator_list($1); - $$->set_location(yylloc); - $$->declarations.push_tail(&decl->link); - if ($7->oper == ast_aggregate) { - ast_aggregate_initializer *ai = (ast_aggregate_initializer *)$7; - ast_type_specifier *type = new(ctx) ast_type_specifier($1->specifier, true, $4); - _mesa_ast_set_aggregate_type(type, ai, state); - } - } | fully_specified_type any_identifier '=' initializer { void *ctx = state; - ast_declaration *decl = new(ctx) ast_declaration($2, false, NULL, $4); + ast_declaration *decl = new(ctx) ast_declaration($2, NULL, $4); $$ = new(ctx) ast_declarator_list($1); $$->set_location(yylloc); $$->declarations.push_tail(&decl->link); - if ($4->oper == ast_aggregate) { - _mesa_ast_set_aggregate_type($1->specifier, $4, state); - } } | INVARIANT variable_identifier // Vertex only. { void *ctx = state; - ast_declaration *decl = new(ctx) ast_declaration($2, false, NULL, NULL); + ast_declaration *decl = new(ctx) ast_declaration($2, NULL, NULL); $$ = new(ctx) ast_declarator_list(NULL); $$->set_location(yylloc); @@ -1612,19 +1548,51 @@ storage_qualifier: } ; -type_specifier: - type_specifier_nonarray - | type_specifier_nonarray '[' ']' +array_specifier: + '[' ']' + { + void *ctx = state; + $$ = new(ctx) ast_array_specifier(yylloc); + } + | '[' constant_expression ']' + { + void *ctx = state; + $$ = new(ctx) ast_array_specifier(yylloc, $2); + } + | array_specifier '[' ']' { $$ = $1; - $$->is_array = true; - $$->array_size = NULL; + + if (!state->ARB_arrays_of_arrays_enable) { + _mesa_glsl_error(& @1, state, + "GL_ARB_arrays_of_arrays " + "required for defining arrays of arrays"); + } else { + _mesa_glsl_error(& @1, state, + "only the outermost array dimension can " + "be unsized"); + } } - | type_specifier_nonarray '[' constant_expression ']' + | array_specifier '[' constant_expression ']' { $$ = $1; - $$->is_array = true; - $$->array_size = $3; + + if (!state->ARB_arrays_of_arrays_enable) { + _mesa_glsl_error(& @1, state, + "GL_ARB_arrays_of_arrays " + "required for defining arrays of arrays"); + } + + $$->add_dimension($3); + } + ; + +type_specifier: + type_specifier_nonarray + | type_specifier_nonarray array_specifier + { + $$ = $1; + $$->array_specifier = $2; } ; @@ -1804,19 +1772,13 @@ struct_declarator: any_identifier { void *ctx = state; - $$ = new(ctx) ast_declaration($1, false, NULL, NULL); - $$->set_location(yylloc); - } - | any_identifier '[' ']' - { - void *ctx = state; - $$ = new(ctx) ast_declaration($1, true, NULL, NULL); + $$ = new(ctx) ast_declaration($1, NULL, NULL); $$->set_location(yylloc); } - | any_identifier '[' constant_expression ']' + | any_identifier array_specifier { void *ctx = state; - $$ = new(ctx) ast_declaration($1, true, $3, NULL); + $$ = new(ctx) ast_declaration($1, $2, NULL); $$->set_location(yylloc); } ; @@ -1974,7 +1936,7 @@ condition: | fully_specified_type any_identifier '=' initializer { void *ctx = state; - ast_declaration *decl = new(ctx) ast_declaration($2, false, NULL, $4); + ast_declaration *decl = new(ctx) ast_declaration($2, NULL, $4); ast_declarator_list *declarator = new(ctx) ast_declarator_list($1); decl->set_location(yylloc); declarator->set_location(yylloc); @@ -2309,22 +2271,17 @@ instance_name_opt: /* empty */ { $$ = new(state) ast_interface_block(*state->default_uniform_qualifier, - NULL, false, NULL); + NULL, NULL); } | NEW_IDENTIFIER { $$ = new(state) ast_interface_block(*state->default_uniform_qualifier, - $1, false, NULL); - } - | NEW_IDENTIFIER '[' constant_expression ']' - { - $$ = new(state) ast_interface_block(*state->default_uniform_qualifier, - $1, true, $3); + $1, NULL); } - | NEW_IDENTIFIER '[' ']' + | NEW_IDENTIFIER array_specifier { $$ = new(state) ast_interface_block(*state->default_uniform_qualifier, - $1, true, NULL); + $1, $2); } ; diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp index 21dc3abd7..87784ed69 100644 --- a/mesalib/src/glsl/glsl_parser_extras.cpp +++ b/mesalib/src/glsl/glsl_parser_extras.cpp @@ -50,7 +50,7 @@ glsl_compute_version_string(void *mem_ctx, bool is_es, unsigned version) static unsigned known_desktop_glsl_versions[] = - { 110, 120, 130, 140, 150, 330, 400, 410, 420, 430 }; + { 110, 120, 130, 140, 150, 330, 400, 410, 420, 430, 440 }; _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx, @@ -291,6 +291,10 @@ _mesa_glsl_parse_state::process_version_directive(YYLTYPE *locp, int version, } } + if (this->es_shader) { + this->ARB_texture_rectangle_enable = false; + } + this->language_version = version; bool supported = false; @@ -484,6 +488,7 @@ struct _mesa_glsl_extension { static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = { /* API availability */ /* name GL ES supported flag */ + EXT(ARB_arrays_of_arrays, true, false, ARB_arrays_of_arrays), EXT(ARB_conservative_depth, true, false, ARB_conservative_depth), EXT(ARB_draw_buffers, true, false, dummy_true), EXT(ARB_draw_instanced, true, false, ARB_draw_instanced), @@ -513,6 +518,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = { EXT(ARB_shader_atomic_counters, true, false, ARB_shader_atomic_counters), EXT(ARB_sample_shading, true, false, ARB_sample_shading), EXT(AMD_shader_trinary_minmax, true, false, dummy_true), + EXT(ARB_viewport_array, true, false, ARB_viewport_array), }; #undef EXT @@ -634,25 +640,6 @@ _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp, /** - * Returns the name of the type of a column of a matrix. E.g., - * - * "mat3" -> "vec3" - * "mat4x2" -> "vec2" - */ -static const char * -_mesa_ast_get_matrix_column_type_name(const char *matrix_type_name) -{ - static const char *vec_name[] = { "vec2", "vec3", "vec4" }; - - /* The number of elements in a row of a matrix is specified by the last - * character of the matrix type name. - */ - long rows = strtol(matrix_type_name + strlen(matrix_type_name) - 1, - NULL, 10); - return vec_name[rows - 2]; -} - -/** * Recurses through <type> and <expr> if <expr> is an aggregate initializer * and sets <expr>'s <constructor_type> field to <type>. Gives later functions * (process_array_constructor, et al) sufficient information to do type @@ -699,37 +686,19 @@ _mesa_ast_get_matrix_column_type_name(const char *matrix_type_name) * doesn't contain sufficient information to determine if the types match. */ void -_mesa_ast_set_aggregate_type(const ast_type_specifier *type, - ast_expression *expr, - _mesa_glsl_parse_state *state) +_mesa_ast_set_aggregate_type(const glsl_type *type, + ast_expression *expr) { - void *ctx = state; ast_aggregate_initializer *ai = (ast_aggregate_initializer *)expr; - ai->constructor_type = (ast_type_specifier *)type; - - bool is_declaration = ai->constructor_type->structure != NULL; - if (!is_declaration) { - /* Look up <type> name in the symbol table to see if it's a struct. */ - const ast_type_specifier *struct_type = - state->symbols->get_type_ast(type->type_name); - ai->constructor_type->structure = - struct_type ? new(ctx) ast_struct_specifier(*struct_type->structure) - : NULL; - } + ai->constructor_type = type; /* If the aggregate is an array, recursively set its elements' types. */ - if (type->is_array) { - /* We want to set the element type which is not an array itself, so make - * a copy of the array type and set its is_array field to false. + if (type->is_array()) { + /* Each array element has the type type->element_type(). * * E.g., if <type> if struct S[2] we want to set each element's type to * struct S. - * - * FINISHME: Update when ARB_array_of_arrays is supported. */ - const ast_type_specifier *non_array_type = - new(ctx) ast_type_specifier(type, false, NULL); - for (exec_node *expr_node = ai->expressions.head; !expr_node->is_tail_sentinel(); expr_node = expr_node->next) { @@ -737,84 +706,33 @@ _mesa_ast_set_aggregate_type(const ast_type_specifier *type, link); if (expr->oper == ast_aggregate) - _mesa_ast_set_aggregate_type(non_array_type, expr, state); + _mesa_ast_set_aggregate_type(type->element_type(), expr); } /* If the aggregate is a struct, recursively set its fields' types. */ - } else if (ai->constructor_type->structure) { - ai->constructor_type->structure->is_declaration = is_declaration; + } else if (type->is_record()) { exec_node *expr_node = ai->expressions.head; - /* Iterate through the struct's fields' declarations. E.g., iterate from - * "float a, b" to "int c" in the struct below. - * - * struct { - * float a, b; - * int c; - * } s; - */ - for (exec_node *decl_list_node = - ai->constructor_type->structure->declarations.head; - !decl_list_node->is_tail_sentinel(); - decl_list_node = decl_list_node->next) { - ast_declarator_list *decl_list = exec_node_data(ast_declarator_list, - decl_list_node, link); - - for (exec_node *decl_node = decl_list->declarations.head; - !decl_node->is_tail_sentinel() && !expr_node->is_tail_sentinel(); - decl_node = decl_node->next, expr_node = expr_node->next) { - ast_declaration *decl = exec_node_data(ast_declaration, decl_node, - link); - ast_expression *expr = exec_node_data(ast_expression, expr_node, - link); - - bool is_array = decl_list->type->specifier->is_array; - ast_expression *array_size = decl_list->type->specifier->array_size; - - /* Recognize variable declarations with the bracketed size attached - * to the type rather than the variable name as arrays. E.g., - * - * float a[2]; - * float[2] b; - * - * are both arrays, but <a>'s array_size is decl->array_size, while - * <b>'s array_size is decl_list->type->specifier->array_size. - */ - if (!is_array) { - /* FINISHME: Update when ARB_array_of_arrays is supported. */ - is_array = decl->is_array; - array_size = decl->array_size; - } - - /* Declaration shadows the <type> parameter. */ - ast_type_specifier *type = - new(ctx) ast_type_specifier(decl_list->type->specifier, - is_array, array_size); + /* Iterate through the struct's fields. */ + for (unsigned i = 0; !expr_node->is_tail_sentinel() && i < type->length; + i++, expr_node = expr_node->next) { + ast_expression *expr = exec_node_data(ast_expression, expr_node, + link); - if (expr->oper == ast_aggregate) - _mesa_ast_set_aggregate_type(type, expr, state); + if (expr->oper == ast_aggregate) { + _mesa_ast_set_aggregate_type(type->fields.structure[i].type, expr); } } - } else { - /* If the aggregate is a matrix, set its columns' types. */ - const char *name; - const glsl_type *const constructor_type = - ai->constructor_type->glsl_type(&name, state); - - if (constructor_type->is_matrix()) { - for (exec_node *expr_node = ai->expressions.head; - !expr_node->is_tail_sentinel(); - expr_node = expr_node->next) { - ast_expression *expr = exec_node_data(ast_expression, expr_node, - link); - - /* Declaration shadows the <type> parameter. */ - ast_type_specifier *type = new(ctx) - ast_type_specifier(_mesa_ast_get_matrix_column_type_name(name)); - - if (expr->oper == ast_aggregate) - _mesa_ast_set_aggregate_type(type, expr, state); - } + /* If the aggregate is a matrix, set its columns' types. */ + } else if (type->is_matrix()) { + for (exec_node *expr_node = ai->expressions.head; + !expr_node->is_tail_sentinel(); + expr_node = expr_node->next) { + ast_expression *expr = exec_node_data(ast_expression, expr_node, + link); + + if (expr->oper == ast_aggregate) + _mesa_ast_set_aggregate_type(type->column_type(), expr); } } } @@ -876,16 +794,10 @@ ast_node::ast_node(void) static void -ast_opt_array_size_print(bool is_array, const ast_expression *array_size) +ast_opt_array_dimensions_print(const ast_array_specifier *array_specifier) { - if (is_array) { - printf("[ "); - - if (array_size) - array_size->print(); - - printf("] "); - } + if (array_specifier) + array_specifier->print(); } @@ -1108,7 +1020,7 @@ ast_parameter_declarator::print(void) const type->print(); if (identifier) printf("%s ", identifier); - ast_opt_array_size_print(is_array, array_size); + ast_opt_array_dimensions_print(array_specifier); } @@ -1124,7 +1036,7 @@ void ast_declaration::print(void) const { printf("%s ", identifier); - ast_opt_array_size_print(is_array, array_size); + ast_opt_array_dimensions_print(array_specifier); if (initializer) { printf("= "); @@ -1133,13 +1045,12 @@ ast_declaration::print(void) const } -ast_declaration::ast_declaration(const char *identifier, bool is_array, - ast_expression *array_size, +ast_declaration::ast_declaration(const char *identifier, + ast_array_specifier *array_specifier, ast_expression *initializer) { this->identifier = identifier; - this->is_array = is_array; - this->array_size = array_size; + this->array_specifier = array_specifier; this->initializer = initializer; } @@ -1560,9 +1471,13 @@ do_common_optimization(exec_list *ir, bool linked, progress = do_copy_propagation(ir) || progress; progress = do_copy_propagation_elements(ir) || progress; - if (options->PreferDP4 && !linked) + if (options->OptimizeForAOS && !linked) progress = opt_flip_matrices(ir) || progress; + if (linked && options->OptimizeForAOS) { + progress = do_vectorize(ir) || progress; + } + if (linked) progress = do_dead_code(ir, uniform_locations_assigned) || progress; else diff --git a/mesalib/src/glsl/glsl_parser_extras.h b/mesalib/src/glsl/glsl_parser_extras.h index 21a27c9ea..8c900e637 100644 --- a/mesalib/src/glsl/glsl_parser_extras.h +++ b/mesalib/src/glsl/glsl_parser_extras.h @@ -298,6 +298,8 @@ struct _mesa_glsl_parse_state { * \name Enable bits for GLSL extensions */ /*@{*/ + bool ARB_arrays_of_arrays_enable; + bool ARB_arrays_of_arrays_warn; bool ARB_draw_buffers_enable; bool ARB_draw_buffers_warn; bool ARB_draw_instanced_enable; @@ -356,6 +358,8 @@ struct _mesa_glsl_parse_state { bool ARB_shader_atomic_counters_warn; bool AMD_shader_trinary_minmax_enable; bool AMD_shader_trinary_minmax_warn; + bool ARB_viewport_array_enable; + bool ARB_viewport_array_warn; /*@}*/ /** Extensions supported by the OpenGL implementation. */ diff --git a/mesalib/src/glsl/glsl_types.cpp b/mesalib/src/glsl/glsl_types.cpp index 12d4ac0ee..1b0b3ef88 100644 --- a/mesalib/src/glsl/glsl_types.cpp +++ b/mesalib/src/glsl/glsl_types.cpp @@ -300,8 +300,20 @@ glsl_type::glsl_type(const glsl_type *array, unsigned length) : if (length == 0) snprintf(n, name_length, "%s[]", array->name); - else - snprintf(n, name_length, "%s[%u]", array->name, length); + else { + /* insert outermost dimensions in the correct spot + * otherwise the dimension order will be backwards + */ + const char *pos = strchr(array->name, '['); + if (pos) { + int idx = pos - array->name; + snprintf(n, idx+1, "%s", array->name); + snprintf(n + idx, name_length - idx, "[%u]%s", + length, array->name + idx); + } else { + snprintf(n, name_length, "%s[%u]", array->name, length); + } + } this->name = n; } @@ -449,6 +461,42 @@ glsl_type::get_array_instance(const glsl_type *base, unsigned array_size) } +bool +glsl_type::record_compare(const glsl_type *b) const +{ + if (this->length != b->length) + return false; + + if (this->interface_packing != b->interface_packing) + return false; + + for (unsigned i = 0; i < this->length; i++) { + if (this->fields.structure[i].type != b->fields.structure[i].type) + return false; + if (strcmp(this->fields.structure[i].name, + b->fields.structure[i].name) != 0) + return false; + if (this->fields.structure[i].row_major + != b->fields.structure[i].row_major) + return false; + if (this->fields.structure[i].location + != b->fields.structure[i].location) + return false; + if (this->fields.structure[i].interpolation + != b->fields.structure[i].interpolation) + return false; + if (this->fields.structure[i].centroid + != b->fields.structure[i].centroid) + return false; + if (this->fields.structure[i].sample + != b->fields.structure[i].sample) + return false; + } + + return true; +} + + int glsl_type::record_key_compare(const void *a, const void *b) { @@ -461,36 +509,7 @@ glsl_type::record_key_compare(const void *a, const void *b) if (strcmp(key1->name, key2->name) != 0) return 1; - if (key1->length != key2->length) - return 1; - - if (key1->interface_packing != key2->interface_packing) - return 1; - - for (unsigned i = 0; i < key1->length; i++) { - if (key1->fields.structure[i].type != key2->fields.structure[i].type) - return 1; - if (strcmp(key1->fields.structure[i].name, - key2->fields.structure[i].name) != 0) - return 1; - if (key1->fields.structure[i].row_major - != key2->fields.structure[i].row_major) - return 1; - if (key1->fields.structure[i].location - != key2->fields.structure[i].location) - return 1; - if (key1->fields.structure[i].interpolation - != key2->fields.structure[i].interpolation) - return 1; - if (key1->fields.structure[i].centroid - != key2->fields.structure[i].centroid) - return 1; - if (key1->fields.structure[i].sample - != key2->fields.structure[i].sample) - return 1; - } - - return 0; + return !key1->record_compare(key2); } diff --git a/mesalib/src/glsl/glsl_types.h b/mesalib/src/glsl/glsl_types.h index fb7c9288d..f88758a9a 100644 --- a/mesalib/src/glsl/glsl_types.h +++ b/mesalib/src/glsl/glsl_types.h @@ -542,6 +542,13 @@ struct glsl_type { */ int sampler_coordinate_components() const; + /** + * Compare a record type against another record type. + * + * This is useful for matching record types declared across shader stages. + */ + bool record_compare(const glsl_type *b) const; + private: /** * ralloc context for all glsl_type allocations diff --git a/mesalib/src/glsl/ir.h b/mesalib/src/glsl/ir.h index 2ae8513a6..19e8383b2 100644 --- a/mesalib/src/glsl/ir.h +++ b/mesalib/src/glsl/ir.h @@ -148,7 +148,7 @@ public: * in particular. No support for other instruction types (assignments, * jumps, calls, etc.) is planned. */ - virtual bool equals(ir_instruction *ir); + virtual bool equals(ir_instruction *ir, enum ir_node_type ignore = ir_type_unset); protected: ir_instruction() @@ -1413,7 +1413,7 @@ public: return this; } - virtual bool equals(ir_instruction *ir); + virtual bool equals(ir_instruction *ir, enum ir_node_type ignore = ir_type_unset); virtual ir_expression *clone(void *mem_ctx, struct hash_table *ht) const; @@ -1741,7 +1741,7 @@ public: virtual ir_visitor_status accept(ir_hierarchical_visitor *); - virtual bool equals(ir_instruction *ir); + virtual bool equals(ir_instruction *ir, enum ir_node_type ignore = ir_type_unset); /** * Return a string representing the ir_texture_opcode. @@ -1847,7 +1847,7 @@ public: virtual ir_visitor_status accept(ir_hierarchical_visitor *); - virtual bool equals(ir_instruction *ir); + virtual bool equals(ir_instruction *ir, enum ir_node_type ignore = ir_type_unset); bool is_lvalue() const { @@ -1913,7 +1913,7 @@ public: return this; } - virtual bool equals(ir_instruction *ir); + virtual bool equals(ir_instruction *ir, enum ir_node_type ignore = ir_type_unset); /** * Get the variable that is ultimately referenced by an r-value @@ -1973,7 +1973,7 @@ public: return this; } - virtual bool equals(ir_instruction *ir); + virtual bool equals(ir_instruction *ir, enum ir_node_type ignore = ir_type_unset); /** * Get the variable that is ultimately referenced by an r-value @@ -2109,7 +2109,7 @@ public: virtual ir_visitor_status accept(ir_hierarchical_visitor *); - virtual bool equals(ir_instruction *ir); + virtual bool equals(ir_instruction *ir, enum ir_node_type ignore = ir_type_unset); /** * Get a particular component of a constant as a specific type diff --git a/mesalib/src/glsl/ir_equals.cpp b/mesalib/src/glsl/ir_equals.cpp index 7cfe1e66b..484530019 100644 --- a/mesalib/src/glsl/ir_equals.cpp +++ b/mesalib/src/glsl/ir_equals.cpp @@ -28,12 +28,12 @@ * can't access a's vtable in that case. */ static bool -possibly_null_equals(ir_instruction *a, ir_instruction *b) +possibly_null_equals(ir_instruction *a, ir_instruction *b, enum ir_node_type ignore) { if (!a || !b) return !a && !b; - return a->equals(b); + return a->equals(b, ignore); } /** @@ -41,13 +41,13 @@ possibly_null_equals(ir_instruction *a, ir_instruction *b) * about. */ bool -ir_instruction::equals(ir_instruction *ir) +ir_instruction::equals(ir_instruction *ir, enum ir_node_type) { return false; } bool -ir_constant::equals(ir_instruction *ir) +ir_constant::equals(ir_instruction *ir, enum ir_node_type ignore) { const ir_constant *other = ir->as_constant(); if (!other) @@ -65,7 +65,7 @@ ir_constant::equals(ir_instruction *ir) } bool -ir_dereference_variable::equals(ir_instruction *ir) +ir_dereference_variable::equals(ir_instruction *ir, enum ir_node_type ignore) { const ir_dereference_variable *other = ir->as_dereference_variable(); if (!other) @@ -75,7 +75,7 @@ ir_dereference_variable::equals(ir_instruction *ir) } bool -ir_dereference_array::equals(ir_instruction *ir) +ir_dereference_array::equals(ir_instruction *ir, enum ir_node_type ignore) { const ir_dereference_array *other = ir->as_dereference_array(); if (!other) @@ -84,17 +84,17 @@ ir_dereference_array::equals(ir_instruction *ir) if (type != other->type) return false; - if (!array->equals(other->array)) + if (!array->equals(other->array, ignore)) return false; - if (!array_index->equals(other->array_index)) + if (!array_index->equals(other->array_index, ignore)) return false; return true; } bool -ir_swizzle::equals(ir_instruction *ir) +ir_swizzle::equals(ir_instruction *ir, enum ir_node_type ignore) { const ir_swizzle *other = ir->as_swizzle(); if (!other) @@ -103,18 +103,20 @@ ir_swizzle::equals(ir_instruction *ir) if (type != other->type) return false; - if (mask.x != other->mask.x || - mask.y != other->mask.y || - mask.z != other->mask.z || - mask.w != other->mask.w) { - return false; + if (ignore != ir_type_swizzle) { + if (mask.x != other->mask.x || + mask.y != other->mask.y || + mask.z != other->mask.z || + mask.w != other->mask.w) { + return false; + } } - return val->equals(other->val); + return val->equals(other->val, ignore); } bool -ir_texture::equals(ir_instruction *ir) +ir_texture::equals(ir_instruction *ir, enum ir_node_type ignore) { const ir_texture *other = ir->as_texture(); if (!other) @@ -126,19 +128,19 @@ ir_texture::equals(ir_instruction *ir) if (op != other->op) return false; - if (!possibly_null_equals(coordinate, other->coordinate)) + if (!possibly_null_equals(coordinate, other->coordinate, ignore)) return false; - if (!possibly_null_equals(projector, other->projector)) + if (!possibly_null_equals(projector, other->projector, ignore)) return false; - if (!possibly_null_equals(shadow_comparitor, other->shadow_comparitor)) + if (!possibly_null_equals(shadow_comparitor, other->shadow_comparitor, ignore)) return false; - if (!possibly_null_equals(offset, other->offset)) + if (!possibly_null_equals(offset, other->offset, ignore)) return false; - if (!sampler->equals(other->sampler)) + if (!sampler->equals(other->sampler, ignore)) return false; switch (op) { @@ -147,26 +149,26 @@ ir_texture::equals(ir_instruction *ir) case ir_query_levels: break; case ir_txb: - if (!lod_info.bias->equals(other->lod_info.bias)) + if (!lod_info.bias->equals(other->lod_info.bias, ignore)) return false; break; case ir_txl: case ir_txf: case ir_txs: - if (!lod_info.lod->equals(other->lod_info.lod)) + if (!lod_info.lod->equals(other->lod_info.lod, ignore)) return false; break; case ir_txd: - if (!lod_info.grad.dPdx->equals(other->lod_info.grad.dPdx) || - !lod_info.grad.dPdy->equals(other->lod_info.grad.dPdy)) + if (!lod_info.grad.dPdx->equals(other->lod_info.grad.dPdx, ignore) || + !lod_info.grad.dPdy->equals(other->lod_info.grad.dPdy, ignore)) return false; break; case ir_txf_ms: - if (!lod_info.sample_index->equals(other->lod_info.sample_index)) + if (!lod_info.sample_index->equals(other->lod_info.sample_index, ignore)) return false; break; case ir_tg4: - if (!lod_info.component->equals(other->lod_info.component)) + if (!lod_info.component->equals(other->lod_info.component, ignore)) return false; break; default: @@ -177,7 +179,7 @@ ir_texture::equals(ir_instruction *ir) } bool -ir_expression::equals(ir_instruction *ir) +ir_expression::equals(ir_instruction *ir, enum ir_node_type ignore) { const ir_expression *other = ir->as_expression(); if (!other) @@ -190,7 +192,7 @@ ir_expression::equals(ir_instruction *ir) return false; for (unsigned i = 0; i < get_num_operands(); i++) { - if (!operands[i]->equals(other->operands[i])) + if (!operands[i]->equals(other->operands[i], ignore)) return false; } diff --git a/mesalib/src/glsl/ir_optimization.h b/mesalib/src/glsl/ir_optimization.h index 3ca9f5744..055d65547 100644 --- a/mesalib/src/glsl/ir_optimization.h +++ b/mesalib/src/glsl/ir_optimization.h @@ -98,6 +98,7 @@ bool do_mat_op_to_vec(exec_list *instructions); bool do_noop_swizzle(exec_list *instructions); bool do_structure_splitting(exec_list *instructions); bool do_swizzle_swizzle(exec_list *instructions); +bool do_vectorize(exec_list *instructions); bool do_tree_grafting(exec_list *instructions); bool do_vec_index_to_cond_assign(exec_list *instructions); bool do_vec_index_to_swizzle(exec_list *instructions); diff --git a/mesalib/src/glsl/link_atomics.cpp b/mesalib/src/glsl/link_atomics.cpp index db9c53965..d92cdb117 100644 --- a/mesalib/src/glsl/link_atomics.cpp +++ b/mesalib/src/glsl/link_atomics.cpp @@ -105,9 +105,10 @@ namespace { ir_variable *var = ((ir_instruction *)node)->as_variable(); if (var && var->type->contains_atomic()) { - unsigned id; + unsigned id = 0; bool found = prog->UniformHash->get(id, var->name); assert(found); + (void) found; active_atomic_buffer *buf = &buffers[var->data.binding]; /* If this is the first time the buffer is used, increment diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp index 85a4d3883..93b475497 100644 --- a/mesalib/src/glsl/linker.cpp +++ b/mesalib/src/glsl/linker.cpp @@ -609,6 +609,10 @@ cross_validate_globals(struct gl_shader_program *prog, if (var->type->length != 0) { existing->type = var->type; } + } else if (var->type->is_record() + && existing->type->is_record() + && existing->type->record_compare(var->type)) { + existing->type = var->type; } else { linker_error(prog, "%s `%s' declared as type " "`%s' and type `%s'\n", @@ -1992,19 +1996,14 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) /* Separate the shaders into groups based on their type. */ - struct gl_shader **vert_shader_list; - unsigned num_vert_shaders = 0; - struct gl_shader **frag_shader_list; - unsigned num_frag_shaders = 0; - struct gl_shader **geom_shader_list; - unsigned num_geom_shaders = 0; - - vert_shader_list = (struct gl_shader **) - calloc(prog->NumShaders, sizeof(struct gl_shader *)); - frag_shader_list = (struct gl_shader **) - calloc(prog->NumShaders, sizeof(struct gl_shader *)); - geom_shader_list = (struct gl_shader **) - calloc(prog->NumShaders, sizeof(struct gl_shader *)); + struct gl_shader **shader_list[MESA_SHADER_STAGES]; + unsigned num_shaders[MESA_SHADER_STAGES]; + + for (int i = 0; i < MESA_SHADER_STAGES; i++) { + shader_list[i] = (struct gl_shader **) + calloc(prog->NumShaders, sizeof(struct gl_shader *)); + num_shaders[i] = 0; + } unsigned min_version = UINT_MAX; unsigned max_version = 0; @@ -2020,20 +2019,9 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) goto done; } - switch (prog->Shaders[i]->Stage) { - case MESA_SHADER_VERTEX: - vert_shader_list[num_vert_shaders] = prog->Shaders[i]; - num_vert_shaders++; - break; - case MESA_SHADER_FRAGMENT: - frag_shader_list[num_frag_shaders] = prog->Shaders[i]; - num_frag_shaders++; - break; - case MESA_SHADER_GEOMETRY: - geom_shader_list[num_geom_shaders] = prog->Shaders[i]; - num_geom_shaders++; - break; - } + gl_shader_stage shader_type = prog->Shaders[i]->Stage; + shader_list[shader_type][num_shaders[shader_type]] = prog->Shaders[i]; + num_shaders[shader_type]++; } /* In desktop GLSL, different shader versions may be linked together. In @@ -2050,7 +2038,8 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) /* Geometry shaders have to be linked with vertex shaders. */ - if (num_geom_shaders > 0 && num_vert_shaders == 0) { + if (num_shaders[MESA_SHADER_GEOMETRY] > 0 && + num_shaders[MESA_SHADER_VERTEX] == 0) { linker_error(prog, "Geometry shader must be linked with " "vertex shader\n"); goto done; @@ -2065,55 +2054,39 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) /* Link all shaders for a particular stage and validate the result. */ - if (num_vert_shaders > 0) { - gl_shader *const sh = - link_intrastage_shaders(mem_ctx, ctx, prog, vert_shader_list, - num_vert_shaders); - - if (!prog->LinkStatus) - goto done; - - validate_vertex_shader_executable(prog, sh); - if (!prog->LinkStatus) - goto done; - prog->LastClipDistanceArraySize = prog->Vert.ClipDistanceArraySize; + for (int stage = 0; stage < MESA_SHADER_STAGES; stage++) { + if (num_shaders[stage] > 0) { + gl_shader *const sh = + link_intrastage_shaders(mem_ctx, ctx, prog, shader_list[stage], + num_shaders[stage]); - _mesa_reference_shader(ctx, &prog->_LinkedShaders[MESA_SHADER_VERTEX], - sh); - } - - if (num_frag_shaders > 0) { - gl_shader *const sh = - link_intrastage_shaders(mem_ctx, ctx, prog, frag_shader_list, - num_frag_shaders); - - if (!prog->LinkStatus) - goto done; + if (!prog->LinkStatus) + goto done; - validate_fragment_shader_executable(prog, sh); - if (!prog->LinkStatus) - goto done; + switch (stage) { + case MESA_SHADER_VERTEX: + validate_vertex_shader_executable(prog, sh); + break; + case MESA_SHADER_GEOMETRY: + validate_geometry_shader_executable(prog, sh); + break; + case MESA_SHADER_FRAGMENT: + validate_fragment_shader_executable(prog, sh); + break; + } + if (!prog->LinkStatus) + goto done; - _mesa_reference_shader(ctx, &prog->_LinkedShaders[MESA_SHADER_FRAGMENT], - sh); + _mesa_reference_shader(ctx, &prog->_LinkedShaders[stage], sh); + } } - if (num_geom_shaders > 0) { - gl_shader *const sh = - link_intrastage_shaders(mem_ctx, ctx, prog, geom_shader_list, - num_geom_shaders); - - if (!prog->LinkStatus) - goto done; - - validate_geometry_shader_executable(prog, sh); - if (!prog->LinkStatus) - goto done; + if (num_shaders[MESA_SHADER_GEOMETRY] > 0) prog->LastClipDistanceArraySize = prog->Geom.ClipDistanceArraySize; - - _mesa_reference_shader(ctx, &prog->_LinkedShaders[MESA_SHADER_GEOMETRY], - sh); - } + else if (num_shaders[MESA_SHADER_VERTEX] > 0) + prog->LastClipDistanceArraySize = prog->Vert.ClipDistanceArraySize; + else + prog->LastClipDistanceArraySize = 0; /* Not used */ /* Here begins the inter-stage linking phase. Some initial validation is * performed, then locations are assigned for uniforms, attributes, and @@ -2371,11 +2344,8 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) /* FINISHME: Assign fragment shader output locations. */ done: - free(vert_shader_list); - free(frag_shader_list); - free(geom_shader_list); - for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) { + free(shader_list[i]); if (prog->_LinkedShaders[i] == NULL) continue; diff --git a/mesalib/src/glsl/opt_algebraic.cpp b/mesalib/src/glsl/opt_algebraic.cpp index 332f0b77b..d1f6435f4 100644 --- a/mesalib/src/glsl/opt_algebraic.cpp +++ b/mesalib/src/glsl/opt_algebraic.cpp @@ -285,6 +285,58 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) reassociate_constant(ir, 0, op_const[0], op_expr[1]); if (op_const[1] && !op_const[0]) reassociate_constant(ir, 1, op_const[1], op_expr[0]); + + /* Replace (-x + y) * a + x and commutative variations with lrp(x, y, a). + * + * (-x + y) * a + x + * (x * -a) + (y * a) + x + * x + (x * -a) + (y * a) + * x * (1 - a) + y * a + * lrp(x, y, a) + */ + for (int mul_pos = 0; mul_pos < 2; mul_pos++) { + ir_expression *mul = op_expr[mul_pos]; + + if (!mul || mul->operation != ir_binop_mul) + continue; + + /* Multiply found on one of the operands. Now check for an + * inner addition operation. + */ + for (int inner_add_pos = 0; inner_add_pos < 2; inner_add_pos++) { + ir_expression *inner_add = + mul->operands[inner_add_pos]->as_expression(); + + if (!inner_add || inner_add->operation != ir_binop_add) + continue; + + /* Inner addition found on one of the operands. Now check for + * one of the operands of the inner addition to be the negative + * of x_operand. + */ + for (int neg_pos = 0; neg_pos < 2; neg_pos++) { + ir_expression *neg = + inner_add->operands[neg_pos]->as_expression(); + + if (!neg || neg->operation != ir_unop_neg) + continue; + + ir_rvalue *x_operand = ir->operands[1 - mul_pos]; + + if (!neg->operands[0]->equals(x_operand)) + continue; + + ir_rvalue *y_operand = inner_add->operands[1 - neg_pos]; + ir_rvalue *a_operand = mul->operands[1 - inner_add_pos]; + + if (x_operand->type != y_operand->type || + x_operand->type != a_operand->type) + continue; + + return lrp(x_operand, y_operand, a_operand); + } + } + } break; case ir_binop_sub: diff --git a/mesalib/src/glsl/opt_vectorize.cpp b/mesalib/src/glsl/opt_vectorize.cpp new file mode 100644 index 000000000..9ca811a86 --- /dev/null +++ b/mesalib/src/glsl/opt_vectorize.cpp @@ -0,0 +1,319 @@ +/* + * Copyright © 2013 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. + */ + +/** + * \file opt_vectorize.cpp + * + * Combines scalar assignments of the same expression (modulo swizzle) to + * multiple channels of the same variable into a single vectorized expression + * and assignment. + * + * Many generated shaders contain scalarized code. That is, they contain + * + * r1.x = log2(v0.x); + * r1.y = log2(v0.y); + * r1.z = log2(v0.z); + * + * rather than + * + * r1.xyz = log2(v0.xyz); + * + * We look for consecutive assignments of the same expression (modulo swizzle) + * to each channel of the same variable. + * + * For instance, we want to convert these three scalar operations + * + * (assign (x) (var_ref r1) (expression float log2 (swiz x (var_ref v0)))) + * (assign (y) (var_ref r1) (expression float log2 (swiz y (var_ref v0)))) + * (assign (z) (var_ref r1) (expression float log2 (swiz z (var_ref v0)))) + * + * into a single vector operation + * + * (assign (xyz) (var_ref r1) (expression vec3 log2 (swiz xyz (var_ref v0)))) + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_optimization.h" +#include "glsl_types.h" +#include "program/prog_instruction.h" + +namespace { + +class ir_vectorize_visitor : public ir_hierarchical_visitor { +public: + void clear() + { + assignment[0] = NULL; + assignment[1] = NULL; + assignment[2] = NULL; + assignment[3] = NULL; + current_assignment = NULL; + last_assignment = NULL; + channels = 0; + has_swizzle = false; + } + + ir_vectorize_visitor() + { + clear(); + progress = false; + } + + virtual ir_visitor_status visit_enter(ir_assignment *); + virtual ir_visitor_status visit_enter(ir_swizzle *); + + virtual ir_visitor_status visit_leave(ir_assignment *); + + void try_vectorize(); + + ir_assignment *assignment[4]; + ir_assignment *current_assignment, *last_assignment; + unsigned channels; + bool has_swizzle; + + bool progress; +}; + +} /* unnamed namespace */ + +/** + * Rewrites the swizzles and types of a right-hand side of an assignment. + * + * From the example above, this function would be called (by visit_tree()) on + * the nodes of the tree (expression float log2 (swiz z (var_ref v0))), + * rewriting it into (expression vec3 log2 (swiz xyz (var_ref v0))). + * + * The function modifies only ir_expressions and ir_swizzles. For expressions + * it sets a new type and swizzles any scalar dereferences into appropriately + * sized vector arguments. For example, if combining + * + * (assign (x) (var_ref r1) (expression float + (swiz x (var_ref v0) (var_ref v1)))) + * (assign (y) (var_ref r1) (expression float + (swiz y (var_ref v0) (var_ref v1)))) + * + * where v1 is a scalar, rewrite_swizzle() would insert a swizzle on + * (var_ref v1) such that the final result was + * + * (assign (xy) (var_ref r1) (expression vec2 + (swiz xy (var_ref v0)) + * (swiz xx (var_ref v1)))) + * + * For swizzles, it sets a new type, and if the variable being swizzled is a + * vector it overwrites the swizzle mask with the ir_swizzle_mask passed as the + * data parameter. If the swizzled variable is scalar, then the swizzle was + * added by an earlier call to rewrite_swizzle() on an expression, so the + * mask should not be modified. + */ +static void +rewrite_swizzle(ir_instruction *ir, void *data) +{ + ir_swizzle_mask *mask = (ir_swizzle_mask *)data; + + switch (ir->ir_type) { + case ir_type_swizzle: { + ir_swizzle *swz = (ir_swizzle *)ir; + if (swz->val->type->is_vector()) { + swz->mask = *mask; + } + swz->type = glsl_type::get_instance(swz->type->base_type, + mask->num_components, 1); + break; + } + case ir_type_expression: { + ir_expression *expr = (ir_expression *)ir; + expr->type = glsl_type::get_instance(expr->type->base_type, + mask->num_components, 1); + for (unsigned i = 0; i < 4; i++) { + if (expr->operands[i]) { + ir_dereference *deref = expr->operands[i]->as_dereference(); + if (deref && deref->type->is_scalar()) { + expr->operands[i] = new(ir) ir_swizzle(deref, 0, 0, 0, 0, + mask->num_components); + } + } + } + break; + } + default: + break; + } +} + +/** + * Attempt to vectorize the previously saved assignments, and clear them from + * consideration. + * + * If the assignments are able to be combined, it modifies in-place the last + * assignment seen to be an equivalent vector form of the scalar assignments. + * It then removes the other now obsolete scalar assignments. + */ +void +ir_vectorize_visitor::try_vectorize() +{ + if (this->last_assignment && this->channels > 1) { + ir_swizzle_mask mask = {0, 1, 2, 3, channels, 0}; + + visit_tree(this->last_assignment->rhs, rewrite_swizzle, &mask); + + this->last_assignment->write_mask = 0; + + for (unsigned i = 0; i < 4; i++) { + if (this->assignment[i]) { + this->last_assignment->write_mask |= 1 << i; + + if (this->assignment[i] != this->last_assignment) { + this->assignment[i]->remove(); + } + } + } + + this->progress = true; + } + clear(); +} + +/** + * Returns whether the write mask is a single channel. + */ +static bool +single_channel_write_mask(unsigned write_mask) +{ + return write_mask != 0 && (write_mask & (write_mask - 1)) == 0; +} + +/** + * Translates single-channeled write mask to single-channeled swizzle. + */ +static unsigned +write_mask_to_swizzle(unsigned write_mask) +{ + switch (write_mask) { + case WRITEMASK_X: return SWIZZLE_X; + case WRITEMASK_Y: return SWIZZLE_Y; + case WRITEMASK_Z: return SWIZZLE_Z; + case WRITEMASK_W: return SWIZZLE_W; + } + assert(!"not reached"); + unreachable(); +} + +/** + * Returns whether a single-channeled write mask matches a swizzle. + */ +static bool +write_mask_matches_swizzle(unsigned write_mask, + const ir_swizzle *swz) +{ + return ((write_mask == WRITEMASK_X && swz->mask.x == SWIZZLE_X) || + (write_mask == WRITEMASK_Y && swz->mask.x == SWIZZLE_Y) || + (write_mask == WRITEMASK_Z && swz->mask.x == SWIZZLE_Z) || + (write_mask == WRITEMASK_W && swz->mask.x == SWIZZLE_W)); +} + +/** + * Upon entering an ir_assignment, attempt to vectorize the currently tracked + * assignments if the current assignment is not suitable. Keep a pointer to + * the current assignment. + */ +ir_visitor_status +ir_vectorize_visitor::visit_enter(ir_assignment *ir) +{ + ir_dereference *lhs = this->last_assignment != NULL ? + this->last_assignment->lhs : NULL; + ir_rvalue *rhs = this->last_assignment != NULL ? + this->last_assignment->rhs : NULL; + + if (ir->condition || + this->channels >= 4 || + !single_channel_write_mask(ir->write_mask) || + (lhs && !ir->lhs->equals(lhs)) || + (rhs && !ir->rhs->equals(rhs, ir_type_swizzle))) { + try_vectorize(); + } + + this->current_assignment = ir; + + return visit_continue; +} + +/** + * Upon entering an ir_swizzle, set ::has_swizzle if we're visiting from an + * ir_assignment (i.e., that ::current_assignment is set) and the swizzle mask + * matches the current assignment's write mask. + * + * If the write mask doesn't match the swizzle mask, remove the current + * assignment from further consideration. + */ +ir_visitor_status +ir_vectorize_visitor::visit_enter(ir_swizzle *ir) +{ + if (this->current_assignment) { + if (write_mask_matches_swizzle(this->current_assignment->write_mask, ir)) { + this->has_swizzle = true; + } else { + this->current_assignment = NULL; + } + } + return visit_continue; +} + +/** + * Upon leaving an ir_assignment, save a pointer to it in ::assignment[] if + * the swizzle mask(s) found were appropriate. Also save a pointer in + * ::last_assignment so that we can compare future assignments with it. + * + * Finally, clear ::current_assignment and ::has_swizzle. + */ +ir_visitor_status +ir_vectorize_visitor::visit_leave(ir_assignment *ir) +{ + if (this->has_swizzle && this->current_assignment) { + assert(this->current_assignment == ir); + + unsigned channel = write_mask_to_swizzle(this->current_assignment->write_mask); + this->assignment[channel] = ir; + this->channels++; + + this->last_assignment = this->current_assignment; + } + this->current_assignment = NULL; + this->has_swizzle = false; + return visit_continue; +} + +/** + * Combines scalar assignments of the same expression (modulo swizzle) to + * multiple channels of the same variable into a single vectorized expression + * and assignment. + */ +bool +do_vectorize(exec_list *instructions) +{ + ir_vectorize_visitor v; + + v.run(instructions); + + /* Try to vectorize the last assignments seen. */ + v.try_vectorize(); + + return v.progress; +} diff --git a/mesalib/src/glsl/standalone_scaffolding.cpp b/mesalib/src/glsl/standalone_scaffolding.cpp index 257d2e7a9..91794719b 100644 --- a/mesalib/src/glsl/standalone_scaffolding.cpp +++ b/mesalib/src/glsl/standalone_scaffolding.cpp @@ -110,6 +110,7 @@ void initialize_context_to_defaults(struct gl_context *ctx, gl_api api) ctx->Extensions.ARB_texture_query_levels = true; ctx->Extensions.ARB_texture_query_lod = true; ctx->Extensions.ARB_uniform_buffer_object = true; + ctx->Extensions.ARB_viewport_array = true; ctx->Extensions.OES_EGL_image_external = true; ctx->Extensions.OES_standard_derivatives = true; diff --git a/mesalib/src/mapi/glapi/gen/ARB_viewport_array.xml b/mesalib/src/mapi/glapi/gen/ARB_viewport_array.xml new file mode 100644 index 000000000..e1c6c2d81 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen/ARB_viewport_array.xml @@ -0,0 +1,79 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"> + +<!-- Note: no GLX protocol info yet. --> + +<OpenGLAPI> + +<category name="GL_ARB_viewport_array" number="100"> + + <enum name="MAX_VIEWPORTS" value="0x825B"/> + <enum name="VIEWPORT_SUBPIXEL_BITS" value="0x825C"/> + <enum name="VIEWPORT_BOUNDS_RANGE" value="0x825D"/> + <enum name="LAYER_PROVOKING_VERTEX" value="0x825E"/> + <enum name="VIEWPORT_INDEX_PROVOKING_VERTEX" value="0x825F"/> + <enum name="SCISSOR_BOX" value="0x0C10"/> + <enum name="VIEWPORT" value="0x0BA2"/> + <enum name="DEPTH_RANGE" value="0x0B70"/> + <enum name="SCISSOR_TEST" value="0x0C11"/> + <enum name="FIRST_VERTEX_CONVENTION" value="0x8E4D"/> + <enum name="LAST_VERTEX_CONVENTION" value="0x8E4E"/> + <enum name="PROVOKING_VERTEX" value="0x8E4F"/> + <enum name="UNDEFINED_VERTEX" value="0x8260"/> + + <function name="ViewportArrayv" offset="assign"> + <param name="first" type="GLuint"/> + <param name="count" type="GLsizei"/> + <param name="v" type="const GLfloat *"/> + </function> + <function name="ViewportIndexedf" offset="assign"> + <param name="index" type="GLuint"/> + <param name="x" type="GLfloat"/> + <param name="y" type="GLfloat"/> + <param name="w" type="GLfloat"/> + <param name="h" type="GLfloat"/> + </function> + <function name="ViewportIndexedfv" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLfloat *"/> + </function> + <function name="ScissorArrayv" offset="assign"> + <param name="first" type="GLuint"/> + <param name="count" type="GLsizei"/> + <param name="v" type="const int *"/> + </function> + <function name="ScissorIndexed" offset="assign"> + <param name="index" type="GLuint"/> + <param name="left" type="GLint"/> + <param name="bottom" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + </function> + <function name="ScissorIndexedv" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLint *"/> + </function> + <function name="DepthRangeArrayv" offset="assign"> + <param name="first" type="GLuint"/> + <param name="count" type="GLsizei"/> + <param name="v" type="const GLclampd *"/> + </function> + <function name="DepthRangeIndexed" offset="assign"> + <param name="index" type="GLuint"/> + <param name="n" type="GLclampd"/> + <param name="f" type="GLclampd"/> + </function> + <function name="GetFloati_v" offset="assign"> + <param name="target" type="GLenum"/> + <param name="index" type="GLuint"/> + <param name="data" type="GLfloat *"/> + </function> + <function name="GetDoublei_v" offset="assign"> + <param name="target" type="GLenum"/> + <param name="index" type="GLuint"/> + <param name="data" type="GLdouble *"/> + </function> + +</category> + +</OpenGLAPI> diff --git a/mesalib/src/mapi/glapi/gen/Makefile.am b/mesalib/src/mapi/glapi/gen/Makefile.am index d5c20b71e..7354725df 100644 --- a/mesalib/src/mapi/glapi/gen/Makefile.am +++ b/mesalib/src/mapi/glapi/gen/Makefile.am @@ -129,6 +129,7 @@ API_XML = \ ARB_texture_view.xml \ ARB_vertex_array_object.xml \ ARB_vertex_attrib_binding.xml \ + ARB_viewport_array.xml \ AMD_draw_buffers_blend.xml \ AMD_performance_monitor.xml \ ARB_vertex_type_2_10_10_10_rev.xml \ diff --git a/mesalib/src/mapi/glapi/gen/gl_API.xml b/mesalib/src/mapi/glapi/gen/gl_API.xml index 5928d1493..4b1a93f68 100755 --- a/mesalib/src/mapi/glapi/gen/gl_API.xml +++ b/mesalib/src/mapi/glapi/gen/gl_API.xml @@ -9926,7 +9926,7 @@ </category> <!-- Extension number 99 is not listed in the extension registry. --> -<!-- Extension number 100 is a GLU extension. --> +<xi:include href="ARB_viewport_array.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> <!-- Shouldn't this be EXT_fragment_lighting? --> <category name="GL_SGIX_fragment_lighting" number="102"> diff --git a/mesalib/src/mapi/u_thread.h b/mesalib/src/mapi/u_thread.h index 31999c4df..ba5d98ea9 100644 --- a/mesalib/src/mapi/u_thread.h +++ b/mesalib/src/mapi/u_thread.h @@ -46,12 +46,7 @@ #include <stdlib.h> #include "u_compiler.h" -#if defined(HAVE_PTHREAD) -#include <pthread.h> /* POSIX threads headers */ -#endif -#ifdef _WIN32 -#include <windows.h> -#endif +#include "c11/threads.h" #if defined(HAVE_PTHREAD) || defined(_WIN32) #ifndef THREADS @@ -79,43 +74,32 @@ extern "C" { #endif -/* - * POSIX threads. This should be your choice in the Unix world - * whenever possible. When building with POSIX threads, be sure - * to enable any compiler flags which will cause the MT-safe - * libc (if one exists) to be used when linking, as well as any - * header macros for MT-safe errno, etc. For Solaris, this is the -mt - * compiler flag. On Solaris with gcc, use -D_REENTRANT to enable - * proper compiling for MT-safe libc etc. - */ -#if defined(HAVE_PTHREAD) - struct u_tsd { - pthread_key_t key; + tss_t key; unsigned initMagic; }; -typedef pthread_mutex_t u_mutex; +typedef mtx_t u_mutex; #define u_mutex_declare_static(name) \ - static u_mutex name = PTHREAD_MUTEX_INITIALIZER + static u_mutex name = _MTX_INITIALIZER_NP -#define u_mutex_init(name) pthread_mutex_init(&(name), NULL) -#define u_mutex_destroy(name) pthread_mutex_destroy(&(name)) -#define u_mutex_lock(name) (void) pthread_mutex_lock(&(name)) -#define u_mutex_unlock(name) (void) pthread_mutex_unlock(&(name)) +#define u_mutex_init(name) mtx_init(&(name), mtx_plain) +#define u_mutex_destroy(name) mtx_destroy(&(name)) +#define u_mutex_lock(name) (void) mtx_lock(&(name)) +#define u_mutex_unlock(name) (void) mtx_unlock(&(name)) static INLINE unsigned long u_thread_self(void) { - return (unsigned long) pthread_self(); + return (unsigned long) (uintptr_t) thrd_current(); } static INLINE void u_tsd_init(struct u_tsd *tsd) { - if (pthread_key_create(&tsd->key, NULL/*free*/) != 0) { + if (tss_create(&tsd->key, NULL/*free*/) != 0) { perror(INIT_TSD_ERROR); exit(-1); } @@ -129,7 +113,7 @@ u_tsd_get(struct u_tsd *tsd) if (tsd->initMagic != INIT_MAGIC) { u_tsd_init(tsd); } - return pthread_getspecific(tsd->key); + return tss_get(tsd->key); } @@ -139,56 +123,12 @@ u_tsd_set(struct u_tsd *tsd, void *ptr) if (tsd->initMagic != INIT_MAGIC) { u_tsd_init(tsd); } - if (pthread_setspecific(tsd->key, ptr) != 0) { + if (tss_set(tsd->key, ptr) != 0) { perror(SET_TSD_ERROR); exit(-1); } } -#endif /* HAVE_PTHREAD */ - - -/* - * Windows threads. Should work with Windows NT and 95. - * IMPORTANT: Link with multithreaded runtime library when THREADS are - * used! - */ -#ifdef _WIN32 - -struct u_tsd { - DWORD key; - unsigned initMagic; -}; - -typedef CRITICAL_SECTION u_mutex; - -/* http://locklessinc.com/articles/pthreads_on_windows/ */ -#define u_mutex_declare_static(name) \ - static u_mutex name = {(PCRITICAL_SECTION_DEBUG)-1, -1, 0, 0, 0, 0} - -#define u_mutex_init(name) InitializeCriticalSection(&name) -#define u_mutex_destroy(name) DeleteCriticalSection(&name) -#define u_mutex_lock(name) EnterCriticalSection(&name) -#define u_mutex_unlock(name) LeaveCriticalSection(&name) - -static INLINE unsigned long -u_thread_self(void) -{ - return GetCurrentThreadId(); -} - - -static INLINE void -u_tsd_init(struct u_tsd *tsd) -{ - tsd->key = TlsAlloc(); - if (tsd->key == TLS_OUT_OF_INDEXES) { - perror(INIT_TSD_ERROR); - exit(-1); - } - tsd->initMagic = INIT_MAGIC; -} - static INLINE void u_tsd_destroy(struct u_tsd *tsd) @@ -196,90 +136,11 @@ u_tsd_destroy(struct u_tsd *tsd) if (tsd->initMagic != INIT_MAGIC) { return; } - TlsFree(tsd->key); + tss_delete(tsd->key); tsd->initMagic = 0x0; } -static INLINE void * -u_tsd_get(struct u_tsd *tsd) -{ - if (tsd->initMagic != INIT_MAGIC) { - u_tsd_init(tsd); - } - return TlsGetValue(tsd->key); -} - - -static INLINE void -u_tsd_set(struct u_tsd *tsd, void *ptr) -{ - /* the following code assumes that the struct u_tsd has been initialized - to zero at creation */ - if (tsd->initMagic != INIT_MAGIC) { - u_tsd_init(tsd); - } - if (TlsSetValue(tsd->key, ptr) == 0) { - perror(SET_TSD_ERROR); - exit(-1); - } -} - -#endif /* _WIN32 */ - - -/* - * THREADS not defined - */ -#ifndef THREADS - -struct u_tsd { - unsigned initMagic; -}; - -typedef unsigned u_mutex; - -#define u_mutex_declare_static(name) static u_mutex name = 0 -#define u_mutex_init(name) (void) name -#define u_mutex_destroy(name) (void) name -#define u_mutex_lock(name) (void) name -#define u_mutex_unlock(name) (void) name - -/* - * no-op functions - */ - -static INLINE unsigned long -u_thread_self(void) -{ - return 0; -} - - -static INLINE void -u_tsd_init(struct u_tsd *tsd) -{ - (void) tsd; -} - - -static INLINE void * -u_tsd_get(struct u_tsd *tsd) -{ - (void) tsd; - return NULL; -} - - -static INLINE void -u_tsd_set(struct u_tsd *tsd, void *ptr) -{ - (void) tsd; - (void) ptr; -} -#endif /* THREADS */ - - #ifdef __cplusplus } #endif diff --git a/mesalib/src/mesa/drivers/common/driverfuncs.c b/mesalib/src/mesa/drivers/common/driverfuncs.c index e8dcb2476..6d56838cd 100644 --- a/mesalib/src/mesa/drivers/common/driverfuncs.c +++ b/mesalib/src/mesa/drivers/common/driverfuncs.c @@ -274,7 +274,7 @@ _mesa_init_driver_state(struct gl_context *ctx) ctx->Driver.Enable(ctx, GL_LIGHTING, ctx->Light.Enabled); ctx->Driver.Enable(ctx, GL_LINE_SMOOTH, ctx->Line.SmoothFlag); ctx->Driver.Enable(ctx, GL_POLYGON_STIPPLE, ctx->Polygon.StippleFlag); - ctx->Driver.Enable(ctx, GL_SCISSOR_TEST, ctx->Scissor.Enabled); + ctx->Driver.Enable(ctx, GL_SCISSOR_TEST, ctx->Scissor.EnableFlags); ctx->Driver.Enable(ctx, GL_STENCIL_TEST, ctx->Stencil._Enabled); ctx->Driver.Enable(ctx, GL_TEXTURE_1D, GL_FALSE); ctx->Driver.Enable(ctx, GL_TEXTURE_2D, GL_FALSE); diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c index 129451471..2443a7723 100644 --- a/mesalib/src/mesa/drivers/common/meta.c +++ b/mesalib/src/mesa/drivers/common/meta.c @@ -138,9 +138,7 @@ struct save_state GLboolean FragmentProgramEnabled; struct gl_fragment_program *FragmentProgram; GLboolean ATIFragmentShaderEnabled; - struct gl_shader_program *VertexShader; - struct gl_shader_program *GeometryShader; - struct gl_shader_program *FragmentShader; + struct gl_shader_program *Shader[MESA_SHADER_STAGES]; struct gl_shader_program *ActiveShader; /** MESA_META_STENCIL_TEST */ @@ -170,7 +168,7 @@ struct save_state struct gl_buffer_object *ArrayBufferObj; /** MESA_META_VIEWPORT */ - GLint ViewportX, ViewportY, ViewportW, ViewportH; + GLfloat ViewportX, ViewportY, ViewportW, ViewportH; GLclampd DepthNear, DepthFar; /** MESA_META_CLAMP_FRAGMENT_COLOR */ @@ -598,6 +596,8 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) } if (state & MESA_META_SHADER) { + int i; + if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_vertex_program) { save->VertexProgramEnabled = ctx->VertexProgram.Enabled; _mesa_reference_vertprog(ctx, &save->VertexProgram, @@ -617,12 +617,10 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) _mesa_set_enable(ctx, GL_FRAGMENT_SHADER_ATI, GL_FALSE); } - _mesa_reference_shader_program(ctx, &save->VertexShader, - ctx->Shader.CurrentVertexProgram); - _mesa_reference_shader_program(ctx, &save->GeometryShader, - ctx->Shader.CurrentGeometryProgram); - _mesa_reference_shader_program(ctx, &save->FragmentShader, - ctx->Shader.CurrentFragmentProgram); + for (i = 0; i < MESA_SHADER_STAGES; i++) { + _mesa_reference_shader_program(ctx, &save->Shader[i], + ctx->Shader.CurrentProgram[i]); + } _mesa_reference_shader_program(ctx, &save->ActiveShader, ctx->Shader.ActiveProgram); @@ -737,21 +735,21 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) if (state & MESA_META_VIEWPORT) { /* save viewport state */ - save->ViewportX = ctx->Viewport.X; - save->ViewportY = ctx->Viewport.Y; - save->ViewportW = ctx->Viewport.Width; - save->ViewportH = ctx->Viewport.Height; + save->ViewportX = ctx->ViewportArray[0].X; + save->ViewportY = ctx->ViewportArray[0].Y; + save->ViewportW = ctx->ViewportArray[0].Width; + save->ViewportH = ctx->ViewportArray[0].Height; /* set viewport to match window size */ - if (ctx->Viewport.X != 0 || - ctx->Viewport.Y != 0 || - ctx->Viewport.Width != ctx->DrawBuffer->Width || - ctx->Viewport.Height != ctx->DrawBuffer->Height) { - _mesa_set_viewport(ctx, 0, 0, + if (ctx->ViewportArray[0].X != 0 || + ctx->ViewportArray[0].Y != 0 || + ctx->ViewportArray[0].Width != (float) ctx->DrawBuffer->Width || + ctx->ViewportArray[0].Height != (float) ctx->DrawBuffer->Height) { + _mesa_set_viewport(ctx, 0, 0, 0, ctx->DrawBuffer->Width, ctx->DrawBuffer->Height); } /* save depth range state */ - save->DepthNear = ctx->Viewport.Near; - save->DepthFar = ctx->Viewport.Far; + save->DepthNear = ctx->ViewportArray[0].Near; + save->DepthFar = ctx->ViewportArray[0].Far; /* set depth range to default */ _mesa_DepthRange(0.0, 1.0); } @@ -829,6 +827,7 @@ _mesa_meta_end(struct gl_context *ctx) { struct save_state *save = &ctx->Meta->Save[ctx->Meta->SaveStackDepth - 1]; const GLbitfield state = save->SavedState; + int i; /* After starting a new occlusion query, initialize the results to the * values saved previously. The driver will then continue to increment @@ -933,9 +932,17 @@ _mesa_meta_end(struct gl_context *ctx) } if (state & MESA_META_SCISSOR) { - _mesa_set_enable(ctx, GL_SCISSOR_TEST, save->Scissor.Enabled); - _mesa_Scissor(save->Scissor.X, save->Scissor.Y, - save->Scissor.Width, save->Scissor.Height); + unsigned i; + + for (i = 0; i < ctx->Const.MaxViewports; i++) { + _mesa_set_scissor(ctx, i, + save->Scissor.ScissorArray[i].X, + save->Scissor.ScissorArray[i].Y, + save->Scissor.ScissorArray[i].Width, + save->Scissor.ScissorArray[i].Height); + _mesa_set_enablei(ctx, GL_SCISSOR_TEST, i, + (save->Scissor.EnableFlags >> i) & 1); + } } if (state & MESA_META_SHADER) { @@ -960,23 +967,24 @@ _mesa_meta_end(struct gl_context *ctx) save->ATIFragmentShaderEnabled); } - if (ctx->Extensions.ARB_vertex_shader) - _mesa_use_shader_program(ctx, GL_VERTEX_SHADER, save->VertexShader); + if (ctx->Extensions.ARB_vertex_shader) { + _mesa_use_shader_program(ctx, GL_VERTEX_SHADER, + save->Shader[MESA_SHADER_VERTEX]); + } if (_mesa_has_geometry_shaders(ctx)) _mesa_use_shader_program(ctx, GL_GEOMETRY_SHADER_ARB, - save->GeometryShader); + save->Shader[MESA_SHADER_GEOMETRY]); if (ctx->Extensions.ARB_fragment_shader) _mesa_use_shader_program(ctx, GL_FRAGMENT_SHADER, - save->FragmentShader); + save->Shader[MESA_SHADER_FRAGMENT]); _mesa_reference_shader_program(ctx, &ctx->Shader.ActiveProgram, save->ActiveShader); - _mesa_reference_shader_program(ctx, &save->VertexShader, NULL); - _mesa_reference_shader_program(ctx, &save->GeometryShader, NULL); - _mesa_reference_shader_program(ctx, &save->FragmentShader, NULL); + 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); } @@ -1089,11 +1097,11 @@ _mesa_meta_end(struct gl_context *ctx) } if (state & MESA_META_VIEWPORT) { - if (save->ViewportX != ctx->Viewport.X || - save->ViewportY != ctx->Viewport.Y || - save->ViewportW != ctx->Viewport.Width || - save->ViewportH != ctx->Viewport.Height) { - _mesa_set_viewport(ctx, save->ViewportX, save->ViewportY, + if (save->ViewportX != ctx->ViewportArray[0].X || + save->ViewportY != ctx->ViewportArray[0].Y || + save->ViewportW != ctx->ViewportArray[0].Width || + save->ViewportH != ctx->ViewportArray[0].Height) { + _mesa_set_viewport(ctx, 0, save->ViewportX, save->ViewportY, save->ViewportW, save->ViewportH); } _mesa_DepthRange(save->DepthNear, save->DepthFar); @@ -1761,7 +1769,7 @@ blitframebuffer_texture(struct gl_context *ctx, } /* setup viewport */ - _mesa_set_viewport(ctx, dstX, dstY, dstW, dstH); + _mesa_set_viewport(ctx, 0, dstX, dstY, dstW, dstH); _mesa_ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); _mesa_DepthMask(GL_FALSE); _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); @@ -1916,7 +1924,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, _mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts); } - _mesa_set_viewport(ctx, dstX, dstY, dstW, dstH); + _mesa_set_viewport(ctx, 0, dstX, dstY, dstW, dstH); _mesa_ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); _mesa_set_enable(ctx, GL_DEPTH_TEST, GL_FALSE); _mesa_DepthMask(GL_FALSE); @@ -1965,7 +1973,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, _mesa_DepthFunc(GL_ALWAYS); _mesa_DepthMask(GL_TRUE); - _mesa_set_viewport(ctx, dstX, dstY, dstW, dstH); + _mesa_set_viewport(ctx, 0, dstX, dstY, dstW, dstH); _mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts); _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); mask &= ~GL_DEPTH_BUFFER_BIT; @@ -3782,7 +3790,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, assert(dstHeight == ctx->DrawBuffer->Height); /* setup viewport */ - _mesa_set_viewport(ctx, 0, 0, dstWidth, dstHeight); + _mesa_set_viewport(ctx, 0, 0, 0, dstWidth, dstHeight); _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); } @@ -4072,7 +4080,7 @@ decompress_texture_image(struct gl_context *ctx, _mesa_MatrixMode(GL_PROJECTION); _mesa_LoadIdentity(); _mesa_Ortho(0.0, width, 0.0, height, -1.0, 1.0); - _mesa_set_viewport(ctx, 0, 0, width, height); + _mesa_set_viewport(ctx, 0, 0, 0, width, height); /* upload new vertex data */ _mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts); diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/.gitignore b/mesalib/src/mesa/drivers/dri/common/xmlpool/.gitignore index 0e0bf178e..383df727a 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/.gitignore +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/.gitignore @@ -1,3 +1,4 @@ +ca de es fr diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile.am b/mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile.am index ad7887d06..0908c8264 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile.am +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile.am @@ -41,7 +41,7 @@ # - info gettext # The set of supported languages. Add languages as needed. -POS=de.po es.po nl.po fr.po sv.po +POS=ca.po de.po es.po nl.po fr.po sv.po # # Don't change anything below, unless you know what you're doing. diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/ca.po b/mesalib/src/mesa/drivers/dri/common/xmlpool/ca.po new file mode 100644 index 000000000..c0cf7f62c --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/ca.po @@ -0,0 +1,321 @@ +# Language translations for Mesa package +# Traduccions al català del paquet «Mesa». +# +# Copyright © 2014 Alex Henrie <alexhenrie24@gmail.com> +# +# 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. + +msgid "" +msgstr "" +"Project-Id-Version: Mesa 10.1.0-devel\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-01-13 22:30-0700\n" +"PO-Revision-Date: 2014-01-15 10:37-0700\n" +"Last-Translator: Alex Henrie <alexhenrie24@gmail.com>\n" +"Language-Team: Catalan <ca@li.org>\n" +"Language: ca\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.5.4\n" + +#: t_options.h:56 +msgid "Debugging" +msgstr "Depuració" + +#: t_options.h:60 +msgid "Disable 3D acceleration" +msgstr "Deshabilita l'acceleració 3D" + +#: t_options.h:65 +msgid "Show performance boxes" +msgstr "Mostra les caixes de rendiment" + +#: t_options.h:70 +msgid "Enable flushing batchbuffer after each draw call" +msgstr "Habilita el buidatge del batchbuffer després de cada trucada de dibuix" + +#: t_options.h:75 +msgid "Enable flushing GPU caches with each draw call" +msgstr "" +"Habilita el buidatge de les memòries cau de GPU amb cada trucada de dibuix" + +#: t_options.h:80 +msgid "Disable throttling on first batch after flush" +msgstr "Deshabilita la regulació en el primer lot després de buidar" + +#: t_options.h:85 +msgid "Force GLSL extension default behavior to 'warn'" +msgstr "" +"Força que el comportament per defecte de les extensions GLSL sigui 'warn'" + +#: t_options.h:90 +msgid "Disable dual source blending" +msgstr "Deshabilita la barreja de font dual" + +#: t_options.h:95 +msgid "Disable backslash-based line continuations in GLSL source" +msgstr "" +"Deshabilitar les continuacions de línia basades en barra invertida en la " +"font GLSL" + +#: t_options.h:100 +msgid "Disable GL_ARB_shader_bit_encoding" +msgstr "Deshabilita el GL_ARB_shader_bit_encoding" + +#: t_options.h:105 +msgid "" +"Force a default GLSL version for shaders that lack an explicit #version line" +msgstr "" +"Força una versió GLSL per defecte en els shaders als quals falta una línia " +"#version explícita" + +#: t_options.h:115 +msgid "Image Quality" +msgstr "Qualitat d'Imatge" + +#: t_options.h:128 +msgid "Texture color depth" +msgstr "Profunditat de color de textura" + +#: t_options.h:129 +msgid "Prefer frame buffer color depth" +msgstr "Prefereix profunditat de color del framebuffer" + +#: t_options.h:130 +msgid "Prefer 32 bits per texel" +msgstr "Prefereix 32 bits per texel" + +#: t_options.h:131 +msgid "Prefer 16 bits per texel" +msgstr "Prefereix 16 bits per texel" + +#: t_options.h:132 +msgid "Force 16 bits per texel" +msgstr "Força 16 bits per texel" + +#: t_options.h:138 +msgid "Initial maximum value for anisotropic texture filtering" +msgstr "Valor màxim inicial per a la filtració de textura anisòtropa" + +#: t_options.h:143 +msgid "Forbid negative texture LOD bias" +msgstr "" +"Prohibeix una parcialitat negativa del Nivell de Detalle (LOD) de les " +"textures" + +#: t_options.h:148 +msgid "" +"Enable S3TC texture compression even if software support is not available" +msgstr "" +"Habilitar la compressió de textures S3TC encara que el suport de programari " +"no estigui disponible" + +#: t_options.h:155 +msgid "Initial color reduction method" +msgstr "Mètode inicial de reducció de color" + +#: t_options.h:156 +msgid "Round colors" +msgstr "Colors arrodonits" + +#: t_options.h:157 +msgid "Dither colors" +msgstr "Colors tramats" + +#: t_options.h:165 +msgid "Color rounding method" +msgstr "Mètode d'arrodoniment de color" + +#: t_options.h:166 +msgid "Round color components downward" +msgstr "Arrondeix els components de color a baix" + +#: t_options.h:167 +msgid "Round to nearest color" +msgstr "Arrondeix al color més proper" + +#: t_options.h:176 +msgid "Color dithering method" +msgstr "Mètode de tramat de color" + +#: t_options.h:177 +msgid "Horizontal error diffusion" +msgstr "Difusió d'error horitzontal" + +#: t_options.h:178 +msgid "Horizontal error diffusion, reset error at line start" +msgstr "Difusió d'error horitzontal, reinicia l'error a l'inici de la línia" + +#: t_options.h:179 +msgid "Ordered 2D color dithering" +msgstr "Tramat de color 2D ordenat" + +#: t_options.h:185 +msgid "Floating point depth buffer" +msgstr "Buffer de profunditat de punt flotant" + +#: t_options.h:190 +msgid "A post-processing filter to cel-shade the output" +msgstr "Un filtre de postprocessament per a aplicar cel shading a la sortida" + +#: t_options.h:195 +msgid "A post-processing filter to remove the red channel" +msgstr "Un filtre de postprocessament per a treure el canal vermell" + +#: t_options.h:200 +msgid "A post-processing filter to remove the green channel" +msgstr "Un filtre de postprocessament per a treure el canal verd" + +#: t_options.h:205 +msgid "A post-processing filter to remove the blue channel" +msgstr "Un filtre de postprocessament per a treure el canal blau" + +#: t_options.h:210 +msgid "" +"Morphological anti-aliasing based on Jimenez\\' MLAA. 0 to disable, 8 for " +"default quality" +msgstr "" +"Antialiàsing morfològic basat en el MLAA de Jimenez. 0 per deshabilitar, 8 " +"per qualitat per defecte" + +#: t_options.h:215 +msgid "" +"Morphological anti-aliasing based on Jimenez\\' MLAA. 0 to disable, 8 for " +"default quality. Color version, usable with 2d GL apps" +msgstr "" +"Antialiàsing morfològic basat en el MLAA de Jimenez. 0 per deshabilitar, 8 " +"per qualitat per defecte. Versió en color, utilitzable amb les aplicacions " +"GL 2D" + +#: t_options.h:225 +msgid "Performance" +msgstr "Rendiment" + +#: t_options.h:233 +msgid "TCL mode (Transformation, Clipping, Lighting)" +msgstr "Mode TCL (Transformació, Retall, Il·luminació)" + +#: t_options.h:234 +msgid "Use software TCL pipeline" +msgstr "Utilitza la canonada TCL de programari" + +#: t_options.h:235 +msgid "Use hardware TCL as first TCL pipeline stage" +msgstr "Utilitza el TCL maquinàri com la primera fase de la canonada TCL" + +#: t_options.h:236 +msgid "Bypass the TCL pipeline" +msgstr "Passar per alt la canonada TCL" + +#: t_options.h:237 +msgid "" +"Bypass the TCL pipeline with state-based machine code generated on-the-fly" +msgstr "" +"Passar per alt la canonada TCL amb codi màquina basat en estats, generat " +"sobre la marxa" + +#: t_options.h:246 +msgid "Method to limit rendering latency" +msgstr "Mètode per a limitar la latència de renderització" + +#: t_options.h:247 +msgid "Busy waiting for the graphics hardware" +msgstr "Espera activa pel maquinari de gràfics" + +#: t_options.h:248 +msgid "Sleep for brief intervals while waiting for the graphics hardware" +msgstr "Dormi per intervals breus mentre s'espera al maquinari de gràfics" + +#: t_options.h:249 +msgid "Let the graphics hardware emit a software interrupt and sleep" +msgstr "" +"Deixa que el maquinari de gràfics emeti una interrupció de programari i dormi" + +#: t_options.h:259 +msgid "Synchronization with vertical refresh (swap intervals)" +msgstr "Sincronització amb refresc vertical (intervals d'intercanvi)" + +#: t_options.h:260 +msgid "Never synchronize with vertical refresh, ignore application's choice" +msgstr "" +"Mai sincronitzis amb el refresc vertial, ignora l'elecció de l'aplicació" + +#: t_options.h:261 +msgid "Initial swap interval 0, obey application's choice" +msgstr "Interval d'intercanvi inicial 0, obeeix l'elecció de l'aplicació" + +#: t_options.h:262 +msgid "Initial swap interval 1, obey application's choice" +msgstr "Interval d'intercanvi inicial 1, obeeix l'elecció de l'aplicació" + +#: t_options.h:263 +msgid "" +"Always synchronize with vertical refresh, application chooses the minimum " +"swap interval" +msgstr "" +"Sempre sincronitza amb el refresc vertical, l'aplicació tria l'interval " +"mínim d'intercanvi" + +#: t_options.h:271 +msgid "Use HyperZ to boost performance" +msgstr "Utilitza el HyperZ per a augmentar el rendiment" + +#: t_options.h:276 +msgid "Number of texture units used" +msgstr "Nombre d'unitats de textura utilitzades" + +#: t_options.h:281 +msgid "Texture filtering quality vs. speed, AKA “brilinear” texture filtering" +msgstr "" +"Qualitat vs. velocitat de filtració de textura, àlies filtració \"brilinear" +"\" de textura" + +#: t_options.h:289 +msgid "Used types of texture memory" +msgstr "Tipus utilitzats de memòria de textura" + +#: t_options.h:290 +msgid "All available memory" +msgstr "Tota la memòria disponible" + +#: t_options.h:291 +msgid "Only card memory (if available)" +msgstr "Només memòria de tarjeta (si està disponible)" + +#: t_options.h:292 +msgid "Only GART (AGP/PCIE) memory (if available)" +msgstr "Només memòria GART (AGP/PCIE) (si està disponible)" + +#: t_options.h:304 +msgid "Features that are not hardware-accelerated" +msgstr "Característiques no accelerades per maquinari" + +#: t_options.h:308 +msgid "Enable extension GL_ARB_vertex_program" +msgstr "Habilita l'extensió GL_ARB_vertex_program" + +#: t_options.h:318 +msgid "Miscellaneous" +msgstr "Miscel·lània" + +#: t_options.h:322 +msgid "Create all visuals with a depth buffer" +msgstr "Crea tots els visuals amb buffer de profunditat" diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/de.po b/mesalib/src/mesa/drivers/dri/common/xmlpool/de.po index a87c8d513..fff7e8bef 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/de.po +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/de.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Mesa 6.3\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-08-30 11:40+0200\n" +"POT-Creation-Date: 2014-01-13 22:30-0700\n" "PO-Revision-Date: 2005-04-11 01:34+0200\n" "Last-Translator: Felix Kuehling <fxkuehl@gmx.de>\n" "Language-Team: German <de@li.org>\n" @@ -17,164 +17,230 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: t_options.h:53 +#: t_options.h:56 msgid "Debugging" msgstr "Fehlersuche" -#: t_options.h:57 +#: t_options.h:60 msgid "Disable 3D acceleration" msgstr "3D-Beschleunigung abschalten" -#: t_options.h:62 +#: t_options.h:65 msgid "Show performance boxes" msgstr "Zeige Performanceboxen" -#: t_options.h:69 +#: t_options.h:70 +msgid "Enable flushing batchbuffer after each draw call" +msgstr "Aktiviere sofortige Leerung des Stapelpuffers nach jedem Zeichenaufruf" + +#: t_options.h:75 +msgid "Enable flushing GPU caches with each draw call" +msgstr "" +"Aktiviere sofortige Leerung der GPU-Zwischenspeicher mit jedem Zeichenaufruf" + +#: t_options.h:80 +msgid "Disable throttling on first batch after flush" +msgstr "" + +#: t_options.h:85 +msgid "Force GLSL extension default behavior to 'warn'" +msgstr "" + +#: t_options.h:90 +msgid "Disable dual source blending" +msgstr "" + +#: t_options.h:95 +msgid "Disable backslash-based line continuations in GLSL source" +msgstr "" + +#: t_options.h:100 +msgid "Disable GL_ARB_shader_bit_encoding" +msgstr "" + +#: t_options.h:105 +msgid "" +"Force a default GLSL version for shaders that lack an explicit #version line" +msgstr "" + +#: t_options.h:115 msgid "Image Quality" msgstr "Bildqualität" -#: t_options.h:82 +#: t_options.h:128 msgid "Texture color depth" msgstr "Texturfarbtiefe" -#: t_options.h:83 +#: t_options.h:129 msgid "Prefer frame buffer color depth" msgstr "Bevorzuge Farbtiefe des Framebuffers" -#: t_options.h:84 +#: t_options.h:130 msgid "Prefer 32 bits per texel" msgstr "Bevorzuge 32 bits pro Texel" -#: t_options.h:85 +#: t_options.h:131 msgid "Prefer 16 bits per texel" msgstr "Bevorzuge 16 bits pro Texel" -#: t_options.h:86 +#: t_options.h:132 msgid "Force 16 bits per texel" msgstr "Erzwinge 16 bits pro Texel" -#: t_options.h:92 +#: t_options.h:138 msgid "Initial maximum value for anisotropic texture filtering" msgstr "Initialer Maximalwert für anisotropische Texturfilterung" -#: t_options.h:97 +#: t_options.h:143 msgid "Forbid negative texture LOD bias" msgstr "Verbiete negative Textur-Detailgradverschiebung" -#: t_options.h:102 +#: t_options.h:148 msgid "" "Enable S3TC texture compression even if software support is not available" msgstr "" "Aktiviere S3TC Texturkomprimierung auch wenn die nötige " "Softwareunterstützung fehlt" -#: t_options.h:109 +#: t_options.h:155 msgid "Initial color reduction method" msgstr "Initiale Farbreduktionsmethode" -#: t_options.h:110 +#: t_options.h:156 msgid "Round colors" msgstr "Farben runden" -#: t_options.h:111 +#: t_options.h:157 msgid "Dither colors" msgstr "Farben rastern" -#: t_options.h:119 +#: t_options.h:165 msgid "Color rounding method" msgstr "Farbrundungsmethode" -#: t_options.h:120 +#: t_options.h:166 msgid "Round color components downward" msgstr "Farbkomponenten abrunden" -#: t_options.h:121 +#: t_options.h:167 msgid "Round to nearest color" msgstr "Zur ähnlichsten Farbe runden" -#: t_options.h:130 +#: t_options.h:176 msgid "Color dithering method" msgstr "Farbrasterungsmethode" -#: t_options.h:131 +#: t_options.h:177 msgid "Horizontal error diffusion" msgstr "Horizontale Fehlerstreuung" -#: t_options.h:132 +#: t_options.h:178 msgid "Horizontal error diffusion, reset error at line start" msgstr "Horizontale Fehlerstreuung, Fehler am Zeilenanfang zurücksetzen" -#: t_options.h:133 +#: t_options.h:179 msgid "Ordered 2D color dithering" msgstr "Geordnete 2D Farbrasterung" -#: t_options.h:139 +#: t_options.h:185 msgid "Floating point depth buffer" msgstr "Fließkomma z-Puffer" -#: t_options.h:145 +#: t_options.h:190 +msgid "A post-processing filter to cel-shade the output" +msgstr "Nachbearbeitungsfilter für Cell Shading" + +#: t_options.h:195 +msgid "A post-processing filter to remove the red channel" +msgstr "Nachbearbeitungsfilter zum Entfernen des Rotkanals" + +#: t_options.h:200 +msgid "A post-processing filter to remove the green channel" +msgstr "Nachbearbeitungsfilter zum Entfernen des Grünkanals" + +#: t_options.h:205 +msgid "A post-processing filter to remove the blue channel" +msgstr "Nachbearbeitungsfilter zum Entfernen des Blaukanals" + +#: t_options.h:210 +msgid "" +"Morphological anti-aliasing based on Jimenez\\' MLAA. 0 to disable, 8 for " +"default quality" +msgstr "" +"Morphologische Kantenglättung (Anti-Aliasing) basierend auf Jimenez' MLAA. 0 " +"für deaktiviert, 8 für Standardqualität" + +#: t_options.h:215 +msgid "" +"Morphological anti-aliasing based on Jimenez\\' MLAA. 0 to disable, 8 for " +"default quality. Color version, usable with 2d GL apps" +msgstr "" +"Morphologische Kantenglättung (Anti-Aliasing) basierend auf Jimenez' MLAA. 0 " +"für deaktiviert, 8 für Standardqualität. Farbversion, für 2D-Anwendungen" + +#: t_options.h:225 msgid "Performance" msgstr "Leistung" -#: t_options.h:153 +#: t_options.h:233 msgid "TCL mode (Transformation, Clipping, Lighting)" msgstr "TCL-Modus (Transformation, Clipping, Licht)" -#: t_options.h:154 +#: t_options.h:234 msgid "Use software TCL pipeline" msgstr "Benutze die Software-TCL-Pipeline" -#: t_options.h:155 +#: t_options.h:235 msgid "Use hardware TCL as first TCL pipeline stage" msgstr "Benutze Hardware TCL als erste Stufe der TCL-Pipeline" -#: t_options.h:156 +#: t_options.h:236 msgid "Bypass the TCL pipeline" msgstr "Umgehe die TCL-Pipeline" -#: t_options.h:157 +#: t_options.h:237 msgid "" "Bypass the TCL pipeline with state-based machine code generated on-the-fly" msgstr "" "Umgehe die TCL-Pipeline mit zur Laufzeit erzeugtem, zustandsbasiertem " "Maschinencode" -#: t_options.h:166 +#: t_options.h:246 msgid "Method to limit rendering latency" msgstr "Methode zur Begrenzung der Bildverzögerung" -#: t_options.h:167 +#: t_options.h:247 msgid "Busy waiting for the graphics hardware" msgstr "Aktives Warten auf die Grafikhardware" -#: t_options.h:168 +#: t_options.h:248 msgid "Sleep for brief intervals while waiting for the graphics hardware" msgstr "Kurze Schlafintervalle beim Warten auf die Grafikhardware" -#: t_options.h:169 +#: t_options.h:249 msgid "Let the graphics hardware emit a software interrupt and sleep" msgstr "" "Die Grafikhardware eine Softwareunterbrechnung erzeugen lassen und schlafen" -#: t_options.h:179 +#: t_options.h:259 msgid "Synchronization with vertical refresh (swap intervals)" msgstr "Synchronisation mit der vertikalen Bildwiederholung" -#: t_options.h:180 +#: t_options.h:260 msgid "Never synchronize with vertical refresh, ignore application's choice" msgstr "" "Niemals mit der Bildwiederholung synchronisieren, Anweisungen der Anwendung " "ignorieren" -#: t_options.h:181 +#: t_options.h:261 msgid "Initial swap interval 0, obey application's choice" msgstr "Initiales Bildinterval 0, Anweisungen der Anwendung gehorchen" -#: t_options.h:182 +#: t_options.h:262 msgid "Initial swap interval 1, obey application's choice" msgstr "Initiales Bildinterval 1, Anweisungen der Anwendung gehorchen" -#: t_options.h:183 +#: t_options.h:263 msgid "" "Always synchronize with vertical refresh, application chooses the minimum " "swap interval" @@ -182,96 +248,61 @@ msgstr "" "Immer mit der Bildwiederholung synchronisieren, Anwendung wählt das minimale " "Bildintervall" -#: t_options.h:191 +#: t_options.h:271 msgid "Use HyperZ to boost performance" msgstr "HyperZ zur Leistungssteigerung verwenden" -#: t_options.h:196 -msgid "A post-processing filter to cel-shade the output" -msgstr "Nachbearbeitungsfilter für Cell Shading" - -#: t_options.h:201 -msgid "A post-processing filter to remove the red channel" -msgstr "Nachbearbeitungsfilter zum Entfernen des Rotkanals" - -#: t_options.h:206 -msgid "A post-processing filter to remove the green channel" -msgstr "Nachbearbeitungsfilter zum Entfernen des Grünkanals" - -#: t_options.h:211 -msgid "A post-processing filter to remove the blue channel" -msgstr "Nachbearbeitungsfilter zum Entfernen des Blaukanals" - -#: t_options.h:216 -msgid "" -"Morphological anti-aliasing based on Jimenez\\' MLAA. 0 to disable, 8 for " -"default quality" -msgstr "Morphologische Kantenglättung (Anti-Aliasing) basierend auf " -"Jimenez' MLAA. 0 für deaktiviert, 8 für Standardqualität" - -#: t_options.h:221 -msgid "" -"Morphological anti-aliasing based on Jimenez\\' MLAA. 0 to disable, 8 for " -"default quality. Color version, usable with 2d GL apps" -msgstr "Morphologische Kantenglättung (Anti-Aliasing) basierend auf " -"Jimenez' MLAA. 0 für deaktiviert, 8 für Standardqualität. " -"Farbversion, für 2D-Anwendungen" - -#: t_options.h:226 +#: t_options.h:276 msgid "Number of texture units used" msgstr "Anzahl der benutzten Textureinheiten" -#: t_options.h:231 -msgid "Support larger textures not guaranteed to fit into graphics memory" -msgstr "" -"Unterstütze grosse Texturen die evtl. nicht in den Grafikspeicher passen" - -#: t_options.h:232 -msgid "No" -msgstr "Nein" - -#: t_options.h:233 -msgid "At least 1 texture must fit under worst-case assumptions" -msgstr "Mindestens 1 Textur muss auch im schlechtesten Fall Platz haben" - -#: t_options.h:234 -msgid "Announce hardware limits" -msgstr "Benutze Hardware-Limits" - -#: t_options.h:240 +#: t_options.h:281 msgid "Texture filtering quality vs. speed, AKA “brilinear” texture filtering" msgstr "" "Texturfilterqualität versus -geschwindigkeit, auch bekannt als „brilineare“ " "Texturfilterung" -#: t_options.h:248 +#: t_options.h:289 msgid "Used types of texture memory" msgstr "Benutzte Arten von Texturspeicher" -#: t_options.h:249 +#: t_options.h:290 msgid "All available memory" msgstr "Aller verfügbarer Speicher" -#: t_options.h:250 +#: t_options.h:291 msgid "Only card memory (if available)" msgstr "Nur Grafikspeicher (falls verfügbar)" -#: t_options.h:251 +#: t_options.h:292 msgid "Only GART (AGP/PCIE) memory (if available)" msgstr "Nur GART-Speicher (AGP/PCIE) (falls verfügbar)" -#: t_options.h:259 +#: t_options.h:304 msgid "Features that are not hardware-accelerated" msgstr "Funktionalität, die nicht hardwarebeschleunigt ist" -#: t_options.h:263 +#: t_options.h:308 msgid "Enable extension GL_ARB_vertex_program" msgstr "Erweiterung GL_ARB_vertex_program aktivieren" -#: t_options.h:273 -msgid "Enable flushing batchbuffer after each draw call" -msgstr "Aktiviere sofortige Leerung des Stapelpuffers nach jedem Zeichenaufruf" +#: t_options.h:318 +msgid "Miscellaneous" +msgstr "" -#: t_options.h:278 -msgid "Enable flushing GPU caches with each draw call" -msgstr "Aktiviere sofortige Leerung der GPU-Zwischenspeicher mit jedem Zeichenaufruf" +#: t_options.h:322 +msgid "Create all visuals with a depth buffer" +msgstr "" + +#~ msgid "Support larger textures not guaranteed to fit into graphics memory" +#~ msgstr "" +#~ "Unterstütze grosse Texturen die evtl. nicht in den Grafikspeicher passen" + +#~ msgid "No" +#~ msgstr "Nein" + +#~ msgid "At least 1 texture must fit under worst-case assumptions" +#~ msgstr "Mindestens 1 Textur muss auch im schlechtesten Fall Platz haben" + +#~ msgid "Announce hardware limits" +#~ msgstr "Benutze Hardware-Limits" diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/es.po b/mesalib/src/mesa/drivers/dri/common/xmlpool/es.po index 8bccd8631..4a6ab91a5 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/es.po +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/es.po @@ -9,206 +9,296 @@ msgid "" msgstr "" "Project-Id-Version: es\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-04-12 12:18+0200\n" -"PO-Revision-Date: 2005-04-12 20:26+0200\n" -"Last-Translator: David Rubio Miguélez <deifo@ono.com>\n" +"POT-Creation-Date: 2014-01-13 22:30-0700\n" +"PO-Revision-Date: 2014-01-15 10:34-0700\n" +"Last-Translator: Alex Henrie <alexhenrie24@gmail.com>\n" "Language-Team: Spanish <es@li.org>\n" +"Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: KBabel 1.10\n" +"X-Generator: Poedit 1.5.4\n" -#: t_options.h:53 +#: t_options.h:56 msgid "Debugging" -msgstr "Depurando" +msgstr "Depuración" -#: t_options.h:57 +#: t_options.h:60 msgid "Disable 3D acceleration" -msgstr "Desactivar aceleración 3D" +msgstr "Deshabilitar aceleración 3D" -#: t_options.h:62 +#: t_options.h:65 msgid "Show performance boxes" msgstr "Mostrar cajas de rendimiento" -#: t_options.h:69 +#: t_options.h:70 +msgid "Enable flushing batchbuffer after each draw call" +msgstr "Habilitar vaciado del batchbuffer después de cada llamada de dibujo" + +#: t_options.h:75 +msgid "Enable flushing GPU caches with each draw call" +msgstr "Habilitar vaciado de los cachés GPU con cada llamada de dibujo" + +#: t_options.h:80 +msgid "Disable throttling on first batch after flush" +msgstr "Deshabilitar regulación del primer lote después de vaciar" + +#: t_options.h:85 +msgid "Force GLSL extension default behavior to 'warn'" +msgstr "" +"Forzar que el comportamiento por defecto de las extensiones GLSL sea 'warn'" + +#: t_options.h:90 +msgid "Disable dual source blending" +msgstr "Deshabilitar mezcla de fuente dual" + +#: t_options.h:95 +msgid "Disable backslash-based line continuations in GLSL source" +msgstr "" +"Deshabilitar continuaciones de línea basadas en barra inversa en el código " +"GLSL" + +#: t_options.h:100 +msgid "Disable GL_ARB_shader_bit_encoding" +msgstr "Deshabilitar GL_ARB_shader_bit_encoding" + +#: t_options.h:105 +msgid "" +"Force a default GLSL version for shaders that lack an explicit #version line" +msgstr "" +"Forzar una versión de GLSL por defecto en los shaders a los cuales les falta " +"una línea #version explícita" + +#: t_options.h:115 msgid "Image Quality" msgstr "Calidad de imagen" -#: t_options.h:77 +#: t_options.h:128 msgid "Texture color depth" msgstr "Profundidad de color de textura" -#: t_options.h:78 +#: t_options.h:129 msgid "Prefer frame buffer color depth" -msgstr "Preferir profundidad de color del \"framebuffer\"" +msgstr "Preferir profundidad de color del framebuffer" -#: t_options.h:79 +#: t_options.h:130 msgid "Prefer 32 bits per texel" msgstr "Preferir 32 bits por texel" -#: t_options.h:80 +#: t_options.h:131 msgid "Prefer 16 bits per texel" msgstr "Preferir 16 bits por texel" -#: t_options.h:81 +#: t_options.h:132 msgid "Force 16 bits per texel" msgstr "Forzar a 16 bits por texel" -#: t_options.h:87 +#: t_options.h:138 msgid "Initial maximum value for anisotropic texture filtering" msgstr "Valor máximo inicial para filtrado anisotrópico de textura" -#: t_options.h:92 +#: t_options.h:143 msgid "Forbid negative texture LOD bias" msgstr "Prohibir valores negativos de Nivel De Detalle (LOD) de texturas" -#: t_options.h:97 -msgid "Enable S3TC texture compression even if software support is not available" -msgstr "Activar la compresión de texturas S3TC incluso si el soporte por software no está disponible" +#: t_options.h:148 +msgid "" +"Enable S3TC texture compression even if software support is not available" +msgstr "" +"Habilitar la compresión de texturas S3TC incluso si el soporte por software " +"no está disponible" -#: t_options.h:104 +#: t_options.h:155 msgid "Initial color reduction method" msgstr "Método inicial de reducción de color" -#: t_options.h:105 +#: t_options.h:156 msgid "Round colors" msgstr "Colores redondeados" -#: t_options.h:106 +#: t_options.h:157 msgid "Dither colors" msgstr "Colores suavizados" -#: t_options.h:114 +#: t_options.h:165 msgid "Color rounding method" msgstr "Método de redondeo de colores" -#: t_options.h:115 +#: t_options.h:166 msgid "Round color components downward" msgstr "Redondear hacia abajo los componentes de color" -#: t_options.h:116 +#: t_options.h:167 msgid "Round to nearest color" msgstr "Redondear al color más cercano" -#: t_options.h:125 +#: t_options.h:176 msgid "Color dithering method" msgstr "Método de suavizado de color" -#: t_options.h:126 +#: t_options.h:177 msgid "Horizontal error diffusion" msgstr "Difusión de error horizontal" -#: t_options.h:127 +#: t_options.h:178 msgid "Horizontal error diffusion, reset error at line start" msgstr "Difusión de error horizontal, reiniciar error al comienzo de línea" -#: t_options.h:128 +#: t_options.h:179 msgid "Ordered 2D color dithering" msgstr "Suavizado de color 2D ordenado" -#: t_options.h:134 +#: t_options.h:185 msgid "Floating point depth buffer" msgstr "Búfer de profundidad en coma flotante" -#: t_options.h:140 +#: t_options.h:190 +msgid "A post-processing filter to cel-shade the output" +msgstr "Un filtro de postprocesamiento para aplicar cel shading a la salida" + +#: t_options.h:195 +msgid "A post-processing filter to remove the red channel" +msgstr "Un filtro de postprocesamiento para eliminar el canal rojo" + +#: t_options.h:200 +msgid "A post-processing filter to remove the green channel" +msgstr "Un filtro de postprocesamiento para eliminar el canal verde" + +#: t_options.h:205 +msgid "A post-processing filter to remove the blue channel" +msgstr "Un filtro de postprocesamiento para eliminar el canal azul" + +#: t_options.h:210 +msgid "" +"Morphological anti-aliasing based on Jimenez\\' MLAA. 0 to disable, 8 for " +"default quality" +msgstr "" +"Antialiasing morfológico basado en el MLAA de Jimenez. 0 para deshabilitar, " +"8 para calidad por defecto" + +#: t_options.h:215 +msgid "" +"Morphological anti-aliasing based on Jimenez\\' MLAA. 0 to disable, 8 for " +"default quality. Color version, usable with 2d GL apps" +msgstr "" +"Antialiasing morfológico basado en el MLAA de Jimenez. 0 para deshabilitar, " +"8 para calidad por defecto. Versión en color, usable con aplicaciones GL 2D" + +#: t_options.h:225 msgid "Performance" msgstr "Rendimiento" -#: t_options.h:148 +#: t_options.h:233 msgid "TCL mode (Transformation, Clipping, Lighting)" msgstr "Modo TCL (Transformación, Recorte, Iluminación)" -#: t_options.h:149 +#: t_options.h:234 msgid "Use software TCL pipeline" msgstr "Usar tubería TCL por software" -#: t_options.h:150 +#: t_options.h:235 msgid "Use hardware TCL as first TCL pipeline stage" msgstr "Usar TCL por hardware en la primera fase de la tubería TCL" -#: t_options.h:151 +#: t_options.h:236 msgid "Bypass the TCL pipeline" msgstr "Pasar por alto la tubería TCL" -#: t_options.h:152 -msgid "Bypass the TCL pipeline with state-based machine code generated on-the-fly" -msgstr "Pasar por alto la tubería TCL con código máquina basado en estados generado al vuelo" +#: t_options.h:237 +msgid "" +"Bypass the TCL pipeline with state-based machine code generated on-the-fly" +msgstr "" +"Pasar por alto la tubería TCL con código máquina basado en estados, generado " +"al vuelo" -#: t_options.h:161 +#: t_options.h:246 msgid "Method to limit rendering latency" -msgstr "Método para limitar la latencia de rénder" +msgstr "Método para limitar la latencia de renderización" -#: t_options.h:162 +#: t_options.h:247 msgid "Busy waiting for the graphics hardware" msgstr "Esperar activamente al hardware gráfico" -#: t_options.h:163 +#: t_options.h:248 msgid "Sleep for brief intervals while waiting for the graphics hardware" msgstr "Dormir en intervalos cortos mientras se espera al hardware gráfico" -#: t_options.h:164 +#: t_options.h:249 msgid "Let the graphics hardware emit a software interrupt and sleep" -msgstr "Permitir que el hardware gráfico emita una interrupción de software y duerma" +msgstr "" +"Permitir que el hardware gráfico emita una interrupción de software y duerma" -#: t_options.h:174 +#: t_options.h:259 msgid "Synchronization with vertical refresh (swap intervals)" msgstr "Sincronización con el refresco vertical (intervalos de intercambio)" -#: t_options.h:175 +#: t_options.h:260 msgid "Never synchronize with vertical refresh, ignore application's choice" -msgstr "No sincronizar nunca con el refresco vertical, ignorar la elección de la aplicación" +msgstr "" +"No sincronizar nunca con el refresco vertical, ignorar la elección de la " +"aplicación" -#: t_options.h:176 +#: t_options.h:261 msgid "Initial swap interval 0, obey application's choice" -msgstr "Intervalo de intercambio inicial 0, obedecer la elección de la aplicación" +msgstr "" +"Intervalo de intercambio inicial 0, obedecer la elección de la aplicación" -#: t_options.h:177 +#: t_options.h:262 msgid "Initial swap interval 1, obey application's choice" -msgstr "Intervalo de intercambio inicial 1, obedecer la elección de la aplicación" +msgstr "" +"Intervalo de intercambio inicial 1, obedecer la elección de la aplicación" -#: t_options.h:178 +#: t_options.h:263 msgid "" "Always synchronize with vertical refresh, application chooses the minimum " "swap interval" -msgstr "Sincronizar siempre con el refresco vertical, la aplicación elige el intervalo de intercambio mínimo" +msgstr "" +"Sincronizar siempre con el refresco vertical, la aplicación elige el " +"intervalo de intercambio mínimo" -#: t_options.h:186 +#: t_options.h:271 msgid "Use HyperZ to boost performance" msgstr "Usar HyperZ para potenciar rendimiento" -#: t_options.h:191 +#: t_options.h:276 msgid "Number of texture units used" msgstr "Número de unidades de textura usadas" -#: t_options.h:196 -msgid "Enable hack to allow larger textures with texture compression on radeon/r200" -msgstr "Activar \"hack\" para permitir texturas más grandes con compresión de textura activada en la Radeon/r200" - -#: t_options.h:201 +#: t_options.h:281 msgid "Texture filtering quality vs. speed, AKA “brilinear” texture filtering" -msgstr "Calidad de filtrado de textura vs. velocidad, alias filtrado \"brilinear\" de textura" +msgstr "" +"Calidad de filtrado de textura vs. velocidad, alias filtrado \"brilinear\" " +"de textura" -#: t_options.h:209 +#: t_options.h:289 msgid "Used types of texture memory" msgstr "Tipos de memoria de textura usados" -#: t_options.h:210 +#: t_options.h:290 msgid "All available memory" msgstr "Toda la memoria disponible" -#: t_options.h:211 +#: t_options.h:291 msgid "Only card memory (if available)" -msgstr "Sólo la memoria de la tarjeta (si disponible)" +msgstr "Solo memoria de tarjeta (si está disponible)" -#: t_options.h:212 +#: t_options.h:292 msgid "Only GART (AGP/PCIE) memory (if available)" -msgstr "Sólo memoria GART (AGP/PCIE) (si disponible)" +msgstr "Solo memoria GART (AGP/PCIE) (si está disponible)" -#: t_options.h:220 +#: t_options.h:304 msgid "Features that are not hardware-accelerated" msgstr "Características no aceleradas por hardware" -#: t_options.h:224 +#: t_options.h:308 msgid "Enable extension GL_ARB_vertex_program" -msgstr "Activar la extensión GL_ARB_vertex_program" +msgstr "Habilitar la extensión GL_ARB_vertex_program" + +#: t_options.h:318 +msgid "Miscellaneous" +msgstr "Misceláneo" + +#: t_options.h:322 +msgid "Create all visuals with a depth buffer" +msgstr "Crear todos los visuales con buffer de profundidad" diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/fr.po b/mesalib/src/mesa/drivers/dri/common/xmlpool/fr.po index 7a10969b8..4a747b355 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/fr.po +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/fr.po @@ -7,215 +7,292 @@ msgid "" msgstr "" "Project-Id-Version: Mesa 6.3\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-04-11 23:19+0200\n" +"POT-Creation-Date: 2014-01-13 22:30-0700\n" "PO-Revision-Date: 2005-04-11 01:34+0200\n" "Last-Translator: Stephane Marchesin <marchesin@icps.u-strasbg.fr>\n" "Language-Team: French <fr@li.org>\n" +"Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: t_options.h:53 +#: t_options.h:56 msgid "Debugging" msgstr "Debogage" -#: t_options.h:57 +#: t_options.h:60 msgid "Disable 3D acceleration" msgstr "Désactiver l'accélération 3D" -#: t_options.h:62 +#: t_options.h:65 msgid "Show performance boxes" msgstr "Afficher les boîtes de performance" -#: t_options.h:69 +#: t_options.h:70 +msgid "Enable flushing batchbuffer after each draw call" +msgstr "" + +#: t_options.h:75 +msgid "Enable flushing GPU caches with each draw call" +msgstr "" + +#: t_options.h:80 +msgid "Disable throttling on first batch after flush" +msgstr "" + +#: t_options.h:85 +msgid "Force GLSL extension default behavior to 'warn'" +msgstr "" + +#: t_options.h:90 +msgid "Disable dual source blending" +msgstr "" + +#: t_options.h:95 +msgid "Disable backslash-based line continuations in GLSL source" +msgstr "" + +#: t_options.h:100 +msgid "Disable GL_ARB_shader_bit_encoding" +msgstr "" + +#: t_options.h:105 +msgid "" +"Force a default GLSL version for shaders that lack an explicit #version line" +msgstr "" + +#: t_options.h:115 msgid "Image Quality" msgstr "Qualité d'image" -#: t_options.h:77 +#: t_options.h:128 msgid "Texture color depth" msgstr "Profondeur de texture" -#: t_options.h:78 +#: t_options.h:129 msgid "Prefer frame buffer color depth" msgstr "Profondeur de couleur" -#: t_options.h:79 +#: t_options.h:130 msgid "Prefer 32 bits per texel" msgstr "Préférer 32 bits par texel" -#: t_options.h:80 +#: t_options.h:131 msgid "Prefer 16 bits per texel" msgstr "Prérérer 16 bits par texel" -#: t_options.h:81 +#: t_options.h:132 msgid "Force 16 bits per texel" msgstr "Forcer 16 bits par texel" -#: t_options.h:87 +#: t_options.h:138 msgid "Initial maximum value for anisotropic texture filtering" msgstr "Valeur maximale initiale pour le filtrage anisotropique de texture" -#: t_options.h:92 +#: t_options.h:143 msgid "Forbid negative texture LOD bias" msgstr "Interdire le LOD bias negatif" -#: t_options.h:97 +#: t_options.h:148 msgid "" "Enable S3TC texture compression even if software support is not available" msgstr "" "Activer la compression de texture S3TC même si le support logiciel est absent" -#: t_options.h:104 +#: t_options.h:155 msgid "Initial color reduction method" msgstr "Technique de réduction de couleurs" -#: t_options.h:105 +#: t_options.h:156 msgid "Round colors" msgstr "Arrondir les valeurs de couleur" -#: t_options.h:106 +#: t_options.h:157 msgid "Dither colors" msgstr "Tramer les couleurs" -#: t_options.h:114 +#: t_options.h:165 msgid "Color rounding method" msgstr "Méthode d'arrondi des couleurs" -#: t_options.h:115 +#: t_options.h:166 msgid "Round color components downward" msgstr "Arrondi à l'inférieur" -#: t_options.h:116 +#: t_options.h:167 msgid "Round to nearest color" msgstr "Arrondi au plus proche" -#: t_options.h:125 +#: t_options.h:176 msgid "Color dithering method" msgstr "Méthode de tramage" -#: t_options.h:126 +#: t_options.h:177 msgid "Horizontal error diffusion" msgstr "Diffusion d'erreur horizontale" -#: t_options.h:127 +#: t_options.h:178 msgid "Horizontal error diffusion, reset error at line start" msgstr "Diffusion d'erreur horizontale, réinitialisé pour chaque ligne" -#: t_options.h:128 +#: t_options.h:179 msgid "Ordered 2D color dithering" msgstr "Tramage ordonné des couleurs" -#: t_options.h:134 +#: t_options.h:185 msgid "Floating point depth buffer" msgstr "Z-buffer en virgule flottante" -#: t_options.h:140 +#: t_options.h:190 +msgid "A post-processing filter to cel-shade the output" +msgstr "" + +#: t_options.h:195 +msgid "A post-processing filter to remove the red channel" +msgstr "" + +#: t_options.h:200 +msgid "A post-processing filter to remove the green channel" +msgstr "" + +#: t_options.h:205 +msgid "A post-processing filter to remove the blue channel" +msgstr "" + +#: t_options.h:210 +msgid "" +"Morphological anti-aliasing based on Jimenez\\' MLAA. 0 to disable, 8 for " +"default quality" +msgstr "" + +#: t_options.h:215 +msgid "" +"Morphological anti-aliasing based on Jimenez\\' MLAA. 0 to disable, 8 for " +"default quality. Color version, usable with 2d GL apps" +msgstr "" + +#: t_options.h:225 msgid "Performance" msgstr "Performance" -#: t_options.h:148 +#: t_options.h:233 msgid "TCL mode (Transformation, Clipping, Lighting)" msgstr "Mode de TCL (Transformation, Clipping, Eclairage)" -#: t_options.h:149 +#: t_options.h:234 msgid "Use software TCL pipeline" msgstr "Utiliser un pipeline TCL logiciel" -#: t_options.h:150 +#: t_options.h:235 msgid "Use hardware TCL as first TCL pipeline stage" msgstr "Utiliser le TCL matériel pour le premier niveau de pipeline" -#: t_options.h:151 +#: t_options.h:236 msgid "Bypass the TCL pipeline" msgstr "Court-circuiter le pipeline TCL" -#: t_options.h:152 +#: t_options.h:237 msgid "" "Bypass the TCL pipeline with state-based machine code generated on-the-fly" msgstr "" -"Court-circuiter le pipeline TCL par une machine à états qui génère le code" -"de TCL à la volée" +"Court-circuiter le pipeline TCL par une machine à états qui génère le codede " +"TCL à la volée" -#: t_options.h:161 +#: t_options.h:246 msgid "Method to limit rendering latency" msgstr "Méthode d'attente de la carte graphique" -#: t_options.h:162 +#: t_options.h:247 msgid "Busy waiting for the graphics hardware" msgstr "Attente active de la carte graphique" -#: t_options.h:163 +#: t_options.h:248 msgid "Sleep for brief intervals while waiting for the graphics hardware" msgstr "Attente utilisant usleep()" -#: t_options.h:164 +#: t_options.h:249 msgid "Let the graphics hardware emit a software interrupt and sleep" msgstr "Utiliser les interruptions" -#: t_options.h:174 +#: t_options.h:259 msgid "Synchronization with vertical refresh (swap intervals)" msgstr "Synchronisation de l'affichage avec le balayage vertical" -#: t_options.h:175 +#: t_options.h:260 msgid "Never synchronize with vertical refresh, ignore application's choice" -msgstr "Ne jamais synchroniser avec le balayage vertical, ignorer le choix de l'application" +msgstr "" +"Ne jamais synchroniser avec le balayage vertical, ignorer le choix de " +"l'application" -#: t_options.h:176 +#: t_options.h:261 msgid "Initial swap interval 0, obey application's choice" -msgstr "Ne pas synchroniser avec le balayage vertical par défaut, mais obéir au choix de l'application" +msgstr "" +"Ne pas synchroniser avec le balayage vertical par défaut, mais obéir au " +"choix de l'application" -#: t_options.h:177 +#: t_options.h:262 msgid "Initial swap interval 1, obey application's choice" -msgstr "Synchroniser avec le balayage vertical par défaut, mais obéir au choix de l'application" +msgstr "" +"Synchroniser avec le balayage vertical par défaut, mais obéir au choix de " +"l'application" -#: t_options.h:178 +#: t_options.h:263 msgid "" "Always synchronize with vertical refresh, application chooses the minimum " "swap interval" msgstr "" -"Toujours synchroniser avec le balayage vertical, l'application choisit l'intervalle minimal" +"Toujours synchroniser avec le balayage vertical, l'application choisit " +"l'intervalle minimal" -#: t_options.h:186 +#: t_options.h:271 msgid "Use HyperZ to boost performance" msgstr "Utiliser le HyperZ pour améliorer les performances" -#: t_options.h:191 +#: t_options.h:276 msgid "Number of texture units used" msgstr "Nombre d'unités de texture" -#: t_options.h:196 -msgid "" -"Enable hack to allow larger textures with texture compression on radeon/r200" -msgstr "" -"Activer le hack permettant l'utilisation de textures de grande taille avec la " -"compression de textures sur radeon/r200" - -#: t_options.h:201 +#: t_options.h:281 msgid "Texture filtering quality vs. speed, AKA “brilinear” texture filtering" msgstr "" "Qualité/performance du filtrage trilinéaire de texture (filtrage brilinéaire)" -#: t_options.h:209 +#: t_options.h:289 msgid "Used types of texture memory" msgstr "Types de mémoire de texture" -#: t_options.h:210 +#: t_options.h:290 msgid "All available memory" msgstr "Utiliser toute la mémoire disponible" -#: t_options.h:211 +#: t_options.h:291 msgid "Only card memory (if available)" msgstr "Utiliser uniquement la mémoire graphique (si disponible)" -#: t_options.h:212 +#: t_options.h:292 msgid "Only GART (AGP/PCIE) memory (if available)" msgstr "Utiliser uniquement la mémoire GART (AGP/PCIE) (si disponible)" -#: t_options.h:220 +#: t_options.h:304 msgid "Features that are not hardware-accelerated" msgstr "Fonctionnalités ne bénéficiant pas d'une accélération matérielle" -#: t_options.h:224 +#: t_options.h:308 msgid "Enable extension GL_ARB_vertex_program" msgstr "Activer l'extension GL_ARB_vertex_program" + +#: t_options.h:318 +msgid "Miscellaneous" +msgstr "" + +#: t_options.h:322 +msgid "Create all visuals with a depth buffer" +msgstr "" + +#~ msgid "" +#~ "Enable hack to allow larger textures with texture compression on radeon/" +#~ "r200" +#~ msgstr "" +#~ "Activer le hack permettant l'utilisation de textures de grande taille " +#~ "avec la compression de textures sur radeon/r200" diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/nl.po b/mesalib/src/mesa/drivers/dri/common/xmlpool/nl.po index 64516f606..8dc1f5566 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/nl.po +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/nl.po @@ -7,173 +7,237 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-04-12 20:09+0200\n" +"POT-Creation-Date: 2014-01-13 22:30-0700\n" "PO-Revision-Date: 2005-04-12 20:09+0200\n" "Last-Translator: Manfred Stienstra <manfred.stienstra@dwerg.net>\n" "Language-Team: Dutch <vertaling@nl.linux.org>\n" +"Language: nl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: t_options.h:53 +#: t_options.h:56 msgid "Debugging" msgstr "Debuggen" -#: t_options.h:57 +#: t_options.h:60 msgid "Disable 3D acceleration" msgstr "3D versnelling uitschakelen" -#: t_options.h:62 +#: t_options.h:65 msgid "Show performance boxes" msgstr "Laat prestatie boxjes zien" -#: t_options.h:69 +#: t_options.h:70 +msgid "Enable flushing batchbuffer after each draw call" +msgstr "" + +#: t_options.h:75 +msgid "Enable flushing GPU caches with each draw call" +msgstr "" + +#: t_options.h:80 +msgid "Disable throttling on first batch after flush" +msgstr "" + +#: t_options.h:85 +msgid "Force GLSL extension default behavior to 'warn'" +msgstr "" + +#: t_options.h:90 +msgid "Disable dual source blending" +msgstr "" + +#: t_options.h:95 +msgid "Disable backslash-based line continuations in GLSL source" +msgstr "" + +#: t_options.h:100 +msgid "Disable GL_ARB_shader_bit_encoding" +msgstr "" + +#: t_options.h:105 +msgid "" +"Force a default GLSL version for shaders that lack an explicit #version line" +msgstr "" + +#: t_options.h:115 msgid "Image Quality" msgstr "Beeldkwaliteit" -#: t_options.h:77 +#: t_options.h:128 msgid "Texture color depth" msgstr "Textuurkleurendiepte" -#: t_options.h:78 +#: t_options.h:129 msgid "Prefer frame buffer color depth" msgstr "Prefereer kaderbufferkleurdiepte" -#: t_options.h:79 +#: t_options.h:130 msgid "Prefer 32 bits per texel" msgstr "Prefereer 32 bits per texel" -#: t_options.h:80 +#: t_options.h:131 msgid "Prefer 16 bits per texel" msgstr "Prefereer 16 bits per texel" -#: t_options.h:81 +#: t_options.h:132 msgid "Force 16 bits per texel" msgstr "Dwing 16 bits per texel af" -#: t_options.h:87 +#: t_options.h:138 msgid "Initial maximum value for anisotropic texture filtering" msgstr "Initïele maximum waarde voor anisotrophische textuur filtering" -#: t_options.h:92 +#: t_options.h:143 msgid "Forbid negative texture LOD bias" msgstr "Verbied negatief niveau detailonderscheid (LOD) van texturen" -#: t_options.h:97 +#: t_options.h:148 msgid "" "Enable S3TC texture compression even if software support is not available" msgstr "" "Schakel S3TC textuurcompressie in, zelfs als softwareondersteuning niet " "aanwezig is" -#: t_options.h:104 +#: t_options.h:155 msgid "Initial color reduction method" msgstr "Initïele kleurreductie methode" -#: t_options.h:105 +#: t_options.h:156 msgid "Round colors" msgstr "Rond kleuren af" -#: t_options.h:106 +#: t_options.h:157 msgid "Dither colors" msgstr "Rasteriseer kleuren" -#: t_options.h:114 +#: t_options.h:165 msgid "Color rounding method" msgstr "Kleurafrondingmethode" -#: t_options.h:115 +#: t_options.h:166 msgid "Round color components downward" msgstr "Rond kleurencomponenten af naar beneden" -#: t_options.h:116 +#: t_options.h:167 msgid "Round to nearest color" msgstr "Rond af naar dichtsbijzijnde kleur" -#: t_options.h:125 +#: t_options.h:176 msgid "Color dithering method" msgstr "Kleurrasteriseringsmethode" -#: t_options.h:126 +#: t_options.h:177 msgid "Horizontal error diffusion" msgstr "Horizontale foutdiffusie" -#: t_options.h:127 +#: t_options.h:178 msgid "Horizontal error diffusion, reset error at line start" msgstr "Horizontale foutdiffusie, zet fout bij lijnbegin terug" -#: t_options.h:128 +#: t_options.h:179 msgid "Ordered 2D color dithering" msgstr "Geordende 2D kleurrasterisering" -#: t_options.h:134 +#: t_options.h:185 msgid "Floating point depth buffer" msgstr "Dieptebuffer als commagetal" -#: t_options.h:140 +#: t_options.h:190 +msgid "A post-processing filter to cel-shade the output" +msgstr "" + +#: t_options.h:195 +msgid "A post-processing filter to remove the red channel" +msgstr "" + +#: t_options.h:200 +msgid "A post-processing filter to remove the green channel" +msgstr "" + +#: t_options.h:205 +msgid "A post-processing filter to remove the blue channel" +msgstr "" + +#: t_options.h:210 +msgid "" +"Morphological anti-aliasing based on Jimenez\\' MLAA. 0 to disable, 8 for " +"default quality" +msgstr "" + +#: t_options.h:215 +msgid "" +"Morphological anti-aliasing based on Jimenez\\' MLAA. 0 to disable, 8 for " +"default quality. Color version, usable with 2d GL apps" +msgstr "" + +#: t_options.h:225 msgid "Performance" msgstr "Prestatie" -#: t_options.h:148 +#: t_options.h:233 msgid "TCL mode (Transformation, Clipping, Lighting)" msgstr "TCL-modus (Transformatie, Clipping, Licht)" -#: t_options.h:149 +#: t_options.h:234 msgid "Use software TCL pipeline" msgstr "Gebruik software TCL pijpleiding" -#: t_options.h:150 +#: t_options.h:235 msgid "Use hardware TCL as first TCL pipeline stage" msgstr "Gebruik hardware TCL as eerste TCL pijpleiding trap" -#: t_options.h:151 +#: t_options.h:236 msgid "Bypass the TCL pipeline" msgstr "Omzeil de TCL pijpleiding" -#: t_options.h:152 +#: t_options.h:237 msgid "" "Bypass the TCL pipeline with state-based machine code generated on-the-fly" msgstr "" "Omzeil de TCL pijpleiding met staatgebaseerde machinecode die tijdens " "executie gegenereerd wordt" -#: t_options.h:161 +#: t_options.h:246 msgid "Method to limit rendering latency" msgstr "Methode om beeldopbouwvertraging te onderdrukken" -#: t_options.h:162 +#: t_options.h:247 msgid "Busy waiting for the graphics hardware" msgstr "Actief wachten voor de grafische hardware" -#: t_options.h:163 +#: t_options.h:248 msgid "Sleep for brief intervals while waiting for the graphics hardware" -msgstr "Slaap voor korte intervallen tijdens het wachten op de grafische " -"hardware" +msgstr "" +"Slaap voor korte intervallen tijdens het wachten op de grafische hardware" -#: t_options.h:164 +#: t_options.h:249 msgid "Let the graphics hardware emit a software interrupt and sleep" -msgstr "Laat de grafische hardware een software onderbreking uitzenden en in " -"slaap vallen" +msgstr "" +"Laat de grafische hardware een software onderbreking uitzenden en in slaap " +"vallen" -#: t_options.h:174 +#: t_options.h:259 msgid "Synchronization with vertical refresh (swap intervals)" msgstr "Synchronisatie met verticale verversing (interval omwisselen)" -#: t_options.h:175 +#: t_options.h:260 msgid "Never synchronize with vertical refresh, ignore application's choice" -msgstr "Nooit synchroniseren met verticale verversing, negeer de keuze van de " +msgstr "" +"Nooit synchroniseren met verticale verversing, negeer de keuze van de " "applicatie" -#: t_options.h:176 +#: t_options.h:261 msgid "Initial swap interval 0, obey application's choice" msgstr "Initïeel omwisselingsinterval 0, honoreer de keuze van de applicatie" -#: t_options.h:177 +#: t_options.h:262 msgid "Initial swap interval 1, obey application's choice" msgstr "Initïeel omwisselingsinterval 1, honoreer de keuze van de applicatie" -#: t_options.h:178 +#: t_options.h:263 msgid "" "Always synchronize with vertical refresh, application chooses the minimum " "swap interval" @@ -181,46 +245,55 @@ msgstr "" "Synchroniseer altijd met verticale verversing, de applicatie kiest het " "minimum omwisselingsinterval" -#: t_options.h:186 +#: t_options.h:271 msgid "Use HyperZ to boost performance" msgstr "Gebruik HyperZ om de prestaties te verbeteren" -#: t_options.h:191 +#: t_options.h:276 msgid "Number of texture units used" msgstr "Aantal textuureenheden in gebruik" -#: t_options.h:196 -msgid "" -"Enable hack to allow larger textures with texture compression on radeon/r200" -msgstr "" -"Schakel hack in om met textuurcompressie grotere texturen toe te staan op " -"een radeon/r200" - -#: t_options.h:201 +#: t_options.h:281 msgid "Texture filtering quality vs. speed, AKA “brilinear” texture filtering" -msgstr "Textuurfilterkwaliteit versus -snelheid, ookwel bekend als " -"“brilineaire” textuurfiltering" +msgstr "" +"Textuurfilterkwaliteit versus -snelheid, ookwel bekend als “brilineaire” " +"textuurfiltering" -#: t_options.h:209 +#: t_options.h:289 msgid "Used types of texture memory" msgstr "Gebruikte soorten textuurgeheugen" -#: t_options.h:210 +#: t_options.h:290 msgid "All available memory" msgstr "Al het beschikbaar geheugen" -#: t_options.h:211 +#: t_options.h:291 msgid "Only card memory (if available)" msgstr "Alleen geheugen op de kaart (als het aanwezig is)" -#: t_options.h:212 +#: t_options.h:292 msgid "Only GART (AGP/PCIE) memory (if available)" msgstr "Alleen GART (AGP/PCIE) geheugen (als het aanwezig is)" -#: t_options.h:220 +#: t_options.h:304 msgid "Features that are not hardware-accelerated" msgstr "Eigenschappen die niet hardwareversneld zijn" -#: t_options.h:224 +#: t_options.h:308 msgid "Enable extension GL_ARB_vertex_program" msgstr "Zet uitbreiding GL_ARB_vertex_program aan" + +#: t_options.h:318 +msgid "Miscellaneous" +msgstr "" + +#: t_options.h:322 +msgid "Create all visuals with a depth buffer" +msgstr "" + +#~ msgid "" +#~ "Enable hack to allow larger textures with texture compression on radeon/" +#~ "r200" +#~ msgstr "" +#~ "Schakel hack in om met textuurcompressie grotere texturen toe te staan op " +#~ "een radeon/r200" diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/sv.po b/mesalib/src/mesa/drivers/dri/common/xmlpool/sv.po index d1cb56bba..082a22a94 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/sv.po +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/sv.po @@ -7,215 +7,291 @@ msgid "" msgstr "" "Project-Id-Version: Mesa DRI\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-04-11 23:19+0200\n" +"POT-Creation-Date: 2014-01-13 22:30-0700\n" "PO-Revision-Date: 2006-09-18 10:56+0100\n" "Last-Translator: Daniel Nylander <po@danielnylander.se>\n" "Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n" +"Language: sv\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: t_options.h:53 +#: t_options.h:56 msgid "Debugging" msgstr "Felsökning" -#: t_options.h:57 +#: t_options.h:60 msgid "Disable 3D acceleration" msgstr "Inaktivera 3D-accelerering" -#: t_options.h:62 +#: t_options.h:65 msgid "Show performance boxes" msgstr "Visa prestandarutor" -#: t_options.h:69 +#: t_options.h:70 +msgid "Enable flushing batchbuffer after each draw call" +msgstr "" + +#: t_options.h:75 +msgid "Enable flushing GPU caches with each draw call" +msgstr "" + +#: t_options.h:80 +msgid "Disable throttling on first batch after flush" +msgstr "" + +#: t_options.h:85 +msgid "Force GLSL extension default behavior to 'warn'" +msgstr "" + +#: t_options.h:90 +msgid "Disable dual source blending" +msgstr "" + +#: t_options.h:95 +msgid "Disable backslash-based line continuations in GLSL source" +msgstr "" + +#: t_options.h:100 +msgid "Disable GL_ARB_shader_bit_encoding" +msgstr "" + +#: t_options.h:105 +msgid "" +"Force a default GLSL version for shaders that lack an explicit #version line" +msgstr "" + +#: t_options.h:115 msgid "Image Quality" msgstr "Bildkvalitet" -#: t_options.h:77 +#: t_options.h:128 msgid "Texture color depth" msgstr "Färgdjup för texturer" -#: t_options.h:78 +#: t_options.h:129 msgid "Prefer frame buffer color depth" msgstr "Föredra färgdjupet för framebuffer" -#: t_options.h:79 +#: t_options.h:130 msgid "Prefer 32 bits per texel" msgstr "Föredra 32 bitar per texel" -#: t_options.h:80 +#: t_options.h:131 msgid "Prefer 16 bits per texel" msgstr "Föredra 16 bitar per texel" -#: t_options.h:81 +#: t_options.h:132 msgid "Force 16 bits per texel" msgstr "Tvinga 16 bitar per texel" -#: t_options.h:87 +#: t_options.h:138 msgid "Initial maximum value for anisotropic texture filtering" msgstr "Initialt maximalt värde för anisotropisk texturfiltrering" -#: t_options.h:92 +#: t_options.h:143 msgid "Forbid negative texture LOD bias" msgstr "Förbjud negativ LOD-kompensation för texturer" -#: t_options.h:97 -msgid "Enable S3TC texture compression even if software support is not available" +#: t_options.h:148 +msgid "" +"Enable S3TC texture compression even if software support is not available" msgstr "Aktivera S3TC-texturkomprimering även om programvarustöd saknas" -#: t_options.h:104 +#: t_options.h:155 msgid "Initial color reduction method" msgstr "Initial färgminskningsmetod" -#: t_options.h:105 +#: t_options.h:156 msgid "Round colors" msgstr "Avrunda färger" -#: t_options.h:106 +#: t_options.h:157 msgid "Dither colors" msgstr "Utjämna färger" -#: t_options.h:114 +#: t_options.h:165 msgid "Color rounding method" msgstr "Färgavrundningsmetod" -#: t_options.h:115 +#: t_options.h:166 msgid "Round color components downward" msgstr "Avrunda färdkomponenter nedåt" -#: t_options.h:116 +#: t_options.h:167 msgid "Round to nearest color" msgstr "Avrunda till närmsta färg" -#: t_options.h:125 +#: t_options.h:176 msgid "Color dithering method" msgstr "Färgutjämningsmetod" -#: t_options.h:126 +#: t_options.h:177 msgid "Horizontal error diffusion" msgstr "Horisontell felspridning" -#: t_options.h:127 +#: t_options.h:178 msgid "Horizontal error diffusion, reset error at line start" msgstr "Horisontell felspridning, återställ fel vid radbörjan" -#: t_options.h:128 +#: t_options.h:179 msgid "Ordered 2D color dithering" msgstr "Ordnad 2D-färgutjämning" -#: t_options.h:134 +#: t_options.h:185 msgid "Floating point depth buffer" msgstr "Buffert för flytande punktdjup" -#: t_options.h:140 +#: t_options.h:190 +msgid "A post-processing filter to cel-shade the output" +msgstr "" + +#: t_options.h:195 +msgid "A post-processing filter to remove the red channel" +msgstr "" + +#: t_options.h:200 +msgid "A post-processing filter to remove the green channel" +msgstr "" + +#: t_options.h:205 +msgid "A post-processing filter to remove the blue channel" +msgstr "" + +#: t_options.h:210 +msgid "" +"Morphological anti-aliasing based on Jimenez\\' MLAA. 0 to disable, 8 for " +"default quality" +msgstr "" + +#: t_options.h:215 +msgid "" +"Morphological anti-aliasing based on Jimenez\\' MLAA. 0 to disable, 8 for " +"default quality. Color version, usable with 2d GL apps" +msgstr "" + +#: t_options.h:225 msgid "Performance" msgstr "Prestanda" -#: t_options.h:148 +#: t_options.h:233 msgid "TCL mode (Transformation, Clipping, Lighting)" msgstr "TCL-läge (Transformation, Clipping, Lighting)" -#: t_options.h:149 +#: t_options.h:234 msgid "Use software TCL pipeline" msgstr "Använd programvaru-TCL-rörledning" -#: t_options.h:150 +#: t_options.h:235 msgid "Use hardware TCL as first TCL pipeline stage" msgstr "Använd maskinvaru-TCL som första TCL-rörledningssteg" -#: t_options.h:151 +#: t_options.h:236 msgid "Bypass the TCL pipeline" msgstr "Kringgå TCL-rörledningen" -#: t_options.h:152 -msgid "Bypass the TCL pipeline with state-based machine code generated on-the-fly" -msgstr "Kringgå TCL-rörledningen med tillståndsbaserad maskinkod som direktgenereras" +#: t_options.h:237 +msgid "" +"Bypass the TCL pipeline with state-based machine code generated on-the-fly" +msgstr "" +"Kringgå TCL-rörledningen med tillståndsbaserad maskinkod som direktgenereras" -#: t_options.h:161 +#: t_options.h:246 msgid "Method to limit rendering latency" msgstr "Metod för att begränsa renderingslatens" -#: t_options.h:162 +#: t_options.h:247 msgid "Busy waiting for the graphics hardware" msgstr "Upptagen med att vänta på grafikhårdvaran" -#: t_options.h:163 +#: t_options.h:248 msgid "Sleep for brief intervals while waiting for the graphics hardware" msgstr "Sov i korta intervall under väntan på grafikhårdvaran" -#: t_options.h:164 +#: t_options.h:249 msgid "Let the graphics hardware emit a software interrupt and sleep" msgstr "Låt grafikhårdvaran sända ut ett programvaruavbrott och sov" -#: t_options.h:174 +#: t_options.h:259 msgid "Synchronization with vertical refresh (swap intervals)" msgstr "Synkronisering med vertikal uppdatering (växlingsintervall)" -#: t_options.h:175 +#: t_options.h:260 msgid "Never synchronize with vertical refresh, ignore application's choice" msgstr "Synkronisera aldrig med vertikal uppdatering, ignorera programmets val" -#: t_options.h:176 +#: t_options.h:261 msgid "Initial swap interval 0, obey application's choice" msgstr "Initialt växlingsintervall 0, följ programmets val" -#: t_options.h:177 +#: t_options.h:262 msgid "Initial swap interval 1, obey application's choice" msgstr "Initialt växlingsintervall 1, följ programmets val" -#: t_options.h:178 -msgid "Always synchronize with vertical refresh, application chooses the minimum swap interval" -msgstr "Synkronisera alltid med vertikal uppdatering, programmet väljer den minsta växlingsintervallen" +#: t_options.h:263 +msgid "" +"Always synchronize with vertical refresh, application chooses the minimum " +"swap interval" +msgstr "" +"Synkronisera alltid med vertikal uppdatering, programmet väljer den minsta " +"växlingsintervallen" -#: t_options.h:186 +#: t_options.h:271 msgid "Use HyperZ to boost performance" msgstr "Använd HyperZ för att maximera prestandan" -#: t_options.h:191 +#: t_options.h:276 msgid "Number of texture units used" msgstr "Antal använda texturenheter" -#: t_options.h:196 -msgid "Support larger textures not guaranteed to fit into graphics memory" -msgstr "Stöd för större texturer är inte garanterat att passa i grafikminnet" - -#: t_options.h:197 -msgid "No" -msgstr "Nej" - -#: t_options.h:198 -msgid "At least 1 texture must fit under worst-case assumptions" -msgstr "Åtminstone en textur måste passa för antaget sämsta förhållande" - -#: t_options.h:199 -msgid "Announce hardware limits" -msgstr "Annonsera hårdvarubegränsningar" - -#: t_options.h:205 +#: t_options.h:281 msgid "Texture filtering quality vs. speed, AKA “brilinear” texture filtering" -msgstr "Texturfiltreringskvalitet mot hastighet, även kallad \"brilinear\"-texturfiltrering" +msgstr "" +"Texturfiltreringskvalitet mot hastighet, även kallad \"brilinear\"-" +"texturfiltrering" -#: t_options.h:213 +#: t_options.h:289 msgid "Used types of texture memory" msgstr "Använda typer av texturminne" -#: t_options.h:214 +#: t_options.h:290 msgid "All available memory" msgstr "Allt tillgängligt minne" -#: t_options.h:215 +#: t_options.h:291 msgid "Only card memory (if available)" msgstr "Endast kortminne (om tillgängligt)" -#: t_options.h:216 +#: t_options.h:292 msgid "Only GART (AGP/PCIE) memory (if available)" msgstr "Endast GART-minne (AGP/PCIE) (om tillgängligt)" -#: t_options.h:224 +#: t_options.h:304 msgid "Features that are not hardware-accelerated" msgstr "Funktioner som inte är hårdvaruaccelererade" -#: t_options.h:228 +#: t_options.h:308 msgid "Enable extension GL_ARB_vertex_program" msgstr "Aktivera tillägget GL_ARB_vertex_program" + +#: t_options.h:318 +msgid "Miscellaneous" +msgstr "" + +#: t_options.h:322 +msgid "Create all visuals with a depth buffer" +msgstr "" + +#~ msgid "Support larger textures not guaranteed to fit into graphics memory" +#~ msgstr "" +#~ "Stöd för större texturer är inte garanterat att passa i grafikminnet" + +#~ msgid "No" +#~ msgstr "Nej" + +#~ msgid "At least 1 texture must fit under worst-case assumptions" +#~ msgstr "Åtminstone en textur måste passa för antaget sämsta förhållande" + +#~ msgid "Announce hardware limits" +#~ msgstr "Annonsera hårdvarubegränsningar" diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c index 96b178905..694558443 100644 --- a/mesalib/src/mesa/main/api_validate.c +++ b/mesalib/src/mesa/main/api_validate.c @@ -128,7 +128,7 @@ check_valid_to_render(struct gl_context *ctx, const char *function) case API_OPENGL_CORE: { const struct gl_shader_program *vsProg = - ctx->Shader.CurrentVertexProgram; + ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX]; GLboolean haveVertexShader = (vsProg && vsProg->LinkStatus); GLboolean haveVertexProgram = ctx->VertexProgram._Enabled; if (haveVertexShader || haveVertexProgram) { @@ -269,9 +269,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.CurrentGeometryProgram) { + if (ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]) { const GLenum geom_mode = - ctx->Shader.CurrentGeometryProgram->Geom.InputType; + ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]->Geom.InputType; switch (mode) { case GL_POINTS: valid_enum = (geom_mode == GL_POINTS); @@ -330,8 +330,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.CurrentGeometryProgram) { - switch (ctx->Shader.CurrentGeometryProgram->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/attrib.c b/mesalib/src/mesa/main/attrib.c index 30c815d67..7b7cf0ef3 100644 --- a/mesalib/src/mesa/main/attrib.c +++ b/mesalib/src/mesa/main/attrib.c @@ -112,7 +112,7 @@ struct gl_enable_attrib GLboolean PolygonSmooth; GLboolean PolygonStipple; GLboolean RescaleNormals; - GLboolean Scissor; + GLbitfield Scissor; GLboolean Stencil; GLboolean StencilTwoSide; /* GL_EXT_stencil_two_side */ GLboolean MultisampleEnabled; /* GL_ARB_multisample */ @@ -354,7 +354,7 @@ _mesa_PushAttrib(GLbitfield mask) attr->PolygonSmooth = ctx->Polygon.SmoothFlag; attr->PolygonStipple = ctx->Polygon.StippleFlag; attr->RescaleNormals = ctx->Transform.RescaleNormals; - attr->Scissor = ctx->Scissor.Enabled; + attr->Scissor = ctx->Scissor.EnableFlags; attr->Stencil = ctx->Stencil.Enabled; attr->StencilTwoSide = ctx->Stencil.TestTwoSide; attr->MultisampleEnabled = ctx->Multisample.Enabled; @@ -533,8 +533,9 @@ _mesa_PushAttrib(GLbitfield mask) if (mask & GL_VIEWPORT_BIT) { if (!push_attrib(ctx, &head, GL_VIEWPORT_BIT, - sizeof(struct gl_viewport_attrib), - (void*)&ctx->Viewport)) + sizeof(struct gl_viewport_attrib) + * ctx->Const.MaxViewports, + (void*)&ctx->ViewportArray)) goto end; } @@ -658,7 +659,13 @@ pop_enable_group(struct gl_context *ctx, const struct gl_enable_attrib *enable) GL_POLYGON_SMOOTH); TEST_AND_UPDATE(ctx->Polygon.StippleFlag, enable->PolygonStipple, GL_POLYGON_STIPPLE); - TEST_AND_UPDATE(ctx->Scissor.Enabled, enable->Scissor, GL_SCISSOR_TEST); + if (ctx->Scissor.EnableFlags != enable->Scissor) { + unsigned i; + + for (i = 0; i < ctx->Const.MaxViewports; i++) { + _mesa_set_enablei(ctx, GL_SCISSOR_TEST, i, (enable->Scissor >> i) & 1); + } + } TEST_AND_UPDATE(ctx->Stencil.Enabled, enable->Stencil, GL_STENCIL_TEST); if (ctx->Extensions.EXT_stencil_two_side) { TEST_AND_UPDATE(ctx->Stencil.TestTwoSide, enable->StencilTwoSide, GL_STENCIL_TEST_TWO_SIDE_EXT); @@ -1262,11 +1269,19 @@ _mesa_PopAttrib(void) break; case GL_SCISSOR_BIT: { + unsigned i; const struct gl_scissor_attrib *scissor; scissor = (const struct gl_scissor_attrib *) attr->data; - _mesa_Scissor(scissor->X, scissor->Y, - scissor->Width, scissor->Height); - _mesa_set_enable(ctx, GL_SCISSOR_TEST, scissor->Enabled); + + for (i = 0; i < ctx->Const.MaxViewports; i++) { + _mesa_set_scissor(ctx, i, + scissor->ScissorArray[i].X, + scissor->ScissorArray[i].Y, + scissor->ScissorArray[i].Width, + scissor->ScissorArray[i].Height); + _mesa_set_enablei(ctx, GL_SCISSOR_TEST, i, + (scissor->EnableFlags >> i) & 1); + } } break; case GL_STENCIL_BUFFER_BIT: @@ -1342,10 +1357,15 @@ _mesa_PopAttrib(void) break; case GL_VIEWPORT_BIT: { + unsigned i; const struct gl_viewport_attrib *vp; vp = (const struct gl_viewport_attrib *) attr->data; - _mesa_Viewport(vp->X, vp->Y, vp->Width, vp->Height); - _mesa_DepthRange(vp->Near, vp->Far); + + for (i = 0; i < ctx->Const.MaxViewports; i++) { + _mesa_set_viewport(ctx, i, vp[i].X, vp[i].Y, vp[i].Width, + vp[i].Height); + _mesa_set_depth_range(ctx, i, vp[i].Near, vp[i].Far); + } } break; case GL_MULTISAMPLE_BIT_ARB: diff --git a/mesalib/src/mesa/main/config.h b/mesalib/src/mesa/main/config.h index 1e1cfb6c5..d1f4632d4 100644 --- a/mesalib/src/mesa/main/config.h +++ b/mesalib/src/mesa/main/config.h @@ -125,7 +125,7 @@ * Max number of texture image units. Also determines number of texture * samplers in shaders. */ -#define MAX_TEXTURE_IMAGE_UNITS 16 +#define MAX_TEXTURE_IMAGE_UNITS 32 /** * Larger of MAX_TEXTURE_COORD_UNITS and MAX_TEXTURE_IMAGE_UNITS. @@ -141,6 +141,9 @@ #define MAX_VIEWPORT_WIDTH 16384 #define MAX_VIEWPORT_HEIGHT 16384 +/** Maximun number of viewports supported with ARB_viewport_array */ +#define MAX_VIEWPORTS 16 + /** Maxmimum size for CVA. May be overridden by the drivers. */ #define MAX_ARRAY_LOCK_SIZE 3000 diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index 4f7bdbdbc..1f8639108 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -587,6 +587,16 @@ _mesa_init_constants(struct gl_context *ctx) ctx->Const.MaxSpotExponent = 128.0; ctx->Const.MaxViewportWidth = MAX_VIEWPORT_WIDTH; ctx->Const.MaxViewportHeight = MAX_VIEWPORT_HEIGHT; + ctx->Const.MinMapBufferAlignment = 1; + + /* Driver must override these values if ARB_viewport_array is supported. */ + ctx->Const.MaxViewports = 1; + ctx->Const.ViewportSubpixelBits = 0; + ctx->Const.ViewportBounds.Min = 0; + ctx->Const.ViewportBounds.Max = 0; + + /* Driver must override if it supports ARB_viewport_array */ + ctx->Const.MaxViewports = 1; /** GL_ARB_uniform_buffer_object */ ctx->Const.MaxCombinedUniformBlocks = 36; @@ -1348,13 +1358,17 @@ _mesa_copy_context( const struct gl_context *src, struct gl_context *dst, } if (mask & GL_VIEWPORT_BIT) { /* Cannot use memcpy, because of pointers in GLmatrix _WindowMap */ - dst->Viewport.X = src->Viewport.X; - dst->Viewport.Y = src->Viewport.Y; - dst->Viewport.Width = src->Viewport.Width; - dst->Viewport.Height = src->Viewport.Height; - dst->Viewport.Near = src->Viewport.Near; - dst->Viewport.Far = src->Viewport.Far; - _math_matrix_copy(&dst->Viewport._WindowMap, &src->Viewport._WindowMap); + unsigned i; + for (i = 0; i < src->Const.MaxViewports; i++) { + dst->ViewportArray[i].X = src->ViewportArray[i].X; + dst->ViewportArray[i].Y = src->ViewportArray[i].Y; + dst->ViewportArray[i].Width = src->ViewportArray[i].Width; + dst->ViewportArray[i].Height = src->ViewportArray[i].Height; + dst->ViewportArray[i].Near = src->ViewportArray[i].Near; + dst->ViewportArray[i].Far = src->ViewportArray[i].Far; + _math_matrix_copy(&dst->ViewportArray[i]._WindowMap, + &src->ViewportArray[i]._WindowMap); + } } /* XXX FIXME: Call callbacks? @@ -1423,12 +1437,20 @@ void _mesa_check_init_viewport(struct gl_context *ctx, GLuint width, GLuint height) { if (!ctx->ViewportInitialized && width > 0 && height > 0) { + unsigned i; + /* Note: set flag here, before calling _mesa_set_viewport(), to prevent * potential infinite recursion. */ ctx->ViewportInitialized = GL_TRUE; - _mesa_set_viewport(ctx, 0, 0, width, height); - _mesa_set_scissor(ctx, 0, 0, width, height); + + /* Note: ctx->Const.MaxViewports may not have been set by the driver + * yet, so just initialize all of them. + */ + for (i = 0; i < MAX_VIEWPORTS; i++) { + _mesa_set_viewport(ctx, i, 0, 0, width, height); + _mesa_set_scissor(ctx, i, 0, 0, width, height); + } } } @@ -1744,10 +1766,10 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where) if (ctx->NewState) _mesa_update_state(ctx); - if (ctx->Shader.CurrentVertexProgram) { + if (ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX]) { vert_from_glsl_shader = true; - if (!ctx->Shader.CurrentVertexProgram->LinkStatus) { + if (!ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX]->LinkStatus) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(shader not linked)", where); return GL_FALSE; @@ -1756,19 +1778,19 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where) { char errMsg[100]; if (!_mesa_validate_shader_program(ctx, - ctx->Shader.CurrentVertexProgram, + ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX], errMsg)) { _mesa_warning(ctx, "Shader program %u is invalid: %s", - ctx->Shader.CurrentVertexProgram->Name, errMsg); + ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX]->Name, errMsg); } } #endif } - if (ctx->Shader.CurrentGeometryProgram) { + if (ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]) { geom_from_glsl_shader = true; - if (!ctx->Shader.CurrentGeometryProgram->LinkStatus) { + if (!ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]->LinkStatus) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(shader not linked)", where); return GL_FALSE; @@ -1777,19 +1799,20 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where) { char errMsg[100]; if (!_mesa_validate_shader_program(ctx, - ctx->Shader.CurrentGeometryProgram, + ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY], errMsg)) { _mesa_warning(ctx, "Shader program %u is invalid: %s", - ctx->Shader.CurrentGeometryProgram->Name, errMsg); + ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]->Name, + errMsg); } } #endif } - if (ctx->Shader.CurrentFragmentProgram) { + if (ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT]) { frag_from_glsl_shader = true; - if (!ctx->Shader.CurrentFragmentProgram->LinkStatus) { + if (!ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT]->LinkStatus) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(shader not linked)", where); return GL_FALSE; @@ -1798,10 +1821,11 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where) { char errMsg[100]; if (!_mesa_validate_shader_program(ctx, - ctx->Shader.CurrentFragmentProgram, + ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT], errMsg)) { _mesa_warning(ctx, "Shader program %u is invalid: %s", - ctx->Shader.CurrentFragmentProgram->Name, errMsg); + ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT]->Name, + errMsg); } } #endif @@ -1851,13 +1875,9 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where) #ifdef DEBUG if (ctx->Shader.Flags & GLSL_LOG) { - struct gl_shader_program *shProg[MESA_SHADER_STAGES]; + struct gl_shader_program **shProg = ctx->Shader.CurrentProgram; gl_shader_stage i; - shProg[MESA_SHADER_VERTEX] = ctx->Shader.CurrentVertexProgram; - shProg[MESA_SHADER_GEOMETRY] = ctx->Shader.CurrentGeometryProgram; - shProg[MESA_SHADER_FRAGMENT] = ctx->Shader.CurrentFragmentProgram; - for (i = 0; i < MESA_SHADER_STAGES; i++) { if (shProg[i] == NULL || shProg[i]->_Used || shProg[i]->_LinkedShaders[i] == NULL) diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c index cb40ff4db..08943c9f9 100644 --- a/mesalib/src/mesa/main/dlist.c +++ b/mesalib/src/mesa/main/dlist.c @@ -767,6 +767,7 @@ _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist) break; case OPCODE_PIXEL_MAP: free(get_pointer(&n[3])); + n += InstSize[n[0].opcode]; break; case OPCODE_CONTINUE: diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c index fca306890..640db8490 100644 --- a/mesalib/src/mesa/main/enable.c +++ b/mesalib/src/mesa/main/enable.c @@ -659,10 +659,15 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) ctx->Transform.RescaleNormals = state; break; case GL_SCISSOR_TEST: - if (ctx->Scissor.Enabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_SCISSOR); - ctx->Scissor.Enabled = state; + { + /* Must expand glEnable to all scissors */ + GLbitfield newEnabled = + state * ((1 << ctx->Const.MaxViewports) - 1); + if (newEnabled != ctx->Scissor.EnableFlags) { + FLUSH_VERTICES(ctx, _NEW_SCISSOR); + ctx->Scissor.EnableFlags = newEnabled; + } + } break; case GL_STENCIL_TEST: if (ctx->Stencil.Enabled == state) @@ -1076,6 +1081,20 @@ _mesa_set_enablei(struct gl_context *ctx, GLenum cap, ctx->Color.BlendEnabled &= ~(1 << index); } break; + case GL_SCISSOR_TEST: + if (index >= ctx->Const.MaxViewports) { + _mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%u)", + state ? "glEnablei" : "glDisablei", index); + return; + } + if (((ctx->Scissor.EnableFlags >> index) & 1) != state) { + FLUSH_VERTICES(ctx, _NEW_SCISSOR); + if (state) + ctx->Scissor.EnableFlags |= (1 << index); + else + ctx->Scissor.EnableFlags &= ~(1 << index); + } + break; default: goto invalid_enum_error; } @@ -1117,6 +1136,13 @@ _mesa_IsEnabledi( GLenum cap, GLuint index ) return GL_FALSE; } return (ctx->Color.BlendEnabled >> index) & 1; + case GL_SCISSOR_TEST: + if (index >= ctx->Const.MaxViewports) { + _mesa_error(ctx, GL_INVALID_VALUE, "glIsEnabledIndexed(index=%u)", + index); + return GL_FALSE; + } + return (ctx->Scissor.EnableFlags >> index) & 1; default: _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabledIndexed(cap=%s)", _mesa_lookup_enum_by_nr(cap)); @@ -1349,7 +1375,7 @@ _mesa_IsEnabled( GLenum cap ) goto invalid_enum_error; return ctx->Transform.RescaleNormals; case GL_SCISSOR_TEST: - return ctx->Scissor.Enabled; + return ctx->Scissor.EnableFlags & 1; /* return state for index 0 */ case GL_STENCIL_TEST: return ctx->Stencil.Enabled; case GL_TEXTURE_1D: diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index 2e0ccc3b6..0676f1e3d 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -80,6 +80,7 @@ static const struct extension extension_table[] = { /* ARB Extensions */ { "GL_ARB_ES2_compatibility", o(ARB_ES2_compatibility), GL, 2009 }, { "GL_ARB_ES3_compatibility", o(ARB_ES3_compatibility), GL, 2012 }, + { "GL_ARB_arrays_of_arrays", o(ARB_arrays_of_arrays), GL, 2012 }, { "GL_ARB_base_instance", o(ARB_base_instance), GL, 2011 }, { "GL_ARB_blend_func_extended", o(ARB_blend_func_extended), GL, 2009 }, { "GL_ARB_clear_buffer_object", o(dummy_true), GL, 2012 }, @@ -176,6 +177,7 @@ static const struct extension extension_table[] = { { "GL_ARB_vertex_shader", o(ARB_vertex_shader), GL, 2002 }, { "GL_ARB_vertex_type_10f_11f_11f_rev", o(ARB_vertex_type_10f_11f_11f_rev), GL, 2013 }, { "GL_ARB_vertex_type_2_10_10_10_rev", o(ARB_vertex_type_2_10_10_10_rev), GL, 2009 }, + { "GL_ARB_viewport_array", o(ARB_viewport_array), GLC, 2010 }, { "GL_ARB_window_pos", o(dummy_true), GLL, 2001 }, /* EXT extensions */ { "GL_EXT_abgr", o(dummy_true), GL, 1995 }, diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index dc7184ad4..943f40bd9 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -880,7 +880,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, /* Covers max_layer_count, is_layered, and layer_tex_target */ bool layer_info_valid = false; GLuint max_layer_count = 0, att_layer_count; - bool is_layered; + bool is_layered = false; GLenum layer_tex_target = 0; assert(_mesa_is_user_fbo(fb)); diff --git a/mesalib/src/mesa/main/ff_fragment_shader.cpp b/mesalib/src/mesa/main/ff_fragment_shader.cpp index 8523edf41..cad67aa85 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.CurrentVertexProgram && - ctx->Shader.CurrentVertexProgram->LinkStatus && - ctx->Shader.CurrentVertexProgram->_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.CurrentVertexProgram->_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/ffvertex_prog.c b/mesalib/src/mesa/main/ffvertex_prog.c index aec2b2dbc..4d71c55ee 100644 --- a/mesalib/src/mesa/main/ffvertex_prog.c +++ b/mesalib/src/mesa/main/ffvertex_prog.c @@ -1676,7 +1676,7 @@ _mesa_get_fixed_func_vertex_program(struct gl_context *ctx) return NULL; create_new_program( &key, prog, - ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].PreferDP4, + ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS, ctx->Const.Program[MESA_SHADER_VERTEX].MaxTemps ); #if 0 diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c index 1246c4d92..7bde1f1a8 100644 --- a/mesalib/src/mesa/main/formats.c +++ b/mesalib/src/mesa/main/formats.c @@ -2032,6 +2032,9 @@ _mesa_get_format_color_encoding(gl_format format) case MESA_FORMAT_SRGBA_DXT3: case MESA_FORMAT_SRGBA_DXT5: case MESA_FORMAT_XBGR8888_SRGB: + case MESA_FORMAT_ETC2_SRGB8: + case MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC: + case MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1: return GL_SRGB; default: return GL_LINEAR; @@ -2077,6 +2080,15 @@ _mesa_get_srgb_format_linear(gl_format format) case MESA_FORMAT_XBGR8888_SRGB: format = MESA_FORMAT_RGBX8888_REV; break; + case MESA_FORMAT_ETC2_SRGB8: + format = MESA_FORMAT_ETC2_RGB8; + break; + case MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC: + format = MESA_FORMAT_ETC2_RGBA8_EAC; + break; + case MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1: + format = MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1; + break; default: break; } diff --git a/mesalib/src/mesa/main/framebuffer.c b/mesalib/src/mesa/main/framebuffer.c index 2fad45880..bd8f4933f 100644 --- a/mesalib/src/mesa/main/framebuffer.c +++ b/mesalib/src/mesa/main/framebuffer.c @@ -357,6 +357,56 @@ update_framebuffer_size(struct gl_context *ctx, struct gl_framebuffer *fb) /** + * Calculate the inclusive bounding box for the scissor of a specific viewport + * + * \param ctx GL context. + * \param buffer Framebuffer to be checked against + * \param idx Index of the desired viewport + * \param bbox Bounding box for the scissored viewport. Stored as xmin, + * xmax, ymin, ymax. + * + * \warning This function assumes that the framebuffer dimensions are up to + * date (e.g., update_framebuffer_size has been recently called on \c buffer). + * + * \sa _mesa_clip_to_region + */ +void +_mesa_scissor_bounding_box(const struct gl_context *ctx, + const struct gl_framebuffer *buffer, + unsigned idx, int *bbox) +{ + bbox[0] = 0; + bbox[2] = 0; + bbox[1] = buffer->Width; + bbox[3] = buffer->Height; + + if (ctx->Scissor.EnableFlags & (1u << idx)) { + if (ctx->Scissor.ScissorArray[idx].X > bbox[0]) { + bbox[0] = ctx->Scissor.ScissorArray[idx].X; + } + if (ctx->Scissor.ScissorArray[idx].Y > bbox[2]) { + bbox[2] = ctx->Scissor.ScissorArray[idx].Y; + } + if (ctx->Scissor.ScissorArray[idx].X + ctx->Scissor.ScissorArray[idx].Width < bbox[1]) { + bbox[1] = ctx->Scissor.ScissorArray[idx].X + ctx->Scissor.ScissorArray[idx].Width; + } + if (ctx->Scissor.ScissorArray[idx].Y + ctx->Scissor.ScissorArray[idx].Height < bbox[3]) { + bbox[3] = ctx->Scissor.ScissorArray[idx].Y + ctx->Scissor.ScissorArray[idx].Height; + } + /* finally, check for empty region */ + if (bbox[0] > bbox[1]) { + bbox[0] = bbox[1]; + } + if (bbox[2] > bbox[3]) { + bbox[2] = bbox[3]; + } + } + + ASSERT(bbox[0] <= bbox[1]); + ASSERT(bbox[2] <= bbox[3]); +} + +/** * Update the context's current drawing buffer's Xmin, Xmax, Ymin, Ymax fields. * These values are computed from the buffer's width and height and * the scissor box, if it's enabled. @@ -366,6 +416,7 @@ void _mesa_update_draw_buffer_bounds(struct gl_context *ctx) { struct gl_framebuffer *buffer = ctx->DrawBuffer; + int bbox[4]; if (!buffer) return; @@ -375,35 +426,12 @@ _mesa_update_draw_buffer_bounds(struct gl_context *ctx) update_framebuffer_size(ctx, buffer); } - buffer->_Xmin = 0; - buffer->_Ymin = 0; - buffer->_Xmax = buffer->Width; - buffer->_Ymax = buffer->Height; - - if (ctx->Scissor.Enabled) { - if (ctx->Scissor.X > buffer->_Xmin) { - buffer->_Xmin = ctx->Scissor.X; - } - if (ctx->Scissor.Y > buffer->_Ymin) { - buffer->_Ymin = ctx->Scissor.Y; - } - if (ctx->Scissor.X + ctx->Scissor.Width < buffer->_Xmax) { - buffer->_Xmax = ctx->Scissor.X + ctx->Scissor.Width; - } - if (ctx->Scissor.Y + ctx->Scissor.Height < buffer->_Ymax) { - buffer->_Ymax = ctx->Scissor.Y + ctx->Scissor.Height; - } - /* finally, check for empty region */ - if (buffer->_Xmin > buffer->_Xmax) { - buffer->_Xmin = buffer->_Xmax; - } - if (buffer->_Ymin > buffer->_Ymax) { - buffer->_Ymin = buffer->_Ymax; - } - } - - ASSERT(buffer->_Xmin <= buffer->_Xmax); - ASSERT(buffer->_Ymin <= buffer->_Ymax); + /* Default to the first scissor as that's always valid */ + _mesa_scissor_bounding_box(ctx, buffer, 0, bbox); + buffer->_Xmin = bbox[0]; + buffer->_Ymin = bbox[2]; + buffer->_Xmax = bbox[1]; + buffer->_Ymax = bbox[3]; } diff --git a/mesalib/src/mesa/main/framebuffer.h b/mesalib/src/mesa/main/framebuffer.h index 264566477..a4274216e 100644 --- a/mesalib/src/mesa/main/framebuffer.h +++ b/mesalib/src/mesa/main/framebuffer.h @@ -71,6 +71,11 @@ _mesa_resize_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb, extern void _mesa_resizebuffers( struct gl_context *ctx ); +extern void +_mesa_scissor_bounding_box(const struct gl_context *ctx, + const struct gl_framebuffer *buffer, + unsigned idx, int *bbox); + extern void _mesa_update_draw_buffer_bounds(struct gl_context *ctx); diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c index b13f9a3db..16dce5b65 100644 --- a/mesalib/src/mesa/main/get.c +++ b/mesalib/src/mesa/main/get.c @@ -113,6 +113,7 @@ enum value_type { TYPE_FLOATN_3, TYPE_FLOATN_4, TYPE_DOUBLEN, + TYPE_DOUBLEN_2, TYPE_MATRIX, TYPE_MATRIX_T, TYPE_CONST @@ -162,6 +163,7 @@ struct value_desc { union value { GLfloat value_float; GLfloat value_float_4[4]; + GLdouble value_double_2[2]; GLmatrix *value_matrix; GLint value_int; GLint value_int_4[4]; @@ -389,6 +391,7 @@ EXTRA_EXT(ARB_texture_gather); EXTRA_EXT(ARB_shader_atomic_counters); EXTRA_EXT(ARB_draw_indirect); EXTRA_EXT(ARB_shader_image_load_store); +EXTRA_EXT(ARB_viewport_array); static const int extra_ARB_color_buffer_float_or_glcore[] = { @@ -665,10 +668,14 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu break; case GL_SCISSOR_BOX: - v->value_int_4[0] = ctx->Scissor.X; - v->value_int_4[1] = ctx->Scissor.Y; - v->value_int_4[2] = ctx->Scissor.Width; - v->value_int_4[3] = ctx->Scissor.Height; + v->value_int_4[0] = ctx->Scissor.ScissorArray[0].X; + v->value_int_4[1] = ctx->Scissor.ScissorArray[0].Y; + v->value_int_4[2] = ctx->Scissor.ScissorArray[0].Width; + v->value_int_4[3] = ctx->Scissor.ScissorArray[0].Height; + break; + + case GL_SCISSOR_TEST: + v->value_bool = ctx->Scissor.EnableFlags & 1; break; case GL_LIST_INDEX: @@ -685,10 +692,15 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu break; case GL_VIEWPORT: - v->value_int_4[0] = ctx->Viewport.X; - v->value_int_4[1] = ctx->Viewport.Y; - v->value_int_4[2] = ctx->Viewport.Width; - v->value_int_4[3] = ctx->Viewport.Height; + v->value_float_4[0] = ctx->ViewportArray[0].X; + v->value_float_4[1] = ctx->ViewportArray[0].Y; + v->value_float_4[2] = ctx->ViewportArray[0].Width; + v->value_float_4[3] = ctx->ViewportArray[0].Height; + break; + + case GL_DEPTH_RANGE: + v->value_double_2[0] = ctx->ViewportArray[0].Near; + v->value_double_2[1] = ctx->ViewportArray[0].Far; break; case GL_ACTIVE_STENCIL_FACE_EXT: @@ -1235,6 +1247,8 @@ _mesa_GetBooleanv(GLenum pname, GLboolean *params) params[0] = FLOAT_TO_BOOLEAN(((GLfloat *) p)[0]); break; + case TYPE_DOUBLEN_2: + params[1] = FLOAT_TO_BOOLEAN(((GLdouble *) p)[1]); case TYPE_DOUBLEN: params[0] = FLOAT_TO_BOOLEAN(((GLdouble *) p)[0]); break; @@ -1321,6 +1335,8 @@ _mesa_GetFloatv(GLenum pname, GLfloat *params) params[0] = ((GLfloat *) p)[0]; break; + case TYPE_DOUBLEN_2: + params[1] = (GLfloat) (((GLdouble *) p)[1]); case TYPE_DOUBLEN: params[0] = (GLfloat) (((GLdouble *) p)[0]); break; @@ -1413,6 +1429,8 @@ _mesa_GetIntegerv(GLenum pname, GLint *params) params[0] = FLOAT_TO_INT(((GLfloat *) p)[0]); break; + case TYPE_DOUBLEN_2: + params[1] = FLOAT_TO_INT(((GLdouble *) p)[1]); case TYPE_DOUBLEN: params[0] = FLOAT_TO_INT(((GLdouble *) p)[0]); break; @@ -1505,6 +1523,8 @@ _mesa_GetInteger64v(GLenum pname, GLint64 *params) params[0] = FLOAT_TO_INT64(((GLfloat *) p)[0]); break; + case TYPE_DOUBLEN_2: + params[1] = FLOAT_TO_INT64(((GLdouble *) p)[1]); case TYPE_DOUBLEN: params[0] = FLOAT_TO_INT64(((GLdouble *) p)[0]); break; @@ -1591,6 +1611,8 @@ _mesa_GetDoublev(GLenum pname, GLdouble *params) params[0] = ((GLfloat *) p)[0]; break; + case TYPE_DOUBLEN_2: + params[1] = ((GLdouble *) p)[1]; case TYPE_DOUBLEN: params[0] = ((GLdouble *) p)[0]; break; @@ -1719,6 +1741,31 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v) v->value_int_4[3] = ctx->Color.ColorMask[index][ACOMP] ? 1 : 0; return TYPE_INT_4; + case GL_SCISSOR_BOX: + if (index >= ctx->Const.MaxViewports) + goto invalid_value; + v->value_int_4[0] = ctx->Scissor.ScissorArray[index].X; + v->value_int_4[1] = ctx->Scissor.ScissorArray[index].Y; + v->value_int_4[2] = ctx->Scissor.ScissorArray[index].Width; + v->value_int_4[3] = ctx->Scissor.ScissorArray[index].Height; + return TYPE_INT_4; + + case GL_VIEWPORT: + if (index >= ctx->Const.MaxViewports) + goto invalid_value; + v->value_float_4[0] = ctx->ViewportArray[index].X; + v->value_float_4[1] = ctx->ViewportArray[index].Y; + v->value_float_4[2] = ctx->ViewportArray[index].Width; + v->value_float_4[3] = ctx->ViewportArray[index].Height; + return TYPE_FLOAT_4; + + case GL_DEPTH_RANGE: + if (index >= ctx->Const.MaxViewports) + goto invalid_value; + v->value_double_2[0] = ctx->ViewportArray[index].Near; + v->value_double_2[1] = ctx->ViewportArray[index].Far; + return TYPE_DOUBLEN_2; + case GL_TRANSFORM_FEEDBACK_BUFFER_START: if (index >= ctx->Const.MaxTransformFeedbackBuffers) goto invalid_value; @@ -1927,6 +1974,26 @@ _mesa_GetIntegeri_v( GLenum pname, GLuint index, GLint *params ) find_value_indexed("glGetIntegeri_v", pname, index, &v); switch (type) { + case TYPE_FLOAT_4: + case TYPE_FLOATN_4: + params[3] = IROUND(v.value_float_4[3]); + case TYPE_FLOAT_3: + case TYPE_FLOATN_3: + params[2] = IROUND(v.value_float_4[2]); + case TYPE_FLOAT_2: + case TYPE_FLOATN_2: + params[1] = IROUND(v.value_float_4[1]); + case TYPE_FLOAT: + case TYPE_FLOATN: + params[0] = IROUND(v.value_float_4[0]); + break; + + case TYPE_DOUBLEN_2: + params[1] = IROUND(v.value_double_2[1]); + case TYPE_DOUBLEN: + params[0] = IROUND(v.value_double_2[0]); + break; + case TYPE_INT: params[0] = v.value_int; break; @@ -1970,6 +2037,150 @@ _mesa_GetInteger64i_v( GLenum pname, GLuint index, GLint64 *params ) } void GLAPIENTRY +_mesa_GetFloati_v(GLenum pname, GLuint index, GLfloat *params) +{ + int i; + GLmatrix *m; + union value v; + enum value_type type = + find_value_indexed("glGetFloati_v", pname, index, &v); + + switch (type) { + case TYPE_FLOAT_4: + case TYPE_FLOATN_4: + params[3] = v.value_float_4[3]; + case TYPE_FLOAT_3: + case TYPE_FLOATN_3: + params[2] = v.value_float_4[2]; + case TYPE_FLOAT_2: + case TYPE_FLOATN_2: + params[1] = v.value_float_4[1]; + case TYPE_FLOAT: + case TYPE_FLOATN: + params[0] = v.value_float_4[0]; + break; + + case TYPE_DOUBLEN_2: + params[1] = (GLfloat) v.value_double_2[1]; + case TYPE_DOUBLEN: + params[0] = (GLfloat) v.value_double_2[0]; + break; + + case TYPE_INT_4: + params[3] = (GLfloat) v.value_int_4[3]; + case TYPE_INT_3: + params[2] = (GLfloat) v.value_int_4[2]; + case TYPE_INT_2: + case TYPE_ENUM_2: + params[1] = (GLfloat) v.value_int_4[1]; + case TYPE_INT: + case TYPE_ENUM: + params[0] = (GLfloat) v.value_int_4[0]; + break; + + case TYPE_INT_N: + for (i = 0; i < v.value_int_n.n; i++) + params[i] = INT_TO_FLOAT(v.value_int_n.ints[i]); + break; + + case TYPE_INT64: + params[0] = (GLfloat) v.value_int64; + break; + + case TYPE_BOOLEAN: + params[0] = BOOLEAN_TO_FLOAT(v.value_bool); + break; + + case TYPE_MATRIX: + m = *(GLmatrix **) &v; + for (i = 0; i < 16; i++) + params[i] = m->m[i]; + break; + + case TYPE_MATRIX_T: + m = *(GLmatrix **) &v; + for (i = 0; i < 16; i++) + params[i] = m->m[transpose[i]]; + break; + + default: + ; + } +} + +void GLAPIENTRY +_mesa_GetDoublei_v(GLenum pname, GLuint index, GLdouble *params) +{ + int i; + GLmatrix *m; + union value v; + enum value_type type = + find_value_indexed("glGetDoublei_v", pname, index, &v); + + switch (type) { + case TYPE_FLOAT_4: + case TYPE_FLOATN_4: + params[3] = (GLdouble) v.value_float_4[3]; + case TYPE_FLOAT_3: + case TYPE_FLOATN_3: + params[2] = (GLdouble) v.value_float_4[2]; + case TYPE_FLOAT_2: + case TYPE_FLOATN_2: + params[1] = (GLdouble) v.value_float_4[1]; + case TYPE_FLOAT: + case TYPE_FLOATN: + params[0] = (GLdouble) v.value_float_4[0]; + break; + + case TYPE_DOUBLEN_2: + params[1] = v.value_double_2[1]; + case TYPE_DOUBLEN: + params[0] = v.value_double_2[0]; + break; + + case TYPE_INT_4: + params[3] = (GLdouble) v.value_int_4[3]; + case TYPE_INT_3: + params[2] = (GLdouble) v.value_int_4[2]; + case TYPE_INT_2: + case TYPE_ENUM_2: + params[1] = (GLdouble) v.value_int_4[1]; + case TYPE_INT: + case TYPE_ENUM: + params[0] = (GLdouble) v.value_int_4[0]; + break; + + case TYPE_INT_N: + for (i = 0; i < v.value_int_n.n; i++) + params[i] = (GLdouble) INT_TO_FLOAT(v.value_int_n.ints[i]); + break; + + case TYPE_INT64: + params[0] = (GLdouble) v.value_int64; + break; + + case TYPE_BOOLEAN: + params[0] = (GLdouble) BOOLEAN_TO_FLOAT(v.value_bool); + break; + + case TYPE_MATRIX: + m = *(GLmatrix **) &v; + for (i = 0; i < 16; i++) + params[i] = (GLdouble) m->m[i]; + break; + + case TYPE_MATRIX_T: + m = *(GLmatrix **) &v; + for (i = 0; i < 16; i++) + params[i] = (GLdouble) m->m[transpose[i]]; + break; + + default: + ; + } +} + +void GLAPIENTRY _mesa_GetFixedv(GLenum pname, GLfixed *params) { const struct value_desc *d; @@ -2000,6 +2211,8 @@ _mesa_GetFixedv(GLenum pname, GLfixed *params) params[0] = FLOAT_TO_FIXED(((GLfloat *) p)[0]); break; + case TYPE_DOUBLEN_2: + params[1] = FLOAT_TO_FIXED(((GLdouble *) p)[1]); case TYPE_DOUBLEN: params[0] = FLOAT_TO_FIXED(((GLdouble *) p)[0]); break; diff --git a/mesalib/src/mesa/main/get.h b/mesalib/src/mesa/main/get.h index 0f72508a7..ce97cc586 100644 --- a/mesalib/src/mesa/main/get.h +++ b/mesalib/src/mesa/main/get.h @@ -65,6 +65,12 @@ _mesa_GetInteger64i_v( GLenum pname, GLuint index, GLint64 *params ); extern void GLAPIENTRY _mesa_GetPointerv( GLenum pname, GLvoid **params ); +extern void GLAPIENTRY +_mesa_GetFloati_v(GLenum target, GLuint index, GLfloat *data); + +extern void GLAPIENTRY +_mesa_GetDoublei_v(GLenum target, GLuint index, GLdouble *data); + extern const GLubyte * GLAPIENTRY _mesa_GetString( GLenum name ); diff --git a/mesalib/src/mesa/main/get_hash_params.py b/mesalib/src/mesa/main/get_hash_params.py index bc2bbafa8..b45e1430b 100644 --- a/mesalib/src/mesa/main/get_hash_params.py +++ b/mesalib/src/mesa/main/get_hash_params.py @@ -11,7 +11,7 @@ descriptor=[ [ "DEPTH_BITS", "BUFFER_INT(Visual.depthBits), extra_new_buffers" ], [ "DEPTH_CLEAR_VALUE", "CONTEXT_FIELD(Depth.Clear, TYPE_DOUBLEN), NO_EXTRA" ], [ "DEPTH_FUNC", "CONTEXT_ENUM(Depth.Func), NO_EXTRA" ], - [ "DEPTH_RANGE", "CONTEXT_FIELD(Viewport.Near, TYPE_FLOATN_2), NO_EXTRA" ], + [ "DEPTH_RANGE", "LOC_CUSTOM, TYPE_DOUBLEN_2, 0, NO_EXTRA" ], [ "DEPTH_TEST", "CONTEXT_BOOL(Depth.Test), NO_EXTRA" ], [ "DEPTH_WRITEMASK", "CONTEXT_BOOL(Depth.Mask), NO_EXTRA" ], [ "DITHER", "CONTEXT_BOOL(Color.DitherFlag), NO_EXTRA" ], @@ -30,7 +30,7 @@ descriptor=[ [ "POLYGON_OFFSET_FILL", "CONTEXT_BOOL(Polygon.OffsetFill), NO_EXTRA" ], [ "RED_BITS", "BUFFER_INT(Visual.redBits), extra_new_buffers" ], [ "SCISSOR_BOX", "LOC_CUSTOM, TYPE_INT_4, 0, NO_EXTRA" ], - [ "SCISSOR_TEST", "CONTEXT_BOOL(Scissor.Enabled), NO_EXTRA" ], + [ "SCISSOR_TEST", "LOC_CUSTOM, TYPE_BOOLEAN, NO_OFFSET, NO_EXTRA" ], [ "STENCIL_BITS", "BUFFER_INT(Visual.stencilBits), extra_new_buffers" ], [ "STENCIL_CLEAR_VALUE", "CONTEXT_INT(Stencil.Clear), NO_EXTRA" ], [ "STENCIL_FAIL", "LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA" ], @@ -44,7 +44,7 @@ descriptor=[ [ "SUBPIXEL_BITS", "CONTEXT_INT(Const.SubPixelBits), NO_EXTRA" ], [ "TEXTURE_BINDING_2D", "LOC_CUSTOM, TYPE_INT, TEXTURE_2D_INDEX, NO_EXTRA" ], [ "UNPACK_ALIGNMENT", "CONTEXT_INT(Unpack.Alignment), NO_EXTRA" ], - [ "VIEWPORT", "LOC_CUSTOM, TYPE_INT_4, 0, NO_EXTRA" ], + [ "VIEWPORT", "LOC_CUSTOM, TYPE_FLOAT_4, 0, NO_EXTRA" ], # GL_ARB_multitexture [ "ACTIVE_TEXTURE", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ], @@ -759,6 +759,13 @@ descriptor=[ [ "TEXTURE_BUFFER_OFFSET_ALIGNMENT", "CONTEXT_INT(Const.TextureBufferOffsetAlignment), extra_ARB_texture_buffer_range" ], # GL_ARB_draw_indirect [ "DRAW_INDIRECT_BUFFER_BINDING", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_draw_indirect" ], + +# GL_ARB_viewport_array + [ "MAX_VIEWPORTS", "CONTEXT_INT(Const.MaxViewports), extra_ARB_viewport_array" ], + [ "VIEWPORT_SUBPIXEL_BITS", "CONTEXT_INT(Const.ViewportSubpixelBits), extra_ARB_viewport_array" ], + [ "VIEWPORT_BOUNDS_RANGE", "CONTEXT_FLOAT2(Const.ViewportBounds), extra_ARB_viewport_array" ], + [ "LAYER_PROVOKING_VERTEX", "CONTEXT_ENUM(Light.ProvokingVertex), extra_ARB_viewport_array" ], + [ "VIEWPORT_INDEX_PROVOKING_VERTEX", "CONTEXT_ENUM(Light.ProvokingVertex), extra_ARB_viewport_array" ], ]} ] diff --git a/mesalib/src/mesa/main/glformats.c b/mesalib/src/mesa/main/glformats.c index bec7a9bbb..7d4a31057 100644 --- a/mesalib/src/mesa/main/glformats.c +++ b/mesalib/src/mesa/main/glformats.c @@ -1136,76 +1136,60 @@ GLenum _mesa_get_nongeneric_internalformat(GLenum format) { switch (format) { - /* GL 1.1 formats. */ - case 4: - case GL_RGBA: - return GL_RGBA8; - - case 3: - case GL_RGB: - return GL_RGB8; - - case 2: - case GL_LUMINANCE_ALPHA: - return GL_LUMINANCE8_ALPHA8; - - case 1: - case GL_LUMINANCE: - return GL_LUMINANCE8; - - case GL_ALPHA: - return GL_ALPHA8; - - case GL_INTENSITY: - return GL_INTENSITY8; - - /* GL_ARB_texture_rg */ - case GL_RED: - return GL_R8; - - case GL_RG: - return GL_RG8; - - /* GL_EXT_texture_sRGB */ - case GL_SRGB: - return GL_SRGB8; - - case GL_SRGB_ALPHA: - return GL_SRGB8_ALPHA8; - - case GL_SLUMINANCE: - return GL_SLUMINANCE8; - - case GL_SLUMINANCE_ALPHA: - return GL_SLUMINANCE8_ALPHA8; - - /* GL_EXT_texture_snorm */ - case GL_RGBA_SNORM: - return GL_RGBA8_SNORM; - - case GL_RGB_SNORM: - return GL_RGB8_SNORM; - - case GL_RG_SNORM: - return GL_RG8_SNORM; - - case GL_RED_SNORM: - return GL_R8_SNORM; - - case GL_LUMINANCE_ALPHA_SNORM: - return GL_LUMINANCE8_ALPHA8_SNORM; - - case GL_LUMINANCE_SNORM: - return GL_LUMINANCE8_SNORM; + /* GL 1.1 formats. */ + case 4: + case GL_RGBA: + return GL_RGBA8; + case 3: + case GL_RGB: + return GL_RGB8; + case 2: + case GL_LUMINANCE_ALPHA: + return GL_LUMINANCE8_ALPHA8; + case 1: + case GL_LUMINANCE: + return GL_LUMINANCE8; + case GL_ALPHA: + return GL_ALPHA8; + case GL_INTENSITY: + return GL_INTENSITY8; - case GL_ALPHA_SNORM: - return GL_ALPHA8_SNORM; + /* GL_ARB_texture_rg */ + case GL_RED: + return GL_R8; + case GL_RG: + return GL_RG8; - case GL_INTENSITY_SNORM: - return GL_INTENSITY8_SNORM; + /* GL_EXT_texture_sRGB */ + case GL_SRGB: + return GL_SRGB8; + case GL_SRGB_ALPHA: + return GL_SRGB8_ALPHA8; + case GL_SLUMINANCE: + return GL_SLUMINANCE8; + case GL_SLUMINANCE_ALPHA: + return GL_SLUMINANCE8_ALPHA8; + + /* GL_EXT_texture_snorm */ + case GL_RGBA_SNORM: + return GL_RGBA8_SNORM; + case GL_RGB_SNORM: + return GL_RGB8_SNORM; + case GL_RG_SNORM: + return GL_RG8_SNORM; + case GL_RED_SNORM: + return GL_R8_SNORM; + case GL_LUMINANCE_ALPHA_SNORM: + return GL_LUMINANCE8_ALPHA8_SNORM; + case GL_LUMINANCE_SNORM: + return GL_LUMINANCE8_SNORM; + case GL_ALPHA_SNORM: + return GL_ALPHA8_SNORM; + case GL_INTENSITY_SNORM: + return GL_INTENSITY8_SNORM; - default: - return format; + default: + return format; } } @@ -1219,22 +1203,20 @@ _mesa_get_linear_internalformat(GLenum format) switch (format) { case GL_SRGB: return GL_RGB; - case GL_SRGB_ALPHA: return GL_RGBA; - case GL_SRGB8: return GL_RGB8; - case GL_SRGB8_ALPHA8: return GL_RGBA8; - - case GL_SLUMINANCE: + case GL_SLUMINANCE8: return GL_LUMINANCE8; - + case GL_SLUMINANCE: + return GL_LUMINANCE; case GL_SLUMINANCE_ALPHA: + return GL_LUMINANCE_ALPHA; + case GL_SLUMINANCE8_ALPHA8: return GL_LUMINANCE8_ALPHA8; - default: return format; } diff --git a/mesalib/src/mesa/main/macros.h b/mesalib/src/mesa/main/macros.h index 379f75663..dafeaa372 100644 --- a/mesalib/src/mesa/main/macros.h +++ b/mesalib/src/mesa/main/macros.h @@ -809,5 +809,7 @@ DIFFERENT_SIGNS(GLfloat x, GLfloat y) /* Compute the size of an array */ #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) +/* Stringify */ +#define STRINGIFY(x) #x #endif diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index 33df682cf..9ab2de026 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -235,6 +235,7 @@ typedef enum VARYING_SLOT_CLIP_DIST1, VARYING_SLOT_PRIMITIVE_ID, /* Does not appear in VS */ VARYING_SLOT_LAYER, /* Appears as VS or GS output */ + VARYING_SLOT_VIEWPORT, /* Appears as VS or GS output */ VARYING_SLOT_FACE, /* FS only */ VARYING_SLOT_PNTC, /* FS only */ VARYING_SLOT_VAR0, /* First generic varying slot */ @@ -270,6 +271,7 @@ typedef enum #define VARYING_BIT_CLIP_DIST1 BITFIELD64_BIT(VARYING_SLOT_CLIP_DIST1) #define VARYING_BIT_PRIMITIVE_ID BITFIELD64_BIT(VARYING_SLOT_PRIMITIVE_ID) #define VARYING_BIT_LAYER BITFIELD64_BIT(VARYING_SLOT_LAYER) +#define VARYING_BIT_VIEWPORT BITFIELD64_BIT(VARYING_SLOT_VIEWPORT) #define VARYING_BIT_FACE BITFIELD64_BIT(VARYING_SLOT_FACE) #define VARYING_BIT_PNTC BITFIELD64_BIT(VARYING_SLOT_PNTC) #define VARYING_BIT_VAR(V) BITFIELD64_BIT(VARYING_SLOT_VAR0 + (V)) @@ -1009,12 +1011,16 @@ struct gl_polygon_attrib /** * Scissor attributes (GL_SCISSOR_BIT). */ -struct gl_scissor_attrib +struct gl_scissor_rect { - GLboolean Enabled; /**< Scissor test enabled? */ GLint X, Y; /**< Lower left corner of box */ GLsizei Width, Height; /**< Size of box */ }; +struct gl_scissor_attrib +{ + GLbitfield EnableFlags; /**< Scissor test enabled? */ + struct gl_scissor_rect ScissorArray[MAX_VIEWPORTS]; +}; /** @@ -1428,9 +1434,9 @@ struct gl_transform_attrib */ struct gl_viewport_attrib { - GLint X, Y; /**< position */ - GLsizei Width, Height; /**< size */ - GLfloat Near, Far; /**< Depth buffer range */ + GLfloat X, Y; /**< position */ + GLfloat Width, Height; /**< size */ + GLdouble Near, Far; /**< Depth buffer range */ GLmatrix _WindowMap; /**< Mapping transformation as a matrix. */ }; @@ -1809,7 +1815,9 @@ struct gl_transform_feedback_object /** * The shader program active when BeginTransformFeedback() was called. - * When active and unpaused, this equals ctx->Shader.CurrentVertexProgram. + * When active and unpaused, this equals ctx->Shader.CurrentProgram[stage], + * where stage is the pipeline stage that is the source of data for + * transform feedback. */ struct gl_shader_program *shader_program; @@ -2708,9 +2716,7 @@ struct gl_shader_state * GL_EXT_separate_shader_objects is not supported, each of these must point * to \c NULL or to the same program. */ - struct gl_shader_program *CurrentVertexProgram; - struct gl_shader_program *CurrentGeometryProgram; - struct gl_shader_program *CurrentFragmentProgram; + struct gl_shader_program *CurrentProgram[MESA_SHADER_STAGES]; struct gl_shader_program *_CurrentFragmentProgram; @@ -2754,10 +2760,13 @@ struct gl_shader_compiler_options GLuint MaxUnrollIterations; /** - * Prefer DP4 instructions (rather than MUL/MAD) for matrix * vector - * operations, such as position transformation. + * Optimize code for array of structures backends. + * + * This is a proxy for: + * - preferring DP4 instructions (rather than MUL/MAD) for + * matrix * vector operations, such as position transformation. */ - GLboolean PreferDP4; + GLboolean OptimizeForAOS; struct gl_sl_pragmas DefaultPragmas; /**< Default #pragma settings */ }; @@ -3166,6 +3175,12 @@ struct gl_constants GLfloat MaxSpotExponent; /**< GL_NV_light_max_exponent */ GLuint MaxViewportWidth, MaxViewportHeight; + GLuint MaxViewports; /**< GL_ARB_viewport_array */ + GLuint ViewportSubpixelBits; /**< GL_ARB_viewport_array */ + struct { + GLfloat Min; + GLfloat Max; + } ViewportBounds; /**< GL_ARB_viewport_array */ struct gl_program_constants Program[MESA_SHADER_STAGES]; GLuint MaxProgramMatrices; @@ -3366,6 +3381,7 @@ struct gl_extensions GLboolean ANGLE_texture_compression_dxt; GLboolean ARB_ES2_compatibility; GLboolean ARB_ES3_compatibility; + GLboolean ARB_arrays_of_arrays; GLboolean ARB_base_instance; GLboolean ARB_blend_func_extended; GLboolean ARB_color_buffer_float; @@ -3434,6 +3450,7 @@ struct gl_extensions GLboolean ARB_vertex_shader; GLboolean ARB_vertex_type_10f_11f_11f_rev; GLboolean ARB_vertex_type_2_10_10_10_rev; + GLboolean ARB_viewport_array; GLboolean EXT_blend_color; GLboolean EXT_blend_equation_separate; GLboolean EXT_blend_func_separate; @@ -3764,6 +3781,9 @@ struct gl_driver_flags /** gl_context::TransformFeedback::CurrentObject */ GLbitfield NewTransformFeedback; + /** gl_context::TransformFeedback::CurrentObject::shader_program */ + GLbitfield NewTransformFeedbackProg; + /** gl_context::RasterDiscard */ GLbitfield NewRasterizerDiscard; @@ -3972,7 +3992,7 @@ struct gl_context struct gl_stencil_attrib Stencil; /**< Stencil buffer attributes */ struct gl_texture_attrib Texture; /**< Texture attributes */ struct gl_transform_attrib Transform; /**< Transformation attributes */ - struct gl_viewport_attrib Viewport; /**< Viewport attributes */ + struct gl_viewport_attrib ViewportArray[MAX_VIEWPORTS]; /**< Viewport attributes */ /*@}*/ /** \name Client attribute stack */ diff --git a/mesalib/src/mesa/main/rastpos.c b/mesalib/src/mesa/main/rastpos.c index 1acdb8b53..a9a6ceec0 100644 --- a/mesalib/src/mesa/main/rastpos.c +++ b/mesalib/src/mesa/main/rastpos.c @@ -227,8 +227,9 @@ window_pos3f(GLfloat x, GLfloat y, GLfloat z) FLUSH_VERTICES(ctx, 0); FLUSH_CURRENT(ctx, 0); - z2 = CLAMP(z, 0.0F, 1.0F) * (ctx->Viewport.Far - ctx->Viewport.Near) - + ctx->Viewport.Near; + z2 = CLAMP(z, 0.0F, 1.0F) + * (ctx->ViewportArray[0].Far - ctx->ViewportArray[0].Near) + + ctx->ViewportArray[0].Near; /* set raster position */ ctx->Current.RasterPos[0] = x; diff --git a/mesalib/src/mesa/main/scissor.c b/mesalib/src/mesa/main/scissor.c index ac86bd591..14c8e8a6c 100644 --- a/mesalib/src/mesa/main/scissor.c +++ b/mesalib/src/mesa/main/scissor.c @@ -30,11 +30,37 @@ /** + * Set scissor rectangle data directly in ScissorArray + * + * This is an internal function that performs no error checking on the + * supplied data. It also does \b not call \c dd_function_table::Scissor. + * + * \sa _mesa_set_scissor + */ +static void +set_scissor_no_notify(struct gl_context *ctx, unsigned idx, + GLint x, GLint y, GLsizei width, GLsizei height) +{ + if (x == ctx->Scissor.ScissorArray[idx].X && + y == ctx->Scissor.ScissorArray[idx].Y && + width == ctx->Scissor.ScissorArray[idx].Width && + height == ctx->Scissor.ScissorArray[idx].Height) + return; + + FLUSH_VERTICES(ctx, _NEW_SCISSOR); + ctx->Scissor.ScissorArray[idx].X = x; + ctx->Scissor.ScissorArray[idx].Y = y; + ctx->Scissor.ScissorArray[idx].Width = width; + ctx->Scissor.ScissorArray[idx].Height = height; +} + +/** * Called via glScissor */ void GLAPIENTRY _mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ) { + unsigned i; GET_CURRENT_CONTEXT(ctx); if (MESA_VERBOSE & VERBOSE_API) @@ -45,7 +71,23 @@ _mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ) return; } - _mesa_set_scissor(ctx, x, y, width, height); + /* The GL_ARB_viewport_array spec says: + * + * "Scissor sets the scissor rectangle for all viewports to the same + * values and is equivalent (assuming no errors are generated) to: + * + * for (uint i = 0; i < MAX_VIEWPORTS; i++) { + * ScissorIndexed(i, left, bottom, width, height); + * }" + * + * Set the scissor rectangle for all of the viewports supported by the + * implementation, but only signal the driver once at the end. + */ + for (i = 0; i < ctx->Const.MaxViewports; i++) + set_scissor_no_notify(ctx, i, x, y, width, height); + + if (ctx->Driver.Scissor) + ctx->Driver.Scissor(ctx); } @@ -63,25 +105,108 @@ _mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ) * the dd_function_table::Scissor callback. */ void -_mesa_set_scissor(struct gl_context *ctx, +_mesa_set_scissor(struct gl_context *ctx, unsigned idx, GLint x, GLint y, GLsizei width, GLsizei height) { - if (x == ctx->Scissor.X && - y == ctx->Scissor.Y && - width == ctx->Scissor.Width && - height == ctx->Scissor.Height) + set_scissor_no_notify(ctx, idx, x, y, width, height); + + if (ctx->Driver.Scissor) + ctx->Driver.Scissor(ctx); +} + +/** + * Define count scissor boxes starting at index. + * + * \param index index of first scissor records to set + * \param count number of scissor records to set + * \param x, y pointer to array of struct gl_scissor_rects + * + * \sa glScissorArrayv(). + * + * Verifies the parameters and call set_scissor_no_notify to do the work. + */ +void GLAPIENTRY +_mesa_ScissorArrayv(GLuint first, GLsizei count, const GLint *v) +{ + int i; + struct gl_scissor_rect *p = (struct gl_scissor_rect *) v; + GET_CURRENT_CONTEXT(ctx); + + if ((first + count) > ctx->Const.MaxViewports) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glScissorArrayv: first (%d) + count (%d) >= MaxViewports (%d)", + first, count, ctx->Const.MaxViewports); return; + } - FLUSH_VERTICES(ctx, _NEW_SCISSOR); - ctx->Scissor.X = x; - ctx->Scissor.Y = y; - ctx->Scissor.Width = width; - ctx->Scissor.Height = height; + /* Verify width & height */ + for (i = 0; i < count; i++) { + if (p[i].Width < 0 || p[i].Height < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glScissorArrayv: index (%d) width or height < 0 (%d, %d)", + i, p[i].Width, p[i].Height); + } + } + + for (i = 0; i < count; i++) + set_scissor_no_notify(ctx, i + first, + p[i].X, p[i].Y, p[i].Width, p[i].Height); if (ctx->Driver.Scissor) ctx->Driver.Scissor(ctx); } +/** + * Define the scissor box. + * + * \param index index of scissor records to set + * \param x, y coordinates of the scissor box lower-left corner. + * \param width width of the scissor box. + * \param height height of the scissor box. + * + * Verifies the parameters call set_scissor_no_notify to do the work. + */ +static void +ScissorIndexed(GLuint index, GLint left, GLint bottom, + GLsizei width, GLsizei height, const char *function) +{ + GET_CURRENT_CONTEXT(ctx); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "%s(%d, %d, %d, %d, %d)\n", + function, index, left, bottom, width, height); + + if (index >= ctx->Const.MaxViewports) { + _mesa_error(ctx, GL_INVALID_VALUE, + "%s: index (%d) >= MaxViewports (%d)", + function, index, ctx->Const.MaxViewports); + return; + } + + if (width < 0 || height < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "%s: index (%d) width or height < 0 (%d, %d)", + function, index, width, height); + } + + set_scissor_no_notify(ctx, index, left, bottom, width, height); + + if (ctx->Driver.Scissor) + ctx->Driver.Scissor(ctx); +} + +void GLAPIENTRY +_mesa_ScissorIndexed(GLuint index, GLint left, GLint bottom, + GLsizei width, GLsizei height) +{ + ScissorIndexed(index, left, bottom, width, height, "glScissorIndexd"); +} + +void GLAPIENTRY +_mesa_ScissorIndexedv(GLuint index, const GLint *v) +{ + ScissorIndexed(index, v[0], v[1], v[2], v[3], "glScissorIndexdv"); +} /** * Initialize the context's scissor state. @@ -90,10 +215,14 @@ _mesa_set_scissor(struct gl_context *ctx, void _mesa_init_scissor(struct gl_context *ctx) { + unsigned i; + /* Scissor group */ - ctx->Scissor.Enabled = GL_FALSE; - ctx->Scissor.X = 0; - ctx->Scissor.Y = 0; - ctx->Scissor.Width = 0; - ctx->Scissor.Height = 0; + ctx->Scissor.EnableFlags = 0; + + /* Note: ctx->Const.MaxViewports may not have been set by the driver yet, + * so just initialize all of them. + */ + for (i = 0; i < MAX_VIEWPORTS; i++) + set_scissor_no_notify(ctx, i, 0, 0, 0, 0); } diff --git a/mesalib/src/mesa/main/scissor.h b/mesalib/src/mesa/main/scissor.h index 0d7e2010a..5f9a9945a 100644 --- a/mesalib/src/mesa/main/scissor.h +++ b/mesalib/src/mesa/main/scissor.h @@ -34,9 +34,17 @@ struct gl_context; extern void GLAPIENTRY _mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ); +extern void GLAPIENTRY +_mesa_ScissorArrayv(GLuint first, GLsizei count, const GLint * v); + +extern void GLAPIENTRY +_mesa_ScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); + +extern void GLAPIENTRY +_mesa_ScissorIndexedv(GLuint index, const GLint * v); extern void -_mesa_set_scissor(struct gl_context *ctx, +_mesa_set_scissor(struct gl_context *ctx, unsigned idx, GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c index 6042fa896..61ac0e35a 100644 --- a/mesalib/src/mesa/main/shaderapi.c +++ b/mesalib/src/mesa/main/shaderapi.c @@ -130,11 +130,11 @@ _mesa_init_shader_state(struct gl_context *ctx) void _mesa_free_shader_state(struct gl_context *ctx) { - _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentVertexProgram, NULL); - _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentGeometryProgram, - NULL); - _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentFragmentProgram, - NULL); + int i; + for (i = 0; i < MESA_SHADER_STAGES; i++) { + _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentProgram[i], + NULL); + } _mesa_reference_shader_program(ctx, &ctx->Shader._CurrentFragmentProgram, NULL); _mesa_reference_shader_program(ctx, &ctx->Shader.ActiveProgram, NULL); @@ -171,16 +171,23 @@ _mesa_copy_string(GLchar *dst, GLsizei maxLength, * \param type Shader target * */ -static bool -validate_shader_target(const struct gl_context *ctx, GLenum type) -{ +bool +_mesa_validate_shader_target(const struct gl_context *ctx, GLenum type) +{ + /* Note: when building built-in GLSL functions, this function may be + * invoked with ctx == NULL. In that case, we can only validate that it's + * a shader target we recognize, not that it's supported in the current + * context. But that's fine--we don't need any further validation than + * that when building built-in GLSL functions. + */ + switch (type) { case GL_FRAGMENT_SHADER: - return ctx->Extensions.ARB_fragment_shader; + return ctx == NULL || ctx->Extensions.ARB_fragment_shader; case GL_VERTEX_SHADER: - return ctx->Extensions.ARB_vertex_shader; + return ctx == NULL || ctx->Extensions.ARB_vertex_shader; case GL_GEOMETRY_SHADER_ARB: - return _mesa_has_geometry_shaders(ctx); + return ctx == NULL || _mesa_has_geometry_shaders(ctx); default: return false; } @@ -273,7 +280,7 @@ create_shader(struct gl_context *ctx, GLenum type) struct gl_shader *sh; GLuint name; - if (!validate_shader_target(ctx, type)) { + if (!_mesa_validate_shader_target(ctx, type)) { _mesa_error(ctx, GL_INVALID_ENUM, "CreateShader(type)"); return 0; } @@ -939,32 +946,11 @@ use_shader_program(struct gl_context *ctx, GLenum type, struct gl_shader_program *shProg) { struct gl_shader_program **target; + gl_shader_stage stage = _mesa_shader_enum_to_shader_stage(type); - switch (type) { - case GL_VERTEX_SHADER: - target = &ctx->Shader.CurrentVertexProgram; - if ((shProg == NULL) - || (shProg->_LinkedShaders[MESA_SHADER_VERTEX] == NULL)) { - shProg = NULL; - } - break; - case GL_GEOMETRY_SHADER_ARB: - target = &ctx->Shader.CurrentGeometryProgram; - if ((shProg == NULL) - || (shProg->_LinkedShaders[MESA_SHADER_GEOMETRY] == NULL)) { - shProg = NULL; - } - break; - case GL_FRAGMENT_SHADER: - target = &ctx->Shader.CurrentFragmentProgram; - if ((shProg == NULL) - || (shProg->_LinkedShaders[MESA_SHADER_FRAGMENT] == NULL)) { - shProg = NULL; - } - break; - default: - return; - } + target = &ctx->Shader.CurrentProgram[stage]; + if ((shProg == NULL) || (shProg->_LinkedShaders[stage] == NULL)) + shProg = NULL; if (*target != shProg) { FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); @@ -1739,7 +1725,7 @@ _mesa_UseShaderProgramEXT(GLenum type, GLuint program) GET_CURRENT_CONTEXT(ctx); struct gl_shader_program *shProg = NULL; - if (!validate_shader_target(ctx, type)) { + if (!_mesa_validate_shader_target(ctx, type)) { _mesa_error(ctx, GL_INVALID_ENUM, "glUseShaderProgramEXT(type)"); return; } diff --git a/mesalib/src/mesa/main/shaderapi.h b/mesalib/src/mesa/main/shaderapi.h index 4822e32c2..10f810caf 100644 --- a/mesalib/src/mesa/main/shaderapi.h +++ b/mesalib/src/mesa/main/shaderapi.h @@ -215,6 +215,9 @@ _mesa_copy_linked_program_data(gl_shader_stage type, const struct gl_shader_program *src, struct gl_program *dst); +extern bool +_mesa_validate_shader_target(const struct gl_context *ctx, GLenum type); + #ifdef __cplusplus } diff --git a/mesalib/src/mesa/main/shaderobj.c b/mesalib/src/mesa/main/shaderobj.c index dc81bbc77..4f4bb69a8 100644 --- a/mesalib/src/mesa/main/shaderobj.c +++ b/mesalib/src/mesa/main/shaderobj.c @@ -34,6 +34,7 @@ #include "main/context.h" #include "main/hash.h" #include "main/mtypes.h" +#include "main/shaderapi.h" #include "main/shaderobj.h" #include "main/uniforms.h" #include "program/program.h" @@ -105,8 +106,7 @@ struct gl_shader * _mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type) { struct gl_shader *shader; - assert(type == GL_FRAGMENT_SHADER || type == GL_VERTEX_SHADER || - type == GL_GEOMETRY_SHADER_ARB); + assert(_mesa_validate_shader_target(ctx, type)); shader = rzalloc(NULL, struct gl_shader); if (shader) { shader->Type = type; diff --git a/mesalib/src/mesa/main/shared.c b/mesalib/src/mesa/main/shared.c index 2f73cf3ca..c11c7f9e9 100644 --- a/mesalib/src/mesa/main/shared.c +++ b/mesalib/src/mesa/main/shared.c @@ -38,6 +38,7 @@ #include "dlist.h" #include "samplerobj.h" #include "set.h" +#include "shaderapi.h" #include "shaderobj.h" #include "syncobj.h" @@ -218,8 +219,7 @@ delete_shader_cb(GLuint id, void *data, void *userData) { struct gl_context *ctx = (struct gl_context *) userData; struct gl_shader *sh = (struct gl_shader *) data; - if (sh->Type == GL_FRAGMENT_SHADER || sh->Type == GL_VERTEX_SHADER || - sh->Type == GL_GEOMETRY_SHADER) { + if (_mesa_validate_shader_target(ctx, sh->Type)) { ctx->Driver.DeleteShader(ctx, sh); } else { diff --git a/mesalib/src/mesa/main/state.c b/mesalib/src/mesa/main/state.c index 33070b7e0..bdebbc141 100644 --- a/mesalib/src/mesa/main/state.c +++ b/mesalib/src/mesa/main/state.c @@ -94,9 +94,12 @@ update_program_enables(struct gl_context *ctx) static GLbitfield update_program(struct gl_context *ctx) { - const struct gl_shader_program *vsProg = ctx->Shader.CurrentVertexProgram; - const struct gl_shader_program *gsProg = ctx->Shader.CurrentGeometryProgram; - struct gl_shader_program *fsProg = ctx->Shader.CurrentFragmentProgram; + const struct gl_shader_program *vsProg = + ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX]; + const struct gl_shader_program *gsProg = + ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]; + struct gl_shader_program *fsProg = + 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; @@ -269,6 +272,7 @@ static void update_viewport_matrix(struct gl_context *ctx) { const GLfloat depthMax = ctx->DrawBuffer->_DepthMaxF; + unsigned i; ASSERT(depthMax > 0); @@ -276,11 +280,13 @@ update_viewport_matrix(struct gl_context *ctx) * and should be maintained elsewhere if at all. * NOTE: RasterPos uses this. */ - _math_matrix_viewport(&ctx->Viewport._WindowMap, - ctx->Viewport.X, ctx->Viewport.Y, - ctx->Viewport.Width, ctx->Viewport.Height, - ctx->Viewport.Near, ctx->Viewport.Far, - depthMax); + for (i = 0; i < ctx->Const.MaxViewports; i++) { + _math_matrix_viewport(&ctx->ViewportArray[i]._WindowMap, + ctx->ViewportArray[i].X, ctx->ViewportArray[i].Y, + ctx->ViewportArray[i].Width, ctx->ViewportArray[i].Height, + ctx->ViewportArray[i].Near, ctx->ViewportArray[i].Far, + depthMax); + } } @@ -304,7 +310,7 @@ update_multisample(struct gl_context *ctx) static void update_twoside(struct gl_context *ctx) { - if (ctx->Shader.CurrentVertexProgram || + if (ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX] || ctx->VertexProgram._Enabled) { ctx->VertexProgram._TwoSideEnabled = ctx->VertexProgram.TwoSideEnabled; } else { diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c index 3c64c4376..5d516c55f 100644 --- a/mesalib/src/mesa/main/texobj.c +++ b/mesalib/src/mesa/main/texobj.c @@ -1104,10 +1104,10 @@ unbind_texobj_from_texunits(struct gl_context *ctx, * and unbind it if that's the case. */ static void -unbind_texobj_from_imgunits(struct gl_context *ctx, - struct gl_texture_object *texObj) +unbind_texobj_from_image_units(struct gl_context *ctx, + struct gl_texture_object *texObj) { - int i; + GLuint i; for (i = 0; i < ctx->Const.MaxImageUnits; i++) { struct gl_image_unit *unit = &ctx->ImageUnits[i]; @@ -1169,7 +1169,7 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures) * image unit. If so, unbind it. * See section 3.9.X of GL_ARB_shader_image_load_store. */ - unbind_texobj_from_imgunits(ctx, delObj); + unbind_texobj_from_image_units(ctx, delObj); _mesa_unlock_texture(ctx, delObj); diff --git a/mesalib/src/mesa/main/texstate.c b/mesalib/src/mesa/main/texstate.c index 7720965a8..08725f601 100644 --- a/mesalib/src/mesa/main/texstate.c +++ b/mesalib/src/mesa/main/texstate.c @@ -527,27 +527,20 @@ static void update_texture_state( struct gl_context *ctx ) { GLuint unit; - struct gl_program *fprog = NULL; - struct gl_program *vprog = NULL; - struct gl_program *gprog = NULL; + struct gl_program *prog[MESA_SHADER_STAGES]; GLbitfield enabledFragUnits = 0x0; - - if (ctx->Shader.CurrentVertexProgram && - ctx->Shader.CurrentVertexProgram->LinkStatus) { - vprog = ctx->Shader.CurrentVertexProgram->_LinkedShaders[MESA_SHADER_VERTEX]->Program; - } - - if (ctx->Shader.CurrentGeometryProgram && - ctx->Shader.CurrentGeometryProgram->LinkStatus) { - gprog = ctx->Shader.CurrentGeometryProgram->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program; - } - - if (ctx->Shader.CurrentFragmentProgram && - ctx->Shader.CurrentFragmentProgram->LinkStatus) { - fprog = ctx->Shader.CurrentFragmentProgram->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program; - } - else if (ctx->FragmentProgram._Enabled) { - fprog = &ctx->FragmentProgram.Current->Base; + 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; + } else { + if (i == MESA_SHADER_FRAGMENT && ctx->FragmentProgram._Enabled) + prog[i] = &ctx->FragmentProgram.Current->Base; + else + prog[i] = NULL; + } } /* TODO: only set this if there are actual changes */ @@ -563,9 +556,7 @@ update_texture_state( struct gl_context *ctx ) */ for (unit = 0; unit < ctx->Const.MaxCombinedTextureImageUnits; unit++) { struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; - GLbitfield enabledVertTargets = 0x0; - GLbitfield enabledFragTargets = 0x0; - GLbitfield enabledGeomTargets = 0x0; + GLbitfield enabledTargetsByStage[MESA_SHADER_STAGES]; GLbitfield enabledTargets = 0x0; GLuint texIndex; @@ -575,25 +566,16 @@ update_texture_state( struct gl_context *ctx ) * by a fragment program/program. When multiple flags are set, we'll * settle on the one with highest priority (see below). */ - if (vprog) { - enabledVertTargets |= vprog->TexturesUsed[unit]; + for (i = 0; i < MESA_SHADER_STAGES; i++) { + if (prog[i]) + enabledTargetsByStage[i] = prog[i]->TexturesUsed[unit]; + else if (i == MESA_SHADER_FRAGMENT) + enabledTargetsByStage[i] = texUnit->Enabled; + else + enabledTargetsByStage[i] = 0; + enabledTargets |= enabledTargetsByStage[i]; } - if (gprog) { - enabledGeomTargets |= gprog->TexturesUsed[unit]; - } - - if (fprog) { - enabledFragTargets |= fprog->TexturesUsed[unit]; - } - else { - /* fixed-function fragment program */ - enabledFragTargets |= texUnit->Enabled; - } - - enabledTargets = enabledVertTargets | enabledFragTargets | - enabledGeomTargets; - texUnit->_ReallyEnabled = 0x0; if (enabledTargets == 0x0) { @@ -625,7 +607,7 @@ update_texture_state( struct gl_context *ctx ) } if (!texUnit->_ReallyEnabled) { - if (fprog) { + if (prog[MESA_SHADER_FRAGMENT]) { /* If we get here it means the shader is expecting a texture * object, but there isn't one (or it's incomplete). Use the * fallback texture. @@ -655,25 +637,26 @@ update_texture_state( struct gl_context *ctx ) ctx->Texture._EnabledUnits |= (1 << unit); - if (enabledFragTargets) + if (enabledTargetsByStage[MESA_SHADER_FRAGMENT]) enabledFragUnits |= (1 << unit); - if (!fprog) + if (!prog[MESA_SHADER_FRAGMENT]) update_tex_combine(ctx, texUnit); } /* Determine which texture coordinate sets are actually needed */ - if (fprog) { + if (prog[MESA_SHADER_FRAGMENT]) { const GLuint coordMask = (1 << MAX_TEXTURE_COORD_UNITS) - 1; ctx->Texture._EnabledCoordUnits - = (fprog->InputsRead >> VARYING_SLOT_TEX0) & coordMask; + = (prog[MESA_SHADER_FRAGMENT]->InputsRead >> VARYING_SLOT_TEX0) & + coordMask; } else { ctx->Texture._EnabledCoordUnits = enabledFragUnits; } - if (!fprog || !vprog) + if (!prog[MESA_SHADER_FRAGMENT] || !prog[MESA_SHADER_VERTEX]) update_texgen(ctx); _mesa_validate_image_units(ctx); diff --git a/mesalib/src/mesa/main/texstorage.c b/mesalib/src/mesa/main/texstorage.c index 5062fdb4f..22208572f 100644 --- a/mesalib/src/mesa/main/texstorage.c +++ b/mesalib/src/mesa/main/texstorage.c @@ -244,6 +244,10 @@ _mesa_alloc_texture_storage(struct gl_context *ctx, int face; int level; + (void) width; + (void) height; + (void) depth; + for (face = 0; face < numFaces; face++) { for (level = 0; level < levels; level++) { struct gl_texture_image *const texImage = texObj->Image[face][level]; @@ -460,7 +464,16 @@ _mesa_TextureStorage1DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width) { - /* no-op */ + GET_CURRENT_CONTEXT(ctx); + + (void) texture; + (void) target; + (void) levels; + (void) internalformat; + (void) width; + + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTextureStorage1DEXT not supported"); } @@ -469,7 +482,17 @@ _mesa_TextureStorage2DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) { - /* no-op */ + GET_CURRENT_CONTEXT(ctx); + + (void) texture; + (void) target; + (void) levels; + (void) internalformat; + (void) width; + (void) height; + + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTextureStorage2DEXT not supported"); } @@ -479,5 +502,16 @@ _mesa_TextureStorage3DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) { - /* no-op */ + GET_CURRENT_CONTEXT(ctx); + + (void) texture; + (void) target; + (void) levels; + (void) internalformat; + (void) width; + (void) height; + (void) depth; + + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTextureStorage3DEXT not supported"); } diff --git a/mesalib/src/mesa/main/transformfeedback.c b/mesalib/src/mesa/main/transformfeedback.c index 76d213b16..6b9565ca3 100644 --- a/mesalib/src/mesa/main/transformfeedback.c +++ b/mesalib/src/mesa/main/transformfeedback.c @@ -24,7 +24,7 @@ /* - * Vertex transform feedback support. + * Transform feedback support. * * Authors: * Brian Paul @@ -376,24 +376,48 @@ _mesa_compute_max_transform_feedback_vertices( **/ +/** + * Figure out which stage of the pipeline is the source of transform feedback + * data given the current context state, and return its gl_shader_program. + * + * If no active program can generate transform feedback data (i.e. no vertex + * shader is active), returns NULL. + */ +static struct gl_shader_program * +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]; + } + return NULL; +} + + void GLAPIENTRY _mesa_BeginTransformFeedback(GLenum mode) { struct gl_transform_feedback_object *obj; - struct gl_transform_feedback_info *info; + struct gl_transform_feedback_info *info = NULL; + struct gl_shader_program *source; GLuint i; unsigned vertices_per_prim; GET_CURRENT_CONTEXT(ctx); obj = ctx->TransformFeedback.CurrentObject; - if (ctx->Shader.CurrentVertexProgram == NULL) { + /* Figure out what pipeline stage is the source of data for transform + * feedback. + */ + source = get_xfb_source(ctx); + if (source == NULL) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginTransformFeedback(no program active)"); return; } - info = &ctx->Shader.CurrentVertexProgram->LinkedTransformFeedback; + info = &source->LinkedTransformFeedback; if (info->NumOutputs == 0) { _mesa_error(ctx, GL_INVALID_OPERATION, @@ -451,7 +475,10 @@ _mesa_BeginTransformFeedback(GLenum mode) obj->GlesRemainingPrims = max_vertices / vertices_per_prim; } - obj->shader_program = ctx->Shader.CurrentVertexProgram; + if (obj->shader_program != source) { + ctx->NewDriverState |= ctx->DriverFlags.NewTransformFeedbackProg; + obj->shader_program = source; + } assert(ctx->Driver.BeginTransformFeedback); ctx->Driver.BeginTransformFeedback(ctx, mode, obj); @@ -518,7 +545,7 @@ bind_buffer_range(struct gl_context *ctx, GLuint index, /** - * Specify a buffer object to receive vertex shader results. Plus, + * Specify a buffer object to receive transform feedback results. Plus, * specify the starting offset to place the results, and max size. * Called from the glBindBufferRange() function. */ @@ -562,7 +589,7 @@ _mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx, /** - * Specify a buffer object to receive vertex shader results. + * Specify a buffer object to receive transform feedback results. * As above, but start at offset = 0. * Called from the glBindBufferBase() function. */ @@ -591,7 +618,7 @@ _mesa_bind_buffer_base_transform_feedback(struct gl_context *ctx, /** - * Specify a buffer object to receive vertex shader results, plus the + * Specify a buffer object to receive transform feedback results, plus the * offset in the buffer to start placing results. * This function is part of GL_EXT_transform_feedback, but not GL3. */ @@ -646,7 +673,7 @@ _mesa_BindBufferOffsetEXT(GLenum target, GLuint index, GLuint buffer, /** - * This function specifies the vertex shader outputs to be written + * This function specifies the transform feedback outputs to be written * to the feedback buffer(s), and in what order. */ void GLAPIENTRY @@ -756,7 +783,7 @@ _mesa_TransformFeedbackVaryings(GLuint program, GLsizei count, /** - * Get info about the vertex shader's outputs which are to be written + * Get info about the transform feedback outputs which are to be written * to the feedback buffer(s). */ void GLAPIENTRY @@ -993,9 +1020,9 @@ _mesa_ResumeTransformFeedback(void) * the program object being used by the current transform feedback object * is not active." */ - if (obj->shader_program != ctx->Shader.CurrentVertexProgram) { + if (obj->shader_program != get_xfb_source(ctx)) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glResumeTransformFeedback(wrong vertex program bound)"); + "glResumeTransformFeedback(wrong program bound)"); return; } diff --git a/mesalib/src/mesa/main/viewport.c b/mesalib/src/mesa/main/viewport.c index 3aaab2d46..6545bf68a 100644 --- a/mesalib/src/mesa/main/viewport.c +++ b/mesalib/src/mesa/main/viewport.c @@ -34,6 +34,60 @@ #include "mtypes.h" #include "viewport.h" +static void +set_viewport_no_notify(struct gl_context *ctx, unsigned idx, + GLfloat x, GLfloat y, + GLfloat width, GLfloat height) +{ + /* clamp width and height to the implementation dependent range */ + width = MIN2(width, (GLfloat) ctx->Const.MaxViewportWidth); + height = MIN2(height, (GLfloat) ctx->Const.MaxViewportHeight); + + /* The GL_ARB_viewport_array spec says: + * + * "The location of the viewport's bottom-left corner, given by (x,y), + * are clamped to be within the implementation-dependent viewport + * bounds range. The viewport bounds range [min, max] tuple may be + * determined by calling GetFloatv with the symbolic constant + * VIEWPORT_BOUNDS_RANGE (see section 6.1)." + */ + if (ctx->Extensions.ARB_viewport_array) { + x = CLAMP(x, + ctx->Const.ViewportBounds.Min, ctx->Const.ViewportBounds.Max); + y = CLAMP(y, + ctx->Const.ViewportBounds.Min, ctx->Const.ViewportBounds.Max); + } + + ctx->ViewportArray[idx].X = x; + ctx->ViewportArray[idx].Width = width; + ctx->ViewportArray[idx].Y = y; + ctx->ViewportArray[idx].Height = height; + ctx->NewState |= _NEW_VIEWPORT; + +#if 1 + /* XXX remove this someday. Currently the DRI drivers rely on + * the WindowMap matrix being up to date in the driver's Viewport + * and DepthRange functions. + */ + _math_matrix_viewport(&ctx->ViewportArray[idx]._WindowMap, + ctx->ViewportArray[idx].X, + ctx->ViewportArray[idx].Y, + ctx->ViewportArray[idx].Width, + ctx->ViewportArray[idx].Height, + ctx->ViewportArray[idx].Near, + ctx->ViewportArray[idx].Far, + ctx->DrawBuffer->_DepthMaxF); +#endif +} + +struct gl_viewport_inputs { + GLfloat X, Y; /**< position */ + GLfloat Width, Height; /**< size */ +}; + +struct gl_depthrange_inputs { + GLdouble Near, Far; /**< Depth buffer range */ +}; /** * Set the viewport. @@ -45,9 +99,39 @@ void GLAPIENTRY _mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height) { + unsigned i; GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); - _mesa_set_viewport(ctx, x, y, width, height); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glViewport %d %d %d %d\n", x, y, width, height); + + if (width < 0 || height < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glViewport(%d, %d, %d, %d)", x, y, width, height); + return; + } + + /* The GL_ARB_viewport_array spec says: + * + * "Viewport sets the parameters for all viewports to the same values + * and is equivalent (assuming no errors are generated) to: + * + * for (uint i = 0; i < MAX_VIEWPORTS; i++) + * ViewportIndexedf(i, 1, (float)x, (float)y, (float)w, (float)h);" + * + * Set all of the viewports supported by the implementation, but only + * signal the driver once at the end. + */ + for (i = 0; i < ctx->Const.MaxViewports; i++) + set_viewport_no_notify(ctx, i, x, y, width, height); + + if (ctx->Driver.Viewport) { + /* Many drivers will use this call to check for window size changes + * and reallocate the z/stencil/accum/etc buffers if needed. + */ + ctx->Driver.Viewport(ctx); + } } @@ -56,31 +140,114 @@ _mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height) * matrix). Usually called from _mesa_Viewport(). * * \param ctx GL context. + * \param idx Index of the viewport to be updated. * \param x, y coordinates of the lower left corner of the viewport rectangle. * \param width width of the viewport rectangle. * \param height height of the viewport rectangle. */ void -_mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y, - GLsizei width, GLsizei height) +_mesa_set_viewport(struct gl_context *ctx, unsigned idx, GLfloat x, GLfloat y, + GLfloat width, GLfloat height) { + set_viewport_no_notify(ctx, idx, x, y, width, height); + + if (ctx->Driver.Viewport) { + /* Many drivers will use this call to check for window size changes + * and reallocate the z/stencil/accum/etc buffers if needed. + */ + ctx->Driver.Viewport(ctx); + } +} + +void GLAPIENTRY +_mesa_ViewportArrayv(GLuint first, GLsizei count, const GLfloat *v) +{ + int i; + const struct gl_viewport_inputs *const p = (struct gl_viewport_inputs *) v; + GET_CURRENT_CONTEXT(ctx); + if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glViewport %d %d %d %d\n", x, y, width, height); + _mesa_debug(ctx, "glViewportArrayv %d %d\n", first, count); - if (width < 0 || height < 0) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glViewport(%d, %d, %d, %d)", x, y, width, height); + if ((first + count) > ctx->Const.MaxViewports) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glViewportArrayv: first (%d) + count (%d) > MaxViewports " + "(%d)", + first, count, ctx->Const.MaxViewports); return; } - /* clamp width and height to the implementation dependent range */ - width = MIN2(width, (GLsizei) ctx->Const.MaxViewportWidth); - height = MIN2(height, (GLsizei) ctx->Const.MaxViewportHeight); + /* Verify width & height */ + for (i = 0; i < count; i++) { + if (p[i].Width < 0 || p[i].Height < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glViewportArrayv: index (%d) width or height < 0 " + "(%f, %f)", + i + first, p[i].Width, p[i].Height); + return; + } + } + + for (i = 0; i < count; i++) + set_viewport_no_notify(ctx, i + first, + p[i].X, p[i].Y, + p[i].Width, p[i].Height); + + if (ctx->Driver.Viewport) + ctx->Driver.Viewport(ctx); +} - ctx->Viewport.X = x; - ctx->Viewport.Width = width; - ctx->Viewport.Y = y; - ctx->Viewport.Height = height; +static void +ViewportIndexedf(GLuint index, GLfloat x, GLfloat y, + GLfloat w, GLfloat h, const char *function) +{ + GET_CURRENT_CONTEXT(ctx); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "%s(%d, %f, %f, %f, %f)\n", + function, index, x, y, w, h); + + if (index >= ctx->Const.MaxViewports) { + _mesa_error(ctx, GL_INVALID_VALUE, + "%s: index (%d) >= MaxViewports (%d)", + function, index, ctx->Const.MaxViewports); + return; + } + + /* Verify width & height */ + if (w < 0 || h < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "%s: index (%d) width or height < 0 (%f, %f)", + function, index, w, h); + return; + } + + _mesa_set_viewport(ctx, index, x, y, w, h); +} + +void GLAPIENTRY +_mesa_ViewportIndexedf(GLuint index, GLfloat x, GLfloat y, + GLfloat w, GLfloat h) +{ + ViewportIndexedf(index, x, y, w, h, "glViewportIndexedf"); +} + +void GLAPIENTRY +_mesa_ViewportIndexedfv(GLuint index, const GLfloat *v) +{ + ViewportIndexedf(index, v[0], v[1], v[2], v[3], "glViewportIndexedfv"); +} + +static void +set_depth_range_no_notify(struct gl_context *ctx, unsigned idx, + GLclampd nearval, GLclampd farval) +{ + if (ctx->ViewportArray[idx].Near == nearval && + ctx->ViewportArray[idx].Far == farval) + return; + + ctx->ViewportArray[idx].Near = CLAMP(nearval, 0.0, 1.0); + ctx->ViewportArray[idx].Far = CLAMP(farval, 0.0, 1.0); ctx->NewState |= _NEW_VIEWPORT; #if 1 @@ -88,21 +255,26 @@ _mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y, * the WindowMap matrix being up to date in the driver's Viewport * and DepthRange functions. */ - _math_matrix_viewport(&ctx->Viewport._WindowMap, - ctx->Viewport.X, ctx->Viewport.Y, - ctx->Viewport.Width, ctx->Viewport.Height, - ctx->Viewport.Near, ctx->Viewport.Far, + _math_matrix_viewport(&ctx->ViewportArray[idx]._WindowMap, + ctx->ViewportArray[idx].X, + ctx->ViewportArray[idx].Y, + ctx->ViewportArray[idx].Width, + ctx->ViewportArray[idx].Height, + ctx->ViewportArray[idx].Near, + ctx->ViewportArray[idx].Far, ctx->DrawBuffer->_DepthMaxF); #endif - - if (ctx->Driver.Viewport) { - /* Many drivers will use this call to check for window size changes - * and reallocate the z/stencil/accum/etc buffers if needed. - */ - ctx->Driver.Viewport(ctx); - } } +void +_mesa_set_depth_range(struct gl_context *ctx, unsigned idx, + GLclampd nearval, GLclampd farval) +{ + set_depth_range_no_notify(ctx, idx, nearval, farval); + + if (ctx->Driver.DepthRange) + ctx->Driver.DepthRange(ctx); +} /** * Called by glDepthRange @@ -115,6 +287,7 @@ _mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y, void GLAPIENTRY _mesa_DepthRange(GLclampd nearval, GLclampd farval) { + unsigned i; GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); @@ -122,25 +295,19 @@ _mesa_DepthRange(GLclampd nearval, GLclampd farval) if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glDepthRange %f %f\n", nearval, farval); - if (ctx->Viewport.Near == nearval && - ctx->Viewport.Far == farval) - return; - - ctx->Viewport.Near = (GLfloat) CLAMP(nearval, 0.0, 1.0); - ctx->Viewport.Far = (GLfloat) CLAMP(farval, 0.0, 1.0); - ctx->NewState |= _NEW_VIEWPORT; - -#if 1 - /* XXX remove this someday. Currently the DRI drivers rely on - * the WindowMap matrix being up to date in the driver's Viewport - * and DepthRange functions. + /* The GL_ARB_viewport_array spec says: + * + * "DepthRange sets the depth range for all viewports to the same + * values and is equivalent (assuming no errors are generated) to: + * + * for (uint i = 0; i < MAX_VIEWPORTS; i++) + * DepthRangeIndexed(i, n, f);" + * + * Set the depth range for all of the viewports supported by the + * implementation, but only signal the driver once at the end. */ - _math_matrix_viewport(&ctx->Viewport._WindowMap, - ctx->Viewport.X, ctx->Viewport.Y, - ctx->Viewport.Width, ctx->Viewport.Height, - ctx->Viewport.Near, ctx->Viewport.Far, - ctx->DrawBuffer->_DepthMaxF); -#endif + for (i = 0; i < ctx->Const.MaxViewports; i++) + set_depth_range_no_notify(ctx, i, nearval, farval); if (ctx->Driver.DepthRange) { ctx->Driver.DepthRange(ctx); @@ -153,6 +320,67 @@ _mesa_DepthRangef(GLclampf nearval, GLclampf farval) _mesa_DepthRange(nearval, farval); } +/** + * Update a range DepthRange values + * + * \param first starting array index + * \param count count of DepthRange items to update + * \param v pointer to memory containing + * GLclampd near and far clip-plane values + */ +void GLAPIENTRY +_mesa_DepthRangeArrayv(GLuint first, GLsizei count, const GLclampd *v) +{ + int i; + const struct gl_depthrange_inputs *const p = + (struct gl_depthrange_inputs *) v; + GET_CURRENT_CONTEXT(ctx); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glDepthRangeArrayv %d %d\n", first, count); + + if ((first + count) > ctx->Const.MaxViewports) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glDepthRangev: first (%d) + count (%d) >= MaxViewports (%d)", + first, count, ctx->Const.MaxViewports); + return; + } + + for (i = 0; i < count; i++) + set_depth_range_no_notify(ctx, i + first, p[i].Near, p[i].Far); + + if (ctx->Driver.DepthRange) + ctx->Driver.DepthRange(ctx); +} + +/** + * Update a single DepthRange + * + * \param index array index to update + * \param nearval specifies the Z buffer value which should correspond to + * the near clip plane + * \param farval specifies the Z buffer value which should correspond to + * the far clip plane + */ +void GLAPIENTRY +_mesa_DepthRangeIndexed(GLuint index, GLclampd nearval, GLclampd farval) +{ + GET_CURRENT_CONTEXT(ctx); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glDepthRangeIndexed(%d, %f, %f)\n", + index, nearval, farval); + + if (index >= ctx->Const.MaxViewports) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glDepthRangeIndexed: index (%d) >= MaxViewports (%d)", + index, ctx->Const.MaxViewports); + return; + } + + _mesa_set_depth_range(ctx, index, nearval, farval); +} + /** * Initialize the context viewport attribute group. * \param ctx the GL context. @@ -160,18 +388,24 @@ _mesa_DepthRangef(GLclampf nearval, GLclampf farval) void _mesa_init_viewport(struct gl_context *ctx) { GLfloat depthMax = 65535.0F; /* sorf of arbitrary */ + unsigned i; - /* Viewport group */ - ctx->Viewport.X = 0; - ctx->Viewport.Y = 0; - ctx->Viewport.Width = 0; - ctx->Viewport.Height = 0; - ctx->Viewport.Near = 0.0; - ctx->Viewport.Far = 1.0; - _math_matrix_ctr(&ctx->Viewport._WindowMap); - - _math_matrix_viewport(&ctx->Viewport._WindowMap, 0, 0, 0, 0, - 0.0F, 1.0F, depthMax); + /* Note: ctx->Const.MaxViewports may not have been set by the driver yet, + * so just initialize all of them. + */ + for (i = 0; i < MAX_VIEWPORTS; i++) { + /* Viewport group */ + ctx->ViewportArray[i].X = 0; + ctx->ViewportArray[i].Y = 0; + ctx->ViewportArray[i].Width = 0; + ctx->ViewportArray[i].Height = 0; + ctx->ViewportArray[i].Near = 0.0; + ctx->ViewportArray[i].Far = 1.0; + _math_matrix_ctr(&ctx->ViewportArray[i]._WindowMap); + + _math_matrix_viewport(&ctx->ViewportArray[i]._WindowMap, 0, 0, 0, 0, + 0.0F, 1.0F, depthMax); + } } @@ -181,6 +415,9 @@ void _mesa_init_viewport(struct gl_context *ctx) */ void _mesa_free_viewport_data(struct gl_context *ctx) { - _math_matrix_dtr(&ctx->Viewport._WindowMap); + unsigned i; + + for (i = 0; i < MAX_VIEWPORTS; i++) + _math_matrix_dtr(&ctx->ViewportArray[i]._WindowMap); } diff --git a/mesalib/src/mesa/main/viewport.h b/mesalib/src/mesa/main/viewport.h index ffa3a729c..f2311c02b 100644 --- a/mesalib/src/mesa/main/viewport.h +++ b/mesalib/src/mesa/main/viewport.h @@ -34,10 +34,18 @@ struct gl_context; extern void GLAPIENTRY _mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height); +extern void GLAPIENTRY +_mesa_ViewportArrayv(GLuint first, GLsizei count, const GLfloat * v); + +extern void GLAPIENTRY +_mesa_ViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); + +extern void GLAPIENTRY +_mesa_ViewportIndexedfv(GLuint index, const GLfloat * v); extern void -_mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y, - GLsizei width, GLsizei height); +_mesa_set_viewport(struct gl_context *ctx, unsigned idx, GLfloat x, GLfloat y, + GLfloat width, GLfloat height); extern void GLAPIENTRY @@ -46,6 +54,15 @@ _mesa_DepthRange(GLclampd nearval, GLclampd farval); extern void GLAPIENTRY _mesa_DepthRangef(GLclampf nearval, GLclampf farval); +extern void GLAPIENTRY +_mesa_DepthRangeArrayv(GLuint first, GLsizei count, const GLclampd * v); + +extern void GLAPIENTRY +_mesa_DepthRangeIndexed(GLuint index, GLclampd n, GLclampd f); + +extern void +_mesa_set_depth_range(struct gl_context *ctx, unsigned idx, + GLclampd nearval, GLclampd farval); extern void _mesa_init_viewport(struct gl_context *ctx); diff --git a/mesalib/src/mesa/math/m_matrix.c b/mesalib/src/mesa/math/m_matrix.c index 274f969d2..e512e456f 100644 --- a/mesalib/src/mesa/math/m_matrix.c +++ b/mesalib/src/mesa/math/m_matrix.c @@ -1110,15 +1110,16 @@ _math_matrix_translate( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z ) * Transforms Normalized Device Coords to window/Z values. */ void -_math_matrix_viewport(GLmatrix *m, GLint x, GLint y, GLint width, GLint height, - GLfloat zNear, GLfloat zFar, GLfloat depthMax) +_math_matrix_viewport(GLmatrix *m, GLfloat x, GLfloat y, + GLfloat width, GLfloat height, + GLdouble zNear, GLdouble zFar, GLdouble depthMax) { - m->m[MAT_SX] = (GLfloat) width / 2.0F; + m->m[MAT_SX] = width / 2.0F; m->m[MAT_TX] = m->m[MAT_SX] + x; - m->m[MAT_SY] = (GLfloat) height / 2.0F; + m->m[MAT_SY] = height / 2.0F; m->m[MAT_TY] = m->m[MAT_SY] + y; - m->m[MAT_SZ] = depthMax * ((zFar - zNear) / 2.0F); - m->m[MAT_TZ] = depthMax * ((zFar - zNear) / 2.0F + zNear); + m->m[MAT_SZ] = (GLfloat) (depthMax * ((zFar - zNear) / 2.0)); + m->m[MAT_TZ] = (GLfloat) (depthMax * ((zFar - zNear) / 2.0 + zNear)); m->flags = MAT_FLAG_GENERAL_SCALE | MAT_FLAG_TRANSLATION; m->type = MATRIX_3D_NO_ROT; } diff --git a/mesalib/src/mesa/math/m_matrix.h b/mesalib/src/mesa/math/m_matrix.h index 2b097cb31..dddce7019 100644 --- a/mesalib/src/mesa/math/m_matrix.h +++ b/mesalib/src/mesa/math/m_matrix.h @@ -122,8 +122,8 @@ _math_matrix_frustum( GLmatrix *mat, GLfloat nearval, GLfloat farval ); extern void -_math_matrix_viewport(GLmatrix *m, GLint x, GLint y, GLint width, GLint height, - GLfloat zNear, GLfloat zFar, GLfloat depthMax); +_math_matrix_viewport(GLmatrix *m, GLfloat x, GLfloat y, GLfloat width, GLfloat height, + GLdouble zNear, GLdouble zFar, GLdouble depthMax); extern void _math_matrix_set_identity( GLmatrix *dest ); diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp index 85d414259..74c512b33 100644 --- a/mesalib/src/mesa/program/ir_to_mesa.cpp +++ b/mesalib/src/mesa/program/ir_to_mesa.cpp @@ -3053,7 +3053,7 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) _mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program, linked_prog); if (!ctx->Driver.ProgramStringNotify(ctx, - _mesa_program_index_to_target(i), + _mesa_shader_stage_to_program(i), linked_prog)) { return GL_FALSE; } diff --git a/mesalib/src/mesa/program/prog_print.c b/mesalib/src/mesa/program/prog_print.c index 9391e99ff..02ba01eca 100644 --- a/mesalib/src/mesa/program/prog_print.c +++ b/mesalib/src/mesa/program/prog_print.c @@ -144,8 +144,9 @@ arb_input_attrib_string(GLint index, GLenum progType) "fragment.(eighteen)", /* VARYING_SLOT_CLIP_DIST1 */ "fragment.(nineteen)", /* VARYING_SLOT_PRIMITIVE_ID */ "fragment.(twenty)", /* VARYING_SLOT_LAYER */ - "fragment.(twenty-one)", /* VARYING_SLOT_FACE */ - "fragment.(twenty-two)", /* VARYING_SLOT_PNTC */ + "fragment.(twenty-one)", /* VARYING_SLOT_VIEWPORT */ + "fragment.(twenty-two)", /* VARYING_SLOT_FACE */ + "fragment.(twenty-three)", /* VARYING_SLOT_PNTC */ "fragment.varying[0]", "fragment.varying[1]", "fragment.varying[2]", @@ -268,8 +269,9 @@ arb_output_attrib_string(GLint index, GLenum progType) "result.(eighteen)", /* VARYING_SLOT_CLIP_DIST1 */ "result.(nineteen)", /* VARYING_SLOT_PRIMITIVE_ID */ "result.(twenty)", /* VARYING_SLOT_LAYER */ - "result.(twenty-one)", /* VARYING_SLOT_FACE */ - "result.(twenty-two)", /* VARYING_SLOT_PNTC */ + "result.(twenty-one)", /* VARYING_SLOT_VIEWPORT */ + "result.(twenty-two)", /* VARYING_SLOT_FACE */ + "result.(twenty-three)", /* VARYING_SLOT_PNTC */ "result.varying[0]", "result.varying[1]", "result.varying[2]", diff --git a/mesalib/src/mesa/program/prog_statevars.c b/mesalib/src/mesa/program/prog_statevars.c index 58e1f496e..5dda8e28d 100644 --- a/mesalib/src/mesa/program/prog_statevars.c +++ b/mesalib/src/mesa/program/prog_statevars.c @@ -353,9 +353,9 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[], ((int *)value)[0] = ctx->DrawBuffer->Visual.samples; return; case STATE_DEPTH_RANGE: - value[0] = ctx->Viewport.Near; /* near */ - value[1] = ctx->Viewport.Far; /* far */ - value[2] = ctx->Viewport.Far - ctx->Viewport.Near; /* far - near */ + value[0] = ctx->ViewportArray[0].Near; /* near */ + value[1] = ctx->ViewportArray[0].Far; /* far */ + value[2] = ctx->ViewportArray[0].Far - ctx->ViewportArray[0].Near; /* far - near */ value[3] = 1.0; return; case STATE_FRAGMENT_PROGRAM: diff --git a/mesalib/src/mesa/program/program.c b/mesalib/src/mesa/program/program.c index 3c19e8c60..ea8eb0d3a 100644 --- a/mesalib/src/mesa/program/program.c +++ b/mesalib/src/mesa/program/program.c @@ -1023,7 +1023,8 @@ _mesa_postprocess_program(struct gl_context *ctx, struct gl_program *prog) */ GLint _mesa_get_min_invocations_per_fragment(struct gl_context *ctx, - const struct gl_fragment_program *prog) + const struct gl_fragment_program *prog, + bool ignore_sample_qualifier) { /* From ARB_sample_shading specification: * "Using gl_SampleID in a fragment shader causes the entire shader @@ -1041,7 +1042,7 @@ _mesa_get_min_invocations_per_fragment(struct gl_context *ctx, * "Use of the "sample" qualifier on a fragment shader input * forces per-sample shading" */ - if (prog->IsSample) + if (prog->IsSample && !ignore_sample_qualifier) return MAX2(ctx->DrawBuffer->Visual.samples, 1); if (prog->Base.SystemValuesRead & (SYSTEM_BIT_SAMPLE_ID | diff --git a/mesalib/src/mesa/program/program.h b/mesalib/src/mesa/program/program.h index 0e350cd6f..71b0a4af2 100644 --- a/mesalib/src/mesa/program/program.h +++ b/mesalib/src/mesa/program/program.h @@ -189,7 +189,8 @@ _mesa_postprocess_program(struct gl_context *ctx, struct gl_program *prog); extern GLint _mesa_get_min_invocations_per_fragment(struct gl_context *ctx, - const struct gl_fragment_program *prog); + const struct gl_fragment_program *prog, + bool ignore_sample_qualifier); static inline GLuint _mesa_program_enum_to_shader_stage(GLenum v) @@ -209,7 +210,7 @@ _mesa_program_enum_to_shader_stage(GLenum v) static inline GLenum -_mesa_shader_stage_to_program(gl_shader_stage stage) +_mesa_shader_stage_to_program(unsigned stage) { switch (stage) { case MESA_SHADER_VERTEX: @@ -225,23 +226,6 @@ _mesa_shader_stage_to_program(gl_shader_stage stage) } -static inline GLenum -_mesa_program_index_to_target(GLuint i) -{ - static const GLenum enums[] = { - GL_VERTEX_PROGRAM_ARB, - GL_GEOMETRY_PROGRAM_NV, - GL_FRAGMENT_PROGRAM_ARB - }; - STATIC_ASSERT(Elements(enums) == MESA_SHADER_STAGES); - if(i >= MESA_SHADER_STAGES) { - assert(!"Unexpected program index"); - return 0; - } else - return enums[i]; -} - - /* Cast wrappers from gl_program to gl_vertex/geometry/fragment_program */ static inline struct gl_fragment_program * diff --git a/mesalib/src/mesa/program/programopt.c b/mesalib/src/mesa/program/programopt.c index 7e0057223..92a8831d2 100644 --- a/mesalib/src/mesa/program/programopt.c +++ b/mesalib/src/mesa/program/programopt.c @@ -218,7 +218,7 @@ _mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_vertex_program *vpro void _mesa_insert_mvp_code(struct gl_context *ctx, struct gl_vertex_program *vprog) { - if (ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].PreferDP4) + if (ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS) _mesa_insert_mvp_dp4_code( ctx, vprog ); else _mesa_insert_mvp_mad_code( ctx, vprog ); diff --git a/mesalib/src/mesa/state_tracker/st_atom_clip.c b/mesalib/src/mesa/state_tracker/st_atom_clip.c index 700899934..274b36a62 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.CurrentVertexProgram) + 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 14cdfc6f9..a5013ed2c 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_constbuf.c +++ b/mesalib/src/mesa/state_tracker/st_atom_constbuf.c @@ -218,7 +218,8 @@ 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.CurrentVertexProgram; + struct gl_shader_program *prog = + st->ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX]; if (!prog) return; @@ -237,7 +238,8 @@ 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.CurrentFragmentProgram; + struct gl_shader_program *prog = + st->ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT]; if (!prog) return; @@ -256,7 +258,8 @@ 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.CurrentGeometryProgram; + struct gl_shader_program *prog = + st->ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY]; if (!prog) return; diff --git a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c index ca227dcfa..a4f3ffee3 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c @@ -223,7 +223,7 @@ static void update_raster_state( struct st_context *st ) raster->multisample = ctx->Multisample._Enabled; /* _NEW_SCISSOR */ - raster->scissor = ctx->Scissor.Enabled; + raster->scissor = ctx->Scissor.EnableFlags; /* _NEW_FRAG_CLAMP */ raster->clamp_fragment_color = !st->clamp_frag_color_in_shader && diff --git a/mesalib/src/mesa/state_tracker/st_atom_scissor.c b/mesalib/src/mesa/state_tracker/st_atom_scissor.c index 539c423eb..a1f72da47 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_scissor.c +++ b/mesalib/src/mesa/state_tracker/st_atom_scissor.c @@ -53,15 +53,15 @@ update_scissor( struct st_context *st ) scissor.maxx = fb->Width; scissor.maxy = fb->Height; - if (ctx->Scissor.Enabled) { + if (ctx->Scissor.EnableFlags & 1) { /* need to be careful here with xmax or ymax < 0 */ - GLint xmax = MAX2(0, ctx->Scissor.X + ctx->Scissor.Width); - GLint ymax = MAX2(0, ctx->Scissor.Y + ctx->Scissor.Height); + GLint xmax = MAX2(0, ctx->Scissor.ScissorArray[0].X + ctx->Scissor.ScissorArray[0].Width); + GLint ymax = MAX2(0, ctx->Scissor.ScissorArray[0].Y + ctx->Scissor.ScissorArray[0].Height); - if (ctx->Scissor.X > (GLint)scissor.minx) - scissor.minx = ctx->Scissor.X; - if (ctx->Scissor.Y > (GLint)scissor.miny) - scissor.miny = ctx->Scissor.Y; + if (ctx->Scissor.ScissorArray[0].X > (GLint)scissor.minx) + scissor.minx = ctx->Scissor.ScissorArray[0].X; + if (ctx->Scissor.ScissorArray[0].Y > (GLint)scissor.miny) + scissor.miny = ctx->Scissor.ScissorArray[0].Y; if (xmax < (GLint) scissor.maxx) scissor.maxx = xmax; diff --git a/mesalib/src/mesa/state_tracker/st_atom_viewport.c b/mesalib/src/mesa/state_tracker/st_atom_viewport.c index 7a1a689b7..8c6d679a0 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_viewport.c +++ b/mesalib/src/mesa/state_tracker/st_atom_viewport.c @@ -62,12 +62,12 @@ update_viewport( struct st_context *st ) /* _NEW_VIEWPORT */ { - GLfloat x = (GLfloat)ctx->Viewport.X; - GLfloat y = (GLfloat)ctx->Viewport.Y; - GLfloat z = ctx->Viewport.Near; - GLfloat half_width = (GLfloat)ctx->Viewport.Width * 0.5f; - GLfloat half_height = (GLfloat)ctx->Viewport.Height * 0.5f; - GLfloat half_depth = (GLfloat)(ctx->Viewport.Far - ctx->Viewport.Near) * 0.5f; + GLfloat x = ctx->ViewportArray[0].X; + GLfloat y = ctx->ViewportArray[0].Y; + GLfloat z = ctx->ViewportArray[0].Near; + GLfloat half_width = ctx->ViewportArray[0].Width * 0.5f; + GLfloat half_height = ctx->ViewportArray[0].Height * 0.5f; + GLfloat half_depth = (GLfloat)(ctx->ViewportArray[0].Far - ctx->ViewportArray[0].Near) * 0.5f; st->state.viewport.scale[0] = half_width; st->state.viewport.scale[1] = half_height * yScale; diff --git a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c index 487a46164..874ff77b5 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c +++ b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c @@ -457,7 +457,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, cso_save_aux_vertex_buffer_slot(cso); /* rasterizer state: just scissor */ - st->bitmap.rasterizer.scissor = ctx->Scissor.Enabled; + st->bitmap.rasterizer.scissor = ctx->Scissor.EnableFlags & 1; cso_set_rasterizer(cso, &st->bitmap.rasterizer); /* fragment shader state: TEX lookup program */ diff --git a/mesalib/src/mesa/state_tracker/st_cb_clear.c b/mesalib/src/mesa/state_tracker/st_cb_clear.c index 28f9c83d5..97cc5a232 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_clear.c +++ b/mesalib/src/mesa/state_tracker/st_cb_clear.c @@ -364,11 +364,11 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers) static INLINE GLboolean is_scissor_enabled(struct gl_context *ctx, struct gl_renderbuffer *rb) { - return ctx->Scissor.Enabled && - (ctx->Scissor.X > 0 || - ctx->Scissor.Y > 0 || - (unsigned) ctx->Scissor.Width < rb->Width || - (unsigned) ctx->Scissor.Height < rb->Height); + return (ctx->Scissor.EnableFlags & 1) && + (ctx->Scissor.ScissorArray[0].X > 0 || + ctx->Scissor.ScissorArray[0].Y > 0 || + (unsigned) ctx->Scissor.ScissorArray[0].Width < rb->Width || + (unsigned) ctx->Scissor.ScissorArray[0].Height < rb->Height); } diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c index 72cc9fa54..97f213077 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c @@ -713,7 +713,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, rasterizer.half_pixel_center = 1; rasterizer.bottom_edge_rule = 1; rasterizer.depth_clip = !ctx->Transform.DepthClamp; - rasterizer.scissor = ctx->Scissor.Enabled; + rasterizer.scissor = ctx->Scissor.EnableFlags; cso_set_rasterizer(cso, &rasterizer); } @@ -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.CurrentFragmentProgram && + !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_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c index 637f7ee98..780148487 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c +++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c @@ -544,6 +544,12 @@ st_validate_attachment(struct gl_context *ctx, gl_format texFormat; GLboolean valid; + /* Sanity check: we must be binding the surface as a (color) render target + * or depth/stencil target. + */ + assert(bindings == PIPE_BIND_RENDER_TARGET || + bindings == PIPE_BIND_DEPTH_STENCIL); + /* Only validate texture attachments for now, since * st_renderbuffer_alloc_storage makes sure that * the format is supported. @@ -700,7 +706,8 @@ st_ReadBuffer(struct gl_context *ctx, GLenum buffer) (void) buffer; /* add the renderbuffer on demand */ - st_manager_add_color_renderbuffer(st, fb, fb->_ColorReadBufferIndex); + if (fb->_ColorReadBufferIndex >= 0) + st_manager_add_color_renderbuffer(st, fb, fb->_ColorReadBufferIndex); } diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c index 77db6ab39..0ffc76263 100644 --- a/mesalib/src/mesa/state_tracker/st_context.c +++ b/mesalib/src/mesa/state_tracker/st_context.c @@ -240,7 +240,7 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe, * driver prefers DP4 or MUL/MAD for vertex transformation. */ if (debug_get_option_mesa_mvp_dp4()) - ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].PreferDP4 = GL_TRUE; + ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS = GL_TRUE; return st_create_context_priv(ctx, pipe, options); } diff --git a/mesalib/src/mesa/state_tracker/st_draw.c b/mesalib/src/mesa/state_tracker/st_draw.c index 46257e0f5..355c180f8 100644 --- a/mesalib/src/mesa/state_tracker/st_draw.c +++ b/mesalib/src/mesa/state_tracker/st_draw.c @@ -131,11 +131,7 @@ setup_index_buffer(struct st_context *st, static void check_uniforms(struct gl_context *ctx) { - struct gl_shader_program *shProg[3] = { - ctx->Shader.CurrentVertexProgram, - ctx->Shader.CurrentGeometryProgram, - ctx->Shader.CurrentFragmentProgram, - }; + 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 f1b354429..0871dd064 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -5312,7 +5312,7 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) _mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program, linked_prog); if (!ctx->Driver.ProgramStringNotify(ctx, - _mesa_program_index_to_target(i), + _mesa_shader_stage_to_program(i), linked_prog)) { _mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program, NULL); diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c index 2d6d43099..7a15b23fa 100644 --- a/mesalib/src/mesa/state_tracker/st_program.c +++ b/mesalib/src/mesa/state_tracker/st_program.c @@ -1195,11 +1195,7 @@ st_get_gp_variant(struct st_context *st, void st_print_shaders(struct gl_context *ctx) { - struct gl_shader_program *shProg[3] = { - ctx->Shader.CurrentVertexProgram, - ctx->Shader.CurrentGeometryProgram, - ctx->Shader.CurrentFragmentProgram, - }; + struct gl_shader_program **shProg = ctx->Shader.CurrentProgram; unsigned j; for (j = 0; j < 3; j++) { diff --git a/mesalib/src/mesa/swrast/s_context.c b/mesalib/src/mesa/swrast/s_context.c index f219d3de0..07485006c 100644 --- a/mesalib/src/mesa/swrast/s_context.c +++ b/mesalib/src/mesa/swrast/s_context.c @@ -61,7 +61,7 @@ _swrast_update_rasterflags( struct gl_context *ctx ) if (ctx->Color.BlendEnabled) rasterMask |= BLEND_BIT; if (ctx->Depth.Test) rasterMask |= DEPTH_BIT; if (swrast->_FogEnabled) rasterMask |= FOG_BIT; - if (ctx->Scissor.Enabled) rasterMask |= CLIP_BIT; + if (ctx->Scissor.EnableFlags) rasterMask |= CLIP_BIT; if (ctx->Stencil._Enabled) rasterMask |= STENCIL_BIT; for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) { if (!ctx->Color.ColorMask[i][0] || @@ -74,10 +74,10 @@ _swrast_update_rasterflags( struct gl_context *ctx ) } if (ctx->Color.ColorLogicOpEnabled) rasterMask |= LOGIC_OP_BIT; if (ctx->Texture._EnabledUnits) rasterMask |= TEXTURE_BIT; - if ( ctx->Viewport.X < 0 - || ctx->Viewport.X + ctx->Viewport.Width > (GLint) ctx->DrawBuffer->Width - || ctx->Viewport.Y < 0 - || ctx->Viewport.Y + ctx->Viewport.Height > (GLint) ctx->DrawBuffer->Height) { + if ( ctx->ViewportArray[0].X < 0 + || ctx->ViewportArray[0].X + ctx->ViewportArray[0].Width > (GLfloat) ctx->DrawBuffer->Width + || ctx->ViewportArray[0].Y < 0 + || ctx->ViewportArray[0].Y + ctx->ViewportArray[0].Height > (GLfloat) ctx->DrawBuffer->Height) { rasterMask |= CLIP_BIT; } diff --git a/mesalib/src/mesa/swrast/s_depth.c b/mesalib/src/mesa/swrast/s_depth.c index 0f4fb9506..7f3c76de4 100644 --- a/mesalib/src/mesa/swrast/s_depth.c +++ b/mesalib/src/mesa/swrast/s_depth.c @@ -171,12 +171,12 @@ _swrast_depth_clamp_span( struct gl_context *ctx, SWspan *span ) GLfloat min_f, max_f; GLuint i; - if (ctx->Viewport.Near < ctx->Viewport.Far) { - min_f = ctx->Viewport.Near; - max_f = ctx->Viewport.Far; + if (ctx->ViewportArray[0].Near < ctx->ViewportArray[0].Far) { + min_f = ctx->ViewportArray[0].Near; + max_f = ctx->ViewportArray[0].Far; } else { - min_f = ctx->Viewport.Far; - max_f = ctx->Viewport.Near; + min_f = ctx->ViewportArray[0].Far; + max_f = ctx->ViewportArray[0].Near; } /* Convert floating point values in [0,1] to device Z coordinates in diff --git a/mesalib/src/mesa/swrast/s_fragprog.c b/mesalib/src/mesa/swrast/s_fragprog.c index 4e9ac394e..fa45fa97a 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.CurrentFragmentProgram) { + if (ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT]) { /* Store front/back facing value */ machine->Attribs[VARYING_SLOT_FACE][col][0] = 1.0F - span->facing; } diff --git a/mesalib/src/mesa/swrast_setup/ss_context.c b/mesalib/src/mesa/swrast_setup/ss_context.c index 1be37d4c8..12a47358f 100644 --- a/mesalib/src/mesa/swrast_setup/ss_context.c +++ b/mesalib/src/mesa/swrast_setup/ss_context.c @@ -167,7 +167,7 @@ setup_vertex_format(struct gl_context *ctx) EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F, pointSize ); _tnl_install_attrs( ctx, map, e, - ctx->Viewport._WindowMap.m, + ctx->ViewportArray[0]._WindowMap.m, sizeof(SWvertex) ); swsetup->last_index_bitset = index_bitset; @@ -265,7 +265,7 @@ _swsetup_Wakeup( struct gl_context *ctx ) void _swsetup_Translate( struct gl_context *ctx, const void *vertex, SWvertex *dest ) { - const GLfloat *m = ctx->Viewport._WindowMap.m; + const GLfloat *m = ctx->ViewportArray[0]._WindowMap.m; GLfloat tmp[4]; GLuint i; diff --git a/mesalib/src/mesa/tnl/t_rasterpos.c b/mesalib/src/mesa/tnl/t_rasterpos.c index 3ee5c4547..e538c348f 100644 --- a/mesalib/src/mesa/tnl/t_rasterpos.c +++ b/mesalib/src/mesa/tnl/t_rasterpos.c @@ -409,19 +409,19 @@ _tnl_RasterPos(struct gl_context *ctx, const GLfloat vObj[4]) ndc[1] = clip[1] * d; ndc[2] = clip[2] * d; /* wincoord = viewport_mapping(ndc) */ - ctx->Current.RasterPos[0] = (ndc[0] * ctx->Viewport._WindowMap.m[MAT_SX] - + ctx->Viewport._WindowMap.m[MAT_TX]); - ctx->Current.RasterPos[1] = (ndc[1] * ctx->Viewport._WindowMap.m[MAT_SY] - + ctx->Viewport._WindowMap.m[MAT_TY]); - ctx->Current.RasterPos[2] = (ndc[2] * ctx->Viewport._WindowMap.m[MAT_SZ] - + ctx->Viewport._WindowMap.m[MAT_TZ]) + ctx->Current.RasterPos[0] = (ndc[0] * ctx->ViewportArray[0]._WindowMap.m[MAT_SX] + + ctx->ViewportArray[0]._WindowMap.m[MAT_TX]); + ctx->Current.RasterPos[1] = (ndc[1] * ctx->ViewportArray[0]._WindowMap.m[MAT_SY] + + ctx->ViewportArray[0]._WindowMap.m[MAT_TY]); + ctx->Current.RasterPos[2] = (ndc[2] * ctx->ViewportArray[0]._WindowMap.m[MAT_SZ] + + ctx->ViewportArray[0]._WindowMap.m[MAT_TZ]) / ctx->DrawBuffer->_DepthMaxF; ctx->Current.RasterPos[3] = clip[3]; if (ctx->Transform.DepthClamp) { ctx->Current.RasterPos[3] = CLAMP(ctx->Current.RasterPos[3], - ctx->Viewport.Near, - ctx->Viewport.Far); + ctx->ViewportArray[0].Near, + ctx->ViewportArray[0].Far); } /* compute raster distance */ diff --git a/mesalib/src/mesa/x86/read_rgba_span_x86.h b/mesalib/src/mesa/x86/read_rgba_span_x86.h deleted file mode 100644 index 564b1bb0f..000000000 --- a/mesalib/src/mesa/x86/read_rgba_span_x86.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (C) Copyright IBM Corporation 2004 - * 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 THEIR 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. - */ - -/** - * \file read_rgba_span_x86.h - * - * \author Ian Romanick <idr@us.ibm.com> - */ - -#ifndef READ_RGBA_SPAN_X86_H -#define READ_RGBA_SPAN_X86_H - -#if defined(USE_SSE_ASM) || defined(USE_MMX_ASM) -#include "x86/common_x86_asm.h" -#endif - -#if defined(USE_SSE_ASM) -extern void _generic_read_RGBA_span_BGRA8888_REV_SSE2( const unsigned char *, - unsigned char *, unsigned ); -#endif - -#if defined(USE_SSE_ASM) -extern void _generic_read_RGBA_span_BGRA8888_REV_SSE( const unsigned char *, - unsigned char *, unsigned ); -#endif - -#if defined(USE_MMX_ASM) -extern void _generic_read_RGBA_span_BGRA8888_REV_MMX( const unsigned char *, - unsigned char *, unsigned ); - -extern void _generic_read_RGBA_span_RGB565_MMX( const unsigned char *, - unsigned char *, unsigned ); -#endif - -#endif /* READ_RGBA_SPAN_X86_H */ |