From 30eb28e89e513ba7c04e8424be0cba326a01882b Mon Sep 17 00:00:00 2001 From: marha Date: Wed, 1 Oct 2014 20:47:44 +0200 Subject: libxtrans pixman fontconfig mesa xserver xkeyboard-config git update 1 Oct 2014 plink 10277 xserver commit d3d845ca9e92f0a2ccde93f4242d7769cfe14164 xkeyboard-config commit 73aa90ce32967747c84a1b5fe32cee329bc3bbcf pixman commit f078727f392bc9f235df916e75634ed87177b9b4 libxtrans commit 7cbad9fe2e61cd9d5caeaf361826a6f4bd320f03 fontconfig commit 1082161ea303cf2bbc13b62a191662984131e820 mesa commit 4f7916ab4f8093fa33519dfa3d08e73b4d35ebe3 --- mesalib/src/gallium/Makefile.am | 8 +- mesalib/src/gallium/auxiliary/util/u_blit.c | 39 +- mesalib/src/gallium/auxiliary/util/u_blit.h | 7 +- mesalib/src/gallium/auxiliary/util/u_inlines.h | 5 +- mesalib/src/gallium/auxiliary/util/u_snprintf.c | 9 - mesalib/src/gallium/auxiliary/util/u_video.h | 74 +++ mesalib/src/glsl/Makefile.sources | 1 + mesalib/src/glsl/ast_array_index.cpp | 10 +- mesalib/src/glsl/ast_function.cpp | 11 +- mesalib/src/glsl/ast_to_hir.cpp | 4 +- mesalib/src/glsl/builtin_functions.cpp | 6 +- mesalib/src/glsl/builtin_variables.cpp | 9 +- mesalib/src/glsl/glsl_lexer.ll | 9 +- mesalib/src/glsl/glsl_parser_extras.cpp | 31 +- mesalib/src/glsl/glsl_symbol_table.cpp | 2 + mesalib/src/glsl/glsl_types.cpp | 34 +- mesalib/src/glsl/glsl_types.h | 11 + mesalib/src/glsl/ir.cpp | 58 +- mesalib/src/glsl/ir.h | 207 +++++-- mesalib/src/glsl/ir_clone.cpp | 19 +- mesalib/src/glsl/ir_function.cpp | 11 +- mesalib/src/glsl/ir_optimization.h | 2 + mesalib/src/glsl/ir_validate.cpp | 19 +- mesalib/src/glsl/link_functions.cpp | 14 +- mesalib/src/glsl/link_uniforms.cpp | 36 +- mesalib/src/glsl/link_varyings.cpp | 5 + mesalib/src/glsl/linker.cpp | 31 +- mesalib/src/glsl/linker.h | 3 - mesalib/src/glsl/lower_offset_array.cpp | 3 +- mesalib/src/glsl/lower_packed_varyings.cpp | 1 + mesalib/src/glsl/lower_texture_projection.cpp | 2 +- mesalib/src/glsl/lower_ubo_reference.cpp | 33 +- mesalib/src/glsl/main.cpp | 1 + mesalib/src/glsl/opt_algebraic.cpp | 14 + mesalib/src/glsl/opt_cse.cpp | 2 +- mesalib/src/glsl/opt_dead_builtin_variables.cpp | 81 +++ mesalib/src/glsl/test_optpass.cpp | 1 + mesalib/src/loader/loader.c | 3 + mesalib/src/mapi/glapi/gen/gl_enums.py | 8 +- mesalib/src/mapi/glapi/gen/gl_gentable.py | 2 +- mesalib/src/mapi/glapi/gen/gl_x86_asm.py | 2 +- mesalib/src/mapi/glapi/glapi_nop.c | 4 +- mesalib/src/mesa/Makefile.sources | 1 - mesalib/src/mesa/drivers/common/meta_blit.c | 33 +- mesalib/src/mesa/drivers/common/meta_copy_image.c | 9 + mesalib/src/mesa/drivers/dri/common/xmlpool/ca.po | 129 ++-- mesalib/src/mesa/drivers/dri/common/xmlpool/de.po | 118 ++-- mesalib/src/mesa/drivers/dri/common/xmlpool/es.po | 122 ++-- mesalib/src/mesa/drivers/dri/common/xmlpool/fr.po | 118 ++-- mesalib/src/mesa/drivers/dri/common/xmlpool/nl.po | 118 ++-- mesalib/src/mesa/drivers/dri/common/xmlpool/sv.po | 118 ++-- mesalib/src/mesa/main/arrayobj.c | 2 +- mesalib/src/mesa/main/arrayobj.h | 26 - mesalib/src/mesa/main/attrib.c | 2 +- mesalib/src/mesa/main/compiler.h | 4 +- mesalib/src/mesa/main/context.c | 27 +- mesalib/src/mesa/main/debug.c | 4 +- mesalib/src/mesa/main/dlopen.h | 19 +- mesalib/src/mesa/main/errors.c | 8 +- mesalib/src/mesa/main/extensions.c | 11 +- mesalib/src/mesa/main/fbobject.c | 60 +- mesalib/src/mesa/main/get_hash_params.py | 8 +- mesalib/src/mesa/main/imports.c | 80 +-- mesalib/src/mesa/main/imports.h | 45 +- mesalib/src/mesa/main/macros.h | 7 - mesalib/src/mesa/main/mtypes.h | 20 +- mesalib/src/mesa/main/shaderapi.c | 10 +- mesalib/src/mesa/main/shaderobj.h | 7 - mesalib/src/mesa/main/texcompress_s3tc.c | 2 - mesalib/src/mesa/main/varray.c | 8 +- mesalib/src/mesa/main/version.c | 16 +- mesalib/src/mesa/main/viewport.c | 6 + mesalib/src/mesa/math/m_debug_clip.c | 2 +- mesalib/src/mesa/math/m_debug_norm.c | 2 +- mesalib/src/mesa/math/m_debug_xform.c | 2 +- mesalib/src/mesa/program/ir_to_mesa.cpp | 14 +- mesalib/src/mesa/program/prog_instruction.c | 5 +- mesalib/src/mesa/program/prog_parameter.c | 5 +- mesalib/src/mesa/program/register_allocate.c | 654 --------------------- mesalib/src/mesa/program/register_allocate.h | 79 --- mesalib/src/mesa/program/symbol_table.c | 30 + .../src/mesa/state_tracker/st_atom_rasterizer.c | 6 +- mesalib/src/mesa/state_tracker/st_atom_texture.c | 2 +- .../src/mesa/state_tracker/st_cb_bufferobjects.c | 8 +- mesalib/src/mesa/state_tracker/st_cb_fbo.c | 3 +- mesalib/src/mesa/state_tracker/st_context.c | 2 +- mesalib/src/mesa/state_tracker/st_extensions.c | 25 +- mesalib/src/mesa/state_tracker/st_extensions.h | 1 - mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 19 +- mesalib/src/mesa/state_tracker/st_manager.c | 2 +- mesalib/src/mesa/state_tracker/st_program.c | 46 +- mesalib/src/mesa/state_tracker/st_program.h | 25 + mesalib/src/mesa/state_tracker/st_texture.c | 5 +- mesalib/src/mesa/tnl/t_vb_cliptmp.h | 10 +- mesalib/src/mesa/tnl/t_vertex.c | 2 +- mesalib/src/mesa/vbo/vbo_exec_api.c | 2 +- mesalib/src/mesa/vbo/vbo_exec_array.c | 46 +- mesalib/src/mesa/vbo/vbo_primitive_restart.c | 4 +- mesalib/src/mesa/x86/assyntax.h | 6 +- mesalib/src/mesa/x86/common_x86.c | 10 +- mesalib/src/mesa/x86/read_rgba_span_x86.S | 4 +- mesalib/src/util/Makefile.am | 3 + mesalib/src/util/Makefile.sources | 2 + mesalib/src/util/SConscript | 3 + mesalib/src/util/macros.h | 29 +- mesalib/src/util/ralloc.h | 16 +- mesalib/src/util/register_allocate.c | 654 +++++++++++++++++++++ mesalib/src/util/register_allocate.h | 79 +++ 108 files changed, 2107 insertions(+), 1670 deletions(-) create mode 100644 mesalib/src/glsl/opt_dead_builtin_variables.cpp delete mode 100644 mesalib/src/mesa/program/register_allocate.c delete mode 100644 mesalib/src/mesa/program/register_allocate.h create mode 100644 mesalib/src/util/register_allocate.c create mode 100644 mesalib/src/util/register_allocate.h (limited to 'mesalib/src') diff --git a/mesalib/src/gallium/Makefile.am b/mesalib/src/gallium/Makefile.am index 6018e9f72..21595a1aa 100644 --- a/mesalib/src/gallium/Makefile.am +++ b/mesalib/src/gallium/Makefile.am @@ -68,11 +68,11 @@ SUBDIRS += winsys/radeon/drm endif ## swrast/softpipe -if NEED_GALLIUM_SOFTPIPE_DRIVER +if HAVE_GALLIUM_SOFTPIPE SUBDIRS += drivers/softpipe ## swrast/llvmpipe -if NEED_GALLIUM_LLVMPIPE_DRIVER +if HAVE_GALLIUM_LLVMPIPE SUBDIRS += drivers/llvmpipe endif endif @@ -158,6 +158,10 @@ if HAVE_GALLIUM_OSMESA SUBDIRS += state_trackers/osmesa targets/osmesa endif +if HAVE_ST_VA +SUBDIRS += state_trackers/va targets/va +endif + if HAVE_ST_VDPAU SUBDIRS += state_trackers/vdpau targets/vdpau endif diff --git a/mesalib/src/gallium/auxiliary/util/u_blit.c b/mesalib/src/gallium/auxiliary/util/u_blit.c index f69b4b1ab..2573bedf5 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blit.c +++ b/mesalib/src/gallium/auxiliary/util/u_blit.c @@ -336,10 +336,10 @@ formats_compatible(enum pipe_format src_format, * Copy pixel block from src surface to dst surface. * Overlapping regions are acceptable. * Flipping and stretching are supported. - * \param filter one of PIPE_TEX_MIPFILTER_NEAREST/LINEAR - * \param writemask controls which channels in the dest surface are sourced - * from the src surface. Disabled channels are sourced - * from (0,0,0,1). + * \param filter one of PIPE_TEX_FILTER_NEAREST/LINEAR + * \param writemask bitmask of PIPE_MASK_[RGBAZS]. Controls which channels + * in the dest surface are sourced from the src surface. + * Disabled color channels are sourced from (0,0,0,1). */ void util_blit_pixels(struct blit_state *ctx, @@ -352,7 +352,7 @@ util_blit_pixels(struct blit_state *ctx, int dstX0, int dstY0, int dstX1, int dstY1, float z, uint filter, - uint writemask, uint zs_writemask) + uint writemask) { struct pipe_context *pipe = ctx->pipe; enum pipe_format src_format, dst_format; @@ -364,8 +364,8 @@ util_blit_pixels(struct blit_state *ctx, util_format_description(src_tex->format); struct pipe_blit_info info; - assert(filter == PIPE_TEX_MIPFILTER_NEAREST || - filter == PIPE_TEX_MIPFILTER_LINEAR); + assert(filter == PIPE_TEX_FILTER_NEAREST || + filter == PIPE_TEX_FILTER_LINEAR); assert(src_level <= src_tex->last_level); @@ -383,11 +383,18 @@ util_blit_pixels(struct blit_state *ctx, is_depth = util_format_has_depth(src_desc); is_stencil = util_format_has_stencil(src_desc); - blit_depth = is_depth && (zs_writemask & BLIT_WRITEMASK_Z); - blit_stencil = is_stencil && (zs_writemask & BLIT_WRITEMASK_STENCIL); + blit_depth = is_depth && (writemask & PIPE_MASK_Z); + blit_stencil = is_stencil && (writemask & PIPE_MASK_S); - assert((writemask && !zs_writemask && !is_depth && !is_stencil) || - (!writemask && (blit_depth || blit_stencil))); + if (is_depth || is_stencil) { + assert((writemask & PIPE_MASK_RGBA) == 0); + assert(blit_depth || blit_stencil); + } + else { + assert((writemask & PIPE_MASK_ZS) == 0); + assert(!blit_depth); + assert(!blit_stencil); + } /* * XXX: z parameter is deprecated. dst->u.tex.first_layer @@ -437,7 +444,7 @@ util_blit_pixels(struct blit_state *ctx, assert(info.dst.box.width >= 0); assert(info.dst.box.height >= 0); info.dst.box.depth = 1; - info.dst.format = dst->texture->format; + info.dst.format = dst_format; info.src.resource = src_tex; info.src.level = src_level; info.src.box.x = srcX0; @@ -446,8 +453,8 @@ util_blit_pixels(struct blit_state *ctx, info.src.box.width = srcX1 - srcX0; info.src.box.height = srcY1 - srcY0; info.src.box.depth = 1; - info.src.format = src_tex->format; - info.mask = writemask | (zs_writemask << 4); + info.src.format = src_format; + info.mask = writemask; info.filter = filter; info.scissor_enable = 0; @@ -486,8 +493,8 @@ util_blit_pixels_tex(struct blit_state *ctx, unsigned offset; struct pipe_resource *tex = src_sampler_view->texture; - assert(filter == PIPE_TEX_MIPFILTER_NEAREST || - filter == PIPE_TEX_MIPFILTER_LINEAR); + assert(filter == PIPE_TEX_FILTER_NEAREST || + filter == PIPE_TEX_FILTER_LINEAR); assert(tex); assert(tex->width0 != 0); diff --git a/mesalib/src/gallium/auxiliary/util/u_blit.h b/mesalib/src/gallium/auxiliary/util/u_blit.h index 042c48942..b50edab78 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blit.h +++ b/mesalib/src/gallium/auxiliary/util/u_blit.h @@ -31,8 +31,6 @@ #include "pipe/p_compiler.h" -/* for TGSI_WRITEMASK_* specification in util_blit_pixels */ -#include "pipe/p_shader_tokens.h" #ifdef __cplusplus @@ -46,9 +44,6 @@ struct pipe_resource; struct pipe_sampler_view; struct pipe_surface; -#define BLIT_WRITEMASK_Z 1 -#define BLIT_WRITEMASK_STENCIL 2 - extern struct blit_state * util_create_blit(struct pipe_context *pipe, struct cso_context *cso); @@ -66,7 +61,7 @@ util_blit_pixels(struct blit_state *ctx, int dstX0, int dstY0, int dstX1, int dstY1, float z, uint filter, - uint writemask, uint zs_writemask); + uint writemask); extern void util_blit_pixels_tex(struct blit_state *ctx, diff --git a/mesalib/src/gallium/auxiliary/util/u_inlines.h b/mesalib/src/gallium/auxiliary/util/u_inlines.h index c80ec487e..95401621e 100644 --- a/mesalib/src/gallium/auxiliary/util/u_inlines.h +++ b/mesalib/src/gallium/auxiliary/util/u_inlines.h @@ -627,10 +627,11 @@ static INLINE unsigned util_max_layer(const struct pipe_resource *r, unsigned level) { switch (r->target) { - case PIPE_TEXTURE_CUBE: - return 6 - 1; case PIPE_TEXTURE_3D: return u_minify(r->depth0, level) - 1; + case PIPE_TEXTURE_CUBE: + assert(r->array_size == 6); + /* fall-through */ case PIPE_TEXTURE_1D_ARRAY: case PIPE_TEXTURE_2D_ARRAY: case PIPE_TEXTURE_CUBE_ARRAY: diff --git a/mesalib/src/gallium/auxiliary/util/u_snprintf.c b/mesalib/src/gallium/auxiliary/util/u_snprintf.c index a24b6ff38..7a2bf2a6f 100644 --- a/mesalib/src/gallium/auxiliary/util/u_snprintf.c +++ b/mesalib/src/gallium/auxiliary/util/u_snprintf.c @@ -334,15 +334,6 @@ static void *mymemcpy(void *, void *, size_t); #endif /* HAVE_UINTPTR_T || defined(uintptr_t) */ #endif /* !defined(UINTPTR_T) */ -/* WinCE5.0 does not have uintptr_t defined */ -#if (_WIN32_WCE < 600) -#ifdef UINTPTR_T -#undef UINTPTR_T -#endif -#define UINTPTR_T unsigned long int -#endif - - /* Support for ptrdiff_t. */ #ifndef PTRDIFF_T #if HAVE_PTRDIFF_T || defined(ptrdiff_t) diff --git a/mesalib/src/gallium/auxiliary/util/u_video.h b/mesalib/src/gallium/auxiliary/util/u_video.h index d1ca7362b..45b2d6e76 100644 --- a/mesalib/src/gallium/auxiliary/util/u_video.h +++ b/mesalib/src/gallium/auxiliary/util/u_video.h @@ -72,6 +72,80 @@ u_reduce_video_profile(enum pipe_video_profile profile) } } +static INLINE void +u_copy_nv12_to_yv12(void *const *destination_data, + uint32_t const *destination_pitches, + int src_plane, int src_field, + int src_stride, int num_fields, + uint8_t const *src, + int width, int height) +{ + int x, y; + unsigned u_stride = destination_pitches[2] * num_fields; + unsigned v_stride = destination_pitches[1] * num_fields; + uint8_t *u_dst = (uint8_t *)destination_data[2] + destination_pitches[2] * src_field; + uint8_t *v_dst = (uint8_t *)destination_data[1] + destination_pitches[1] * src_field; + + /* TODO: SIMD */ + for (y = 0; y < height; y++) { + for (x = 0; x < width; x++) { + u_dst[x] = src[2*x]; + v_dst[x] = src[2*x+1]; + } + u_dst += u_stride; + v_dst += v_stride; + src += src_stride; + } +} + +static INLINE void +u_copy_yv12_to_nv12(void *const *destination_data, + uint32_t const *destination_pitches, + int src_plane, int src_field, + int src_stride, int num_fields, + uint8_t const *src, + int width, int height) +{ + int x, y; + unsigned offset = 2 - src_plane; + unsigned stride = destination_pitches[1] * num_fields; + uint8_t *dst = (uint8_t *)destination_data[1] + destination_pitches[1] * src_field; + + /* TODO: SIMD */ + for (y = 0; y < height; y++) { + for (x = 0; x < 2 * width; x += 2) { + dst[x+offset] = src[x>>1]; + } + dst += stride; + src += src_stride; + } +} + +static INLINE void +u_copy_swap422_packed(void *const *destination_data, + uint32_t const *destination_pitches, + int src_plane, int src_field, + int src_stride, int num_fields, + uint8_t const *src, + int width, int height) +{ + int x, y; + unsigned stride = destination_pitches[0] * num_fields; + uint8_t *dst = (uint8_t *)destination_data[0] + destination_pitches[0] * src_field; + + /* TODO: SIMD */ + for (y = 0; y < height; y++) { + for (x = 0; x < 4 * width; x += 4) { + dst[x+0] = src[x+1]; + dst[x+1] = src[x+0]; + dst[x+2] = src[x+3]; + dst[x+3] = src[x+2]; + } + dst += stride; + src += src_stride; + } +} + #ifdef __cplusplus } #endif diff --git a/mesalib/src/glsl/Makefile.sources b/mesalib/src/glsl/Makefile.sources index cb8d5a6f7..bfb699353 100644 --- a/mesalib/src/glsl/Makefile.sources +++ b/mesalib/src/glsl/Makefile.sources @@ -87,6 +87,7 @@ LIBGLSL_FILES = \ $(GLSL_SRCDIR)/opt_copy_propagation.cpp \ $(GLSL_SRCDIR)/opt_copy_propagation_elements.cpp \ $(GLSL_SRCDIR)/opt_cse.cpp \ + $(GLSL_SRCDIR)/opt_dead_builtin_variables.cpp \ $(GLSL_SRCDIR)/opt_dead_builtin_varyings.cpp \ $(GLSL_SRCDIR)/opt_dead_code.cpp \ $(GLSL_SRCDIR)/opt_dead_code_local.cpp \ diff --git a/mesalib/src/glsl/ast_array_index.cpp b/mesalib/src/glsl/ast_array_index.cpp index 5ca85f6ab..49a8574f2 100644 --- a/mesalib/src/glsl/ast_array_index.cpp +++ b/mesalib/src/glsl/ast_array_index.cpp @@ -88,8 +88,14 @@ update_max_array_access(ir_rvalue *ir, unsigned idx, YYLTYPE *loc, unsigned field_index = deref_record->record->type->field_index(deref_record->field); assert(field_index < interface_type->length); - if (idx > deref_var->var->max_ifc_array_access[field_index]) { - deref_var->var->max_ifc_array_access[field_index] = idx; + + unsigned *const max_ifc_array_access = + deref_var->var->get_max_ifc_array_access(); + + assert(max_ifc_array_access != NULL); + + if (idx > max_ifc_array_access[field_index]) { + max_ifc_array_access[field_index] = idx; /* Check whether this access will, as a side effect, implicitly * cause the size of a built-in array to be too large. diff --git a/mesalib/src/glsl/ast_function.cpp b/mesalib/src/glsl/ast_function.cpp index 7130d6162..cbff9d8b4 100644 --- a/mesalib/src/glsl/ast_function.cpp +++ b/mesalib/src/glsl/ast_function.cpp @@ -408,14 +408,17 @@ generate_call(exec_list *instructions, ir_function_signature *sig, ir_dereference_variable *deref = NULL; if (!sig->return_type->is_void()) { /* Create a new temporary to hold the return value. */ + char *const name = ir_variable::temporaries_allocate_names + ? ralloc_asprintf(ctx, "%s_retval", sig->function_name()) + : NULL; + ir_variable *var; - var = new(ctx) ir_variable(sig->return_type, - ralloc_asprintf(ctx, "%s_retval", - sig->function_name()), - ir_var_temporary); + var = new(ctx) ir_variable(sig->return_type, name, ir_var_temporary); instructions->push_tail(var); + ralloc_free(name); + deref = new(ctx) ir_dereference_variable(var); } ir_call *call = new(ctx) ir_call(sig, deref, actual_parameters); diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp index 5ec1614be..068af295a 100644 --- a/mesalib/src/glsl/ast_to_hir.cpp +++ b/mesalib/src/glsl/ast_to_hir.cpp @@ -912,7 +912,6 @@ get_lvalue_copy(exec_list *instructions, ir_rvalue *lvalue) var = new(ctx) ir_variable(lvalue->type, "_post_incdec_tmp", ir_var_temporary); instructions->push_tail(var); - var->data.mode = ir_var_auto; instructions->push_tail(new(ctx) ir_assignment(new(ctx) ir_dereference_variable(var), lvalue)); @@ -2499,6 +2498,7 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, /* If there is no qualifier that changes the mode of the variable, leave * the setting alone. */ + assert(var->data.mode != ir_var_temporary); if (qual->flags.q.in && qual->flags.q.out) var->data.mode = ir_var_function_inout; else if (qual->flags.q.in) @@ -5031,7 +5031,7 @@ ast_type_specifier::hir(exec_list *instructions, */ ir_variable *const junk = new(state) ir_variable(type, "#default precision", - ir_var_temporary); + ir_var_auto); state->symbols->add_variable(junk); } diff --git a/mesalib/src/glsl/builtin_functions.cpp b/mesalib/src/glsl/builtin_functions.cpp index 9be7f6d1a..5a024cb43 100644 --- a/mesalib/src/glsl/builtin_functions.cpp +++ b/mesalib/src/glsl/builtin_functions.cpp @@ -1882,8 +1882,8 @@ builtin_builder::create_builtins() NULL); add_function("texture2DProjLod", - _texture(ir_txl, v110_lod, glsl_type::vec4_type, glsl_type::sampler2D_type, glsl_type::vec3_type, TEX_PROJECT), - _texture(ir_txl, v110_lod, glsl_type::vec4_type, glsl_type::sampler2D_type, glsl_type::vec4_type, TEX_PROJECT), + _texture(ir_txl, lod_exists_in_stage, glsl_type::vec4_type, glsl_type::sampler2D_type, glsl_type::vec3_type, TEX_PROJECT), + _texture(ir_txl, lod_exists_in_stage, glsl_type::vec4_type, glsl_type::sampler2D_type, glsl_type::vec4_type, TEX_PROJECT), NULL); add_function("texture3D", @@ -1910,7 +1910,7 @@ builtin_builder::create_builtins() NULL); add_function("textureCubeLod", - _texture(ir_txl, v110_lod, glsl_type::vec4_type, glsl_type::samplerCube_type, glsl_type::vec3_type), + _texture(ir_txl, lod_exists_in_stage, glsl_type::vec4_type, glsl_type::samplerCube_type, glsl_type::vec3_type), NULL); add_function("texture2DRect", diff --git a/mesalib/src/glsl/builtin_variables.cpp b/mesalib/src/glsl/builtin_variables.cpp index 5b6f4ae62..c36d19831 100644 --- a/mesalib/src/glsl/builtin_variables.cpp +++ b/mesalib/src/glsl/builtin_variables.cpp @@ -478,12 +478,9 @@ builtin_variable_generator::add_uniform(const glsl_type *type, &_mesa_builtin_uniform_desc[i]; const unsigned array_count = type->is_array() ? type->length : 1; - uni->num_state_slots = array_count * statevar->num_elements; ir_state_slot *slots = - ralloc_array(uni, ir_state_slot, uni->num_state_slots); - - uni->state_slots = slots; + uni->allocate_state_slots(array_count * statevar->num_elements); for (unsigned a = 0; a < array_count; a++) { for (unsigned j = 0; j < statevar->num_elements; j++) { @@ -908,14 +905,14 @@ builtin_variable_generator::generate_fs_special_vars() ir_variable *const var = add_output(FRAG_RESULT_STENCIL, int_t, "gl_FragStencilRefARB"); if (state->ARB_shader_stencil_export_warn) - var->warn_extension = "GL_ARB_shader_stencil_export"; + var->enable_extension_warning("GL_ARB_shader_stencil_export"); } if (state->AMD_shader_stencil_export_enable) { ir_variable *const var = add_output(FRAG_RESULT_STENCIL, int_t, "gl_FragStencilRefAMD"); if (state->AMD_shader_stencil_export_warn) - var->warn_extension = "GL_AMD_shader_stencil_export"; + var->enable_extension_warning("GL_AMD_shader_stencil_export"); } if (state->ARB_sample_shading_enable) { diff --git a/mesalib/src/glsl/glsl_lexer.ll b/mesalib/src/glsl/glsl_lexer.ll index b7c4aad3a..e66a93591 100644 --- a/mesalib/src/glsl/glsl_lexer.ll +++ b/mesalib/src/glsl/glsl_lexer.ll @@ -81,7 +81,8 @@ static int classify_identifier(struct _mesa_glsl_parse_state *, const char *); "illegal use of reserved word `%s'", yytext); \ return ERROR_TOK; \ } else { \ - yylval->identifier = strdup(yytext); \ + void *mem_ctx = yyextra; \ + yylval->identifier = ralloc_strdup(mem_ctx, yytext); \ return classify_identifier(yyextra, yytext); \ } \ } while (0) @@ -232,7 +233,8 @@ HASH ^{SPC}#{SPC} [ \t\r]* { } : return COLON; [_a-zA-Z][_a-zA-Z0-9]* { - yylval->identifier = strdup(yytext); + void *mem_ctx = yyextra; + yylval->identifier = ralloc_strdup(mem_ctx, yytext); return IDENTIFIER; } [1-9][0-9]* { @@ -409,7 +411,8 @@ layout { || yyextra->ARB_compute_shader_enable) { return LAYOUT_TOK; } else { - yylval->identifier = strdup(yytext); + void *mem_ctx = yyextra; + yylval->identifier = ralloc_strdup(mem_ctx, yytext); return classify_identifier(yyextra, yytext); } } diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp index 490c3c8ee..cc7d2d746 100644 --- a/mesalib/src/glsl/glsl_parser_extras.cpp +++ b/mesalib/src/glsl/glsl_parser_extras.cpp @@ -1440,6 +1440,9 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader, new(shader) _mesa_glsl_parse_state(ctx, shader->Stage, shader); const char *source = shader->Source; + if (ctx->Const.GenerateTemporaryNames) + ir_variable::temporaries_allocate_names = true; + state->error = glcpp_preprocess(state, &source, &state->info_log, &ctx->Extensions, ctx); @@ -1483,6 +1486,26 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader, ; validate_ir_tree(shader->ir); + + enum ir_variable_mode other; + switch (shader->Stage) { + case MESA_SHADER_VERTEX: + other = ir_var_shader_in; + break; + case MESA_SHADER_FRAGMENT: + other = ir_var_shader_out; + break; + default: + /* Something invalid to ensure optimize_dead_builtin_uniforms + * doesn't remove anything other than uniforms or constants. + */ + other = ir_var_mode_count; + break; + } + + optimize_dead_builtin_variables(shader->ir, other); + + validate_ir_tree(shader->ir); } if (shader->InfoLog) @@ -1516,9 +1539,13 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader, case ir_type_function: shader->symbols->add_function((ir_function *) ir); break; - case ir_type_variable: - shader->symbols->add_variable((ir_variable *) ir); + case ir_type_variable: { + ir_variable *const var = (ir_variable *) ir; + + if (var->data.mode != ir_var_temporary) + shader->symbols->add_variable(var); break; + } default: break; } diff --git a/mesalib/src/glsl/glsl_symbol_table.cpp b/mesalib/src/glsl/glsl_symbol_table.cpp index a05236203..2294dda42 100644 --- a/mesalib/src/glsl/glsl_symbol_table.cpp +++ b/mesalib/src/glsl/glsl_symbol_table.cpp @@ -124,6 +124,8 @@ bool glsl_symbol_table::name_declared_this_scope(const char *name) bool glsl_symbol_table::add_variable(ir_variable *v) { + assert(v->data.mode != ir_var_temporary); + if (this->separate_function_namespace) { /* In 1.10, functions and variables have separate namespaces. */ symbol_table_entry *existing = get_entry(v->name); diff --git a/mesalib/src/glsl/glsl_types.cpp b/mesalib/src/glsl/glsl_types.cpp index 66e9b1330..c11d86482 100644 --- a/mesalib/src/glsl/glsl_types.cpp +++ b/mesalib/src/glsl/glsl_types.cpp @@ -490,6 +490,20 @@ glsl_type::record_compare(const glsl_type *b) const if (this->interface_packing != b->interface_packing) return false; + /* From the GLSL 4.20 specification (Sec 4.2): + * + * "Structures must have the same name, sequence of type names, and + * type definitions, and field names to be considered the same type." + * + * GLSL ES behaves the same (Ver 1.00 Sec 4.2.4, Ver 3.00 Sec 4.2.5). + * + * Note that we cannot force type name check when comparing unnamed + * structure types, these have a unique name assigned during parsing. + */ + if (!this->is_anonymous() && !b->is_anonymous()) + if (strcmp(this->name, b->name) != 0) + return false; + for (unsigned i = 0; i < this->length; i++) { if (this->fields.structure[i].type != b->fields.structure[i].type) return false; @@ -678,12 +692,17 @@ glsl_type::component_slots() const unsigned glsl_type::uniform_locations() const { - if (this->is_matrix()) - return 1; - unsigned size = 0; switch (this->base_type) { + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + case GLSL_TYPE_FLOAT: + case GLSL_TYPE_BOOL: + case GLSL_TYPE_SAMPLER: + case GLSL_TYPE_IMAGE: + return 1; + case GLSL_TYPE_STRUCT: case GLSL_TYPE_INTERFACE: for (unsigned i = 0; i < this->length; i++) @@ -692,13 +711,8 @@ glsl_type::uniform_locations() const case GLSL_TYPE_ARRAY: return this->length * this->fields.array->uniform_locations(); default: - break; + return 0; } - - /* The location count for many types match with component_slots() result, - * all expections should be handled above. - */ - return component_slots(); } bool @@ -965,7 +979,7 @@ glsl_type::std140_size(bool row_major) const if (field_type->is_record() && (i + 1 < this->length)) size = glsl_align(size, 16); } - size = glsl_align(size, max_align); + size = glsl_align(size, MAX2(max_align, 16)); return size; } diff --git a/mesalib/src/glsl/glsl_types.h b/mesalib/src/glsl/glsl_types.h index d545533dc..eeb14c274 100644 --- a/mesalib/src/glsl/glsl_types.h +++ b/mesalib/src/glsl/glsl_types.h @@ -279,6 +279,9 @@ struct glsl_type { /** * Calculate the number of unique values from glGetUniformLocation for the * elements of the type. + * + * This is used to allocate slots in the UniformRemapTable, the amount of + * locations may not match with actual used storage space by the driver. */ unsigned uniform_locations() const; @@ -485,6 +488,14 @@ struct glsl_type { return base_type == GLSL_TYPE_ERROR; } + /** + * Query if a type is unnamed/anonymous (named by the parser) + */ + bool is_anonymous() const + { + return !strncmp(name, "#anon", 5); + } + /** * Get the type stripped of any arrays * diff --git a/mesalib/src/glsl/ir.cpp b/mesalib/src/glsl/ir.cpp index 739a9f412..c712c6a7b 100644 --- a/mesalib/src/glsl/ir.cpp +++ b/mesalib/src/glsl/ir.cpp @@ -1543,18 +1543,44 @@ ir_swizzle::variable_referenced() const } +bool ir_variable::temporaries_allocate_names = false; + +const char ir_variable::tmp_name[] = "compiler_temp"; + ir_variable::ir_variable(const struct glsl_type *type, const char *name, ir_variable_mode mode) - : ir_instruction(ir_type_variable), max_ifc_array_access(NULL) + : ir_instruction(ir_type_variable) { this->type = type; - this->name = ralloc_strdup(this, name); + + if (mode == ir_var_temporary && !ir_variable::temporaries_allocate_names) + name = NULL; + + /* The ir_variable clone method may call this constructor with name set to + * tmp_name. + */ + assert(name != NULL + || mode == ir_var_temporary + || mode == ir_var_function_in + || mode == ir_var_function_out + || mode == ir_var_function_inout); + assert(name != ir_variable::tmp_name + || mode == ir_var_temporary); + if (mode == ir_var_temporary + && (name == NULL || name == ir_variable::tmp_name)) { + this->name = ir_variable::tmp_name; + } else { + this->name = ralloc_strdup(this, name); + } + + this->u.max_ifc_array_access = NULL; + this->data.explicit_location = false; this->data.has_initializer = false; this->data.location = -1; this->data.location_frac = 0; this->data.binding = 0; - this->warn_extension = NULL; + this->data.warn_extension_index = 0; this->constant_value = NULL; this->constant_initializer = NULL; this->data.origin_upper_left = false; @@ -1617,6 +1643,32 @@ ir_variable::determine_interpolation_mode(bool flat_shade) return INTERP_QUALIFIER_SMOOTH; } +const char *const ir_variable::warn_extension_table[] = { + "", + "GL_ARB_shader_stencil_export", + "GL_AMD_shader_stencil_export", +}; + +void +ir_variable::enable_extension_warning(const char *extension) +{ + for (unsigned i = 0; i < Elements(warn_extension_table); i++) { + if (strcmp(warn_extension_table[i], extension) == 0) { + this->data.warn_extension_index = i; + return; + } + } + + assert(!"Should not get here."); + this->data.warn_extension_index = 0; +} + +const char * +ir_variable::get_extension_warning() const +{ + return this->data.warn_extension_index == 0 + ? NULL : warn_extension_table[this->data.warn_extension_index]; +} ir_function_signature::ir_function_signature(const glsl_type *return_type, builtin_available_predicate b) diff --git a/mesalib/src/glsl/ir.h b/mesalib/src/glsl/ir.h index 8003f88ce..90c443c3d 100644 --- a/mesalib/src/glsl/ir.h +++ b/mesalib/src/glsl/ir.h @@ -475,7 +475,7 @@ public: assert(this->interface_type == NULL); this->interface_type = type; if (this->is_interface_instance()) { - this->max_ifc_array_access = + this->u.max_ifc_array_access = rzalloc_array(this, unsigned, type->length); } } @@ -487,7 +487,7 @@ public: */ void change_interface_type(const struct glsl_type *type) { - if (this->max_ifc_array_access != NULL) { + if (this->u.max_ifc_array_access != NULL) { /* max_ifc_array_access has already been allocated, so make sure the * new interface has the same number of fields as the old one. */ @@ -504,7 +504,7 @@ public: */ void reinit_interface_type(const struct glsl_type *type) { - if (this->max_ifc_array_access != NULL) { + if (this->u.max_ifc_array_access != NULL) { #ifndef NDEBUG /* Redeclaring gl_PerVertex is only allowed if none of the built-ins * it defines have been accessed yet; so it's safe to throw away the @@ -512,10 +512,10 @@ public: * zero. */ for (unsigned i = 0; i < this->interface_type->length; i++) - assert(this->max_ifc_array_access[i] == 0); + assert(this->u.max_ifc_array_access[i] == 0); #endif - ralloc_free(this->max_ifc_array_access); - this->max_ifc_array_access = NULL; + ralloc_free(this->u.max_ifc_array_access); + this->u.max_ifc_array_access = NULL; } this->interface_type = NULL; init_interface_type(type); @@ -527,27 +527,80 @@ public: } /** - * Declared type of the variable + * Get the max_ifc_array_access pointer + * + * A "set" function is not needed because the array is dynmically allocated + * as necessary. */ - const struct glsl_type *type; + inline unsigned *get_max_ifc_array_access() + { + assert(this->data._num_state_slots == 0); + return this->u.max_ifc_array_access; + } + + inline unsigned get_num_state_slots() const + { + assert(!this->is_interface_instance() + || this->data._num_state_slots == 0); + return this->data._num_state_slots; + } + + inline void set_num_state_slots(unsigned n) + { + assert(!this->is_interface_instance() + || n == 0); + this->data._num_state_slots = n; + } + + inline ir_state_slot *get_state_slots() + { + return this->is_interface_instance() ? NULL : this->u.state_slots; + } + + inline const ir_state_slot *get_state_slots() const + { + return this->is_interface_instance() ? NULL : this->u.state_slots; + } + + inline ir_state_slot *allocate_state_slots(unsigned n) + { + assert(!this->is_interface_instance()); + + this->u.state_slots = ralloc_array(this, ir_state_slot, n); + this->data._num_state_slots = 0; + + if (this->u.state_slots != NULL) + this->data._num_state_slots = n; + + return this->u.state_slots; + } + + inline bool is_name_ralloced() const + { + return this->name != ir_variable::tmp_name; + } /** - * Declared name of the variable + * Enable emitting extension warnings for this variable */ - const char *name; + void enable_extension_warning(const char *extension); /** - * For variables which satisfy the is_interface_instance() predicate, this - * points to an array of integers such that if the ith member of the - * interface block is an array, max_ifc_array_access[i] is the maximum - * array element of that member that has been accessed. If the ith member - * of the interface block is not an array, max_ifc_array_access[i] is - * unused. + * Get the extension warning string for this variable * - * For variables whose type is not an interface block, this pointer is - * NULL. + * If warnings are not enabled, \c NULL is returned. + */ + const char *get_extension_warning() const; + + /** + * Declared type of the variable + */ + const struct glsl_type *type; + + /** + * Declared name of the variable */ - unsigned *max_ifc_array_access; + const char *name; struct ir_variable_data { @@ -697,6 +750,13 @@ public: */ unsigned index:1; + /** + * \brief Layout qualifier for gl_FragDepth. + * + * This is not equal to \c ir_depth_layout_none if and only if this + * variable is \c gl_FragDepth and a layout qualifier is specified. + */ + ir_depth_layout depth_layout:3; /** * ARB_shader_image_load_store qualifiers. @@ -707,16 +767,34 @@ public: unsigned image_volatile:1; unsigned image_restrict:1; + /** + * Emit a warning if this variable is accessed. + */ + private: + uint8_t warn_extension_index; + + public: /** Image internal format if specified explicitly, otherwise GL_NONE. */ uint16_t image_format; + private: /** - * \brief Layout qualifier for gl_FragDepth. + * Number of state slots used * - * This is not equal to \c ir_depth_layout_none if and only if this - * variable is \c gl_FragDepth and a layout qualifier is specified. + * \note + * This could be stored in as few as 7-bits, if necessary. If it is made + * smaller, add an assertion to \c ir_variable::allocate_state_slots to + * be safe. */ - ir_depth_layout depth_layout; + uint16_t _num_state_slots; + + public: + /** + * Initial binding point for a sampler, atomic, or UBO. + * + * For array types, this represents the binding point for the first element. + */ + int16_t binding; /** * Storage location of the base of this variable @@ -743,13 +821,6 @@ public: */ unsigned stream; - /** - * Initial binding point for a sampler, atomic, or UBO. - * - * For array types, this represents the binding point for the first element. - */ - int binding; - /** * Location an atomic counter is stored at. */ @@ -764,29 +835,12 @@ public: */ unsigned max_array_access; + /** + * Allow (only) ir_variable direct access private members. + */ + friend class ir_variable; } data; - /** - * Built-in state that backs this uniform - * - * Once set at variable creation, \c state_slots must remain invariant. - * This is because, ideally, this array would be shared by all clones of - * this variable in the IR tree. In other words, we'd really like for it - * to be a fly-weight. - * - * If the variable is not a uniform, \c num_state_slots will be zero and - * \c state_slots will be \c NULL. - */ - /*@{*/ - unsigned num_state_slots; /**< Number of state slots used */ - ir_state_slot *state_slots; /**< State descriptors. */ - /*@}*/ - - /** - * Emit a warning if this variable is accessed. - */ - const char *warn_extension; - /** * Value assigned in the initializer of a variable declared "const" */ @@ -803,6 +857,33 @@ public: ir_constant *constant_initializer; private: + static const char *const warn_extension_table[]; + + union { + /** + * For variables which satisfy the is_interface_instance() predicate, + * this points to an array of integers such that if the ith member of + * the interface block is an array, max_ifc_array_access[i] is the + * maximum array element of that member that has been accessed. If the + * ith member of the interface block is not an array, + * max_ifc_array_access[i] is unused. + * + * For variables whose type is not an interface block, this pointer is + * NULL. + */ + unsigned *max_ifc_array_access; + + /** + * Built-in state that backs this uniform + * + * Once set at variable creation, \c state_slots must remain invariant. + * + * If the variable is not a uniform, \c _num_state_slots will be zero + * and \c state_slots will be \c NULL. + */ + ir_state_slot *state_slots; + } u; + /** * For variables that are in an interface block or are an instance of an * interface block, this is the \c GLSL_TYPE_INTERFACE type for that block. @@ -810,6 +891,30 @@ private: * \sa ir_variable::location */ const glsl_type *interface_type; + + /** + * Name used for anonymous compiler temporaries + */ + static const char tmp_name[]; + +public: + /** + * Should the construct keep names for ir_var_temporary variables? + * + * When this global is false, names passed to the constructor for + * \c ir_var_temporary variables will be dropped. Instead, the variable will + * be named "compiler_temp". This name will be in static storage. + * + * \warning + * \b NEVER change the mode of an \c ir_var_temporary. + * + * \warning + * This variable is \b not thread-safe. It is global, \b not + * per-context. It begins life false. A context can, at some point, make + * it true. From that point on, it will be true forever. This should be + * okay since it will only be set true while debugging. + */ + static bool temporaries_allocate_names; }; /** diff --git a/mesalib/src/glsl/ir_clone.cpp b/mesalib/src/glsl/ir_clone.cpp index 4b444d468..dffa57844 100644 --- a/mesalib/src/glsl/ir_clone.cpp +++ b/mesalib/src/glsl/ir_clone.cpp @@ -45,25 +45,18 @@ ir_variable::clone(void *mem_ctx, struct hash_table *ht) const var->data.max_array_access = this->data.max_array_access; if (this->is_interface_instance()) { - var->max_ifc_array_access = + var->u.max_ifc_array_access = rzalloc_array(var, unsigned, this->interface_type->length); - memcpy(var->max_ifc_array_access, this->max_ifc_array_access, + memcpy(var->u.max_ifc_array_access, this->u.max_ifc_array_access, this->interface_type->length * sizeof(unsigned)); } memcpy(&var->data, &this->data, sizeof(var->data)); - var->warn_extension = this->warn_extension; - - var->num_state_slots = this->num_state_slots; - if (this->state_slots) { - /* FINISHME: This really wants to use something like talloc_reference, but - * FINISHME: ralloc doesn't have any similar function. - */ - var->state_slots = ralloc_array(var, ir_state_slot, - this->num_state_slots); - memcpy(var->state_slots, this->state_slots, - sizeof(this->state_slots[0]) * var->num_state_slots); + if (this->get_state_slots()) { + ir_state_slot *s = var->allocate_state_slots(this->get_num_state_slots()); + memcpy(s, this->get_state_slots(), + sizeof(s[0]) * var->get_num_state_slots()); } if (this->constant_value) diff --git a/mesalib/src/glsl/ir_function.cpp b/mesalib/src/glsl/ir_function.cpp index 98bec45ce..2b2643c64 100644 --- a/mesalib/src/glsl/ir_function.cpp +++ b/mesalib/src/glsl/ir_function.cpp @@ -24,6 +24,7 @@ #include "glsl_types.h" #include "ir.h" #include "glsl_parser_extras.h" +#include "main/errors.h" typedef enum { PARAMETER_LIST_NO_MATCH, @@ -296,6 +297,7 @@ ir_function::matching_signature(_mesa_glsl_parse_state *state, bool *is_exact) { ir_function_signature **inexact_matches = NULL; + ir_function_signature **inexact_matches_temp; ir_function_signature *match = NULL; int num_inexact_matches = 0; @@ -321,11 +323,16 @@ ir_function::matching_signature(_mesa_glsl_parse_state *state, free(inexact_matches); return sig; case PARAMETER_LIST_INEXACT_MATCH: - inexact_matches = (ir_function_signature **) + inexact_matches_temp = (ir_function_signature **) realloc(inexact_matches, sizeof(*inexact_matches) * (num_inexact_matches + 1)); - assert(inexact_matches); + if (inexact_matches_temp == NULL) { + _mesa_error_no_memory(__func__); + free(inexact_matches); + return NULL; + } + inexact_matches = inexact_matches_temp; inexact_matches[num_inexact_matches++] = sig; continue; case PARAMETER_LIST_NO_MATCH: diff --git a/mesalib/src/glsl/ir_optimization.h b/mesalib/src/glsl/ir_optimization.h index 369dcd15b..0c3a63831 100644 --- a/mesalib/src/glsl/ir_optimization.h +++ b/mesalib/src/glsl/ir_optimization.h @@ -125,6 +125,8 @@ void lower_named_interface_blocks(void *mem_ctx, gl_shader *shader); bool optimize_redundant_jumps(exec_list *instructions); bool optimize_split_arrays(exec_list *instructions, bool linked); bool lower_offset_arrays(exec_list *instructions); +void optimize_dead_builtin_variables(exec_list *instructions, + enum ir_variable_mode other); bool lower_vertex_id(gl_shader *shader); diff --git a/mesalib/src/glsl/ir_validate.cpp b/mesalib/src/glsl/ir_validate.cpp index 97a581dc2..5a6f8bbf5 100644 --- a/mesalib/src/glsl/ir_validate.cpp +++ b/mesalib/src/glsl/ir_validate.cpp @@ -654,7 +654,7 @@ ir_validate::visit(ir_variable *ir) * in the ir_dereference_variable handler to ensure that a variable is * declared before it is dereferenced. */ - if (ir->name) + if (ir->name && ir->is_name_ralloced()) assert(ralloc_parent(ir->name) == ir); hash_table_insert(ht, ir, ir); @@ -682,10 +682,15 @@ ir_validate::visit(ir_variable *ir) ir->get_interface_type()->fields.structure; for (unsigned i = 0; i < ir->get_interface_type()->length; i++) { if (fields[i].type->array_size() > 0) { - if (ir->max_ifc_array_access[i] >= fields[i].type->length) { + const unsigned *const max_ifc_array_access = + ir->get_max_ifc_array_access(); + + assert(max_ifc_array_access != NULL); + + if (max_ifc_array_access[i] >= fields[i].type->length) { printf("ir_variable has maximum access out of bounds for " "field %s (%d vs %d)\n", fields[i].name, - ir->max_ifc_array_access[i], fields[i].type->length); + max_ifc_array_access[i], fields[i].type->length); ir->print(); abort(); } @@ -700,6 +705,14 @@ ir_validate::visit(ir_variable *ir) abort(); } + if (ir->data.mode == ir_var_uniform + && strncmp(ir->name, "gl_", 3) == 0 + && ir->get_state_slots() == NULL) { + printf("built-in uniform has no state\n"); + ir->print(); + abort(); + } + return visit_continue; } diff --git a/mesalib/src/glsl/link_functions.cpp b/mesalib/src/glsl/link_functions.cpp index d62c16853..537f4dc77 100644 --- a/mesalib/src/glsl/link_functions.cpp +++ b/mesalib/src/glsl/link_functions.cpp @@ -245,11 +245,19 @@ public: /* Similarly, we need implicit sizes of arrays within interface * blocks to be sized by the maximal access in *any* shader. */ + unsigned *const linked_max_ifc_array_access = + var->get_max_ifc_array_access(); + unsigned *const ir_max_ifc_array_access = + ir->var->get_max_ifc_array_access(); + + assert(linked_max_ifc_array_access != NULL); + assert(ir_max_ifc_array_access != NULL); + for (unsigned i = 0; i < var->get_interface_type()->length; i++) { - var->max_ifc_array_access[i] = - MAX2(var->max_ifc_array_access[i], - ir->var->max_ifc_array_access[i]); + linked_max_ifc_array_access[i] = + MAX2(linked_max_ifc_array_access[i], + ir_max_ifc_array_access[i]); } } } diff --git a/mesalib/src/glsl/link_uniforms.cpp b/mesalib/src/glsl/link_uniforms.cpp index 258d279ea..400e13479 100644 --- a/mesalib/src/glsl/link_uniforms.cpp +++ b/mesalib/src/glsl/link_uniforms.cpp @@ -749,7 +749,7 @@ link_update_uniform_buffer_variables(struct gl_shader *shader) if (end == NULL) continue; - if (l != (end - begin)) + if ((ptrdiff_t) l != (end - begin)) continue; if (strncmp(var->name, begin, l) == 0) { @@ -771,40 +771,6 @@ link_update_uniform_buffer_variables(struct gl_shader *shader) } } -void -link_assign_uniform_block_offsets(struct gl_shader *shader) -{ - for (unsigned b = 0; b < shader->NumUniformBlocks; b++) { - struct gl_uniform_block *block = &shader->UniformBlocks[b]; - - unsigned offset = 0; - for (unsigned int i = 0; i < block->NumUniforms; i++) { - struct gl_uniform_buffer_variable *ubo_var = &block->Uniforms[i]; - const struct glsl_type *type = ubo_var->Type; - - unsigned alignment = type->std140_base_alignment(ubo_var->RowMajor); - unsigned size = type->std140_size(ubo_var->RowMajor); - - offset = glsl_align(offset, alignment); - ubo_var->Offset = offset; - offset += size; - } - - /* From the GL_ARB_uniform_buffer_object spec: - * - * "For uniform blocks laid out according to [std140] rules, - * the minimum buffer object size returned by the - * UNIFORM_BLOCK_DATA_SIZE query is derived by taking the - * offset of the last basic machine unit consumed by the - * last uniform of the uniform block (including any - * end-of-array or end-of-structure padding), adding one, - * and rounding up to the next multiple of the base - * alignment required for a vec4." - */ - block->UniformBufferSize = glsl_align(offset, 16); - } -} - /** * Scan the program for image uniforms and store image unit access * information into the gl_shader data structure. diff --git a/mesalib/src/glsl/link_varyings.cpp b/mesalib/src/glsl/link_varyings.cpp index 54ceae1b9..a738e2f38 100644 --- a/mesalib/src/glsl/link_varyings.cpp +++ b/mesalib/src/glsl/link_varyings.cpp @@ -318,6 +318,11 @@ tfeedback_decl::init(struct gl_context *ctx, const void *mem_ctx, const char *base_name_end; long subscript = parse_program_resource_name(input, &base_name_end); this->var_name = ralloc_strndup(mem_ctx, input, base_name_end - input); + if (this->var_name == NULL) { + _mesa_error_no_memory(__func__); + return; + } + if (subscript >= 0) { this->array_subscript = subscript; this->is_subscripted = true; diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp index 7689198b0..47a722d9d 100644 --- a/mesalib/src/glsl/linker.cpp +++ b/mesalib/src/glsl/linker.cpp @@ -976,7 +976,8 @@ populate_symbol_table(gl_shader *sh) if ((func = inst->as_function()) != NULL) { sh->symbols->add_function(func); } else if ((var = inst->as_variable()) != NULL) { - sh->symbols->add_variable(var); + if (var->data.mode != ir_var_temporary) + sh->symbols->add_variable(var); } } } @@ -1173,7 +1174,8 @@ public: if (var->type->is_interface()) { if (interface_contains_unsized_arrays(var->type)) { const glsl_type *new_type = - resize_interface_members(var->type, var->max_ifc_array_access); + resize_interface_members(var->type, + var->get_max_ifc_array_access()); var->type = new_type; var->change_interface_type(new_type); } @@ -1182,7 +1184,7 @@ public: if (interface_contains_unsized_arrays(var->type->fields.array)) { const glsl_type *new_type = resize_interface_members(var->type->fields.array, - var->max_ifc_array_access); + var->get_max_ifc_array_access()); var->change_interface_type(new_type); var->type = glsl_type::get_array_instance(new_type, var->type->length); @@ -1714,12 +1716,19 @@ link_intrastage_shaders(void *mem_ctx, */ gl_shader **linking_shaders = (gl_shader **) calloc(num_shaders + 1, sizeof(gl_shader *)); - memcpy(linking_shaders, shader_list, num_shaders * sizeof(gl_shader *)); - linking_shaders[num_shaders] = _mesa_glsl_get_builtin_function_shader(); - ok = link_function_calls(prog, linked, linking_shaders, num_shaders + 1); + ok = linking_shaders != NULL; - free(linking_shaders); + if (ok) { + memcpy(linking_shaders, shader_list, num_shaders * sizeof(gl_shader *)); + linking_shaders[num_shaders] = _mesa_glsl_get_builtin_function_shader(); + + ok = link_function_calls(prog, linked, linking_shaders, num_shaders + 1); + + free(linking_shaders); + } else { + _mesa_error_no_memory(__func__); + } } else { ok = link_function_calls(prog, linked, shader_list, num_shaders); } @@ -1824,9 +1833,10 @@ update_array_sizes(struct gl_shader_program *prog) * Determine the number of slots per array element by dividing by * the old (total) size. */ - if (var->num_state_slots > 0) { - var->num_state_slots = (size + 1) - * (var->num_state_slots / var->type->length); + const unsigned num_slots = var->get_num_state_slots(); + if (num_slots > 0) { + var->set_num_state_slots((size + 1) + * (num_slots / var->type->length)); } var->type = glsl_type::get_array_instance(var->type->fields.array, @@ -2176,6 +2186,7 @@ demote_shader_inputs_and_outputs(gl_shader *sh, enum ir_variable_mode mode) * to have a location assigned. */ if (var->data.is_unmatched_generic_inout) { + assert(var->data.mode != ir_var_temporary); var->data.mode = ir_var_auto; } } diff --git a/mesalib/src/glsl/linker.h b/mesalib/src/glsl/linker.h index 9440794e2..6ee585898 100644 --- a/mesalib/src/glsl/linker.h +++ b/mesalib/src/glsl/linker.h @@ -50,9 +50,6 @@ link_cross_validate_uniform_block(void *mem_ctx, unsigned int *num_linked_blocks, struct gl_uniform_block *new_block); -void -link_assign_uniform_block_offsets(struct gl_shader *shader); - extern bool link_uniform_blocks_are_compatible(const gl_uniform_block *a, const gl_uniform_block *b); diff --git a/mesalib/src/glsl/lower_offset_array.cpp b/mesalib/src/glsl/lower_offset_array.cpp index 0c235eda3..5b48526db 100644 --- a/mesalib/src/glsl/lower_offset_array.cpp +++ b/mesalib/src/glsl/lower_offset_array.cpp @@ -63,7 +63,8 @@ brw_lower_offset_array_visitor::handle_rvalue(ir_rvalue **rv) void *mem_ctx = ralloc_parent(ir); - ir_variable *var = new (mem_ctx) ir_variable(ir->type, "result", ir_var_auto); + ir_variable *var = + new (mem_ctx) ir_variable(ir->type, "result", ir_var_temporary); base_ir->insert_before(var); for (int i = 0; i < 4; i++) { diff --git a/mesalib/src/glsl/lower_packed_varyings.cpp b/mesalib/src/glsl/lower_packed_varyings.cpp index 780148315..5e844c792 100644 --- a/mesalib/src/glsl/lower_packed_varyings.cpp +++ b/mesalib/src/glsl/lower_packed_varyings.cpp @@ -261,6 +261,7 @@ lower_packed_varyings_visitor::run(exec_list *instructions) !var->type->contains_integer()); /* Change the old varying into an ordinary global. */ + assert(var->data.mode != ir_var_temporary); var->data.mode = ir_var_auto; /* Create a reference to the old varying. */ diff --git a/mesalib/src/glsl/lower_texture_projection.cpp b/mesalib/src/glsl/lower_texture_projection.cpp index 16d637680..95df106d9 100644 --- a/mesalib/src/glsl/lower_texture_projection.cpp +++ b/mesalib/src/glsl/lower_texture_projection.cpp @@ -62,7 +62,7 @@ lower_texture_projection_visitor::visit_leave(ir_texture *ir) void *mem_ctx = ralloc_parent(ir); ir_variable *var = new(mem_ctx) ir_variable(ir->projector->type, - "projector", ir_var_auto); + "projector", ir_var_temporary); base_ir->insert_before(var); ir_dereference *deref = new(mem_ctx) ir_dereference_variable(var); ir_expression *expr = new(mem_ctx) ir_expression(ir_unop_rcp, diff --git a/mesalib/src/glsl/lower_ubo_reference.cpp b/mesalib/src/glsl/lower_ubo_reference.cpp index 3cdfc04ac..43dd067fa 100644 --- a/mesalib/src/glsl/lower_ubo_reference.cpp +++ b/mesalib/src/glsl/lower_ubo_reference.cpp @@ -111,7 +111,7 @@ is_dereferenced_thing_row_major(const ir_dereference *deref) case GLSL_MATRIX_LAYOUT_COLUMN_MAJOR: return false; case GLSL_MATRIX_LAYOUT_ROW_MAJOR: - return matrix || deref->type->is_record(); + return matrix || deref->type->without_array()->is_record(); } unreachable("invalid matrix layout"); @@ -301,7 +301,14 @@ lower_ubo_reference_visitor::handle_rvalue(ir_rvalue **rvalue) deref = deref_array->array->as_dereference(); break; } else { - array_stride = deref_array->type->std140_size(row_major); + /* Whether or not the field is row-major (because it might be a + * bvec2 or something) does not affect the array itself. We need + * to know whether an array element in its entirety is row-major. + */ + const bool array_row_major = + is_dereferenced_thing_row_major(deref_array); + + array_stride = deref_array->type->std140_size(array_row_major); array_stride = glsl_align(array_stride, 16); } @@ -327,6 +334,15 @@ lower_ubo_reference_visitor::handle_rvalue(ir_rvalue **rvalue) const glsl_type *struct_type = deref_record->record->type; unsigned intra_struct_offset = 0; + /* glsl_type::std140_base_alignment doesn't grok interfaces. Use + * 16-bytes for the alignment because that is the general minimum of + * std140. + */ + const unsigned struct_alignment = struct_type->is_interface() + ? 16 + : struct_type->std140_base_alignment(row_major); + + for (unsigned int i = 0; i < struct_type->length; i++) { const glsl_type *type = struct_type->fields.structure[i].type; @@ -346,6 +362,19 @@ lower_ubo_reference_visitor::handle_rvalue(ir_rvalue **rvalue) deref_record->field) == 0) break; intra_struct_offset += type->std140_size(field_row_major); + + /* If the field just examined was itself a structure, apply rule + * #9: + * + * "The structure may have padding at the end; the base offset + * of the member following the sub-structure is rounded up to + * the next multiple of the base alignment of the structure." + */ + if (type->without_array()->is_record()) { + intra_struct_offset = glsl_align(intra_struct_offset, + struct_alignment); + + } } const_offset += intra_struct_offset; diff --git a/mesalib/src/glsl/main.cpp b/mesalib/src/glsl/main.cpp index a4452e023..feed10082 100644 --- a/mesalib/src/glsl/main.cpp +++ b/mesalib/src/glsl/main.cpp @@ -210,6 +210,7 @@ initialize_context(struct gl_context *ctx, gl_api api) break; } + ctx->Const.GenerateTemporaryNames = true; ctx->Driver.NewShader = _mesa_new_shader; } diff --git a/mesalib/src/glsl/opt_algebraic.cpp b/mesalib/src/glsl/opt_algebraic.cpp index 447618f9e..0cdb8ecfc 100644 --- a/mesalib/src/glsl/opt_algebraic.cpp +++ b/mesalib/src/glsl/opt_algebraic.cpp @@ -357,6 +357,20 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) if (op_expr[0]->operation == ir_unop_log2) { return op_expr[0]->operands[0]; } + + if (!options->EmitNoPow && op_expr[0]->operation == ir_binop_mul) { + for (int log2_pos = 0; log2_pos < 2; log2_pos++) { + ir_expression *log2_expr = + op_expr[0]->operands[log2_pos]->as_expression(); + + if (log2_expr && log2_expr->operation == ir_unop_log2) { + return new(mem_ctx) ir_expression(ir_binop_pow, + ir->type, + log2_expr->operands[0], + op_expr[0]->operands[1 - log2_pos]); + } + } + } break; case ir_unop_log2: diff --git a/mesalib/src/glsl/opt_cse.cpp b/mesalib/src/glsl/opt_cse.cpp index 0e720cc26..9c96835dd 100644 --- a/mesalib/src/glsl/opt_cse.cpp +++ b/mesalib/src/glsl/opt_cse.cpp @@ -276,7 +276,7 @@ cse_visitor::try_cse(ir_rvalue *rvalue) ir_variable *var = new(rvalue) ir_variable(rvalue->type, "cse", - ir_var_auto); + ir_var_temporary); /* Write the previous expression result into a new variable. */ base_ir->insert_before(var); diff --git a/mesalib/src/glsl/opt_dead_builtin_variables.cpp b/mesalib/src/glsl/opt_dead_builtin_variables.cpp new file mode 100644 index 000000000..85c75d6f2 --- /dev/null +++ b/mesalib/src/glsl/opt_dead_builtin_variables.cpp @@ -0,0 +1,81 @@ +/* + * Copyright © 2014 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_optimization.h" + +/** + * Pre-linking, optimize unused built-in variables + * + * Uniforms, constants, system values, inputs (vertex shader only), and + * outputs (fragment shader only) that are not used can be removed. + */ +void +optimize_dead_builtin_variables(exec_list *instructions, + enum ir_variable_mode other) +{ + foreach_in_list_safe(ir_variable, var, instructions) { + if (var->ir_type != ir_type_variable || var->data.used) + continue; + + if (var->data.mode != ir_var_uniform + && var->data.mode != ir_var_auto + && var->data.mode != ir_var_system_value + && var->data.mode != other) + continue; + + /* So that linker rules can later be enforced, we cannot elimate + * variables that were redeclared in the shader code. + */ + if ((var->data.mode == other || var->data.mode == ir_var_system_value) + && var->data.how_declared != ir_var_declared_implicitly) + continue; + + if (strncmp(var->name, "gl_", 3) != 0) + continue; + + /* gl_ModelViewProjectionMatrix and gl_Vertex are special because they + * are used by ftransform. No other built-in variable is used by a + * built-in function. The forward declarations of these variables in + * the built-in function shader does not have the "state slot" + * information, so removing these variables from the user shader will + * cause problems later. + * + * Matrix uniforms with "Transpose" are not eliminated because there's + * an optimization pass that can turn references to the regular matrix + * into references to the transpose matrix. Eliminating the transpose + * matrix would cause that pass to generate references to undeclareds + * variables (thank you, ir_validate). + * + * It doesn't seem worth the effort to track when the transpose could be + * eliminated (i.e., when the non-transpose was eliminated). + */ + if (strcmp(var->name, "gl_ModelViewProjectionMatrix") == 0 + || strcmp(var->name, "gl_Vertex") == 0 + || strstr(var->name, "Transpose") != NULL) + continue; + + var->remove(); + } +} diff --git a/mesalib/src/glsl/test_optpass.cpp b/mesalib/src/glsl/test_optpass.cpp index 24c06f11b..ac3e3f48c 100644 --- a/mesalib/src/glsl/test_optpass.cpp +++ b/mesalib/src/glsl/test_optpass.cpp @@ -200,6 +200,7 @@ int test_optpass(int argc, char **argv) initialize_context_to_defaults(ctx, API_OPENGL_COMPAT); ctx->Driver.NewShader = _mesa_new_shader; + ir_variable::temporaries_allocate_names = true; struct gl_shader *shader = rzalloc(NULL, struct gl_shader); shader->Type = shader_type; diff --git a/mesalib/src/loader/loader.c b/mesalib/src/loader/loader.c index bdd390691..94c993ac8 100644 --- a/mesalib/src/loader/loader.c +++ b/mesalib/src/loader/loader.c @@ -594,6 +594,9 @@ libudev_get_device_name_for_fd(int fd) (struct udev_device *)); UDEV_SYMBOL(struct udev *, udev_unref, (struct udev *)); + if (dlsym_failed) + return NULL; + udev = udev_new(); device = udev_device_new_from_fd(udev, fd); if (device == NULL) diff --git a/mesalib/src/mapi/glapi/gen/gl_enums.py b/mesalib/src/mapi/glapi/gen/gl_enums.py index 0214932b6..35919d68a 100644 --- a/mesalib/src/mapi/glapi/gen/gl_enums.py +++ b/mesalib/src/mapi/glapi/gen/gl_enums.py @@ -82,10 +82,10 @@ const char *_mesa_lookup_enum_by_nr( int nr ) STATIC_ASSERT(sizeof(enum_string_table) < (1 << 16)); - elt = _mesa_bsearch(& nr, enum_string_table_offsets, - Elements(enum_string_table_offsets), - sizeof(enum_string_table_offsets[0]), - (cfunc) compar_nr); + elt = bsearch(& nr, enum_string_table_offsets, + Elements(enum_string_table_offsets), + sizeof(enum_string_table_offsets[0]), + (cfunc) compar_nr); if (elt != NULL) { return &enum_string_table[elt->offset]; diff --git a/mesalib/src/mapi/glapi/gen/gl_gentable.py b/mesalib/src/mapi/glapi/gen/gl_gentable.py index ce9af99d5..deffcee4d 100644 --- a/mesalib/src/mapi/glapi/gen/gl_gentable.py +++ b/mesalib/src/mapi/glapi/gen/gl_gentable.py @@ -42,7 +42,7 @@ header = """/* GLXEXT is the define used in the xserver when the GLX extension i #endif #if (defined(GLXEXT) && defined(HAVE_BACKTRACE)) \\ - || (!defined(GLXEXT) && defined(DEBUG) && !defined(_WIN32_WCE) && !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__)) + || (!defined(GLXEXT) && defined(DEBUG) && !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__)) #define USE_BACKTRACE #endif diff --git a/mesalib/src/mapi/glapi/gen/gl_x86_asm.py b/mesalib/src/mapi/glapi/gen/gl_x86_asm.py index 919bbc032..d87d0bd24 100644 --- a/mesalib/src/mapi/glapi/gen/gl_x86_asm.py +++ b/mesalib/src/mapi/glapi/gen/gl_x86_asm.py @@ -72,7 +72,7 @@ class PrintGenericStubs(gl_XML.gl_print_base): print '' print '#define GL_OFFSET(x) CODEPTR(REGOFF(4 * x, EAX))' print '' - print '#if defined(GNU_ASSEMBLER) && !defined(__DJGPP__) && !defined(__MINGW32__) && !defined(__APPLE__)' + print '#if defined(GNU_ASSEMBLER) && !defined(__MINGW32__) && !defined(__APPLE__)' print '#define GLOBL_FN(x) GLOBL x ; .type x, @function' print '#else' print '#define GLOBL_FN(x) GLOBL x' diff --git a/mesalib/src/mapi/glapi/glapi_nop.c b/mesalib/src/mapi/glapi/glapi_nop.c index 2597c8cb8..628276e93 100644 --- a/mesalib/src/mapi/glapi/glapi_nop.c +++ b/mesalib/src/mapi/glapi/glapi_nop.c @@ -63,7 +63,7 @@ _glapi_set_warning_func(_glapi_proc func) static int Warn(const char *func) { -#if defined(DEBUG) && !defined(_WIN32_WCE) +#if defined(DEBUG) if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) { fprintf(stderr, "GL User Error: gl%s called without a rendering context\n", func); @@ -103,11 +103,9 @@ NoOpUnused(void) static int NoOpGeneric(void) { -#if !defined(_WIN32_WCE) if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) { fprintf(stderr, "GL User Error: calling GL function without a rendering context\n"); } -#endif return 0; } diff --git a/mesalib/src/mesa/Makefile.sources b/mesalib/src/mesa/Makefile.sources index 12336c074..475501877 100644 --- a/mesalib/src/mesa/Makefile.sources +++ b/mesalib/src/mesa/Makefile.sources @@ -280,7 +280,6 @@ PROGRAM_FILES = \ $(SRCDIR)program/prog_print.c \ $(SRCDIR)program/prog_statevars.c \ $(SRCDIR)program/programopt.c \ - $(SRCDIR)program/register_allocate.c \ $(SRCDIR)program/sampler.cpp \ $(SRCDIR)program/string_to_uint_map.cpp \ $(SRCDIR)program/symbol_table.c \ diff --git a/mesalib/src/mesa/drivers/common/meta_blit.c b/mesalib/src/mesa/drivers/common/meta_blit.c index fc9848a7a..770bc4178 100644 --- a/mesalib/src/mesa/drivers/common/meta_blit.c +++ b/mesalib/src/mesa/drivers/common/meta_blit.c @@ -70,26 +70,28 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx, const char *sampler_array_suffix = ""; char *name; const char *texcoord_type = "vec2"; - const int samples = MAX2(src_rb->NumSamples, 1); + int samples; int shader_offset = 0; - /* We expect only power of 2 samples in source multisample buffer. */ - assert((samples & (samples - 1)) == 0); - while (samples >> (shader_offset + 1)) { - shader_offset++; - } - /* Update the assert if we plan to support more than 16X MSAA. */ - assert(shader_offset >= 0 && shader_offset <= 4); - if (src_rb) { + samples = MAX2(src_rb->NumSamples, 1); src_datatype = _mesa_get_format_datatype(src_rb->Format); } else { /* depth-or-color glCopyTexImage fallback path that passes a NULL rb and * doesn't handle integer. */ + samples = 1; src_datatype = GL_UNSIGNED_NORMALIZED; } + /* We expect only power of 2 samples in source multisample buffer. */ + assert((samples & (samples - 1)) == 0); + while (samples >> (shader_offset + 1)) { + shader_offset++; + } + /* Update the assert if we plan to support more than 16X MSAA. */ + assert(shader_offset >= 0 && shader_offset <= 4); + if (ctx->DrawBuffer->Visual.samples > 1) { /* If you're calling meta_BlitFramebuffer with the destination * multisampled, this is the only path that will work -- swrast and @@ -108,8 +110,8 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx, switch (target) { case GL_TEXTURE_2D_MULTISAMPLE: case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: - if (src_rb->_BaseFormat == GL_DEPTH_COMPONENT || - src_rb->_BaseFormat == GL_DEPTH_STENCIL) { + if (src_rb && (src_rb->_BaseFormat == GL_DEPTH_COMPONENT || + src_rb->_BaseFormat == GL_DEPTH_STENCIL)) { if (dst_is_msaa) shader_index = BLIT_MSAA_SHADER_2D_MULTISAMPLE_DEPTH_COPY; else @@ -624,13 +626,20 @@ _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx, GLenum *target) { struct gl_texture_image *texImage; + GLuint tempTex; if (rb->NumSamples > 1) *target = GL_TEXTURE_2D_MULTISAMPLE; else *target = GL_TEXTURE_2D; - _mesa_GenTextures(1, tex); + tempTex = 0; + _mesa_GenTextures(1, &tempTex); + if (tempTex == 0) + return false; + + *tex = tempTex; + _mesa_BindTexture(*target, *tex); *texObj = _mesa_lookup_texture(ctx, *tex); texImage = _mesa_get_tex_image(ctx, *texObj, *target, 0); diff --git a/mesalib/src/mesa/drivers/common/meta_copy_image.c b/mesalib/src/mesa/drivers/common/meta_copy_image.c index 0c204b87d..fc0cbaf1b 100644 --- a/mesalib/src/mesa/drivers/common/meta_copy_image.c +++ b/mesalib/src/mesa/drivers/common/meta_copy_image.c @@ -63,12 +63,21 @@ make_view(struct gl_context *ctx, struct gl_texture_image *tex_image, if (!ctx->Driver.TestProxyTexImage(ctx, tex_obj->Target, 0, tex_format, tex_image->Width, tex_image->Height, tex_image->Depth, 0)) { + _mesa_DeleteTextures(1, view_tex_name); + *view_tex_name = 0; return false; } view_tex_obj->Target = tex_obj->Target; *view_tex_image = _mesa_get_tex_image(ctx, view_tex_obj, tex_obj->Target, 0); + + if (!*view_tex_image) { + _mesa_DeleteTextures(1, view_tex_name); + *view_tex_name = 0; + return false; + } + _mesa_init_teximage_fields(ctx, *view_tex_image, tex_image->Width, tex_image->Height, tex_image->Depth, diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/ca.po b/mesalib/src/mesa/drivers/dri/common/xmlpool/ca.po index c0cf7f62c..23e9f4211 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/ca.po +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/ca.po @@ -21,20 +21,19 @@ # 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" +"POT-Creation-Date: 2014-09-25 22:29-0600\n" +"PO-Revision-Date: 2014-09-26 14:43-0700\n" "Last-Translator: Alex Henrie \n" "Language-Team: Catalan \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" +"X-Generator: Poedit 1.6.9\n" #: t_options.h:56 msgid "Debugging" @@ -73,8 +72,8 @@ 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" +"Deshabilita les continuacions de línia basades en barra invertida en la font " +"GLSL" #: t_options.h:100 msgid "Disable GL_ARB_shader_bit_encoding" @@ -87,108 +86,112 @@ msgstr "" "Força una versió GLSL per defecte en els shaders als quals falta una línia " "#version explícita" -#: t_options.h:115 +#: t_options.h:110 +msgid "Allow GLSL #extension directives in the middle of shaders" +msgstr "Permet les directives #extension GLSL en el mitjà dels shaders" + +#: t_options.h:120 msgid "Image Quality" msgstr "Qualitat d'Imatge" -#: t_options.h:128 +#: t_options.h:133 msgid "Texture color depth" msgstr "Profunditat de color de textura" -#: t_options.h:129 +#: t_options.h:134 msgid "Prefer frame buffer color depth" msgstr "Prefereix profunditat de color del framebuffer" -#: t_options.h:130 +#: t_options.h:135 msgid "Prefer 32 bits per texel" msgstr "Prefereix 32 bits per texel" -#: t_options.h:131 +#: t_options.h:136 msgid "Prefer 16 bits per texel" msgstr "Prefereix 16 bits per texel" -#: t_options.h:132 +#: t_options.h:137 msgid "Force 16 bits per texel" msgstr "Força 16 bits per texel" -#: t_options.h:138 +#: t_options.h:143 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 +#: t_options.h:148 msgid "Forbid negative texture LOD bias" msgstr "" "Prohibeix una parcialitat negativa del Nivell de Detalle (LOD) de les " "textures" -#: t_options.h:148 +#: t_options.h:153 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 " +"Habilita la compressió de textures S3TC encara que el suport de programari " "no estigui disponible" -#: t_options.h:155 +#: t_options.h:160 msgid "Initial color reduction method" msgstr "Mètode inicial de reducció de color" -#: t_options.h:156 +#: t_options.h:161 msgid "Round colors" msgstr "Colors arrodonits" -#: t_options.h:157 +#: t_options.h:162 msgid "Dither colors" msgstr "Colors tramats" -#: t_options.h:165 +#: t_options.h:170 msgid "Color rounding method" msgstr "Mètode d'arrodoniment de color" -#: t_options.h:166 +#: t_options.h:171 msgid "Round color components downward" msgstr "Arrondeix els components de color a baix" -#: t_options.h:167 +#: t_options.h:172 msgid "Round to nearest color" msgstr "Arrondeix al color més proper" -#: t_options.h:176 +#: t_options.h:181 msgid "Color dithering method" msgstr "Mètode de tramat de color" -#: t_options.h:177 +#: t_options.h:182 msgid "Horizontal error diffusion" msgstr "Difusió d'error horitzontal" -#: t_options.h:178 +#: t_options.h:183 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 +#: t_options.h:184 msgid "Ordered 2D color dithering" msgstr "Tramat de color 2D ordenat" -#: t_options.h:185 +#: t_options.h:190 msgid "Floating point depth buffer" msgstr "Buffer de profunditat de punt flotant" -#: t_options.h:190 +#: t_options.h:195 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 +#: t_options.h:200 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 +#: t_options.h:205 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 +#: t_options.h:210 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 +#: t_options.h:215 msgid "" "Morphological anti-aliasing based on Jimenez\\' MLAA. 0 to disable, 8 for " "default quality" @@ -196,7 +199,7 @@ msgstr "" "Antialiàsing morfològic basat en el MLAA de Jimenez. 0 per deshabilitar, 8 " "per qualitat per defecte" -#: t_options.h:215 +#: t_options.h:220 msgid "" "Morphological anti-aliasing based on Jimenez\\' MLAA. 0 to disable, 8 for " "default quality. Color version, usable with 2d GL apps" @@ -205,68 +208,68 @@ msgstr "" "per qualitat per defecte. Versió en color, utilitzable amb les aplicacions " "GL 2D" -#: t_options.h:225 +#: t_options.h:230 msgid "Performance" msgstr "Rendiment" -#: t_options.h:233 +#: t_options.h:238 msgid "TCL mode (Transformation, Clipping, Lighting)" msgstr "Mode TCL (Transformació, Retall, Il·luminació)" -#: t_options.h:234 +#: t_options.h:239 msgid "Use software TCL pipeline" msgstr "Utilitza la canonada TCL de programari" -#: t_options.h:235 +#: t_options.h:240 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 +#: t_options.h:241 msgid "Bypass the TCL pipeline" msgstr "Passar per alt la canonada TCL" -#: t_options.h:237 +#: t_options.h:242 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 +#: t_options.h:251 msgid "Method to limit rendering latency" msgstr "Mètode per a limitar la latència de renderització" -#: t_options.h:247 +#: t_options.h:252 msgid "Busy waiting for the graphics hardware" msgstr "Espera activa pel maquinari de gràfics" -#: t_options.h:248 +#: t_options.h:253 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 +#: t_options.h:254 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 +#: t_options.h:264 msgid "Synchronization with vertical refresh (swap intervals)" msgstr "Sincronització amb refresc vertical (intervals d'intercanvi)" -#: t_options.h:260 +#: t_options.h:265 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 +#: t_options.h:266 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 +#: t_options.h:267 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 +#: t_options.h:268 msgid "" "Always synchronize with vertical refresh, application chooses the minimum " "swap interval" @@ -274,48 +277,56 @@ msgstr "" "Sempre sincronitza amb el refresc vertical, l'aplicació tria l'interval " "mínim d'intercanvi" -#: t_options.h:271 +#: t_options.h:276 msgid "Use HyperZ to boost performance" msgstr "Utilitza el HyperZ per a augmentar el rendiment" -#: t_options.h:276 +#: t_options.h:281 msgid "Number of texture units used" msgstr "Nombre d'unitats de textura utilitzades" -#: t_options.h:281 +#: t_options.h:286 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 +#: t_options.h:294 msgid "Used types of texture memory" msgstr "Tipus utilitzats de memòria de textura" -#: t_options.h:290 +#: t_options.h:295 msgid "All available memory" msgstr "Tota la memòria disponible" -#: t_options.h:291 +#: t_options.h:296 msgid "Only card memory (if available)" msgstr "Només memòria de tarjeta (si està disponible)" -#: t_options.h:292 +#: t_options.h:297 msgid "Only GART (AGP/PCIE) memory (if available)" msgstr "Només memòria GART (AGP/PCIE) (si està disponible)" -#: t_options.h:304 +#: t_options.h:309 msgid "Features that are not hardware-accelerated" msgstr "Característiques no accelerades per maquinari" -#: t_options.h:308 +#: t_options.h:313 msgid "Enable extension GL_ARB_vertex_program" msgstr "Habilita l'extensió GL_ARB_vertex_program" -#: t_options.h:318 +#: t_options.h:323 msgid "Miscellaneous" msgstr "Miscel·lània" -#: t_options.h:322 +#: t_options.h:327 msgid "Create all visuals with a depth buffer" msgstr "Crea tots els visuals amb buffer de profunditat" + +#: t_options.h:337 +msgid "Initialization" +msgstr "Inicialització" + +#: t_options.h:341 +msgid "Define the graphic device to use if possible" +msgstr "Defineix el dispositiu de gràfics que usar si és possible" diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/de.po b/mesalib/src/mesa/drivers/dri/common/xmlpool/de.po index fff7e8bef..7b20d00a6 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: 2014-01-13 22:30-0700\n" +"POT-Creation-Date: 2014-09-25 22:29-0600\n" "PO-Revision-Date: 2005-04-11 01:34+0200\n" "Last-Translator: Felix Kuehling \n" "Language-Team: German \n" @@ -63,106 +63,110 @@ msgid "" "Force a default GLSL version for shaders that lack an explicit #version line" msgstr "" -#: t_options.h:115 +#: t_options.h:110 +msgid "Allow GLSL #extension directives in the middle of shaders" +msgstr "" + +#: t_options.h:120 msgid "Image Quality" msgstr "Bildqualität" -#: t_options.h:128 +#: t_options.h:133 msgid "Texture color depth" msgstr "Texturfarbtiefe" -#: t_options.h:129 +#: t_options.h:134 msgid "Prefer frame buffer color depth" msgstr "Bevorzuge Farbtiefe des Framebuffers" -#: t_options.h:130 +#: t_options.h:135 msgid "Prefer 32 bits per texel" msgstr "Bevorzuge 32 bits pro Texel" -#: t_options.h:131 +#: t_options.h:136 msgid "Prefer 16 bits per texel" msgstr "Bevorzuge 16 bits pro Texel" -#: t_options.h:132 +#: t_options.h:137 msgid "Force 16 bits per texel" msgstr "Erzwinge 16 bits pro Texel" -#: t_options.h:138 +#: t_options.h:143 msgid "Initial maximum value for anisotropic texture filtering" msgstr "Initialer Maximalwert für anisotropische Texturfilterung" -#: t_options.h:143 +#: t_options.h:148 msgid "Forbid negative texture LOD bias" msgstr "Verbiete negative Textur-Detailgradverschiebung" -#: t_options.h:148 +#: t_options.h:153 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:155 +#: t_options.h:160 msgid "Initial color reduction method" msgstr "Initiale Farbreduktionsmethode" -#: t_options.h:156 +#: t_options.h:161 msgid "Round colors" msgstr "Farben runden" -#: t_options.h:157 +#: t_options.h:162 msgid "Dither colors" msgstr "Farben rastern" -#: t_options.h:165 +#: t_options.h:170 msgid "Color rounding method" msgstr "Farbrundungsmethode" -#: t_options.h:166 +#: t_options.h:171 msgid "Round color components downward" msgstr "Farbkomponenten abrunden" -#: t_options.h:167 +#: t_options.h:172 msgid "Round to nearest color" msgstr "Zur ähnlichsten Farbe runden" -#: t_options.h:176 +#: t_options.h:181 msgid "Color dithering method" msgstr "Farbrasterungsmethode" -#: t_options.h:177 +#: t_options.h:182 msgid "Horizontal error diffusion" msgstr "Horizontale Fehlerstreuung" -#: t_options.h:178 +#: t_options.h:183 msgid "Horizontal error diffusion, reset error at line start" msgstr "Horizontale Fehlerstreuung, Fehler am Zeilenanfang zurücksetzen" -#: t_options.h:179 +#: t_options.h:184 msgid "Ordered 2D color dithering" msgstr "Geordnete 2D Farbrasterung" -#: t_options.h:185 +#: t_options.h:190 msgid "Floating point depth buffer" msgstr "Fließkomma z-Puffer" -#: t_options.h:190 +#: t_options.h:195 msgid "A post-processing filter to cel-shade the output" msgstr "Nachbearbeitungsfilter für Cell Shading" -#: t_options.h:195 +#: t_options.h:200 msgid "A post-processing filter to remove the red channel" msgstr "Nachbearbeitungsfilter zum Entfernen des Rotkanals" -#: t_options.h:200 +#: t_options.h:205 msgid "A post-processing filter to remove the green channel" msgstr "Nachbearbeitungsfilter zum Entfernen des Grünkanals" -#: t_options.h:205 +#: t_options.h:210 msgid "A post-processing filter to remove the blue channel" msgstr "Nachbearbeitungsfilter zum Entfernen des Blaukanals" -#: t_options.h:210 +#: t_options.h:215 msgid "" "Morphological anti-aliasing based on Jimenez\\' MLAA. 0 to disable, 8 for " "default quality" @@ -170,7 +174,7 @@ msgstr "" "Morphologische Kantenglättung (Anti-Aliasing) basierend auf Jimenez' MLAA. 0 " "für deaktiviert, 8 für Standardqualität" -#: t_options.h:215 +#: t_options.h:220 msgid "" "Morphological anti-aliasing based on Jimenez\\' MLAA. 0 to disable, 8 for " "default quality. Color version, usable with 2d GL apps" @@ -178,69 +182,69 @@ 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 +#: t_options.h:230 msgid "Performance" msgstr "Leistung" -#: t_options.h:233 +#: t_options.h:238 msgid "TCL mode (Transformation, Clipping, Lighting)" msgstr "TCL-Modus (Transformation, Clipping, Licht)" -#: t_options.h:234 +#: t_options.h:239 msgid "Use software TCL pipeline" msgstr "Benutze die Software-TCL-Pipeline" -#: t_options.h:235 +#: t_options.h:240 msgid "Use hardware TCL as first TCL pipeline stage" msgstr "Benutze Hardware TCL als erste Stufe der TCL-Pipeline" -#: t_options.h:236 +#: t_options.h:241 msgid "Bypass the TCL pipeline" msgstr "Umgehe die TCL-Pipeline" -#: t_options.h:237 +#: t_options.h:242 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:246 +#: t_options.h:251 msgid "Method to limit rendering latency" msgstr "Methode zur Begrenzung der Bildverzögerung" -#: t_options.h:247 +#: t_options.h:252 msgid "Busy waiting for the graphics hardware" msgstr "Aktives Warten auf die Grafikhardware" -#: t_options.h:248 +#: t_options.h:253 msgid "Sleep for brief intervals while waiting for the graphics hardware" msgstr "Kurze Schlafintervalle beim Warten auf die Grafikhardware" -#: t_options.h:249 +#: t_options.h:254 msgid "Let the graphics hardware emit a software interrupt and sleep" msgstr "" "Die Grafikhardware eine Softwareunterbrechnung erzeugen lassen und schlafen" -#: t_options.h:259 +#: t_options.h:264 msgid "Synchronization with vertical refresh (swap intervals)" msgstr "Synchronisation mit der vertikalen Bildwiederholung" -#: t_options.h:260 +#: t_options.h:265 msgid "Never synchronize with vertical refresh, ignore application's choice" msgstr "" "Niemals mit der Bildwiederholung synchronisieren, Anweisungen der Anwendung " "ignorieren" -#: t_options.h:261 +#: t_options.h:266 msgid "Initial swap interval 0, obey application's choice" msgstr "Initiales Bildinterval 0, Anweisungen der Anwendung gehorchen" -#: t_options.h:262 +#: t_options.h:267 msgid "Initial swap interval 1, obey application's choice" msgstr "Initiales Bildinterval 1, Anweisungen der Anwendung gehorchen" -#: t_options.h:263 +#: t_options.h:268 msgid "" "Always synchronize with vertical refresh, application chooses the minimum " "swap interval" @@ -248,52 +252,60 @@ msgstr "" "Immer mit der Bildwiederholung synchronisieren, Anwendung wählt das minimale " "Bildintervall" -#: t_options.h:271 +#: t_options.h:276 msgid "Use HyperZ to boost performance" msgstr "HyperZ zur Leistungssteigerung verwenden" -#: t_options.h:276 +#: t_options.h:281 msgid "Number of texture units used" msgstr "Anzahl der benutzten Textureinheiten" -#: t_options.h:281 +#: t_options.h:286 msgid "Texture filtering quality vs. speed, AKA “brilinear” texture filtering" msgstr "" "Texturfilterqualität versus -geschwindigkeit, auch bekannt als „brilineare“ " "Texturfilterung" -#: t_options.h:289 +#: t_options.h:294 msgid "Used types of texture memory" msgstr "Benutzte Arten von Texturspeicher" -#: t_options.h:290 +#: t_options.h:295 msgid "All available memory" msgstr "Aller verfügbarer Speicher" -#: t_options.h:291 +#: t_options.h:296 msgid "Only card memory (if available)" msgstr "Nur Grafikspeicher (falls verfügbar)" -#: t_options.h:292 +#: t_options.h:297 msgid "Only GART (AGP/PCIE) memory (if available)" msgstr "Nur GART-Speicher (AGP/PCIE) (falls verfügbar)" -#: t_options.h:304 +#: t_options.h:309 msgid "Features that are not hardware-accelerated" msgstr "Funktionalität, die nicht hardwarebeschleunigt ist" -#: t_options.h:308 +#: t_options.h:313 msgid "Enable extension GL_ARB_vertex_program" msgstr "Erweiterung GL_ARB_vertex_program aktivieren" -#: t_options.h:318 +#: t_options.h:323 msgid "Miscellaneous" msgstr "" -#: t_options.h:322 +#: t_options.h:327 msgid "Create all visuals with a depth buffer" msgstr "" +#: t_options.h:337 +msgid "Initialization" +msgstr "" + +#: t_options.h:341 +msgid "Define the graphic device to use if possible" +msgstr "" + #~ msgid "Support larger textures not guaranteed to fit into graphics memory" #~ msgstr "" #~ "Unterstütze grosse Texturen die evtl. nicht in den Grafikspeicher passen" diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/es.po b/mesalib/src/mesa/drivers/dri/common/xmlpool/es.po index 4a6ab91a5..a68c329a5 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/es.po +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/es.po @@ -9,8 +9,8 @@ msgid "" msgstr "" "Project-Id-Version: es\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-01-13 22:30-0700\n" -"PO-Revision-Date: 2014-01-15 10:34-0700\n" +"POT-Creation-Date: 2014-09-25 22:29-0600\n" +"PO-Revision-Date: 2014-09-26 14:22-0700\n" "Last-Translator: Alex Henrie \n" "Language-Team: Spanish \n" "Language: es\n" @@ -18,7 +18,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 1.5.4\n" +"X-Generator: Poedit 1.6.9\n" #: t_options.h:56 msgid "Debugging" @@ -70,106 +70,110 @@ 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 +#: t_options.h:110 +msgid "Allow GLSL #extension directives in the middle of shaders" +msgstr "Permite directivas #extension GLSL en medio de los shaders" + +#: t_options.h:120 msgid "Image Quality" msgstr "Calidad de imagen" -#: t_options.h:128 +#: t_options.h:133 msgid "Texture color depth" msgstr "Profundidad de color de textura" -#: t_options.h:129 +#: t_options.h:134 msgid "Prefer frame buffer color depth" msgstr "Preferir profundidad de color del framebuffer" -#: t_options.h:130 +#: t_options.h:135 msgid "Prefer 32 bits per texel" msgstr "Preferir 32 bits por texel" -#: t_options.h:131 +#: t_options.h:136 msgid "Prefer 16 bits per texel" msgstr "Preferir 16 bits por texel" -#: t_options.h:132 +#: t_options.h:137 msgid "Force 16 bits per texel" msgstr "Forzar a 16 bits por texel" -#: t_options.h:138 +#: t_options.h:143 msgid "Initial maximum value for anisotropic texture filtering" msgstr "Valor máximo inicial para filtrado anisotrópico de textura" -#: t_options.h:143 +#: t_options.h:148 msgid "Forbid negative texture LOD bias" msgstr "Prohibir valores negativos de Nivel De Detalle (LOD) de texturas" -#: t_options.h:148 +#: t_options.h:153 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:155 +#: t_options.h:160 msgid "Initial color reduction method" msgstr "Método inicial de reducción de color" -#: t_options.h:156 +#: t_options.h:161 msgid "Round colors" msgstr "Colores redondeados" -#: t_options.h:157 +#: t_options.h:162 msgid "Dither colors" msgstr "Colores suavizados" -#: t_options.h:165 +#: t_options.h:170 msgid "Color rounding method" msgstr "Método de redondeo de colores" -#: t_options.h:166 +#: t_options.h:171 msgid "Round color components downward" msgstr "Redondear hacia abajo los componentes de color" -#: t_options.h:167 +#: t_options.h:172 msgid "Round to nearest color" msgstr "Redondear al color más cercano" -#: t_options.h:176 +#: t_options.h:181 msgid "Color dithering method" msgstr "Método de suavizado de color" -#: t_options.h:177 +#: t_options.h:182 msgid "Horizontal error diffusion" msgstr "Difusión de error horizontal" -#: t_options.h:178 +#: t_options.h:183 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:179 +#: t_options.h:184 msgid "Ordered 2D color dithering" msgstr "Suavizado de color 2D ordenado" -#: t_options.h:185 +#: t_options.h:190 msgid "Floating point depth buffer" msgstr "Búfer de profundidad en coma flotante" -#: t_options.h:190 +#: t_options.h:195 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 +#: t_options.h:200 msgid "A post-processing filter to remove the red channel" msgstr "Un filtro de postprocesamiento para eliminar el canal rojo" -#: t_options.h:200 +#: t_options.h:205 msgid "A post-processing filter to remove the green channel" msgstr "Un filtro de postprocesamiento para eliminar el canal verde" -#: t_options.h:205 +#: t_options.h:210 msgid "A post-processing filter to remove the blue channel" msgstr "Un filtro de postprocesamiento para eliminar el canal azul" -#: t_options.h:210 +#: t_options.h:215 msgid "" "Morphological anti-aliasing based on Jimenez\\' MLAA. 0 to disable, 8 for " "default quality" @@ -177,7 +181,7 @@ msgstr "" "Antialiasing morfológico basado en el MLAA de Jimenez. 0 para deshabilitar, " "8 para calidad por defecto" -#: t_options.h:215 +#: t_options.h:220 msgid "" "Morphological anti-aliasing based on Jimenez\\' MLAA. 0 to disable, 8 for " "default quality. Color version, usable with 2d GL apps" @@ -185,71 +189,71 @@ 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 +#: t_options.h:230 msgid "Performance" msgstr "Rendimiento" -#: t_options.h:233 +#: t_options.h:238 msgid "TCL mode (Transformation, Clipping, Lighting)" msgstr "Modo TCL (Transformación, Recorte, Iluminación)" -#: t_options.h:234 +#: t_options.h:239 msgid "Use software TCL pipeline" msgstr "Usar tubería TCL por software" -#: t_options.h:235 +#: t_options.h:240 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:236 +#: t_options.h:241 msgid "Bypass the TCL pipeline" msgstr "Pasar por alto la tubería TCL" -#: t_options.h:237 +#: t_options.h:242 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:246 +#: t_options.h:251 msgid "Method to limit rendering latency" msgstr "Método para limitar la latencia de renderización" -#: t_options.h:247 +#: t_options.h:252 msgid "Busy waiting for the graphics hardware" msgstr "Esperar activamente al hardware gráfico" -#: t_options.h:248 +#: t_options.h:253 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:249 +#: t_options.h:254 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" -#: t_options.h:259 +#: t_options.h:264 msgid "Synchronization with vertical refresh (swap intervals)" msgstr "Sincronización con el refresco vertical (intervalos de intercambio)" -#: t_options.h:260 +#: t_options.h:265 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" -#: t_options.h:261 +#: t_options.h:266 msgid "Initial swap interval 0, obey application's choice" msgstr "" "Intervalo de intercambio inicial 0, obedecer la elección de la aplicación" -#: t_options.h:262 +#: t_options.h:267 msgid "Initial swap interval 1, obey application's choice" msgstr "" "Intervalo de intercambio inicial 1, obedecer la elección de la aplicación" -#: t_options.h:263 +#: t_options.h:268 msgid "" "Always synchronize with vertical refresh, application chooses the minimum " "swap interval" @@ -257,48 +261,56 @@ msgstr "" "Sincronizar siempre con el refresco vertical, la aplicación elige el " "intervalo de intercambio mínimo" -#: t_options.h:271 +#: t_options.h:276 msgid "Use HyperZ to boost performance" msgstr "Usar HyperZ para potenciar rendimiento" -#: t_options.h:276 +#: t_options.h:281 msgid "Number of texture units used" msgstr "Número de unidades de textura usadas" -#: t_options.h:281 +#: t_options.h:286 msgid "Texture filtering quality vs. speed, AKA “brilinear” texture filtering" msgstr "" "Calidad de filtrado de textura vs. velocidad, alias filtrado \"brilinear\" " "de textura" -#: t_options.h:289 +#: t_options.h:294 msgid "Used types of texture memory" msgstr "Tipos de memoria de textura usados" -#: t_options.h:290 +#: t_options.h:295 msgid "All available memory" msgstr "Toda la memoria disponible" -#: t_options.h:291 +#: t_options.h:296 msgid "Only card memory (if available)" msgstr "Solo memoria de tarjeta (si está disponible)" -#: t_options.h:292 +#: t_options.h:297 msgid "Only GART (AGP/PCIE) memory (if available)" msgstr "Solo memoria GART (AGP/PCIE) (si está disponible)" -#: t_options.h:304 +#: t_options.h:309 msgid "Features that are not hardware-accelerated" msgstr "Características no aceleradas por hardware" -#: t_options.h:308 +#: t_options.h:313 msgid "Enable extension GL_ARB_vertex_program" msgstr "Habilitar la extensión GL_ARB_vertex_program" -#: t_options.h:318 +#: t_options.h:323 msgid "Miscellaneous" msgstr "Misceláneo" -#: t_options.h:322 +#: t_options.h:327 msgid "Create all visuals with a depth buffer" msgstr "Crear todos los visuales con buffer de profundidad" + +#: t_options.h:337 +msgid "Initialization" +msgstr "Inicialización" + +#: t_options.h:341 +msgid "Define the graphic device to use if possible" +msgstr "Define el dispositivo de gráficos que usar si es posible" diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/fr.po b/mesalib/src/mesa/drivers/dri/common/xmlpool/fr.po index 4a747b355..fa069652c 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/fr.po +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Mesa 6.3\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-01-13 22:30-0700\n" +"POT-Creation-Date: 2014-09-25 22:29-0600\n" "PO-Revision-Date: 2005-04-11 01:34+0200\n" "Last-Translator: Stephane Marchesin \n" "Language-Team: French \n" @@ -62,182 +62,186 @@ msgid "" "Force a default GLSL version for shaders that lack an explicit #version line" msgstr "" -#: t_options.h:115 +#: t_options.h:110 +msgid "Allow GLSL #extension directives in the middle of shaders" +msgstr "" + +#: t_options.h:120 msgid "Image Quality" msgstr "Qualité d'image" -#: t_options.h:128 +#: t_options.h:133 msgid "Texture color depth" msgstr "Profondeur de texture" -#: t_options.h:129 +#: t_options.h:134 msgid "Prefer frame buffer color depth" msgstr "Profondeur de couleur" -#: t_options.h:130 +#: t_options.h:135 msgid "Prefer 32 bits per texel" msgstr "Préférer 32 bits par texel" -#: t_options.h:131 +#: t_options.h:136 msgid "Prefer 16 bits per texel" msgstr "Prérérer 16 bits par texel" -#: t_options.h:132 +#: t_options.h:137 msgid "Force 16 bits per texel" msgstr "Forcer 16 bits par texel" -#: t_options.h:138 +#: t_options.h:143 msgid "Initial maximum value for anisotropic texture filtering" msgstr "Valeur maximale initiale pour le filtrage anisotropique de texture" -#: t_options.h:143 +#: t_options.h:148 msgid "Forbid negative texture LOD bias" msgstr "Interdire le LOD bias negatif" -#: t_options.h:148 +#: t_options.h:153 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:155 +#: t_options.h:160 msgid "Initial color reduction method" msgstr "Technique de réduction de couleurs" -#: t_options.h:156 +#: t_options.h:161 msgid "Round colors" msgstr "Arrondir les valeurs de couleur" -#: t_options.h:157 +#: t_options.h:162 msgid "Dither colors" msgstr "Tramer les couleurs" -#: t_options.h:165 +#: t_options.h:170 msgid "Color rounding method" msgstr "Méthode d'arrondi des couleurs" -#: t_options.h:166 +#: t_options.h:171 msgid "Round color components downward" msgstr "Arrondi à l'inférieur" -#: t_options.h:167 +#: t_options.h:172 msgid "Round to nearest color" msgstr "Arrondi au plus proche" -#: t_options.h:176 +#: t_options.h:181 msgid "Color dithering method" msgstr "Méthode de tramage" -#: t_options.h:177 +#: t_options.h:182 msgid "Horizontal error diffusion" msgstr "Diffusion d'erreur horizontale" -#: t_options.h:178 +#: t_options.h:183 msgid "Horizontal error diffusion, reset error at line start" msgstr "Diffusion d'erreur horizontale, réinitialisé pour chaque ligne" -#: t_options.h:179 +#: t_options.h:184 msgid "Ordered 2D color dithering" msgstr "Tramage ordonné des couleurs" -#: t_options.h:185 +#: t_options.h:190 msgid "Floating point depth buffer" msgstr "Z-buffer en virgule flottante" -#: t_options.h:190 +#: t_options.h:195 msgid "A post-processing filter to cel-shade the output" msgstr "" -#: t_options.h:195 +#: t_options.h:200 msgid "A post-processing filter to remove the red channel" msgstr "" -#: t_options.h:200 +#: t_options.h:205 msgid "A post-processing filter to remove the green channel" msgstr "" -#: t_options.h:205 +#: t_options.h:210 msgid "A post-processing filter to remove the blue channel" msgstr "" -#: t_options.h:210 +#: t_options.h:215 msgid "" "Morphological anti-aliasing based on Jimenez\\' MLAA. 0 to disable, 8 for " "default quality" msgstr "" -#: t_options.h:215 +#: t_options.h:220 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 +#: t_options.h:230 msgid "Performance" msgstr "Performance" -#: t_options.h:233 +#: t_options.h:238 msgid "TCL mode (Transformation, Clipping, Lighting)" msgstr "Mode de TCL (Transformation, Clipping, Eclairage)" -#: t_options.h:234 +#: t_options.h:239 msgid "Use software TCL pipeline" msgstr "Utiliser un pipeline TCL logiciel" -#: t_options.h:235 +#: t_options.h:240 msgid "Use hardware TCL as first TCL pipeline stage" msgstr "Utiliser le TCL matériel pour le premier niveau de pipeline" -#: t_options.h:236 +#: t_options.h:241 msgid "Bypass the TCL pipeline" msgstr "Court-circuiter le pipeline TCL" -#: t_options.h:237 +#: t_options.h:242 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 codede " "TCL à la volée" -#: t_options.h:246 +#: t_options.h:251 msgid "Method to limit rendering latency" msgstr "Méthode d'attente de la carte graphique" -#: t_options.h:247 +#: t_options.h:252 msgid "Busy waiting for the graphics hardware" msgstr "Attente active de la carte graphique" -#: t_options.h:248 +#: t_options.h:253 msgid "Sleep for brief intervals while waiting for the graphics hardware" msgstr "Attente utilisant usleep()" -#: t_options.h:249 +#: t_options.h:254 msgid "Let the graphics hardware emit a software interrupt and sleep" msgstr "Utiliser les interruptions" -#: t_options.h:259 +#: t_options.h:264 msgid "Synchronization with vertical refresh (swap intervals)" msgstr "Synchronisation de l'affichage avec le balayage vertical" -#: t_options.h:260 +#: t_options.h:265 msgid "Never synchronize with vertical refresh, ignore application's choice" msgstr "" "Ne jamais synchroniser avec le balayage vertical, ignorer le choix de " "l'application" -#: t_options.h:261 +#: t_options.h:266 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" -#: t_options.h:262 +#: t_options.h:267 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" -#: t_options.h:263 +#: t_options.h:268 msgid "" "Always synchronize with vertical refresh, application chooses the minimum " "swap interval" @@ -245,51 +249,59 @@ msgstr "" "Toujours synchroniser avec le balayage vertical, l'application choisit " "l'intervalle minimal" -#: t_options.h:271 +#: t_options.h:276 msgid "Use HyperZ to boost performance" msgstr "Utiliser le HyperZ pour améliorer les performances" -#: t_options.h:276 +#: t_options.h:281 msgid "Number of texture units used" msgstr "Nombre d'unités de texture" -#: t_options.h:281 +#: t_options.h:286 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:289 +#: t_options.h:294 msgid "Used types of texture memory" msgstr "Types de mémoire de texture" -#: t_options.h:290 +#: t_options.h:295 msgid "All available memory" msgstr "Utiliser toute la mémoire disponible" -#: t_options.h:291 +#: t_options.h:296 msgid "Only card memory (if available)" msgstr "Utiliser uniquement la mémoire graphique (si disponible)" -#: t_options.h:292 +#: t_options.h:297 msgid "Only GART (AGP/PCIE) memory (if available)" msgstr "Utiliser uniquement la mémoire GART (AGP/PCIE) (si disponible)" -#: t_options.h:304 +#: t_options.h:309 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:308 +#: t_options.h:313 msgid "Enable extension GL_ARB_vertex_program" msgstr "Activer l'extension GL_ARB_vertex_program" -#: t_options.h:318 +#: t_options.h:323 msgid "Miscellaneous" msgstr "" -#: t_options.h:322 +#: t_options.h:327 msgid "Create all visuals with a depth buffer" msgstr "" +#: t_options.h:337 +msgid "Initialization" +msgstr "" + +#: t_options.h:341 +msgid "Define the graphic device to use if possible" +msgstr "" + #~ msgid "" #~ "Enable hack to allow larger textures with texture compression on 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 8dc1f5566..86cb6e96d 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/nl.po +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/nl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-01-13 22:30-0700\n" +"POT-Creation-Date: 2014-09-25 22:29-0600\n" "PO-Revision-Date: 2005-04-12 20:09+0200\n" "Last-Translator: Manfred Stienstra \n" "Language-Team: Dutch \n" @@ -62,182 +62,186 @@ msgid "" "Force a default GLSL version for shaders that lack an explicit #version line" msgstr "" -#: t_options.h:115 +#: t_options.h:110 +msgid "Allow GLSL #extension directives in the middle of shaders" +msgstr "" + +#: t_options.h:120 msgid "Image Quality" msgstr "Beeldkwaliteit" -#: t_options.h:128 +#: t_options.h:133 msgid "Texture color depth" msgstr "Textuurkleurendiepte" -#: t_options.h:129 +#: t_options.h:134 msgid "Prefer frame buffer color depth" msgstr "Prefereer kaderbufferkleurdiepte" -#: t_options.h:130 +#: t_options.h:135 msgid "Prefer 32 bits per texel" msgstr "Prefereer 32 bits per texel" -#: t_options.h:131 +#: t_options.h:136 msgid "Prefer 16 bits per texel" msgstr "Prefereer 16 bits per texel" -#: t_options.h:132 +#: t_options.h:137 msgid "Force 16 bits per texel" msgstr "Dwing 16 bits per texel af" -#: t_options.h:138 +#: t_options.h:143 msgid "Initial maximum value for anisotropic texture filtering" msgstr "Initïele maximum waarde voor anisotrophische textuur filtering" -#: t_options.h:143 +#: t_options.h:148 msgid "Forbid negative texture LOD bias" msgstr "Verbied negatief niveau detailonderscheid (LOD) van texturen" -#: t_options.h:148 +#: t_options.h:153 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:155 +#: t_options.h:160 msgid "Initial color reduction method" msgstr "Initïele kleurreductie methode" -#: t_options.h:156 +#: t_options.h:161 msgid "Round colors" msgstr "Rond kleuren af" -#: t_options.h:157 +#: t_options.h:162 msgid "Dither colors" msgstr "Rasteriseer kleuren" -#: t_options.h:165 +#: t_options.h:170 msgid "Color rounding method" msgstr "Kleurafrondingmethode" -#: t_options.h:166 +#: t_options.h:171 msgid "Round color components downward" msgstr "Rond kleurencomponenten af naar beneden" -#: t_options.h:167 +#: t_options.h:172 msgid "Round to nearest color" msgstr "Rond af naar dichtsbijzijnde kleur" -#: t_options.h:176 +#: t_options.h:181 msgid "Color dithering method" msgstr "Kleurrasteriseringsmethode" -#: t_options.h:177 +#: t_options.h:182 msgid "Horizontal error diffusion" msgstr "Horizontale foutdiffusie" -#: t_options.h:178 +#: t_options.h:183 msgid "Horizontal error diffusion, reset error at line start" msgstr "Horizontale foutdiffusie, zet fout bij lijnbegin terug" -#: t_options.h:179 +#: t_options.h:184 msgid "Ordered 2D color dithering" msgstr "Geordende 2D kleurrasterisering" -#: t_options.h:185 +#: t_options.h:190 msgid "Floating point depth buffer" msgstr "Dieptebuffer als commagetal" -#: t_options.h:190 +#: t_options.h:195 msgid "A post-processing filter to cel-shade the output" msgstr "" -#: t_options.h:195 +#: t_options.h:200 msgid "A post-processing filter to remove the red channel" msgstr "" -#: t_options.h:200 +#: t_options.h:205 msgid "A post-processing filter to remove the green channel" msgstr "" -#: t_options.h:205 +#: t_options.h:210 msgid "A post-processing filter to remove the blue channel" msgstr "" -#: t_options.h:210 +#: t_options.h:215 msgid "" "Morphological anti-aliasing based on Jimenez\\' MLAA. 0 to disable, 8 for " "default quality" msgstr "" -#: t_options.h:215 +#: t_options.h:220 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 +#: t_options.h:230 msgid "Performance" msgstr "Prestatie" -#: t_options.h:233 +#: t_options.h:238 msgid "TCL mode (Transformation, Clipping, Lighting)" msgstr "TCL-modus (Transformatie, Clipping, Licht)" -#: t_options.h:234 +#: t_options.h:239 msgid "Use software TCL pipeline" msgstr "Gebruik software TCL pijpleiding" -#: t_options.h:235 +#: t_options.h:240 msgid "Use hardware TCL as first TCL pipeline stage" msgstr "Gebruik hardware TCL as eerste TCL pijpleiding trap" -#: t_options.h:236 +#: t_options.h:241 msgid "Bypass the TCL pipeline" msgstr "Omzeil de TCL pijpleiding" -#: t_options.h:237 +#: t_options.h:242 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:246 +#: t_options.h:251 msgid "Method to limit rendering latency" msgstr "Methode om beeldopbouwvertraging te onderdrukken" -#: t_options.h:247 +#: t_options.h:252 msgid "Busy waiting for the graphics hardware" msgstr "Actief wachten voor de grafische hardware" -#: t_options.h:248 +#: t_options.h:253 msgid "Sleep for brief intervals while waiting for the graphics hardware" msgstr "" "Slaap voor korte intervallen tijdens het wachten op de grafische hardware" -#: t_options.h:249 +#: t_options.h:254 msgid "Let the graphics hardware emit a software interrupt and sleep" msgstr "" "Laat de grafische hardware een software onderbreking uitzenden en in slaap " "vallen" -#: t_options.h:259 +#: t_options.h:264 msgid "Synchronization with vertical refresh (swap intervals)" msgstr "Synchronisatie met verticale verversing (interval omwisselen)" -#: t_options.h:260 +#: t_options.h:265 msgid "Never synchronize with vertical refresh, ignore application's choice" msgstr "" "Nooit synchroniseren met verticale verversing, negeer de keuze van de " "applicatie" -#: t_options.h:261 +#: t_options.h:266 msgid "Initial swap interval 0, obey application's choice" msgstr "Initïeel omwisselingsinterval 0, honoreer de keuze van de applicatie" -#: t_options.h:262 +#: t_options.h:267 msgid "Initial swap interval 1, obey application's choice" msgstr "Initïeel omwisselingsinterval 1, honoreer de keuze van de applicatie" -#: t_options.h:263 +#: t_options.h:268 msgid "" "Always synchronize with vertical refresh, application chooses the minimum " "swap interval" @@ -245,52 +249,60 @@ msgstr "" "Synchroniseer altijd met verticale verversing, de applicatie kiest het " "minimum omwisselingsinterval" -#: t_options.h:271 +#: t_options.h:276 msgid "Use HyperZ to boost performance" msgstr "Gebruik HyperZ om de prestaties te verbeteren" -#: t_options.h:276 +#: t_options.h:281 msgid "Number of texture units used" msgstr "Aantal textuureenheden in gebruik" -#: t_options.h:281 +#: t_options.h:286 msgid "Texture filtering quality vs. speed, AKA “brilinear” texture filtering" msgstr "" "Textuurfilterkwaliteit versus -snelheid, ookwel bekend als “brilineaire” " "textuurfiltering" -#: t_options.h:289 +#: t_options.h:294 msgid "Used types of texture memory" msgstr "Gebruikte soorten textuurgeheugen" -#: t_options.h:290 +#: t_options.h:295 msgid "All available memory" msgstr "Al het beschikbaar geheugen" -#: t_options.h:291 +#: t_options.h:296 msgid "Only card memory (if available)" msgstr "Alleen geheugen op de kaart (als het aanwezig is)" -#: t_options.h:292 +#: t_options.h:297 msgid "Only GART (AGP/PCIE) memory (if available)" msgstr "Alleen GART (AGP/PCIE) geheugen (als het aanwezig is)" -#: t_options.h:304 +#: t_options.h:309 msgid "Features that are not hardware-accelerated" msgstr "Eigenschappen die niet hardwareversneld zijn" -#: t_options.h:308 +#: t_options.h:313 msgid "Enable extension GL_ARB_vertex_program" msgstr "Zet uitbreiding GL_ARB_vertex_program aan" -#: t_options.h:318 +#: t_options.h:323 msgid "Miscellaneous" msgstr "" -#: t_options.h:322 +#: t_options.h:327 msgid "Create all visuals with a depth buffer" msgstr "" +#: t_options.h:337 +msgid "Initialization" +msgstr "" + +#: t_options.h:341 +msgid "Define the graphic device to use if possible" +msgstr "" + #~ msgid "" #~ "Enable hack to allow larger textures with texture compression on 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 082a22a94..d8d7353f4 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/sv.po +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/sv.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Mesa DRI\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-01-13 22:30-0700\n" +"POT-Creation-Date: 2014-09-25 22:29-0600\n" "PO-Revision-Date: 2006-09-18 10:56+0100\n" "Last-Translator: Daniel Nylander \n" "Language-Team: Swedish \n" @@ -62,174 +62,178 @@ msgid "" "Force a default GLSL version for shaders that lack an explicit #version line" msgstr "" -#: t_options.h:115 +#: t_options.h:110 +msgid "Allow GLSL #extension directives in the middle of shaders" +msgstr "" + +#: t_options.h:120 msgid "Image Quality" msgstr "Bildkvalitet" -#: t_options.h:128 +#: t_options.h:133 msgid "Texture color depth" msgstr "Färgdjup för texturer" -#: t_options.h:129 +#: t_options.h:134 msgid "Prefer frame buffer color depth" msgstr "Föredra färgdjupet för framebuffer" -#: t_options.h:130 +#: t_options.h:135 msgid "Prefer 32 bits per texel" msgstr "Föredra 32 bitar per texel" -#: t_options.h:131 +#: t_options.h:136 msgid "Prefer 16 bits per texel" msgstr "Föredra 16 bitar per texel" -#: t_options.h:132 +#: t_options.h:137 msgid "Force 16 bits per texel" msgstr "Tvinga 16 bitar per texel" -#: t_options.h:138 +#: t_options.h:143 msgid "Initial maximum value for anisotropic texture filtering" msgstr "Initialt maximalt värde för anisotropisk texturfiltrering" -#: t_options.h:143 +#: t_options.h:148 msgid "Forbid negative texture LOD bias" msgstr "Förbjud negativ LOD-kompensation för texturer" -#: t_options.h:148 +#: t_options.h:153 msgid "" "Enable S3TC texture compression even if software support is not available" msgstr "Aktivera S3TC-texturkomprimering även om programvarustöd saknas" -#: t_options.h:155 +#: t_options.h:160 msgid "Initial color reduction method" msgstr "Initial färgminskningsmetod" -#: t_options.h:156 +#: t_options.h:161 msgid "Round colors" msgstr "Avrunda färger" -#: t_options.h:157 +#: t_options.h:162 msgid "Dither colors" msgstr "Utjämna färger" -#: t_options.h:165 +#: t_options.h:170 msgid "Color rounding method" msgstr "Färgavrundningsmetod" -#: t_options.h:166 +#: t_options.h:171 msgid "Round color components downward" msgstr "Avrunda färdkomponenter nedåt" -#: t_options.h:167 +#: t_options.h:172 msgid "Round to nearest color" msgstr "Avrunda till närmsta färg" -#: t_options.h:176 +#: t_options.h:181 msgid "Color dithering method" msgstr "Färgutjämningsmetod" -#: t_options.h:177 +#: t_options.h:182 msgid "Horizontal error diffusion" msgstr "Horisontell felspridning" -#: t_options.h:178 +#: t_options.h:183 msgid "Horizontal error diffusion, reset error at line start" msgstr "Horisontell felspridning, återställ fel vid radbörjan" -#: t_options.h:179 +#: t_options.h:184 msgid "Ordered 2D color dithering" msgstr "Ordnad 2D-färgutjämning" -#: t_options.h:185 +#: t_options.h:190 msgid "Floating point depth buffer" msgstr "Buffert för flytande punktdjup" -#: t_options.h:190 +#: t_options.h:195 msgid "A post-processing filter to cel-shade the output" msgstr "" -#: t_options.h:195 +#: t_options.h:200 msgid "A post-processing filter to remove the red channel" msgstr "" -#: t_options.h:200 +#: t_options.h:205 msgid "A post-processing filter to remove the green channel" msgstr "" -#: t_options.h:205 +#: t_options.h:210 msgid "A post-processing filter to remove the blue channel" msgstr "" -#: t_options.h:210 +#: t_options.h:215 msgid "" "Morphological anti-aliasing based on Jimenez\\' MLAA. 0 to disable, 8 for " "default quality" msgstr "" -#: t_options.h:215 +#: t_options.h:220 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 +#: t_options.h:230 msgid "Performance" msgstr "Prestanda" -#: t_options.h:233 +#: t_options.h:238 msgid "TCL mode (Transformation, Clipping, Lighting)" msgstr "TCL-läge (Transformation, Clipping, Lighting)" -#: t_options.h:234 +#: t_options.h:239 msgid "Use software TCL pipeline" msgstr "Använd programvaru-TCL-rörledning" -#: t_options.h:235 +#: t_options.h:240 msgid "Use hardware TCL as first TCL pipeline stage" msgstr "Använd maskinvaru-TCL som första TCL-rörledningssteg" -#: t_options.h:236 +#: t_options.h:241 msgid "Bypass the TCL pipeline" msgstr "Kringgå TCL-rörledningen" -#: t_options.h:237 +#: t_options.h:242 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:246 +#: t_options.h:251 msgid "Method to limit rendering latency" msgstr "Metod för att begränsa renderingslatens" -#: t_options.h:247 +#: t_options.h:252 msgid "Busy waiting for the graphics hardware" msgstr "Upptagen med att vänta på grafikhårdvaran" -#: t_options.h:248 +#: t_options.h:253 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:249 +#: t_options.h:254 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:259 +#: t_options.h:264 msgid "Synchronization with vertical refresh (swap intervals)" msgstr "Synkronisering med vertikal uppdatering (växlingsintervall)" -#: t_options.h:260 +#: t_options.h:265 msgid "Never synchronize with vertical refresh, ignore application's choice" msgstr "Synkronisera aldrig med vertikal uppdatering, ignorera programmets val" -#: t_options.h:261 +#: t_options.h:266 msgid "Initial swap interval 0, obey application's choice" msgstr "Initialt växlingsintervall 0, följ programmets val" -#: t_options.h:262 +#: t_options.h:267 msgid "Initial swap interval 1, obey application's choice" msgstr "Initialt växlingsintervall 1, följ programmets val" -#: t_options.h:263 +#: t_options.h:268 msgid "" "Always synchronize with vertical refresh, application chooses the minimum " "swap interval" @@ -237,52 +241,60 @@ msgstr "" "Synkronisera alltid med vertikal uppdatering, programmet väljer den minsta " "växlingsintervallen" -#: t_options.h:271 +#: t_options.h:276 msgid "Use HyperZ to boost performance" msgstr "Använd HyperZ för att maximera prestandan" -#: t_options.h:276 +#: t_options.h:281 msgid "Number of texture units used" msgstr "Antal använda texturenheter" -#: t_options.h:281 +#: t_options.h:286 msgid "Texture filtering quality vs. speed, AKA “brilinear” texture filtering" msgstr "" "Texturfiltreringskvalitet mot hastighet, även kallad \"brilinear\"-" "texturfiltrering" -#: t_options.h:289 +#: t_options.h:294 msgid "Used types of texture memory" msgstr "Använda typer av texturminne" -#: t_options.h:290 +#: t_options.h:295 msgid "All available memory" msgstr "Allt tillgängligt minne" -#: t_options.h:291 +#: t_options.h:296 msgid "Only card memory (if available)" msgstr "Endast kortminne (om tillgängligt)" -#: t_options.h:292 +#: t_options.h:297 msgid "Only GART (AGP/PCIE) memory (if available)" msgstr "Endast GART-minne (AGP/PCIE) (om tillgängligt)" -#: t_options.h:304 +#: t_options.h:309 msgid "Features that are not hardware-accelerated" msgstr "Funktioner som inte är hårdvaruaccelererade" -#: t_options.h:308 +#: t_options.h:313 msgid "Enable extension GL_ARB_vertex_program" msgstr "Aktivera tillägget GL_ARB_vertex_program" -#: t_options.h:318 +#: t_options.h:323 msgid "Miscellaneous" msgstr "" -#: t_options.h:322 +#: t_options.h:327 msgid "Create all visuals with a depth buffer" msgstr "" +#: t_options.h:337 +msgid "Initialization" +msgstr "" + +#: t_options.h:341 +msgid "Define the graphic device to use if possible" +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" diff --git a/mesalib/src/mesa/main/arrayobj.c b/mesalib/src/mesa/main/arrayobj.c index 0d77b112b..6440ea670 100644 --- a/mesalib/src/mesa/main/arrayobj.c +++ b/mesalib/src/mesa/main/arrayobj.c @@ -230,7 +230,7 @@ _mesa_initialize_vao(struct gl_context *ctx, obj->RefCount = 1; /* Init the individual arrays */ - for (i = 0; i < Elements(obj->_VertexAttrib); i++) { + for (i = 0; i < Elements(obj->VertexAttrib); i++) { switch (i) { case VERT_ATTRIB_WEIGHT: init_array(ctx, obj, VERT_ATTRIB_WEIGHT, 1, GL_FLOAT); diff --git a/mesalib/src/mesa/main/arrayobj.h b/mesalib/src/mesa/main/arrayobj.h index 1819cd12a..3c1f91835 100644 --- a/mesalib/src/mesa/main/arrayobj.h +++ b/mesalib/src/mesa/main/arrayobj.h @@ -78,32 +78,6 @@ extern void _mesa_update_vao_client_arrays(struct gl_context *ctx, struct gl_vertex_array_object *vao); - -/** Returns the bitmask of all enabled arrays in fixed function mode. - * - * In fixed function mode only the traditional fixed function arrays - * are available. - */ -static inline GLbitfield64 -_mesa_array_object_get_enabled_ff(const struct gl_vertex_array_object *vao) -{ - return vao->_Enabled & VERT_BIT_FF_ALL; -} - -/** Returns the bitmask of all enabled arrays in arb/glsl shader mode. - * - * In arb/glsl shader mode all the fixed function and the arb/glsl generic - * arrays are available. Only the first generic array takes - * precedence over the legacy position array. - */ -static inline GLbitfield64 -_mesa_array_object_get_enabled_arb(const struct gl_vertex_array_object *vao) -{ - GLbitfield64 enabled = vao->_Enabled; - return enabled & ~(VERT_BIT_POS & (enabled >> VERT_ATTRIB_GENERIC0)); -} - - /* * API functions */ diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c index ef98ba7fd..d90e6627f 100644 --- a/mesalib/src/mesa/main/attrib.c +++ b/mesalib/src/mesa/main/attrib.c @@ -1449,7 +1449,7 @@ copy_array_object(struct gl_context *ctx, /* In theory must be the same anyway, but on recreate make sure it matches */ dest->ARBsemantics = src->ARBsemantics; - for (i = 0; i < Elements(src->_VertexAttrib); i++) { + for (i = 0; i < Elements(src->VertexAttrib); i++) { _mesa_copy_client_array(ctx, &dest->_VertexAttrib[i], &src->_VertexAttrib[i]); _mesa_copy_vertex_attrib_array(ctx, &dest->VertexAttrib[i], &src->VertexAttrib[i]); _mesa_copy_vertex_buffer_binding(ctx, &dest->VertexBinding[i], &src->VertexBinding[i]); diff --git a/mesalib/src/mesa/main/compiler.h b/mesalib/src/mesa/main/compiler.h index 813bf1905..34671dc7e 100644 --- a/mesalib/src/mesa/main/compiler.h +++ b/mesalib/src/mesa/main/compiler.h @@ -150,7 +150,7 @@ extern "C" { #elif defined(__APPLE__) #include #define CPU_TO_LE32( x ) CFSwapInt32HostToLittle( x ) -#elif (defined(_AIX) || defined(__blrts)) +#elif (defined(_AIX)) static inline GLuint CPU_TO_LE32(GLuint x) { return (((x & 0x000000ff) << 24) | @@ -214,13 +214,11 @@ static inline GLuint CPU_TO_LE32(GLuint x) /** * ASSERT macro */ -#if !defined(_WIN32_WCE) #if defined(DEBUG) # define ASSERT(X) assert(X) #else # define ASSERT(X) #endif -#endif /* diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index 682b9c797..0edd66d6f 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -642,16 +642,14 @@ _mesa_init_constants(struct gl_constants *consts, gl_api api) consts->MaxGeometryTotalOutputComponents = MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS; /* Shading language version */ - if (api == API_OPENGL_COMPAT || api == API_OPENGL_CORE) { - consts->GLSLVersion = 120; - _mesa_override_glsl_version(consts); - } - else if (api == API_OPENGLES2) { - consts->GLSLVersion = 100; - } - else if (api == API_OPENGLES) { - consts->GLSLVersion = 0; /* GLSL not supported */ - } + consts->GLSLVersion = 120; + _mesa_override_glsl_version(consts); + +#ifdef DEBUG + consts->GenerateTemporaryNames = true; +#else + consts->GenerateTemporaryNames = false; +#endif /* GL_ARB_framebuffer_object */ consts->MaxSamples = 0; @@ -690,9 +688,6 @@ _mesa_init_constants(struct gl_constants *consts, gl_api api) /* GL_ARB_robustness */ consts->ResetStrategy = GL_NO_RESET_NOTIFICATION_ARB; - /* PrimitiveRestart */ - consts->PrimitiveRestartInSoftware = GL_FALSE; - /* ES 3.0 or ARB_ES3_compatibility */ consts->MaxElementIndex = 0xffffffffu; @@ -1098,10 +1093,10 @@ _mesa_initialize_context(struct gl_context *ctx, ctx->CurrentDispatch = ctx->OutsideBeginEnd; ctx->FragmentProgram._MaintainTexEnvProgram - = (_mesa_getenv("MESA_TEX_PROG") != NULL); + = (getenv("MESA_TEX_PROG") != NULL); ctx->VertexProgram._MaintainTnlProgram - = (_mesa_getenv("MESA_TNL_PROG") != NULL); + = (getenv("MESA_TNL_PROG") != NULL); if (ctx->VertexProgram._MaintainTnlProgram) { /* this is required... */ ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; @@ -1545,7 +1540,7 @@ handle_first_current(struct gl_context *ctx) * first time each context is made current we'll print some useful * information. */ - if (_mesa_getenv("MESA_INFO")) { + if (getenv("MESA_INFO")) { _mesa_print_info(ctx); } } diff --git a/mesalib/src/mesa/main/debug.c b/mesalib/src/mesa/main/debug.c index a5b40b4b5..089ce8987 100644 --- a/mesalib/src/mesa/main/debug.c +++ b/mesalib/src/mesa/main/debug.c @@ -215,8 +215,8 @@ set_debug_flags(const char *str) void _mesa_init_debug( struct gl_context *ctx ) { - set_debug_flags(_mesa_getenv("MESA_DEBUG")); - set_verbose_flags(_mesa_getenv("MESA_VERBOSE")); + set_debug_flags(getenv("MESA_DEBUG")); + set_verbose_flags(getenv("MESA_VERBOSE")); } diff --git a/mesalib/src/mesa/main/dlopen.h b/mesalib/src/mesa/main/dlopen.h index 55a56f0d7..1e7784914 100644 --- a/mesalib/src/mesa/main/dlopen.h +++ b/mesalib/src/mesa/main/dlopen.h @@ -47,9 +47,7 @@ typedef void (*GenericFunc)(void); static inline void * _mesa_dlopen(const char *libname, int flags) { -#if defined(__blrts) - return NULL; -#elif defined(HAVE_DLOPEN) +#if defined(HAVE_DLOPEN) flags = RTLD_LAZY | RTLD_GLOBAL; /* Overriding flags at this time */ return dlopen(libname, flags); #elif defined(__MINGW32__) @@ -71,16 +69,7 @@ _mesa_dlsym(void *handle, const char *fname) void *v; GenericFunc f; } u; -#if defined(__blrts) - u.v = NULL; -#elif defined(__DJGPP__) - /* need '_' prefix on symbol names */ - char fname2[1000]; - fname2[0] = '_'; - strncpy(fname2 + 1, fname, 998); - fname2[999] = 0; - u.v = dlsym(handle, fname2); -#elif defined(HAVE_DLOPEN) +#if defined(HAVE_DLOPEN) u.v = dlsym(handle, fname); #elif defined(__MINGW32__) u.v = (void *) GetProcAddress(handle, fname); @@ -96,9 +85,7 @@ _mesa_dlsym(void *handle, const char *fname) static inline void _mesa_dlclose(void *handle) { -#if defined(__blrts) - (void) handle; -#elif defined(HAVE_DLOPEN) +#if defined(HAVE_DLOPEN) dlclose(handle); #elif defined(__MINGW32__) FreeLibrary(handle); diff --git a/mesalib/src/mesa/main/errors.c b/mesalib/src/mesa/main/errors.c index 9cde1e020..25171f0ee 100644 --- a/mesalib/src/mesa/main/errors.c +++ b/mesalib/src/mesa/main/errors.c @@ -1170,7 +1170,7 @@ output_if_debug(const char *prefixString, const char *outputString, /* If MESA_LOG_FILE env var is set, log Mesa errors, warnings, * etc to the named file. Otherwise, output to stderr. */ - const char *logFile = _mesa_getenv("MESA_LOG_FILE"); + const char *logFile = getenv("MESA_LOG_FILE"); if (logFile) fout = fopen(logFile, "w"); if (!fout) @@ -1183,7 +1183,7 @@ output_if_debug(const char *prefixString, const char *outputString, debug = 1; #else /* in release builds, be silent unless MESA_DEBUG is set */ - debug = _mesa_getenv("MESA_DEBUG") != NULL; + debug = getenv("MESA_DEBUG") != NULL; #endif } @@ -1194,7 +1194,7 @@ output_if_debug(const char *prefixString, const char *outputString, fprintf(fout, "\n"); fflush(fout); -#if defined(_WIN32) && !defined(_WIN32_WCE) +#if defined(_WIN32) /* stderr from windows applications without console is not usually * visible, so communicate with the debugger instead */ { @@ -1288,7 +1288,7 @@ should_output(struct gl_context *ctx, GLenum error, const char *fmtString) /* Check debug environment variable only once: */ if (debug == -1) { - const char *debugEnv = _mesa_getenv("MESA_DEBUG"); + const char *debugEnv = getenv("MESA_DEBUG"); #ifdef DEBUG if (debugEnv && strstr(debugEnv, "silent")) diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index 553c01e34..f0e2f89e4 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -588,7 +588,7 @@ free_unknown_extensions_strings(void) void _mesa_one_time_init_extension_overrides(void) { - const char *env_const = _mesa_getenv("MESA_EXTENSION_OVERRIDE"); + const char *env_const = getenv("MESA_EXTENSION_OVERRIDE"); char *env; char *ext; int len; @@ -609,6 +609,15 @@ _mesa_one_time_init_extension_overrides(void) /* Copy env_const because strtok() is destructive. */ env = strdup(env_const); + + if (env == NULL || extra_extensions == NULL || + cant_disable_extensions == NULL) { + free(env); + free(extra_extensions); + free(cant_disable_extensions); + return; + } + for (ext = strtok(env, " "); ext != NULL; ext = strtok(NULL, " ")) { int enable; bool recognized; diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index ae3a418cd..8283373a4 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -2303,8 +2303,8 @@ reuse_framebuffer_texture_attachment(struct gl_framebuffer *fb, /** - * Common code called by glFramebufferTexture1D/2D/3DEXT() and - * glFramebufferTextureLayerEXT(). + * Common code called by glFramebufferTexture1D/2D/3D() and + * glFramebufferTextureLayer(). * * \param textarget is the textarget that was passed to the * glFramebufferTexture...() function, or 0 if the corresponding function @@ -2326,14 +2326,14 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, fb = get_framebuffer_target(ctx, target); if (!fb) { _mesa_error(ctx, GL_INVALID_ENUM, - "glFramebufferTexture%sEXT(target=0x%x)", caller, target); + "glFramebufferTexture%s(target=0x%x)", caller, target); return; } /* check framebuffer binding */ if (_mesa_is_winsys_fbo(fb)) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glFramebufferTexture%sEXT", caller); + "glFramebufferTexture%s", caller); return; } @@ -2397,14 +2397,14 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, else { /* can't render to a non-existant texture */ _mesa_error(ctx, GL_INVALID_OPERATION, - "glFramebufferTexture%sEXT(non existant texture)", + "glFramebufferTexture%s(non existant texture)", caller); return; } if (err) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glFramebufferTexture%sEXT(texture target mismatch)", + "glFramebufferTexture%s(texture target mismatch)", caller); return; } @@ -2413,7 +2413,7 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, const GLint maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1); if (zoffset < 0 || zoffset >= maxSize) { _mesa_error(ctx, GL_INVALID_VALUE, - "glFramebufferTexture%sEXT(zoffset)", caller); + "glFramebufferTexture%s(zoffset)", caller); return; } } @@ -2424,7 +2424,7 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, if (zoffset < 0 || zoffset >= (GLint) ctx->Const.MaxArrayTextureLayers) { _mesa_error(ctx, GL_INVALID_VALUE, - "glFramebufferTexture%sEXT(layer)", caller); + "glFramebufferTexture%s(layer)", caller); return; } } @@ -2433,7 +2433,7 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, if ((level < 0) || (level >= _mesa_max_texture_levels(ctx, maxLevelsTarget))) { _mesa_error(ctx, GL_INVALID_VALUE, - "glFramebufferTexture%sEXT(level)", caller); + "glFramebufferTexture%s(level)", caller); return; } } @@ -2441,7 +2441,7 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, att = get_attachment(ctx, fb, attachment); if (att == NULL) { _mesa_error(ctx, GL_INVALID_ENUM, - "glFramebufferTexture%sEXT(attachment)", caller); + "glFramebufferTexture%s(attachment)", caller); return; } @@ -2531,7 +2531,7 @@ _mesa_FramebufferTexture1D(GLenum target, GLenum attachment, if (error) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glFramebufferTexture1DEXT(textarget=%s)", + "glFramebufferTexture1D(textarget=%s)", _mesa_lookup_enum_by_nr(textarget)); return; } @@ -2582,7 +2582,7 @@ _mesa_FramebufferTexture2D(GLenum target, GLenum attachment, if (error) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glFramebufferTexture2DEXT(textarget=%s)", + "glFramebufferTexture2D(textarget=%s)", _mesa_lookup_enum_by_nr(textarget)); return; } @@ -2602,7 +2602,7 @@ _mesa_FramebufferTexture3D(GLenum target, GLenum attachment, if ((texture != 0) && (textarget != GL_TEXTURE_3D)) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glFramebufferTexture3DEXT(textarget)"); + "glFramebufferTexture3D(textarget)"); return; } @@ -2629,7 +2629,7 @@ _mesa_FramebufferTexture(GLenum target, GLenum attachment, GET_CURRENT_CONTEXT(ctx); if (_mesa_has_geometry_shaders(ctx)) { - framebuffer_texture(ctx, "Layer", target, attachment, 0, texture, + framebuffer_texture(ctx, "", target, attachment, 0, texture, level, 0, GL_TRUE); } else { _mesa_error(ctx, GL_INVALID_OPERATION, @@ -2651,26 +2651,26 @@ _mesa_FramebufferRenderbuffer(GLenum target, GLenum attachment, fb = get_framebuffer_target(ctx, target); if (!fb) { _mesa_error(ctx, GL_INVALID_ENUM, - "glFramebufferRenderbufferEXT(target)"); + "glFramebufferRenderbuffer(target)"); return; } if (renderbufferTarget != GL_RENDERBUFFER_EXT) { _mesa_error(ctx, GL_INVALID_ENUM, - "glFramebufferRenderbufferEXT(renderbufferTarget)"); + "glFramebufferRenderbuffer(renderbufferTarget)"); return; } if (_mesa_is_winsys_fbo(fb)) { /* Can't attach new renderbuffers to a window system framebuffer */ - _mesa_error(ctx, GL_INVALID_OPERATION, "glFramebufferRenderbufferEXT"); + _mesa_error(ctx, GL_INVALID_OPERATION, "glFramebufferRenderbuffer"); return; } att = get_attachment(ctx, fb, attachment); if (att == NULL) { _mesa_error(ctx, GL_INVALID_ENUM, - "glFramebufferRenderbufferEXT(invalid attachment %s)", + "glFramebufferRenderbuffer(invalid attachment %s)", _mesa_lookup_enum_by_nr(attachment)); return; } @@ -2679,13 +2679,13 @@ _mesa_FramebufferRenderbuffer(GLenum target, GLenum attachment, rb = _mesa_lookup_renderbuffer(ctx, renderbuffer); if (!rb) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glFramebufferRenderbufferEXT(non-existant" + "glFramebufferRenderbuffer(non-existant" " renderbuffer %u)", renderbuffer); return; } else if (rb == &DummyRenderbuffer) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glFramebufferRenderbufferEXT(renderbuffer %u)", + "glFramebufferRenderbuffer(renderbuffer %u)", renderbuffer); return; } @@ -2701,7 +2701,7 @@ _mesa_FramebufferRenderbuffer(GLenum target, GLenum attachment, const GLenum baseFormat = _mesa_get_format_base_format(rb->Format); if (baseFormat != GL_DEPTH_STENCIL) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glFramebufferRenderbufferEXT(renderbuffer" + "glFramebufferRenderbuffer(renderbuffer" " is not DEPTH_STENCIL format)"); return; } @@ -2734,7 +2734,7 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, buffer = get_framebuffer_target(ctx, target); if (!buffer) { _mesa_error(ctx, GL_INVALID_ENUM, - "glGetFramebufferAttachmentParameterivEXT(target)"); + "glGetFramebufferAttachmentParameteriv(target)"); return; } @@ -2773,7 +2773,7 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, if (att == NULL) { _mesa_error(ctx, GL_INVALID_ENUM, - "glGetFramebufferAttachmentParameterivEXT(attachment)"); + "glGetFramebufferAttachmentParameteriv(attachment)"); return; } @@ -2797,7 +2797,7 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, stencilAtt = get_attachment(ctx, buffer, GL_STENCIL_ATTACHMENT); if (depthAtt->Renderbuffer != stencilAtt->Renderbuffer) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetFramebufferAttachmentParameterivEXT(DEPTH/STENCIL" + "glGetFramebufferAttachmentParameteriv(DEPTH/STENCIL" " attachments differ)"); return; } @@ -2832,7 +2832,7 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, } else if (att->Type == GL_NONE) { _mesa_error(ctx, err, - "glGetFramebufferAttachmentParameterivEXT(pname)"); + "glGetFramebufferAttachmentParameteriv(pname)"); } else { goto invalid_pname_enum; @@ -2849,7 +2849,7 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, } else if (att->Type == GL_NONE) { _mesa_error(ctx, err, - "glGetFramebufferAttachmentParameterivEXT(pname)"); + "glGetFramebufferAttachmentParameteriv(pname)"); } else { goto invalid_pname_enum; @@ -2860,7 +2860,7 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, goto invalid_pname_enum; } else if (att->Type == GL_NONE) { _mesa_error(ctx, err, - "glGetFramebufferAttachmentParameterivEXT(pname)"); + "glGetFramebufferAttachmentParameteriv(pname)"); } else if (att->Type == GL_TEXTURE) { if (att->Texture && att->Texture->Target == GL_TEXTURE_3D) { *params = att->Zoffset; @@ -2881,7 +2881,7 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, } else if (att->Type == GL_NONE) { _mesa_error(ctx, err, - "glGetFramebufferAttachmentParameterivEXT(pname)"); + "glGetFramebufferAttachmentParameteriv(pname)"); } else { if (ctx->Extensions.EXT_framebuffer_sRGB) { @@ -2904,7 +2904,7 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, } else if (att->Type == GL_NONE) { _mesa_error(ctx, err, - "glGetFramebufferAttachmentParameterivEXT(pname)"); + "glGetFramebufferAttachmentParameteriv(pname)"); } else { mesa_format format = att->Renderbuffer->Format; @@ -2956,7 +2956,7 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, } else if (att->Type == GL_NONE) { _mesa_error(ctx, err, - "glGetFramebufferAttachmentParameterivEXT(pname)"); + "glGetFramebufferAttachmentParameteriv(pname)"); } else if (att->Texture) { const struct gl_texture_image *texImage = diff --git a/mesalib/src/mesa/main/get_hash_params.py b/mesalib/src/mesa/main/get_hash_params.py index aace8a5b5..da3568469 100644 --- a/mesalib/src/mesa/main/get_hash_params.py +++ b/mesalib/src/mesa/main/get_hash_params.py @@ -203,10 +203,10 @@ descriptor=[ [ "COLOR_ARRAY_SIZE", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ], [ "COLOR_ARRAY_TYPE", "ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_COLOR0].Type), NO_EXTRA" ], [ "COLOR_ARRAY_STRIDE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR0].Stride), NO_EXTRA" ], - [ "TEXTURE_COORD_ARRAY", "LOC_CUSTOM, TYPE_BOOLEAN, offsetof(struct gl_client_array, Enabled), NO_EXTRA" ], - [ "TEXTURE_COORD_ARRAY_SIZE", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_client_array, Size), NO_EXTRA" ], - [ "TEXTURE_COORD_ARRAY_TYPE", "LOC_CUSTOM, TYPE_ENUM, offsetof(struct gl_client_array, Type), NO_EXTRA" ], - [ "TEXTURE_COORD_ARRAY_STRIDE", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_client_array, Stride), NO_EXTRA" ], + [ "TEXTURE_COORD_ARRAY", "LOC_CUSTOM, TYPE_BOOLEAN, offsetof(struct gl_vertex_attrib_array, Enabled), NO_EXTRA" ], + [ "TEXTURE_COORD_ARRAY_SIZE", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_vertex_attrib_array, Size), NO_EXTRA" ], + [ "TEXTURE_COORD_ARRAY_TYPE", "LOC_CUSTOM, TYPE_ENUM, offsetof(struct gl_vertex_attrib_array, Type), NO_EXTRA" ], + [ "TEXTURE_COORD_ARRAY_STRIDE", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_vertex_attrib_array, Stride), NO_EXTRA" ], # GL_ARB_multitexture [ "MAX_TEXTURE_UNITS", "CONTEXT_INT(Const.MaxTextureUnits), NO_EXTRA" ], diff --git a/mesalib/src/mesa/main/imports.c b/mesalib/src/mesa/main/imports.c index 4afe156b0..b8c754815 100644 --- a/mesalib/src/mesa/main/imports.c +++ b/mesalib/src/mesa/main/imports.c @@ -209,20 +209,6 @@ _mesa_align_realloc(void *oldBuffer, size_t oldSize, size_t newSize, #endif } - - -/** Reallocate memory */ -void * -_mesa_realloc(void *oldBuffer, size_t oldSize, size_t newSize) -{ - const size_t copySize = (oldSize < newSize) ? oldSize : newSize; - void *newBuffer = malloc(newSize); - if (newBuffer && oldBuffer && copySize > 0) - memcpy(newBuffer, oldBuffer, copySize); - free(oldBuffer); - return newBuffer; -} - /*@}*/ @@ -231,7 +217,7 @@ _mesa_realloc(void *oldBuffer, size_t oldSize, size_t newSize) /*@{*/ -#ifndef __GNUC__ +#ifndef HAVE___BUILTIN_FFS /** * Find the first bit set in a word. */ @@ -260,8 +246,9 @@ ffs(int i) } return bit; } +#endif - +#ifndef HAVE___BUILTIN_FFSLL /** * Find position of first bit set in given value. * XXX Warning: this function can only be used on 64-bit systems! @@ -285,11 +272,10 @@ ffsll(long long int val) return 0; } -#endif /* __GNUC__ */ +#endif -#if !defined(__GNUC__) ||\ - ((__GNUC__ * 100 + __GNUC_MINOR__) < 304) /* Not gcc 3.4 or later */ +#ifndef HAVE___BUILTIN_POPCOUNT /** * Return number of bits set in given GLuint. */ @@ -302,7 +288,9 @@ _mesa_bitcount(unsigned int n) } return bits; } +#endif +#ifndef HAVE___BUILTIN_POPCOUNTLL /** * Return number of bits set in given 64-bit uint. */ @@ -488,60 +476,6 @@ _mesa_half_to_float(GLhalfARB val) /*@}*/ -/**********************************************************************/ -/** \name Sort & Search */ -/*@{*/ - -/** - * Wrapper for bsearch(). - */ -void * -_mesa_bsearch( const void *key, const void *base, size_t nmemb, size_t size, - int (*compar)(const void *, const void *) ) -{ -#if defined(_WIN32_WCE) - void *mid; - int cmp; - while (nmemb) { - nmemb >>= 1; - mid = (char *)base + nmemb * size; - cmp = (*compar)(key, mid); - if (cmp == 0) - return mid; - if (cmp > 0) { - base = (char *)mid + size; - --nmemb; - } - } - return NULL; -#else - return bsearch(key, base, nmemb, size, compar); -#endif -} - -/*@}*/ - - -/**********************************************************************/ -/** \name Environment vars */ -/*@{*/ - -/** - * Wrapper for getenv(). - */ -char * -_mesa_getenv( const char *var ) -{ -#if defined(_XBOX) || defined(_WIN32_WCE) - return NULL; -#else - return getenv(var); -#endif -} - -/*@}*/ - - /**********************************************************************/ /** \name String */ /*@{*/ diff --git a/mesalib/src/mesa/main/imports.h b/mesalib/src/mesa/main/imports.h index 59fd19c36..436d1651a 100644 --- a/mesalib/src/mesa/main/imports.h +++ b/mesalib/src/mesa/main/imports.h @@ -377,8 +377,7 @@ _mesa_is_pow_two(int x) static inline int32_t _mesa_next_pow_two_32(uint32_t x) { -#if defined(__GNUC__) && \ - ((__GNUC__ * 100 + __GNUC_MINOR__) >= 304) /* gcc 3.4 or later */ +#ifdef HAVE___BUILTIN_CLZ uint32_t y = (x != 1); return (1 + y) << ((__builtin_clz(x - y) ^ 31) ); #else @@ -396,13 +395,10 @@ _mesa_next_pow_two_32(uint32_t x) static inline int64_t _mesa_next_pow_two_64(uint64_t x) { -#if defined(__GNUC__) && \ - ((__GNUC__ * 100 + __GNUC_MINOR__) >= 304) /* gcc 3.4 or later */ +#ifdef HAVE___BUILTIN_CLZLL uint64_t y = (x != 1); - if (sizeof(x) == sizeof(long)) - return (1 + y) << ((__builtin_clzl(x - y) ^ 63)); - else - return (1 + y) << ((__builtin_clzll(x - y) ^ 63)); + STATIC_ASSERT(sizeof(x) == sizeof(long long)); + return (1 + y) << ((__builtin_clzll(x - y) ^ 63)); #else x--; x |= x >> 1; @@ -423,8 +419,7 @@ _mesa_next_pow_two_64(uint64_t x) static inline GLuint _mesa_logbase2(GLuint n) { -#if defined(__GNUC__) && \ - ((__GNUC__ * 100 + __GNUC_MINOR__) >= 304) /* gcc 3.4 or later */ +#ifdef HAVE___BUILTIN_CLZ return (31 - __builtin_clz(n | 1)); #else GLuint pos = 0; @@ -473,28 +468,33 @@ _mesa_exec_malloc( GLuint size ); extern void _mesa_exec_free( void *addr ); -extern void * -_mesa_realloc( void *oldBuffer, size_t oldSize, size_t newSize ); - #ifndef FFS_DEFINED #define FFS_DEFINED 1 -#ifdef __GNUC__ +#ifdef HAVE___BUILTIN_FFS #define ffs __builtin_ffs -#define ffsll __builtin_ffsll #else extern int ffs(int i); +#endif + +#ifdef HAVE___BUILTIN_FFSLL +#define ffsll __builtin_ffsll +#else extern int ffsll(long long int i); -#endif /*__ GNUC__ */ +#endif #endif /* FFS_DEFINED */ -#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 304) /* gcc 3.4 or later */ +#ifdef HAVE___BUILTIN_POPCOUNT #define _mesa_bitcount(i) __builtin_popcount(i) -#define _mesa_bitcount_64(i) __builtin_popcountll(i) #else extern unsigned int _mesa_bitcount(unsigned int n); +#endif + +#ifdef HAVE___BUILTIN_POPCOUNTLL +#define _mesa_bitcount_64(i) __builtin_popcountll(i) +#else extern unsigned int _mesa_bitcount_64(uint64_t n); #endif @@ -507,7 +507,7 @@ _mesa_bitcount_64(uint64_t n); static inline unsigned int _mesa_fls(unsigned int n) { -#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 304) +#ifdef HAVE___BUILTIN_CLZ return n == 0 ? 0 : 32 - __builtin_clz(n); #else unsigned int v = 1; @@ -537,13 +537,6 @@ _mesa_half_is_negative(GLhalfARB h) return h & 0x8000; } -extern void * -_mesa_bsearch( const void *key, const void *base, size_t nmemb, size_t size, - int (*compar)(const void *, const void *) ); - -extern char * -_mesa_getenv( const char *var ); - extern char * _mesa_strdup( const char *s ); diff --git a/mesalib/src/mesa/main/macros.h b/mesalib/src/mesa/main/macros.h index 712699f75..cd5f2d6f2 100644 --- a/mesalib/src/mesa/main/macros.h +++ b/mesalib/src/mesa/main/macros.h @@ -799,13 +799,6 @@ NORMALIZE_3FV(GLfloat v[3]) } -/** Is float value negative? */ -static inline GLboolean -IS_NEGATIVE(float x) -{ - return signbit(x) != 0; -} - /** Test two floats have opposite signs */ static inline GLboolean DIFFERENT_SIGNS(GLfloat x, GLfloat y) diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index 553a21667..dd330eab7 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -3452,7 +3452,7 @@ struct gl_constants GLuint MaxGeometryOutputVertices; GLuint MaxGeometryTotalOutputComponents; - GLuint GLSLVersion; /**< GLSL version supported (ex: 120 = 1.20) */ + GLuint GLSLVersion; /**< Desktop GLSL version supported (ex: 120 = 1.20) */ /** * Changes default GLSL extension behavior from "error" to "warn". It's out @@ -3551,11 +3551,6 @@ struct gl_constants */ GLboolean GLSLSkipStrictMaxUniformLimitCheck; - /** - * Force software support for primitive restart in the VBO module. - */ - GLboolean PrimitiveRestartInSoftware; - /** * Always use the GetTransformFeedbackVertexCount() driver hook, rather * than passing the transform feedback object to the drawing function. @@ -3576,6 +3571,19 @@ struct gl_constants */ GLboolean DisableVaryingPacking; + /** + * Should meaningful names be generated for compiler temporary variables? + * + * Generally, it is not useful to have the compiler generate "meaningful" + * names for temporary variables that it creates. This can, however, be a + * useful debugging aid. In Mesa debug builds or release builds when + * MESA_GLSL is set at run-time, meaningful names will be generated. + * Drivers can also force names to be generated by setting this field. + * For example, the i965 driver may set it when INTEL_DEBUG=vs (to dump + * vertex shader assembly) is set at run-time. + */ + bool GenerateTemporaryNames; + /* * Maximum value supported for an index in DrawElements and friends. * diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c index 620cab3cc..3e6f61067 100644 --- a/mesalib/src/mesa/main/shaderapi.c +++ b/mesalib/src/mesa/main/shaderapi.c @@ -70,7 +70,7 @@ GLbitfield _mesa_get_shader_flags(void) { GLbitfield flags = 0x0; - const char *env = _mesa_getenv("MESA_GLSL"); + const char *env = getenv("MESA_GLSL"); if (env) { if (strstr(env, "dump_on_error")) @@ -123,6 +123,9 @@ _mesa_init_shader_state(struct gl_context *ctx) ctx->Shader.Flags = _mesa_get_shader_flags(); + if (ctx->Shader.Flags != 0) + ctx->Const.GenerateTemporaryNames = true; + /* Extended for ARB_separate_shader_objects */ ctx->Shader.RefCount = 1; mtx_init(&ctx->Shader.Mutex, mtx_plain); @@ -272,9 +275,8 @@ attach_shader(struct gl_context *ctx, GLuint program, GLuint shader) /* grow list */ shProg->Shaders = (struct gl_shader **) - _mesa_realloc(shProg->Shaders, - n * sizeof(struct gl_shader *), - (n + 1) * sizeof(struct gl_shader *)); + realloc(shProg->Shaders, + (n + 1) * sizeof(struct gl_shader *)); if (!shProg->Shaders) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glAttachShader"); return; diff --git a/mesalib/src/mesa/main/shaderobj.h b/mesalib/src/mesa/main/shaderobj.h index fae8be827..d72919c1f 100644 --- a/mesalib/src/mesa/main/shaderobj.h +++ b/mesalib/src/mesa/main/shaderobj.h @@ -94,13 +94,6 @@ _mesa_free_shader_program_data(struct gl_context *ctx, extern void _mesa_init_shader_object_functions(struct dd_function_table *driver); -extern void -_mesa_init_shader_state(struct gl_context *ctx); - -extern void -_mesa_free_shader_state(struct gl_context *ctx); - - static inline gl_shader_stage _mesa_shader_enum_to_shader_stage(GLenum v) { diff --git a/mesalib/src/mesa/main/texcompress_s3tc.c b/mesalib/src/mesa/main/texcompress_s3tc.c index 5b275efe0..254f84ef7 100644 --- a/mesalib/src/mesa/main/texcompress_s3tc.c +++ b/mesalib/src/mesa/main/texcompress_s3tc.c @@ -51,8 +51,6 @@ #define DXTN_LIBNAME "dxtn.dll" #define RTLD_LAZY 0 #define RTLD_GLOBAL 0 -#elif defined(__DJGPP__) -#define DXTN_LIBNAME "dxtn.dxe" #else #define DXTN_LIBNAME "libtxc_dxtn.so" #endif diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c index ead78649d..09bf52c42 100644 --- a/mesalib/src/mesa/main/varray.c +++ b/mesalib/src/mesa/main/varray.c @@ -711,7 +711,7 @@ _mesa_EnableVertexAttribArray(GLuint index) vao = ctx->Array.VAO; - ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(vao->_VertexAttrib)); + ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(vao->VertexAttrib)); if (!vao->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled) { /* was disabled, now being enabled */ @@ -737,7 +737,7 @@ _mesa_DisableVertexAttribArray(GLuint index) vao = ctx->Array.VAO; - ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(vao->_VertexAttrib)); + ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(vao->VertexAttrib)); if (vao->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled) { /* was enabled, now being disabled */ @@ -831,7 +831,7 @@ get_current_attrib(struct gl_context *ctx, GLuint index, const char *function) return NULL; } - ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.VAO->_VertexAttrib)); + ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.VAO->VertexAttrib)); FLUSH_CURRENT(ctx, 0); return ctx->Current.Attrib[VERT_ATTRIB_GENERIC(index)]; @@ -953,7 +953,7 @@ _mesa_GetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid **pointer) return; } - ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.VAO->_VertexAttrib)); + ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.VAO->VertexAttrib)); *pointer = (GLvoid *) ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Ptr; } diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c index 4dea530cd..71f70119b 100644 --- a/mesalib/src/mesa/main/version.c +++ b/mesalib/src/mesa/main/version.c @@ -57,13 +57,15 @@ check_for_ending(const char *string, const char *ending) * fwd_context is only valid if version > 0 */ static void -get_gl_override(int *version, GLboolean *fwd_context) +get_gl_override(int *version, GLboolean *fwd_context, + GLboolean *compat_context) { const char *env_var = "MESA_GL_VERSION_OVERRIDE"; const char *version_str; int major, minor, n; static int override_version = -1; static GLboolean fc_suffix = GL_FALSE; + static GLboolean compat_suffix = GL_FALSE; if (override_version < 0) { override_version = 0; @@ -71,6 +73,7 @@ get_gl_override(int *version, GLboolean *fwd_context) version_str = getenv(env_var); if (version_str) { fc_suffix = check_for_ending(version_str, "FC"); + compat_suffix = check_for_ending(version_str, "COMPAT"); n = sscanf(version_str, "%u.%u", &major, &minor); if (n != 2) { @@ -87,6 +90,7 @@ get_gl_override(int *version, GLboolean *fwd_context) *version = override_version; *fwd_context = fc_suffix; + *compat_context = compat_suffix; } /** @@ -129,16 +133,16 @@ _mesa_override_gl_version_contextless(struct gl_constants *consts, gl_api *apiOut, GLuint *versionOut) { int version; - GLboolean fwd_context; + GLboolean fwd_context, compat_context; - get_gl_override(&version, &fwd_context); + get_gl_override(&version, &fwd_context, &compat_context); if (version > 0) { *versionOut = version; if (version >= 30 && fwd_context) { *apiOut = API_OPENGL_CORE; consts->ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT; - } else if (version >= 31) { + } else if (version >= 31 && !compat_context) { *apiOut = API_OPENGL_CORE; } else { *apiOut = API_OPENGL_COMPAT; @@ -166,9 +170,9 @@ int _mesa_get_gl_version_override(void) { int version; - GLboolean fwd_context; + GLboolean fwd_context, compat_context; - get_gl_override(&version, &fwd_context); + get_gl_override(&version, &fwd_context, &compat_context); return version; } diff --git a/mesalib/src/mesa/main/viewport.c b/mesalib/src/mesa/main/viewport.c index 6545bf68a..222ae307b 100644 --- a/mesalib/src/mesa/main/viewport.c +++ b/mesalib/src/mesa/main/viewport.c @@ -58,6 +58,12 @@ set_viewport_no_notify(struct gl_context *ctx, unsigned idx, ctx->Const.ViewportBounds.Min, ctx->Const.ViewportBounds.Max); } + if (ctx->ViewportArray[idx].X == x && + ctx->ViewportArray[idx].Width == width && + ctx->ViewportArray[idx].Y == y && + ctx->ViewportArray[idx].Height == height) + return; + ctx->ViewportArray[idx].X = x; ctx->ViewportArray[idx].Width = width; ctx->ViewportArray[idx].Y = y; diff --git a/mesalib/src/mesa/math/m_debug_clip.c b/mesalib/src/mesa/math/m_debug_clip.c index cd8a90d4d..044768dbd 100644 --- a/mesalib/src/mesa/math/m_debug_clip.c +++ b/mesalib/src/mesa/math/m_debug_clip.c @@ -355,7 +355,7 @@ void _math_test_all_cliptest_functions( char *description ) if ( first_time ) { first_time = 0; - mesa_profile = _mesa_getenv( "MESA_PROFILE" ); + mesa_profile = getenv( "MESA_PROFILE" ); } #ifdef RUN_DEBUG_BENCHMARK diff --git a/mesalib/src/mesa/math/m_debug_norm.c b/mesalib/src/mesa/math/m_debug_norm.c index db71ebef0..00e72be54 100644 --- a/mesalib/src/mesa/math/m_debug_norm.c +++ b/mesalib/src/mesa/math/m_debug_norm.c @@ -339,7 +339,7 @@ void _math_test_all_normal_transform_functions( char *description ) if ( first_time ) { first_time = 0; - mesa_profile = _mesa_getenv( "MESA_PROFILE" ); + mesa_profile = getenv( "MESA_PROFILE" ); } #ifdef RUN_DEBUG_BENCHMARK diff --git a/mesalib/src/mesa/math/m_debug_xform.c b/mesalib/src/mesa/math/m_debug_xform.c index fbfa9b28a..f56b4cfc7 100644 --- a/mesalib/src/mesa/math/m_debug_xform.c +++ b/mesalib/src/mesa/math/m_debug_xform.c @@ -285,7 +285,7 @@ void _math_test_all_transform_functions( char *description ) if ( first_time ) { first_time = 0; - mesa_profile = _mesa_getenv( "MESA_PROFILE" ); + mesa_profile = getenv( "MESA_PROFILE" ); } #ifdef RUN_DEBUG_BENCHMARK diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp index 293fe34b9..b3e04d7b6 100644 --- a/mesalib/src/mesa/program/ir_to_mesa.cpp +++ b/mesalib/src/mesa/program/ir_to_mesa.cpp @@ -682,8 +682,8 @@ ir_to_mesa_visitor::visit(ir_variable *ir) if (ir->data.mode == ir_var_uniform && strncmp(ir->name, "gl_", 3) == 0) { unsigned int i; - const ir_state_slot *const slots = ir->state_slots; - assert(ir->state_slots != NULL); + const ir_state_slot *const slots = ir->get_state_slots(); + assert(slots != NULL); /* Check if this statevar's setup in the STATE file exactly * matches how we'll want to reference it as a @@ -691,7 +691,7 @@ ir_to_mesa_visitor::visit(ir_variable *ir) * temporary storage and hope that it'll get copy-propagated * out. */ - for (i = 0; i < ir->num_state_slots; i++) { + for (i = 0; i < ir->get_num_state_slots(); i++) { if (slots[i].swizzle != SWIZZLE_XYZW) { break; } @@ -699,7 +699,7 @@ ir_to_mesa_visitor::visit(ir_variable *ir) variable_storage *storage; dst_reg dst; - if (i == ir->num_state_slots) { + if (i == ir->get_num_state_slots()) { /* We'll set the index later. */ storage = new(mem_ctx) variable_storage(ir, PROGRAM_STATE_VAR, -1); this->variables.push_tail(storage); @@ -710,7 +710,7 @@ ir_to_mesa_visitor::visit(ir_variable *ir) * of the type. However, this had better match the number of state * elements that we're going to copy into the new temporary. */ - assert((int) ir->num_state_slots == type_size(ir->type)); + assert((int) ir->get_num_state_slots() == type_size(ir->type)); storage = new(mem_ctx) variable_storage(ir, PROGRAM_TEMPORARY, this->next_temp); @@ -721,7 +721,7 @@ ir_to_mesa_visitor::visit(ir_variable *ir) } - for (unsigned int i = 0; i < ir->num_state_slots; i++) { + for (unsigned int i = 0; i < ir->get_num_state_slots(); i++) { int index = _mesa_add_state_reference(this->prog->Parameters, (gl_state_index *)slots[i].tokens); @@ -741,7 +741,7 @@ ir_to_mesa_visitor::visit(ir_variable *ir) } if (storage->file == PROGRAM_TEMPORARY && - dst.index != storage->index + (int) ir->num_state_slots) { + dst.index != storage->index + (int) ir->get_num_state_slots()) { linker_error(this->shader_program, "failed to load builtin uniform `%s' " "(%d/%d regs loaded)\n", diff --git a/mesalib/src/mesa/program/prog_instruction.c b/mesalib/src/mesa/program/prog_instruction.c index dc0a5109f..e2eadc36c 100644 --- a/mesalib/src/mesa/program/prog_instruction.c +++ b/mesalib/src/mesa/program/prog_instruction.c @@ -90,9 +90,8 @@ _mesa_realloc_instructions(struct prog_instruction *oldInst, struct prog_instruction *newInst; newInst = (struct prog_instruction *) - _mesa_realloc(oldInst, - numOldInst * sizeof(struct prog_instruction), - numNewInst * sizeof(struct prog_instruction)); + realloc(oldInst, + numNewInst * sizeof(struct prog_instruction)); return newInst; } diff --git a/mesalib/src/mesa/program/prog_parameter.c b/mesalib/src/mesa/program/prog_parameter.c index f43deba0b..896c6052b 100644 --- a/mesalib/src/mesa/program/prog_parameter.c +++ b/mesalib/src/mesa/program/prog_parameter.c @@ -121,9 +121,8 @@ _mesa_add_parameter(struct gl_program_parameter_list *paramList, /* realloc arrays */ paramList->Parameters = (struct gl_program_parameter *) - _mesa_realloc(paramList->Parameters, - oldNum * sizeof(struct gl_program_parameter), - paramList->Size * sizeof(struct gl_program_parameter)); + realloc(paramList->Parameters, + paramList->Size * sizeof(struct gl_program_parameter)); paramList->ParameterValues = (gl_constant_value (*)[4]) _mesa_align_realloc(paramList->ParameterValues, /* old buf */ diff --git a/mesalib/src/mesa/program/register_allocate.c b/mesalib/src/mesa/program/register_allocate.c deleted file mode 100644 index 7faf67215..000000000 --- a/mesalib/src/mesa/program/register_allocate.c +++ /dev/null @@ -1,654 +0,0 @@ -/* - * Copyright © 2010 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - * - * Authors: - * Eric Anholt - * - */ - -/** @file register_allocate.c - * - * Graph-coloring register allocator. - * - * The basic idea of graph coloring is to make a node in a graph for - * every thing that needs a register (color) number assigned, and make - * edges in the graph between nodes that interfere (can't be allocated - * to the same register at the same time). - * - * During the "simplify" process, any any node with fewer edges than - * there are registers means that that edge can get assigned a - * register regardless of what its neighbors choose, so that node is - * pushed on a stack and removed (with its edges) from the graph. - * That likely causes other nodes to become trivially colorable as well. - * - * Then during the "select" process, nodes are popped off of that - * stack, their edges restored, and assigned a color different from - * their neighbors. Because they were pushed on the stack only when - * they were trivially colorable, any color chosen won't interfere - * with the registers to be popped later. - * - * The downside to most graph coloring is that real hardware often has - * limitations, like registers that need to be allocated to a node in - * pairs, or aligned on some boundary. This implementation follows - * the paper "Retargetable Graph-Coloring Register Allocation for - * Irregular Architectures" by Johan Runeson and Sven-Olof Nyström. - * - * In this system, there are register classes each containing various - * registers, and registers may interfere with other registers. For - * example, one might have a class of base registers, and a class of - * aligned register pairs that would each interfere with their pair of - * the base registers. Each node has a register class it needs to be - * assigned to. Define p(B) to be the size of register class B, and - * q(B,C) to be the number of registers in B that the worst choice - * register in C could conflict with. Then, this system replaces the - * basic graph coloring test of "fewer edges from this node than there - * are registers" with "For this node of class B, the sum of q(B,C) - * for each neighbor node of class C is less than pB". - * - * A nice feature of the pq test is that q(B,C) can be computed once - * up front and stored in a 2-dimensional array, so that the cost of - * coloring a node is constant with the number of registers. We do - * this during ra_set_finalize(). - */ - -#include - -#include "util/ralloc.h" -#include "main/imports.h" -#include "main/macros.h" -#include "main/mtypes.h" -#include "main/bitset.h" -#include "register_allocate.h" - -#define NO_REG ~0 - -struct ra_reg { - BITSET_WORD *conflicts; - unsigned int *conflict_list; - unsigned int conflict_list_size; - unsigned int num_conflicts; -}; - -struct ra_regs { - struct ra_reg *regs; - unsigned int count; - - struct ra_class **classes; - unsigned int class_count; - - bool round_robin; -}; - -struct ra_class { - /** - * Bitset indicating which registers belong to this class. - * - * (If bit N is set, then register N belongs to this class.) - */ - BITSET_WORD *regs; - - /** - * p(B) in Runeson/Nyström paper. - * - * This is "how many regs are in the set." - */ - unsigned int p; - - /** - * q(B,C) (indexed by C, B is this register class) in - * Runeson/Nyström paper. This is "how many registers of B could - * the worst choice register from C conflict with". - */ - unsigned int *q; -}; - -struct ra_node { - /** @{ - * - * List of which nodes this node interferes with. This should be - * symmetric with the other node. - */ - BITSET_WORD *adjacency; - unsigned int *adjacency_list; - unsigned int adjacency_list_size; - unsigned int adjacency_count; - /** @} */ - - unsigned int class; - - /* Register, if assigned, or NO_REG. */ - unsigned int reg; - - /** - * Set when the node is in the trivially colorable stack. When - * set, the adjacency to this node is ignored, to implement the - * "remove the edge from the graph" in simplification without - * having to actually modify the adjacency_list. - */ - bool in_stack; - - /** - * The q total, as defined in the Runeson/Nyström paper, for all the - * interfering nodes not in the stack. - */ - unsigned int q_total; - - /* For an implementation that needs register spilling, this is the - * approximate cost of spilling this node. - */ - float spill_cost; -}; - -struct ra_graph { - struct ra_regs *regs; - /** - * the variables that need register allocation. - */ - struct ra_node *nodes; - unsigned int count; /**< count of nodes. */ - - unsigned int *stack; - unsigned int stack_count; -}; - -/** - * Creates a set of registers for the allocator. - * - * mem_ctx is a ralloc context for the allocator. The reg set may be freed - * using ralloc_free(). - */ -struct ra_regs * -ra_alloc_reg_set(void *mem_ctx, unsigned int count) -{ - unsigned int i; - struct ra_regs *regs; - - regs = rzalloc(mem_ctx, struct ra_regs); - regs->count = count; - regs->regs = rzalloc_array(regs, struct ra_reg, count); - - for (i = 0; i < count; i++) { - regs->regs[i].conflicts = rzalloc_array(regs->regs, BITSET_WORD, - BITSET_WORDS(count)); - BITSET_SET(regs->regs[i].conflicts, i); - - regs->regs[i].conflict_list = ralloc_array(regs->regs, unsigned int, 4); - regs->regs[i].conflict_list_size = 4; - regs->regs[i].conflict_list[0] = i; - regs->regs[i].num_conflicts = 1; - } - - return regs; -} - -/** - * The register allocator by default prefers to allocate low register numbers, - * since it was written for hardware (gen4/5 Intel) that is limited in its - * multithreadedness by the number of registers used in a given shader. - * - * However, for hardware without that restriction, densely packed register - * allocation can put serious constraints on instruction scheduling. This - * function tells the allocator to rotate around the registers if possible as - * it allocates the nodes. - */ -void -ra_set_allocate_round_robin(struct ra_regs *regs) -{ - regs->round_robin = true; -} - -static void -ra_add_conflict_list(struct ra_regs *regs, unsigned int r1, unsigned int r2) -{ - struct ra_reg *reg1 = ®s->regs[r1]; - - if (reg1->conflict_list_size == reg1->num_conflicts) { - reg1->conflict_list_size *= 2; - reg1->conflict_list = reralloc(regs->regs, reg1->conflict_list, - unsigned int, reg1->conflict_list_size); - } - reg1->conflict_list[reg1->num_conflicts++] = r2; - BITSET_SET(reg1->conflicts, r2); -} - -void -ra_add_reg_conflict(struct ra_regs *regs, unsigned int r1, unsigned int r2) -{ - if (!BITSET_TEST(regs->regs[r1].conflicts, r2)) { - ra_add_conflict_list(regs, r1, r2); - ra_add_conflict_list(regs, r2, r1); - } -} - -/** - * Adds a conflict between base_reg and reg, and also between reg and - * anything that base_reg conflicts with. - * - * This can simplify code for setting up multiple register classes - * which are aggregates of some base hardware registers, compared to - * explicitly using ra_add_reg_conflict. - */ -void -ra_add_transitive_reg_conflict(struct ra_regs *regs, - unsigned int base_reg, unsigned int reg) -{ - int i; - - ra_add_reg_conflict(regs, reg, base_reg); - - for (i = 0; i < regs->regs[base_reg].num_conflicts; i++) { - ra_add_reg_conflict(regs, reg, regs->regs[base_reg].conflict_list[i]); - } -} - -unsigned int -ra_alloc_reg_class(struct ra_regs *regs) -{ - struct ra_class *class; - - regs->classes = reralloc(regs->regs, regs->classes, struct ra_class *, - regs->class_count + 1); - - class = rzalloc(regs, struct ra_class); - regs->classes[regs->class_count] = class; - - class->regs = rzalloc_array(class, BITSET_WORD, BITSET_WORDS(regs->count)); - - return regs->class_count++; -} - -void -ra_class_add_reg(struct ra_regs *regs, unsigned int c, unsigned int r) -{ - struct ra_class *class = regs->classes[c]; - - BITSET_SET(class->regs, r); - class->p++; -} - -/** - * Returns true if the register belongs to the given class. - */ -static bool -reg_belongs_to_class(unsigned int r, struct ra_class *c) -{ - return BITSET_TEST(c->regs, r); -} - -/** - * Must be called after all conflicts and register classes have been - * set up and before the register set is used for allocation. - * To avoid costly q value computation, use the q_values paramater - * to pass precomputed q values to this function. - */ -void -ra_set_finalize(struct ra_regs *regs, unsigned int **q_values) -{ - unsigned int b, c; - - for (b = 0; b < regs->class_count; b++) { - regs->classes[b]->q = ralloc_array(regs, unsigned int, regs->class_count); - } - - if (q_values) { - for (b = 0; b < regs->class_count; b++) { - for (c = 0; c < regs->class_count; c++) { - regs->classes[b]->q[c] = q_values[b][c]; - } - } - return; - } - - /* Compute, for each class B and C, how many regs of B an - * allocation to C could conflict with. - */ - for (b = 0; b < regs->class_count; b++) { - for (c = 0; c < regs->class_count; c++) { - unsigned int rc; - int max_conflicts = 0; - - for (rc = 0; rc < regs->count; rc++) { - int conflicts = 0; - int i; - - if (!reg_belongs_to_class(rc, regs->classes[c])) - continue; - - for (i = 0; i < regs->regs[rc].num_conflicts; i++) { - unsigned int rb = regs->regs[rc].conflict_list[i]; - if (BITSET_TEST(regs->classes[b]->regs, rb)) - conflicts++; - } - max_conflicts = MAX2(max_conflicts, conflicts); - } - regs->classes[b]->q[c] = max_conflicts; - } - } -} - -static void -ra_add_node_adjacency(struct ra_graph *g, unsigned int n1, unsigned int n2) -{ - BITSET_SET(g->nodes[n1].adjacency, n2); - - if (n1 != n2) { - int n1_class = g->nodes[n1].class; - int n2_class = g->nodes[n2].class; - g->nodes[n1].q_total += g->regs->classes[n1_class]->q[n2_class]; - } - - if (g->nodes[n1].adjacency_count >= - g->nodes[n1].adjacency_list_size) { - g->nodes[n1].adjacency_list_size *= 2; - g->nodes[n1].adjacency_list = reralloc(g, g->nodes[n1].adjacency_list, - unsigned int, - g->nodes[n1].adjacency_list_size); - } - - g->nodes[n1].adjacency_list[g->nodes[n1].adjacency_count] = n2; - g->nodes[n1].adjacency_count++; -} - -struct ra_graph * -ra_alloc_interference_graph(struct ra_regs *regs, unsigned int count) -{ - struct ra_graph *g; - unsigned int i; - - g = rzalloc(regs, struct ra_graph); - g->regs = regs; - g->nodes = rzalloc_array(g, struct ra_node, count); - g->count = count; - - g->stack = rzalloc_array(g, unsigned int, count); - - for (i = 0; i < count; i++) { - int bitset_count = BITSET_WORDS(count); - g->nodes[i].adjacency = rzalloc_array(g, BITSET_WORD, bitset_count); - - g->nodes[i].adjacency_list_size = 4; - g->nodes[i].adjacency_list = - ralloc_array(g, unsigned int, g->nodes[i].adjacency_list_size); - g->nodes[i].adjacency_count = 0; - g->nodes[i].q_total = 0; - - ra_add_node_adjacency(g, i, i); - g->nodes[i].reg = NO_REG; - } - - return g; -} - -void -ra_set_node_class(struct ra_graph *g, - unsigned int n, unsigned int class) -{ - g->nodes[n].class = class; -} - -void -ra_add_node_interference(struct ra_graph *g, - unsigned int n1, unsigned int n2) -{ - if (!BITSET_TEST(g->nodes[n1].adjacency, n2)) { - ra_add_node_adjacency(g, n1, n2); - ra_add_node_adjacency(g, n2, n1); - } -} - -static bool -pq_test(struct ra_graph *g, unsigned int n) -{ - int n_class = g->nodes[n].class; - - return g->nodes[n].q_total < g->regs->classes[n_class]->p; -} - -static void -decrement_q(struct ra_graph *g, unsigned int n) -{ - unsigned int i; - int n_class = g->nodes[n].class; - - for (i = 0; i < g->nodes[n].adjacency_count; i++) { - unsigned int n2 = g->nodes[n].adjacency_list[i]; - unsigned int n2_class = g->nodes[n2].class; - - if (n != n2 && !g->nodes[n2].in_stack) { - assert(g->nodes[n2].q_total >= g->regs->classes[n2_class]->q[n_class]); - g->nodes[n2].q_total -= g->regs->classes[n2_class]->q[n_class]; - } - } -} - -/** - * Simplifies the interference graph by pushing all - * trivially-colorable nodes into a stack of nodes to be colored, - * removing them from the graph, and rinsing and repeating. - * - * If we encounter a case where we can't push any nodes on the stack, then - * we optimistically choose a node and push it on the stack. We heuristically - * push the node with the lowest total q value, since it has the fewest - * neighbors and therefore is most likely to be allocated. - */ -static void -ra_simplify(struct ra_graph *g) -{ - bool progress = true; - int i; - - while (progress) { - unsigned int best_optimistic_node = ~0; - unsigned int lowest_q_total = ~0; - - progress = false; - - for (i = g->count - 1; i >= 0; i--) { - if (g->nodes[i].in_stack || g->nodes[i].reg != NO_REG) - continue; - - if (pq_test(g, i)) { - decrement_q(g, i); - g->stack[g->stack_count] = i; - g->stack_count++; - g->nodes[i].in_stack = true; - progress = true; - } else { - unsigned int new_q_total = g->nodes[i].q_total; - if (new_q_total < lowest_q_total) { - best_optimistic_node = i; - lowest_q_total = new_q_total; - } - } - } - - if (!progress && best_optimistic_node != ~0) { - decrement_q(g, best_optimistic_node); - g->stack[g->stack_count] = best_optimistic_node; - g->stack_count++; - g->nodes[best_optimistic_node].in_stack = true; - progress = true; - } - } -} - -/** - * Pops nodes from the stack back into the graph, coloring them with - * registers as they go. - * - * If all nodes were trivially colorable, then this must succeed. If - * not (optimistic coloring), then it may return false; - */ -static bool -ra_select(struct ra_graph *g) -{ - int i; - int start_search_reg = 0; - - while (g->stack_count != 0) { - unsigned int ri; - unsigned int r = -1; - int n = g->stack[g->stack_count - 1]; - struct ra_class *c = g->regs->classes[g->nodes[n].class]; - - /* Find the lowest-numbered reg which is not used by a member - * of the graph adjacent to us. - */ - for (ri = 0; ri < g->regs->count; ri++) { - r = (start_search_reg + ri) % g->regs->count; - if (!reg_belongs_to_class(r, c)) - continue; - - /* Check if any of our neighbors conflict with this register choice. */ - for (i = 0; i < g->nodes[n].adjacency_count; i++) { - unsigned int n2 = g->nodes[n].adjacency_list[i]; - - if (!g->nodes[n2].in_stack && - BITSET_TEST(g->regs->regs[r].conflicts, g->nodes[n2].reg)) { - break; - } - } - if (i == g->nodes[n].adjacency_count) - break; - } - - /* set this to false even if we return here so that - * ra_get_best_spill_node() considers this node later. - */ - g->nodes[n].in_stack = false; - - if (ri == g->regs->count) - return false; - - g->nodes[n].reg = r; - g->stack_count--; - - if (g->regs->round_robin) - start_search_reg = r + 1; - } - - return true; -} - -bool -ra_allocate(struct ra_graph *g) -{ - ra_simplify(g); - return ra_select(g); -} - -unsigned int -ra_get_node_reg(struct ra_graph *g, unsigned int n) -{ - return g->nodes[n].reg; -} - -/** - * Forces a node to a specific register. This can be used to avoid - * creating a register class containing one node when handling data - * that must live in a fixed location and is known to not conflict - * with other forced register assignment (as is common with shader - * input data). These nodes do not end up in the stack during - * ra_simplify(), and thus at ra_select() time it is as if they were - * the first popped off the stack and assigned their fixed locations. - * Nodes that use this function do not need to be assigned a register - * class. - * - * Must be called before ra_simplify(). - */ -void -ra_set_node_reg(struct ra_graph *g, unsigned int n, unsigned int reg) -{ - g->nodes[n].reg = reg; - g->nodes[n].in_stack = false; -} - -static float -ra_get_spill_benefit(struct ra_graph *g, unsigned int n) -{ - int j; - float benefit = 0; - int n_class = g->nodes[n].class; - - /* Define the benefit of eliminating an interference between n, n2 - * through spilling as q(C, B) / p(C). This is similar to the - * "count number of edges" approach of traditional graph coloring, - * but takes classes into account. - */ - for (j = 0; j < g->nodes[n].adjacency_count; j++) { - unsigned int n2 = g->nodes[n].adjacency_list[j]; - if (n != n2) { - unsigned int n2_class = g->nodes[n2].class; - benefit += ((float)g->regs->classes[n_class]->q[n2_class] / - g->regs->classes[n_class]->p); - } - } - - return benefit; -} - -/** - * Returns a node number to be spilled according to the cost/benefit using - * the pq test, or -1 if there are no spillable nodes. - */ -int -ra_get_best_spill_node(struct ra_graph *g) -{ - unsigned int best_node = -1; - float best_benefit = 0.0; - unsigned int n; - - /* Consider any nodes that we colored successfully or the node we failed to - * color for spilling. When we failed to color a node in ra_select(), we - * only considered these nodes, so spilling any other ones would not result - * in us making progress. - */ - for (n = 0; n < g->count; n++) { - float cost = g->nodes[n].spill_cost; - float benefit; - - if (cost <= 0.0) - continue; - - if (g->nodes[n].in_stack) - continue; - - benefit = ra_get_spill_benefit(g, n); - - if (benefit / cost > best_benefit) { - best_benefit = benefit / cost; - best_node = n; - } - } - - return best_node; -} - -/** - * Only nodes with a spill cost set (cost != 0.0) will be considered - * for register spilling. - */ -void -ra_set_node_spill_cost(struct ra_graph *g, unsigned int n, float cost) -{ - g->nodes[n].spill_cost = cost; -} diff --git a/mesalib/src/mesa/program/register_allocate.h b/mesalib/src/mesa/program/register_allocate.h deleted file mode 100644 index dc6874495..000000000 --- a/mesalib/src/mesa/program/register_allocate.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright © 2010 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - * - * Authors: - * Eric Anholt - * - */ - -#include - -struct ra_class; -struct ra_regs; - -/* @{ - * Register set setup. - * - * This should be done once at backend initializaion, as - * ra_set_finalize is O(r^2*c^2). The registers may be virtual - * registers, such as aligned register pairs that conflict with the - * two real registers from which they are composed. - */ -struct ra_regs *ra_alloc_reg_set(void *mem_ctx, unsigned int count); -void ra_set_allocate_round_robin(struct ra_regs *regs); -unsigned int ra_alloc_reg_class(struct ra_regs *regs); -void ra_add_reg_conflict(struct ra_regs *regs, - unsigned int r1, unsigned int r2); -void ra_add_transitive_reg_conflict(struct ra_regs *regs, - unsigned int base_reg, unsigned int reg); -void ra_class_add_reg(struct ra_regs *regs, unsigned int c, unsigned int reg); -void ra_set_num_conflicts(struct ra_regs *regs, unsigned int class_a, - unsigned int class_b, unsigned int num_conflicts); -void ra_set_finalize(struct ra_regs *regs, unsigned int **conflicts); -/** @} */ - -/** @{ Interference graph setup. - * - * Each interference graph node is a virtual variable in the IL. It - * is up to the user to ra_set_node_class() for the virtual variable, - * and compute live ranges and ra_node_interfere() between conflicting - * live ranges. Note that an interference *must not* be added between - * two nodes if their classes haven't been assigned yet. The user - * should set the class of each node before building the interference - * graph. - */ -struct ra_graph *ra_alloc_interference_graph(struct ra_regs *regs, - unsigned int count); -void ra_set_node_class(struct ra_graph *g, unsigned int n, unsigned int c); -void ra_add_node_interference(struct ra_graph *g, - unsigned int n1, unsigned int n2); -/** @} */ - -/** @{ Graph-coloring register allocation */ -bool ra_allocate(struct ra_graph *g); - -unsigned int ra_get_node_reg(struct ra_graph *g, unsigned int n); -void ra_set_node_reg(struct ra_graph * g, unsigned int n, unsigned int reg); -void ra_set_node_spill_cost(struct ra_graph *g, unsigned int n, float cost); -int ra_get_best_spill_node(struct ra_graph *g); -/** @} */ - diff --git a/mesalib/src/mesa/program/symbol_table.c b/mesalib/src/mesa/program/symbol_table.c index 9462978ee..5b2274593 100644 --- a/mesalib/src/mesa/program/symbol_table.c +++ b/mesalib/src/mesa/program/symbol_table.c @@ -172,6 +172,11 @@ _mesa_symbol_table_push_scope(struct _mesa_symbol_table *table) { struct scope_level *const scope = calloc(1, sizeof(*scope)); + if (scope == NULL) { + _mesa_error_no_memory(__func__); + return; + } + scope->next = table->current_scope; table->current_scope = scope; table->depth++; @@ -254,7 +259,17 @@ _mesa_symbol_table_add_symbol(struct _mesa_symbol_table *table, if (hdr == NULL) { hdr = calloc(1, sizeof(*hdr)); + if (hdr == NULL) { + _mesa_error_no_memory(__func__); + return -1; + } + hdr->name = strdup(name); + if (hdr->name == NULL) { + free(hdr); + _mesa_error_no_memory(__func__); + return -1; + } hash_table_insert(table->ht, hdr, hdr->name); hdr->next = table->hdr; @@ -276,6 +291,11 @@ _mesa_symbol_table_add_symbol(struct _mesa_symbol_table *table, return -1; sym = calloc(1, sizeof(*sym)); + if (sym == NULL) { + _mesa_error_no_memory(__func__); + return -1; + } + sym->next_with_same_name = hdr->symbols; sym->next_with_same_scope = table->current_scope->symbols; sym->hdr = hdr; @@ -311,6 +331,11 @@ _mesa_symbol_table_add_global_symbol(struct _mesa_symbol_table *table, if (hdr == NULL) { hdr = calloc(1, sizeof(*hdr)); + if (hdr == NULL) { + _mesa_error_no_memory(__func__); + return -1; + } + hdr->name = strdup(name); hash_table_insert(table->ht, hdr, hdr->name); @@ -340,6 +365,11 @@ _mesa_symbol_table_add_global_symbol(struct _mesa_symbol_table *table, } sym = calloc(1, sizeof(*sym)); + if (sym == NULL) { + _mesa_error_no_memory(__func__); + return -1; + } + sym->next_with_same_scope = top_scope->symbols; sym->hdr = hdr; sym->name_space = name_space; diff --git a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c index 2bad64334..a2285383e 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c @@ -33,6 +33,7 @@ #include "main/macros.h" #include "st_context.h" #include "st_atom.h" +#include "st_program.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "cso_cache/cso_context.h" @@ -171,9 +172,10 @@ static void update_raster_state( struct st_context *st ) raster->sprite_coord_enable |= 1 << i; } } - if (fragProg->Base.InputsRead & VARYING_BIT_PNTC) { + if (!st->needs_texcoord_semantic && + fragProg->Base.InputsRead & VARYING_BIT_PNTC) { raster->sprite_coord_enable |= - 1 << (VARYING_SLOT_PNTC - VARYING_SLOT_TEX0); + 1 << st_get_generic_varying_index(st, VARYING_SLOT_PNTC); } raster->point_quad_rasterization = 1; diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c index ed9a44429..19072ae2f 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_texture.c +++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c @@ -223,7 +223,7 @@ static unsigned last_level(struct st_texture_object *stObj) static unsigned last_layer(struct st_texture_object *stObj) { - if (stObj->base.Immutable) + if (stObj->base.Immutable && stObj->pt->array_size > 1) return MIN2(stObj->base.MinLayer + stObj->base.NumLayers - 1, stObj->pt->array_size - 1); return stObj->pt->array_size - 1; diff --git a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c index e0cb979f2..d53602c8b 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -246,21 +246,23 @@ st_bufferobj_data(struct gl_context *ctx, /* BufferData */ switch (usage) { case GL_STATIC_DRAW: - case GL_STATIC_READ: case GL_STATIC_COPY: default: pipe_usage = PIPE_USAGE_DEFAULT; break; case GL_DYNAMIC_DRAW: - case GL_DYNAMIC_READ: case GL_DYNAMIC_COPY: pipe_usage = PIPE_USAGE_DYNAMIC; break; case GL_STREAM_DRAW: - case GL_STREAM_READ: case GL_STREAM_COPY: pipe_usage = PIPE_USAGE_STREAM; break; + case GL_STATIC_READ: + case GL_DYNAMIC_READ: + case GL_STREAM_READ: + pipe_usage = PIPE_USAGE_STAGING; + break; } } diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c index 470ab278b..7b6a444e6 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c +++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c @@ -451,7 +451,8 @@ st_update_renderbuffer_surface(struct st_context *st, } /* Adjust for texture views */ - if (strb->is_rtt) { + if (strb->is_rtt && resource->array_size > 1 && + strb->Base.TexImage->TexObject->Immutable) { struct gl_texture_object *tex = strb->Base.TexImage->TexObject; first_layer += tex->MinLayer; if (!strb->rtt_layered) diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c index 768a66790..17235132e 100644 --- a/mesalib/src/mesa/state_tracker/st_context.c +++ b/mesalib/src/mesa/state_tracker/st_context.c @@ -242,7 +242,7 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe, /* GL limits and extensions */ st_init_limits(st->pipe->screen, &ctx->Const, &ctx->Extensions); - st_init_extensions(st->pipe->screen, ctx->API, &ctx->Const, + st_init_extensions(st->pipe->screen, &ctx->Const, &ctx->Extensions, &st->options, ctx->Mesa_DXTn); /* Enable shader-based fallbacks for ARB_color_buffer_float if needed. */ diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index c7bc0ca50..5dd827800 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -407,7 +407,6 @@ get_max_samples_for_formats(struct pipe_screen *screen, * Some fine tuning may still be needed. */ void st_init_extensions(struct pipe_screen *screen, - gl_api api, struct gl_constants *consts, struct gl_extensions *extensions, struct st_config_options *options, @@ -715,9 +714,8 @@ void st_init_extensions(struct pipe_screen *screen, #endif } - extensions->NV_primitive_restart = GL_TRUE; - if (!screen->get_param(screen, PIPE_CAP_PRIMITIVE_RESTART)) { - consts->PrimitiveRestartInSoftware = GL_TRUE; + if (screen->get_param(screen, PIPE_CAP_PRIMITIVE_RESTART)) { + extensions->NV_primitive_restart = GL_TRUE; } /* ARB_color_buffer_float. */ @@ -844,17 +842,16 @@ void st_init_extensions(struct pipe_screen *screen, consts->DisableVaryingPacking = GL_TRUE; } - if (api == API_OPENGL_CORE) { - consts->MaxViewports = screen->get_param(screen, PIPE_CAP_MAX_VIEWPORTS); - if (consts->MaxViewports >= 16) { - consts->ViewportBounds.Min = -16384.0; - consts->ViewportBounds.Max = 16384.0; - extensions->ARB_viewport_array = GL_TRUE; - extensions->ARB_fragment_layer_viewport = GL_TRUE; - if (extensions->AMD_vertex_shader_layer) - extensions->AMD_vertex_shader_viewport_index = GL_TRUE; - } + consts->MaxViewports = screen->get_param(screen, PIPE_CAP_MAX_VIEWPORTS); + if (consts->MaxViewports >= 16) { + consts->ViewportBounds.Min = -16384.0; + consts->ViewportBounds.Max = 16384.0; + extensions->ARB_viewport_array = GL_TRUE; + extensions->ARB_fragment_layer_viewport = GL_TRUE; + if (extensions->AMD_vertex_shader_layer) + extensions->AMD_vertex_shader_viewport_index = GL_TRUE; } + if (consts->MaxProgramTextureGatherComponents > 0) extensions->ARB_texture_gather = GL_TRUE; diff --git a/mesalib/src/mesa/state_tracker/st_extensions.h b/mesalib/src/mesa/state_tracker/st_extensions.h index 8d2724d67..faff11fd5 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.h +++ b/mesalib/src/mesa/state_tracker/st_extensions.h @@ -38,7 +38,6 @@ extern void st_init_limits(struct pipe_screen *screen, struct gl_extensions *extensions); extern void st_init_extensions(struct pipe_screen *screen, - gl_api api, struct gl_constants *consts, struct gl_extensions *extensions, struct st_config_options *options, 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 b338a9836..a0da9f635 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -1072,8 +1072,8 @@ glsl_to_tgsi_visitor::visit(ir_variable *ir) if (ir->data.mode == ir_var_uniform && strncmp(ir->name, "gl_", 3) == 0) { unsigned int i; - const ir_state_slot *const slots = ir->state_slots; - assert(ir->state_slots != NULL); + const ir_state_slot *const slots = ir->get_state_slots(); + assert(slots != NULL); /* Check if this statevar's setup in the STATE file exactly * matches how we'll want to reference it as a @@ -1081,7 +1081,7 @@ glsl_to_tgsi_visitor::visit(ir_variable *ir) * temporary storage and hope that it'll get copy-propagated * out. */ - for (i = 0; i < ir->num_state_slots; i++) { + for (i = 0; i < ir->get_num_state_slots(); i++) { if (slots[i].swizzle != SWIZZLE_XYZW) { break; } @@ -1089,7 +1089,7 @@ glsl_to_tgsi_visitor::visit(ir_variable *ir) variable_storage *storage; st_dst_reg dst; - if (i == ir->num_state_slots) { + if (i == ir->get_num_state_slots()) { /* We'll set the index later. */ storage = new(mem_ctx) variable_storage(ir, PROGRAM_STATE_VAR, -1); this->variables.push_tail(storage); @@ -1100,7 +1100,7 @@ glsl_to_tgsi_visitor::visit(ir_variable *ir) * of the type. However, this had better match the number of state * elements that we're going to copy into the new temporary. */ - assert((int) ir->num_state_slots == type_size(ir->type)); + assert((int) ir->get_num_state_slots() == type_size(ir->type)); dst = st_dst_reg(get_temp(ir->type)); @@ -1110,7 +1110,7 @@ glsl_to_tgsi_visitor::visit(ir_variable *ir) } - for (unsigned int i = 0; i < ir->num_state_slots; i++) { + for (unsigned int i = 0; i < ir->get_num_state_slots(); i++) { int index = _mesa_add_state_reference(this->prog->Parameters, (gl_state_index *)slots[i].tokens); @@ -1135,7 +1135,7 @@ glsl_to_tgsi_visitor::visit(ir_variable *ir) } if (storage->file == PROGRAM_TEMPORARY && - dst.index != storage->index + (int) ir->num_state_slots) { + dst.index != storage->index + (int) ir->get_num_state_slots()) { fail_link(this->shader_program, "failed to load builtin uniform `%s' (%d/%d regs loaded)\n", ir->name, dst.index - storage->index, @@ -2617,10 +2617,7 @@ glsl_to_tgsi_visitor::visit(ir_constant *ir) case GLSL_TYPE_BOOL: gl_type = native_integers ? GL_BOOL : GL_FLOAT; for (i = 0; i < ir->type->vector_elements; i++) { - if (native_integers) - values[i].u = ir->value.b[i] ? ~0 : 0; - else - values[i].f = ir->value.b[i]; + values[i].u = ir->value.b[i] ? ctx->Const.UniformBooleanTrue : 0; } break; default: diff --git a/mesalib/src/mesa/state_tracker/st_manager.c b/mesalib/src/mesa/state_tracker/st_manager.c index 7bc33268e..df6de737f 100644 --- a/mesalib/src/mesa/state_tracker/st_manager.c +++ b/mesalib/src/mesa/state_tracker/st_manager.c @@ -928,7 +928,7 @@ static unsigned get_version(struct pipe_screen *screen, _mesa_init_extensions(&extensions); st_init_limits(screen, &consts, &extensions); - st_init_extensions(screen, api, &consts, &extensions, options, GL_TRUE); + st_init_extensions(screen, &consts, &extensions, options, GL_TRUE); return _mesa_get_version(&extensions, &consts, api); } diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c index fbf8930cb..926086bf8 100644 --- a/mesalib/src/mesa/state_tracker/st_program.c +++ b/mesalib/src/mesa/state_tracker/st_program.c @@ -275,17 +275,18 @@ st_prepare_vertex_program(struct gl_context *ctx, case VARYING_SLOT_TEX5: case VARYING_SLOT_TEX6: case VARYING_SLOT_TEX7: - stvp->output_semantic_name[slot] = st->needs_texcoord_semantic ? - TGSI_SEMANTIC_TEXCOORD : TGSI_SEMANTIC_GENERIC; - stvp->output_semantic_index[slot] = attr - VARYING_SLOT_TEX0; - break; - + if (st->needs_texcoord_semantic) { + stvp->output_semantic_name[slot] = TGSI_SEMANTIC_TEXCOORD; + stvp->output_semantic_index[slot] = attr - VARYING_SLOT_TEX0; + break; + } + /* fall through */ case VARYING_SLOT_VAR0: default: assert(attr < VARYING_SLOT_MAX); stvp->output_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - stvp->output_semantic_index[slot] = st->needs_texcoord_semantic ? - (attr - VARYING_SLOT_VAR0) : (attr - VARYING_SLOT_TEX0); + stvp->output_semantic_index[slot] = + st_get_generic_varying_index(st, attr); break; } } @@ -655,9 +656,8 @@ st_translate_fragment_program(struct st_context *st, * the user varyings on VAR0. Otherwise, we use TEX0 as base index. */ assert(attr >= VARYING_SLOT_TEX0); - input_semantic_index[slot] = st->needs_texcoord_semantic ? - (attr - VARYING_SLOT_VAR0) : (attr - VARYING_SLOT_TEX0); input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; + input_semantic_index[slot] = st_get_generic_varying_index(st, attr); if (attr == VARYING_SLOT_PNTC) interpMode[slot] = TGSI_INTERPOLATE_LINEAR; else @@ -974,16 +974,18 @@ st_translate_geometry_program(struct st_context *st, case VARYING_SLOT_TEX5: case VARYING_SLOT_TEX6: case VARYING_SLOT_TEX7: - stgp->input_semantic_name[slot] = st->needs_texcoord_semantic ? - TGSI_SEMANTIC_TEXCOORD : TGSI_SEMANTIC_GENERIC; - stgp->input_semantic_index[slot] = (attr - VARYING_SLOT_TEX0); - break; + if (st->needs_texcoord_semantic) { + stgp->input_semantic_name[slot] = TGSI_SEMANTIC_TEXCOORD; + stgp->input_semantic_index[slot] = attr - VARYING_SLOT_TEX0; + break; + } + /* fall through */ case VARYING_SLOT_VAR0: default: assert(attr >= VARYING_SLOT_VAR0 && attr < VARYING_SLOT_MAX); stgp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - stgp->input_semantic_index[slot] = st->needs_texcoord_semantic ? - (attr - VARYING_SLOT_VAR0) : (attr - VARYING_SLOT_TEX0); + stgp->input_semantic_index[slot] = + st_get_generic_varying_index(st, attr); break; } } @@ -1069,17 +1071,19 @@ st_translate_geometry_program(struct st_context *st, case VARYING_SLOT_TEX5: case VARYING_SLOT_TEX6: case VARYING_SLOT_TEX7: - gs_output_semantic_name[slot] = st->needs_texcoord_semantic ? - TGSI_SEMANTIC_TEXCOORD : TGSI_SEMANTIC_GENERIC; - gs_output_semantic_index[slot] = (attr - VARYING_SLOT_TEX0); - break; + if (st->needs_texcoord_semantic) { + gs_output_semantic_name[slot] = TGSI_SEMANTIC_TEXCOORD; + gs_output_semantic_index[slot] = attr - VARYING_SLOT_TEX0; + break; + } + /* fall through */ case VARYING_SLOT_VAR0: default: assert(slot < Elements(gs_output_semantic_name)); assert(attr >= VARYING_SLOT_VAR0); gs_output_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - gs_output_semantic_index[slot] = st->needs_texcoord_semantic ? - (attr - VARYING_SLOT_VAR0) : (attr - VARYING_SLOT_TEX0); + gs_output_semantic_index[slot] = + st_get_generic_varying_index(st, attr); break; } } diff --git a/mesalib/src/mesa/state_tracker/st_program.h b/mesalib/src/mesa/state_tracker/st_program.h index 9a5b6a847..cf1b40a55 100644 --- a/mesalib/src/mesa/state_tracker/st_program.h +++ b/mesalib/src/mesa/state_tracker/st_program.h @@ -270,6 +270,31 @@ st_reference_fragprog(struct st_context *st, (struct gl_program *) prog); } +/** + * This defines mapping from Mesa VARYING_SLOTs to TGSI GENERIC slots. + */ +static INLINE unsigned +st_get_generic_varying_index(struct st_context *st, GLuint attr) +{ + if (attr >= VARYING_SLOT_VAR0) { + if (st->needs_texcoord_semantic) + return attr - VARYING_SLOT_VAR0; + else + return 9 + (attr - VARYING_SLOT_VAR0); + } + if (attr == VARYING_SLOT_PNTC) { + assert(!st->needs_texcoord_semantic); + return 8; + } + if (attr >= VARYING_SLOT_TEX0 && attr <= VARYING_SLOT_TEX7) { + assert(!st->needs_texcoord_semantic); + return attr - VARYING_SLOT_TEX0; + } + + assert(0); + return 0; +} + extern struct st_vp_variant * st_get_vp_variant(struct st_context *st, diff --git a/mesalib/src/mesa/state_tracker/st_texture.c b/mesalib/src/mesa/state_tracker/st_texture.c index c84aa4566..5996b7d1b 100644 --- a/mesalib/src/mesa/state_tracker/st_texture.c +++ b/mesalib/src/mesa/state_tracker/st_texture.c @@ -88,7 +88,7 @@ st_texture_create(struct st_context *st, pt.width0 = width0; pt.height0 = height0; pt.depth0 = depth0; - pt.array_size = (target == PIPE_TEXTURE_CUBE ? 6 : layers); + pt.array_size = layers; pt.usage = PIPE_USAGE_DEFAULT; pt.bind = bind; pt.flags = 0; @@ -263,7 +263,8 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage, if (stObj->base.Immutable) { level += stObj->base.MinLevel; z += stObj->base.MinLayer; - d = MIN2(d, stObj->base.NumLayers); + if (stObj->pt->array_size > 1) + d = MIN2(d, stObj->base.NumLayers); } z += stImage->base.Face; diff --git a/mesalib/src/mesa/tnl/t_vb_cliptmp.h b/mesalib/src/mesa/tnl/t_vb_cliptmp.h index 83de16d76..7dafb83cf 100644 --- a/mesalib/src/mesa/tnl/t_vb_cliptmp.h +++ b/mesalib/src/mesa/tnl/t_vb_cliptmp.h @@ -41,12 +41,12 @@ do { \ GLuint idx = inlist[i]; \ GLfloat dp = CLIP_DOTPROD(idx, A, B, C, D ); \ \ - if (!IS_NEGATIVE(dpPrev)) { \ + if (dpPrev >= 0.0f) { \ outlist[outcount++] = idxPrev; \ } \ \ if (DIFFERENT_SIGNS(dp, dpPrev)) { \ - if (IS_NEGATIVE(dp)) { \ + if (dp < 0.0f) { \ /* Going out of bounds. Avoid division by zero as we \ * know dp != dpPrev from DIFFERENT_SIGNS, above. \ */ \ @@ -85,15 +85,15 @@ do { \ if (mask & PLANE_BIT) { \ const GLfloat dp0 = CLIP_DOTPROD( v0, A, B, C, D ); \ const GLfloat dp1 = CLIP_DOTPROD( v1, A, B, C, D ); \ - const GLboolean neg_dp0 = IS_NEGATIVE(dp0); \ - const GLboolean neg_dp1 = IS_NEGATIVE(dp1); \ + const GLboolean neg_dp0 = dp0 < 0.0f; \ + const GLboolean neg_dp1 = dp1 < 0.0f; \ \ /* For regular clipping, we know from the clipmask that one \ * (or both) of these must be negative (otherwise we wouldn't \ * be here). \ * For userclip, there is only a single bit for all active \ * planes, so we can end up here when there is nothing to do, \ - * hence the second IS_NEGATIVE() test: \ + * hence the second < 0.0f test: \ */ \ if (neg_dp0 && neg_dp1) \ return; /* both vertices outside clip plane: discard */ \ diff --git a/mesalib/src/mesa/tnl/t_vertex.c b/mesalib/src/mesa/tnl/t_vertex.c index 421bae2b8..90b97a092 100644 --- a/mesalib/src/mesa/tnl/t_vertex.c +++ b/mesalib/src/mesa/tnl/t_vertex.c @@ -543,7 +543,7 @@ void _tnl_init_vertices( struct gl_context *ctx, vtx->codegen_emit = NULL; #ifdef USE_SSE_ASM - if (!_mesa_getenv("MESA_NO_CODEGEN")) + if (!getenv("MESA_NO_CODEGEN")) vtx->codegen_emit = _tnl_generate_sse_emit; #endif } diff --git a/mesalib/src/mesa/vbo/vbo_exec_api.c b/mesalib/src/mesa/vbo/vbo_exec_api.c index 74aec127c..2871100ae 100644 --- a/mesalib/src/mesa/vbo/vbo_exec_api.c +++ b/mesalib/src/mesa/vbo/vbo_exec_api.c @@ -1067,7 +1067,7 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec ) struct gl_client_array *array; array = &arrays[VERT_ATTRIB_FF(i)]; array->BufferObj = NULL; - _mesa_reference_buffer_object(ctx, &arrays->BufferObj, + _mesa_reference_buffer_object(ctx, &array->BufferObj, vbo->currval[VBO_ATTRIB_POS+i].BufferObj); } diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c index 111321bd7..045dbb506 100644 --- a/mesalib/src/mesa/vbo/vbo_exec_array.c +++ b/mesalib/src/mesa/vbo/vbo_exec_array.c @@ -562,38 +562,6 @@ vbo_bind_arrays(struct gl_context *ctx) } } - -/** - * Handle a draw case that potentially has primitive restart enabled. - * - * If primitive restart is enabled, and PrimitiveRestartInSoftware is - * set, then vbo_sw_primitive_restart is used to handle the primitive - * restart case in software. - */ -static void -vbo_handle_primitive_restart(struct gl_context *ctx, - const struct _mesa_prim *prim, - GLuint nr_prims, - const struct _mesa_index_buffer *ib, - GLboolean index_bounds_valid, - GLuint min_index, - GLuint max_index) -{ - struct vbo_context *vbo = vbo_context(ctx); - - if (ctx->Const.PrimitiveRestartInSoftware && - ctx->Array._PrimitiveRestart && - (ib != NULL)) { - /* Handle primitive restart in software */ - vbo_sw_primitive_restart(ctx, prim, nr_prims, ib, NULL); - } else { - /* Call driver directly for draw_prims */ - vbo->draw_prims(ctx, prim, nr_prims, ib, - index_bounds_valid, min_index, max_index, NULL, NULL); - } -} - - /** * Helper function called by the other DrawArrays() functions below. * This is where we handle primitive restart for drawing non-indexed @@ -1011,8 +979,8 @@ vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode, */ check_buffers_are_unmapped(exec->array.inputs); - vbo_handle_primitive_restart(ctx, prim, 1, &ib, - index_bounds_valid, start, end); + vbo->draw_prims(ctx, prim, 1, &ib, + index_bounds_valid, start, end, NULL, NULL); if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) { _mesa_flush(ctx); @@ -1372,8 +1340,8 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode, } check_buffers_are_unmapped(exec->array.inputs); - vbo_handle_primitive_restart(ctx, prim, primcount, &ib, - GL_FALSE, ~0, ~0); + vbo->draw_prims(ctx, prim, primcount, &ib, + false, ~0, ~0, NULL, NULL); } else { /* render one prim at a time */ for (i = 0; i < primcount; i++) { @@ -1401,8 +1369,8 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode, prim[0].basevertex = 0; check_buffers_are_unmapped(exec->array.inputs); - vbo_handle_primitive_restart(ctx, prim, 1, &ib, - GL_FALSE, ~0, ~0); + vbo->draw_prims(ctx, prim, 1, &ib, + false, ~0, ~0, NULL, NULL); } } @@ -1464,8 +1432,6 @@ vbo_draw_transform_feedback(struct gl_context *ctx, GLenum mode, if (ctx->Driver.GetTransformFeedbackVertexCount && (ctx->Const.AlwaysUseGetTransformFeedbackVertexCount || - (ctx->Const.PrimitiveRestartInSoftware && - ctx->Array._PrimitiveRestart) || !vbo_all_varyings_in_vbos(exec->array.inputs))) { GLsizei n = ctx->Driver.GetTransformFeedbackVertexCount(ctx, obj, stream); vbo_draw_arrays(ctx, mode, 0, n, numInstances, 0); diff --git a/mesalib/src/mesa/vbo/vbo_primitive_restart.c b/mesalib/src/mesa/vbo/vbo_primitive_restart.c index 25c89669c..562dedcd5 100644 --- a/mesalib/src/mesa/vbo/vbo_primitive_restart.c +++ b/mesalib/src/mesa/vbo/vbo_primitive_restart.c @@ -41,8 +41,8 @@ /* * Notes on primitive restart: - * The code below is used when the driver does not support primitive - * restart itself. (ctx->Const.PrimitiveRestartInSoftware == GL_TRUE) + * The code below is used when the driver does not fully support primitive + * restart (for example, if it only does restart index of ~0). * * We map the index buffer, find the restart indexes, unmap * the index buffer then draw the sub-primitives delineated by the restarts. diff --git a/mesalib/src/mesa/x86/assyntax.h b/mesalib/src/mesa/x86/assyntax.h index fa7d92ea5..67867bda4 100644 --- a/mesalib/src/mesa/x86/assyntax.h +++ b/mesalib/src/mesa/x86/assyntax.h @@ -255,7 +255,7 @@ #endif /* ACK_ASSEMBLER */ -#if defined(__QNX__) || defined(Lynx) || (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) || defined(__ELF__) || defined(__GNU__) || defined(__GNUC__) && !defined(__DJGPP__) && !defined(__MINGW32__) +#if defined(__QNX__) || defined(Lynx) || (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) || defined(__ELF__) || defined(__GNU__) || defined(__GNUC__) && !defined(__MINGW32__) #define GLNAME(a) a #else #define GLNAME(a) CONCAT(_,a) @@ -1727,9 +1727,9 @@ * If we build with gcc's -fvisibility=hidden flag, we'll need to change * the symbol visibility mode to 'default'. */ -#if defined(GNU_ASSEMBLER) && !defined(__DJGPP__) && !defined(__MINGW32__) && !defined(__APPLE__) +#if defined(GNU_ASSEMBLER) && !defined(__MINGW32__) && !defined(__APPLE__) # define HIDDEN(x) .hidden x -#elif defined(__GNUC__) && !defined(__DJGPP__) && !defined(__MINGW32__) && !defined(__APPLE__) +#elif defined(__GNUC__) && !defined(__MINGW32__) && !defined(__APPLE__) # pragma GCC visibility push(default) # define HIDDEN(x) .hidden x #else diff --git a/mesalib/src/mesa/x86/common_x86.c b/mesalib/src/mesa/x86/common_x86.c index 2a936a473..25f5c40e2 100644 --- a/mesalib/src/mesa/x86/common_x86.c +++ b/mesalib/src/mesa/x86/common_x86.c @@ -224,7 +224,7 @@ _mesa_get_x86_features(void) #ifdef USE_X86_ASM _mesa_x86_cpu_features = 0x0; - if (_mesa_getenv( "MESA_NO_ASM")) { + if (getenv( "MESA_NO_ASM")) { return; } @@ -307,7 +307,7 @@ _mesa_get_x86_features(void) #ifdef USE_MMX_ASM if ( cpu_has_mmx ) { - if ( _mesa_getenv( "MESA_NO_MMX" ) == 0 ) { + if ( getenv( "MESA_NO_MMX" ) == 0 ) { if (detection_debug) _mesa_debug(NULL, "MMX cpu detected.\n"); } else { @@ -318,7 +318,7 @@ _mesa_get_x86_features(void) #ifdef USE_3DNOW_ASM if ( cpu_has_3dnow ) { - if ( _mesa_getenv( "MESA_NO_3DNOW" ) == 0 ) { + if ( getenv( "MESA_NO_3DNOW" ) == 0 ) { if (detection_debug) _mesa_debug(NULL, "3DNow! cpu detected.\n"); } else { @@ -329,10 +329,10 @@ _mesa_get_x86_features(void) #ifdef USE_SSE_ASM if ( cpu_has_xmm ) { - if ( _mesa_getenv( "MESA_NO_SSE" ) == 0 ) { + if ( getenv( "MESA_NO_SSE" ) == 0 ) { if (detection_debug) _mesa_debug(NULL, "SSE cpu detected.\n"); - if ( _mesa_getenv( "MESA_FORCE_SSE" ) == 0 ) { + if ( getenv( "MESA_FORCE_SSE" ) == 0 ) { _mesa_check_os_sse_support(); } } else { diff --git a/mesalib/src/mesa/x86/read_rgba_span_x86.S b/mesalib/src/mesa/x86/read_rgba_span_x86.S index 817729973..5def1f859 100644 --- a/mesalib/src/mesa/x86/read_rgba_span_x86.S +++ b/mesalib/src/mesa/x86/read_rgba_span_x86.S @@ -31,7 +31,7 @@ */ .file "read_rgba_span_x86.S" -#if !defined(__DJGPP__) && !defined(__MINGW32__) && !defined(__APPLE__) /* this one cries for assyntax.h */ +#if !defined(__MINGW32__) && !defined(__APPLE__) /* this one cries for assyntax.h */ /* Kevin F. Quinn 2nd July 2006 * Replaced data segment constants with text-segment instructions. */ @@ -671,7 +671,7 @@ _generic_read_RGBA_span_RGB565_MMX: emms #endif ret -#endif /* !defined(__DJGPP__) && !defined(__MINGW32__) && !defined(__APPLE__) */ +#endif /* !defined(__MINGW32__) && !defined(__APPLE__) */ #if defined (__ELF__) && defined (__linux__) .section .note.GNU-stack,"",%progbits diff --git a/mesalib/src/util/Makefile.am b/mesalib/src/util/Makefile.am index 4733a1a74..8d5f90e97 100644 --- a/mesalib/src/util/Makefile.am +++ b/mesalib/src/util/Makefile.am @@ -28,6 +28,9 @@ noinst_LTLIBRARIES = libmesautil.la libmesautil_la_CPPFLAGS = \ $(DEFINES) \ -I$(top_srcdir)/include \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/src/mapi \ + -I$(top_srcdir)/src/mesa \ $(VISIBILITY_CFLAGS) libmesautil_la_SOURCES = \ diff --git a/mesalib/src/util/Makefile.sources b/mesalib/src/util/Makefile.sources index c34475a84..952b79905 100644 --- a/mesalib/src/util/Makefile.sources +++ b/mesalib/src/util/Makefile.sources @@ -1,6 +1,8 @@ MESA_UTIL_FILES := \ hash_table.c \ ralloc.c \ + register_allocate.c \ + register_allocate.h \ rgtc.c MESA_UTIL_GENERATED_FILES = \ diff --git a/mesalib/src/util/SConscript b/mesalib/src/util/SConscript index 84803c016..ade1d6c6c 100644 --- a/mesalib/src/util/SConscript +++ b/mesalib/src/util/SConscript @@ -8,6 +8,9 @@ env = env.Clone() env.Prepend(CPPPATH = [ '#include', + '#src', + '#src/mapi', + '#src/mesa', '#src/util', ]) diff --git a/mesalib/src/util/macros.h b/mesalib/src/util/macros.h index ee05e05a4..40ebf02da 100644 --- a/mesalib/src/util/macros.h +++ b/mesalib/src/util/macros.h @@ -33,12 +33,12 @@ /** * __builtin_expect macros */ -#if !defined(__GNUC__) +#if !defined(HAVE___BUILTIN_EXPECT) # define __builtin_expect(x, y) (x) #endif #ifndef likely -# ifdef __GNUC__ +# ifdef HAVE___BUILTIN_EXPECT # define likely(x) __builtin_expect(!!(x), 1) # define unlikely(x) __builtin_expect(!!(x), 0) # else @@ -63,44 +63,45 @@ * Unreachable macro. Useful for suppressing "control reaches end of non-void * function" warnings. */ -#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 5 +#ifdef HAVE___BUILTIN_UNREACHABLE #define unreachable(str) \ do { \ assert(!str); \ __builtin_unreachable(); \ } while (0) -#elif (defined(__clang__) && defined(__has_builtin)) -# if __has_builtin(__builtin_unreachable) -# define unreachable(str) \ -do { \ - assert(!str); \ - __builtin_unreachable(); \ -} while (0) -# endif #endif #ifndef unreachable #define unreachable(str) #endif +#ifdef HAVE_FUNC_ATTRIBUTE_FLATTEN +#define FLATTEN __attribute__((__flatten__)) +#else +#define FLATTEN +#endif -#if (__GNUC__ >= 3) +#ifdef HAVE_FUNC_ATTRIBUTE_FORMAT #define PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a))) #else #define PRINTFLIKE(f, a) #endif +#ifdef HAVE_FUNC_ATTRIBUTE_MALLOC +#define MALLOCLIKE __attribute__((__malloc__)) +#else +#define MALLOCLIKE +#endif /* Used to optionally mark structures with misaligned elements or size as * packed, to trade off performance for space. */ -#if (__GNUC__ >= 3) +#ifdef HAVE_FUNC_ATTRIBUTE_PACKED #define PACKED __attribute__((__packed__)) #else #define PACKED #endif - #ifdef __cplusplus /** * Macro function that evaluates to true if T is a trivially diff --git a/mesalib/src/util/ralloc.h b/mesalib/src/util/ralloc.h index 4b88f3286..f088a3627 100644 --- a/mesalib/src/util/ralloc.h +++ b/mesalib/src/util/ralloc.h @@ -98,14 +98,14 @@ void *ralloc_context(const void *ctx); * simply allocates storage for \p size bytes and returns the pointer, * similar to \c malloc. */ -void *ralloc_size(const void *ctx, size_t size); +void *ralloc_size(const void *ctx, size_t size) MALLOCLIKE; /** * Allocate zero-initialized memory chained off of the given context. * * This is similar to \c calloc with a size of 1. */ -void *rzalloc_size(const void *ctx, size_t size); +void *rzalloc_size(const void *ctx, size_t size) MALLOCLIKE; /** * Resize a piece of ralloc-managed memory, preserving data. @@ -185,7 +185,7 @@ void *reralloc_size(const void *ctx, void *ptr, size_t size); * More than a convenience function, this also checks for integer overflow when * multiplying \p size and \p count. This is necessary for security. */ -void *ralloc_array_size(const void *ctx, size_t size, unsigned count); +void *ralloc_array_size(const void *ctx, size_t size, unsigned count) MALLOCLIKE; /** * Allocate a zero-initialized array chained off the given context. @@ -195,7 +195,7 @@ void *ralloc_array_size(const void *ctx, size_t size, unsigned count); * More than a convenience function, this also checks for integer overflow when * multiplying \p size and \p count. This is necessary for security. */ -void *rzalloc_array_size(const void *ctx, size_t size, unsigned count); +void *rzalloc_array_size(const void *ctx, size_t size, unsigned count) MALLOCLIKE; /** * Resize a ralloc-managed array, preserving data. @@ -257,7 +257,7 @@ void ralloc_set_destructor(const void *ptr, void(*destructor)(void *)); /** * Duplicate a string, allocating the memory from the given context. */ -char *ralloc_strdup(const void *ctx, const char *str); +char *ralloc_strdup(const void *ctx, const char *str) MALLOCLIKE; /** * Duplicate a string, allocating the memory from the given context. @@ -265,7 +265,7 @@ char *ralloc_strdup(const void *ctx, const char *str); * Like \c strndup, at most \p n characters are copied. If \p str is longer * than \p n characters, \p n are copied, and a termining \c '\0' byte is added. */ -char *ralloc_strndup(const void *ctx, const char *str, size_t n); +char *ralloc_strndup(const void *ctx, const char *str, size_t n) MALLOCLIKE; /** * Concatenate two strings, allocating the necessary space. @@ -302,7 +302,7 @@ bool ralloc_strncat(char **dest, const char *str, size_t n); * * \return The newly allocated string. */ -char *ralloc_asprintf (const void *ctx, const char *fmt, ...) PRINTFLIKE(2, 3); +char *ralloc_asprintf (const void *ctx, const char *fmt, ...) PRINTFLIKE(2, 3) MALLOCLIKE; /** * Print to a string, given a va_list. @@ -312,7 +312,7 @@ char *ralloc_asprintf (const void *ctx, const char *fmt, ...) PRINTFLIKE(2, 3); * * \return The newly allocated string. */ -char *ralloc_vasprintf(const void *ctx, const char *fmt, va_list args); +char *ralloc_vasprintf(const void *ctx, const char *fmt, va_list args) MALLOCLIKE; /** * Rewrite the tail of an existing string, starting at a given index. diff --git a/mesalib/src/util/register_allocate.c b/mesalib/src/util/register_allocate.c new file mode 100644 index 000000000..afab9ddd3 --- /dev/null +++ b/mesalib/src/util/register_allocate.c @@ -0,0 +1,654 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Eric Anholt + * + */ + +/** @file register_allocate.c + * + * Graph-coloring register allocator. + * + * The basic idea of graph coloring is to make a node in a graph for + * every thing that needs a register (color) number assigned, and make + * edges in the graph between nodes that interfere (can't be allocated + * to the same register at the same time). + * + * During the "simplify" process, any any node with fewer edges than + * there are registers means that that edge can get assigned a + * register regardless of what its neighbors choose, so that node is + * pushed on a stack and removed (with its edges) from the graph. + * That likely causes other nodes to become trivially colorable as well. + * + * Then during the "select" process, nodes are popped off of that + * stack, their edges restored, and assigned a color different from + * their neighbors. Because they were pushed on the stack only when + * they were trivially colorable, any color chosen won't interfere + * with the registers to be popped later. + * + * The downside to most graph coloring is that real hardware often has + * limitations, like registers that need to be allocated to a node in + * pairs, or aligned on some boundary. This implementation follows + * the paper "Retargetable Graph-Coloring Register Allocation for + * Irregular Architectures" by Johan Runeson and Sven-Olof Nyström. + * + * In this system, there are register classes each containing various + * registers, and registers may interfere with other registers. For + * example, one might have a class of base registers, and a class of + * aligned register pairs that would each interfere with their pair of + * the base registers. Each node has a register class it needs to be + * assigned to. Define p(B) to be the size of register class B, and + * q(B,C) to be the number of registers in B that the worst choice + * register in C could conflict with. Then, this system replaces the + * basic graph coloring test of "fewer edges from this node than there + * are registers" with "For this node of class B, the sum of q(B,C) + * for each neighbor node of class C is less than pB". + * + * A nice feature of the pq test is that q(B,C) can be computed once + * up front and stored in a 2-dimensional array, so that the cost of + * coloring a node is constant with the number of registers. We do + * this during ra_set_finalize(). + */ + +#include + +#include "ralloc.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/mtypes.h" +#include "main/bitset.h" +#include "register_allocate.h" + +#define NO_REG ~0 + +struct ra_reg { + BITSET_WORD *conflicts; + unsigned int *conflict_list; + unsigned int conflict_list_size; + unsigned int num_conflicts; +}; + +struct ra_regs { + struct ra_reg *regs; + unsigned int count; + + struct ra_class **classes; + unsigned int class_count; + + bool round_robin; +}; + +struct ra_class { + /** + * Bitset indicating which registers belong to this class. + * + * (If bit N is set, then register N belongs to this class.) + */ + BITSET_WORD *regs; + + /** + * p(B) in Runeson/Nyström paper. + * + * This is "how many regs are in the set." + */ + unsigned int p; + + /** + * q(B,C) (indexed by C, B is this register class) in + * Runeson/Nyström paper. This is "how many registers of B could + * the worst choice register from C conflict with". + */ + unsigned int *q; +}; + +struct ra_node { + /** @{ + * + * List of which nodes this node interferes with. This should be + * symmetric with the other node. + */ + BITSET_WORD *adjacency; + unsigned int *adjacency_list; + unsigned int adjacency_list_size; + unsigned int adjacency_count; + /** @} */ + + unsigned int class; + + /* Register, if assigned, or NO_REG. */ + unsigned int reg; + + /** + * Set when the node is in the trivially colorable stack. When + * set, the adjacency to this node is ignored, to implement the + * "remove the edge from the graph" in simplification without + * having to actually modify the adjacency_list. + */ + bool in_stack; + + /** + * The q total, as defined in the Runeson/Nyström paper, for all the + * interfering nodes not in the stack. + */ + unsigned int q_total; + + /* For an implementation that needs register spilling, this is the + * approximate cost of spilling this node. + */ + float spill_cost; +}; + +struct ra_graph { + struct ra_regs *regs; + /** + * the variables that need register allocation. + */ + struct ra_node *nodes; + unsigned int count; /**< count of nodes. */ + + unsigned int *stack; + unsigned int stack_count; +}; + +/** + * Creates a set of registers for the allocator. + * + * mem_ctx is a ralloc context for the allocator. The reg set may be freed + * using ralloc_free(). + */ +struct ra_regs * +ra_alloc_reg_set(void *mem_ctx, unsigned int count) +{ + unsigned int i; + struct ra_regs *regs; + + regs = rzalloc(mem_ctx, struct ra_regs); + regs->count = count; + regs->regs = rzalloc_array(regs, struct ra_reg, count); + + for (i = 0; i < count; i++) { + regs->regs[i].conflicts = rzalloc_array(regs->regs, BITSET_WORD, + BITSET_WORDS(count)); + BITSET_SET(regs->regs[i].conflicts, i); + + regs->regs[i].conflict_list = ralloc_array(regs->regs, unsigned int, 4); + regs->regs[i].conflict_list_size = 4; + regs->regs[i].conflict_list[0] = i; + regs->regs[i].num_conflicts = 1; + } + + return regs; +} + +/** + * The register allocator by default prefers to allocate low register numbers, + * since it was written for hardware (gen4/5 Intel) that is limited in its + * multithreadedness by the number of registers used in a given shader. + * + * However, for hardware without that restriction, densely packed register + * allocation can put serious constraints on instruction scheduling. This + * function tells the allocator to rotate around the registers if possible as + * it allocates the nodes. + */ +void +ra_set_allocate_round_robin(struct ra_regs *regs) +{ + regs->round_robin = true; +} + +static void +ra_add_conflict_list(struct ra_regs *regs, unsigned int r1, unsigned int r2) +{ + struct ra_reg *reg1 = ®s->regs[r1]; + + if (reg1->conflict_list_size == reg1->num_conflicts) { + reg1->conflict_list_size *= 2; + reg1->conflict_list = reralloc(regs->regs, reg1->conflict_list, + unsigned int, reg1->conflict_list_size); + } + reg1->conflict_list[reg1->num_conflicts++] = r2; + BITSET_SET(reg1->conflicts, r2); +} + +void +ra_add_reg_conflict(struct ra_regs *regs, unsigned int r1, unsigned int r2) +{ + if (!BITSET_TEST(regs->regs[r1].conflicts, r2)) { + ra_add_conflict_list(regs, r1, r2); + ra_add_conflict_list(regs, r2, r1); + } +} + +/** + * Adds a conflict between base_reg and reg, and also between reg and + * anything that base_reg conflicts with. + * + * This can simplify code for setting up multiple register classes + * which are aggregates of some base hardware registers, compared to + * explicitly using ra_add_reg_conflict. + */ +void +ra_add_transitive_reg_conflict(struct ra_regs *regs, + unsigned int base_reg, unsigned int reg) +{ + int i; + + ra_add_reg_conflict(regs, reg, base_reg); + + for (i = 0; i < regs->regs[base_reg].num_conflicts; i++) { + ra_add_reg_conflict(regs, reg, regs->regs[base_reg].conflict_list[i]); + } +} + +unsigned int +ra_alloc_reg_class(struct ra_regs *regs) +{ + struct ra_class *class; + + regs->classes = reralloc(regs->regs, regs->classes, struct ra_class *, + regs->class_count + 1); + + class = rzalloc(regs, struct ra_class); + regs->classes[regs->class_count] = class; + + class->regs = rzalloc_array(class, BITSET_WORD, BITSET_WORDS(regs->count)); + + return regs->class_count++; +} + +void +ra_class_add_reg(struct ra_regs *regs, unsigned int c, unsigned int r) +{ + struct ra_class *class = regs->classes[c]; + + BITSET_SET(class->regs, r); + class->p++; +} + +/** + * Returns true if the register belongs to the given class. + */ +static bool +reg_belongs_to_class(unsigned int r, struct ra_class *c) +{ + return BITSET_TEST(c->regs, r); +} + +/** + * Must be called after all conflicts and register classes have been + * set up and before the register set is used for allocation. + * To avoid costly q value computation, use the q_values paramater + * to pass precomputed q values to this function. + */ +void +ra_set_finalize(struct ra_regs *regs, unsigned int **q_values) +{ + unsigned int b, c; + + for (b = 0; b < regs->class_count; b++) { + regs->classes[b]->q = ralloc_array(regs, unsigned int, regs->class_count); + } + + if (q_values) { + for (b = 0; b < regs->class_count; b++) { + for (c = 0; c < regs->class_count; c++) { + regs->classes[b]->q[c] = q_values[b][c]; + } + } + return; + } + + /* Compute, for each class B and C, how many regs of B an + * allocation to C could conflict with. + */ + for (b = 0; b < regs->class_count; b++) { + for (c = 0; c < regs->class_count; c++) { + unsigned int rc; + int max_conflicts = 0; + + for (rc = 0; rc < regs->count; rc++) { + int conflicts = 0; + int i; + + if (!reg_belongs_to_class(rc, regs->classes[c])) + continue; + + for (i = 0; i < regs->regs[rc].num_conflicts; i++) { + unsigned int rb = regs->regs[rc].conflict_list[i]; + if (BITSET_TEST(regs->classes[b]->regs, rb)) + conflicts++; + } + max_conflicts = MAX2(max_conflicts, conflicts); + } + regs->classes[b]->q[c] = max_conflicts; + } + } +} + +static void +ra_add_node_adjacency(struct ra_graph *g, unsigned int n1, unsigned int n2) +{ + BITSET_SET(g->nodes[n1].adjacency, n2); + + if (n1 != n2) { + int n1_class = g->nodes[n1].class; + int n2_class = g->nodes[n2].class; + g->nodes[n1].q_total += g->regs->classes[n1_class]->q[n2_class]; + } + + if (g->nodes[n1].adjacency_count >= + g->nodes[n1].adjacency_list_size) { + g->nodes[n1].adjacency_list_size *= 2; + g->nodes[n1].adjacency_list = reralloc(g, g->nodes[n1].adjacency_list, + unsigned int, + g->nodes[n1].adjacency_list_size); + } + + g->nodes[n1].adjacency_list[g->nodes[n1].adjacency_count] = n2; + g->nodes[n1].adjacency_count++; +} + +struct ra_graph * +ra_alloc_interference_graph(struct ra_regs *regs, unsigned int count) +{ + struct ra_graph *g; + unsigned int i; + + g = rzalloc(regs, struct ra_graph); + g->regs = regs; + g->nodes = rzalloc_array(g, struct ra_node, count); + g->count = count; + + g->stack = rzalloc_array(g, unsigned int, count); + + for (i = 0; i < count; i++) { + int bitset_count = BITSET_WORDS(count); + g->nodes[i].adjacency = rzalloc_array(g, BITSET_WORD, bitset_count); + + g->nodes[i].adjacency_list_size = 4; + g->nodes[i].adjacency_list = + ralloc_array(g, unsigned int, g->nodes[i].adjacency_list_size); + g->nodes[i].adjacency_count = 0; + g->nodes[i].q_total = 0; + + ra_add_node_adjacency(g, i, i); + g->nodes[i].reg = NO_REG; + } + + return g; +} + +void +ra_set_node_class(struct ra_graph *g, + unsigned int n, unsigned int class) +{ + g->nodes[n].class = class; +} + +void +ra_add_node_interference(struct ra_graph *g, + unsigned int n1, unsigned int n2) +{ + if (!BITSET_TEST(g->nodes[n1].adjacency, n2)) { + ra_add_node_adjacency(g, n1, n2); + ra_add_node_adjacency(g, n2, n1); + } +} + +static bool +pq_test(struct ra_graph *g, unsigned int n) +{ + int n_class = g->nodes[n].class; + + return g->nodes[n].q_total < g->regs->classes[n_class]->p; +} + +static void +decrement_q(struct ra_graph *g, unsigned int n) +{ + unsigned int i; + int n_class = g->nodes[n].class; + + for (i = 0; i < g->nodes[n].adjacency_count; i++) { + unsigned int n2 = g->nodes[n].adjacency_list[i]; + unsigned int n2_class = g->nodes[n2].class; + + if (n != n2 && !g->nodes[n2].in_stack) { + assert(g->nodes[n2].q_total >= g->regs->classes[n2_class]->q[n_class]); + g->nodes[n2].q_total -= g->regs->classes[n2_class]->q[n_class]; + } + } +} + +/** + * Simplifies the interference graph by pushing all + * trivially-colorable nodes into a stack of nodes to be colored, + * removing them from the graph, and rinsing and repeating. + * + * If we encounter a case where we can't push any nodes on the stack, then + * we optimistically choose a node and push it on the stack. We heuristically + * push the node with the lowest total q value, since it has the fewest + * neighbors and therefore is most likely to be allocated. + */ +static void +ra_simplify(struct ra_graph *g) +{ + bool progress = true; + int i; + + while (progress) { + unsigned int best_optimistic_node = ~0; + unsigned int lowest_q_total = ~0; + + progress = false; + + for (i = g->count - 1; i >= 0; i--) { + if (g->nodes[i].in_stack || g->nodes[i].reg != NO_REG) + continue; + + if (pq_test(g, i)) { + decrement_q(g, i); + g->stack[g->stack_count] = i; + g->stack_count++; + g->nodes[i].in_stack = true; + progress = true; + } else { + unsigned int new_q_total = g->nodes[i].q_total; + if (new_q_total < lowest_q_total) { + best_optimistic_node = i; + lowest_q_total = new_q_total; + } + } + } + + if (!progress && best_optimistic_node != ~0) { + decrement_q(g, best_optimistic_node); + g->stack[g->stack_count] = best_optimistic_node; + g->stack_count++; + g->nodes[best_optimistic_node].in_stack = true; + progress = true; + } + } +} + +/** + * Pops nodes from the stack back into the graph, coloring them with + * registers as they go. + * + * If all nodes were trivially colorable, then this must succeed. If + * not (optimistic coloring), then it may return false; + */ +static bool +ra_select(struct ra_graph *g) +{ + int i; + int start_search_reg = 0; + + while (g->stack_count != 0) { + unsigned int ri; + unsigned int r = -1; + int n = g->stack[g->stack_count - 1]; + struct ra_class *c = g->regs->classes[g->nodes[n].class]; + + /* Find the lowest-numbered reg which is not used by a member + * of the graph adjacent to us. + */ + for (ri = 0; ri < g->regs->count; ri++) { + r = (start_search_reg + ri) % g->regs->count; + if (!reg_belongs_to_class(r, c)) + continue; + + /* Check if any of our neighbors conflict with this register choice. */ + for (i = 0; i < g->nodes[n].adjacency_count; i++) { + unsigned int n2 = g->nodes[n].adjacency_list[i]; + + if (!g->nodes[n2].in_stack && + BITSET_TEST(g->regs->regs[r].conflicts, g->nodes[n2].reg)) { + break; + } + } + if (i == g->nodes[n].adjacency_count) + break; + } + + /* set this to false even if we return here so that + * ra_get_best_spill_node() considers this node later. + */ + g->nodes[n].in_stack = false; + + if (ri == g->regs->count) + return false; + + g->nodes[n].reg = r; + g->stack_count--; + + if (g->regs->round_robin) + start_search_reg = r + 1; + } + + return true; +} + +bool +ra_allocate(struct ra_graph *g) +{ + ra_simplify(g); + return ra_select(g); +} + +unsigned int +ra_get_node_reg(struct ra_graph *g, unsigned int n) +{ + return g->nodes[n].reg; +} + +/** + * Forces a node to a specific register. This can be used to avoid + * creating a register class containing one node when handling data + * that must live in a fixed location and is known to not conflict + * with other forced register assignment (as is common with shader + * input data). These nodes do not end up in the stack during + * ra_simplify(), and thus at ra_select() time it is as if they were + * the first popped off the stack and assigned their fixed locations. + * Nodes that use this function do not need to be assigned a register + * class. + * + * Must be called before ra_simplify(). + */ +void +ra_set_node_reg(struct ra_graph *g, unsigned int n, unsigned int reg) +{ + g->nodes[n].reg = reg; + g->nodes[n].in_stack = false; +} + +static float +ra_get_spill_benefit(struct ra_graph *g, unsigned int n) +{ + int j; + float benefit = 0; + int n_class = g->nodes[n].class; + + /* Define the benefit of eliminating an interference between n, n2 + * through spilling as q(C, B) / p(C). This is similar to the + * "count number of edges" approach of traditional graph coloring, + * but takes classes into account. + */ + for (j = 0; j < g->nodes[n].adjacency_count; j++) { + unsigned int n2 = g->nodes[n].adjacency_list[j]; + if (n != n2) { + unsigned int n2_class = g->nodes[n2].class; + benefit += ((float)g->regs->classes[n_class]->q[n2_class] / + g->regs->classes[n_class]->p); + } + } + + return benefit; +} + +/** + * Returns a node number to be spilled according to the cost/benefit using + * the pq test, or -1 if there are no spillable nodes. + */ +int +ra_get_best_spill_node(struct ra_graph *g) +{ + unsigned int best_node = -1; + float best_benefit = 0.0; + unsigned int n; + + /* Consider any nodes that we colored successfully or the node we failed to + * color for spilling. When we failed to color a node in ra_select(), we + * only considered these nodes, so spilling any other ones would not result + * in us making progress. + */ + for (n = 0; n < g->count; n++) { + float cost = g->nodes[n].spill_cost; + float benefit; + + if (cost <= 0.0) + continue; + + if (g->nodes[n].in_stack) + continue; + + benefit = ra_get_spill_benefit(g, n); + + if (benefit / cost > best_benefit) { + best_benefit = benefit / cost; + best_node = n; + } + } + + return best_node; +} + +/** + * Only nodes with a spill cost set (cost != 0.0) will be considered + * for register spilling. + */ +void +ra_set_node_spill_cost(struct ra_graph *g, unsigned int n, float cost) +{ + g->nodes[n].spill_cost = cost; +} diff --git a/mesalib/src/util/register_allocate.h b/mesalib/src/util/register_allocate.h new file mode 100644 index 000000000..dc6874495 --- /dev/null +++ b/mesalib/src/util/register_allocate.h @@ -0,0 +1,79 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Eric Anholt + * + */ + +#include + +struct ra_class; +struct ra_regs; + +/* @{ + * Register set setup. + * + * This should be done once at backend initializaion, as + * ra_set_finalize is O(r^2*c^2). The registers may be virtual + * registers, such as aligned register pairs that conflict with the + * two real registers from which they are composed. + */ +struct ra_regs *ra_alloc_reg_set(void *mem_ctx, unsigned int count); +void ra_set_allocate_round_robin(struct ra_regs *regs); +unsigned int ra_alloc_reg_class(struct ra_regs *regs); +void ra_add_reg_conflict(struct ra_regs *regs, + unsigned int r1, unsigned int r2); +void ra_add_transitive_reg_conflict(struct ra_regs *regs, + unsigned int base_reg, unsigned int reg); +void ra_class_add_reg(struct ra_regs *regs, unsigned int c, unsigned int reg); +void ra_set_num_conflicts(struct ra_regs *regs, unsigned int class_a, + unsigned int class_b, unsigned int num_conflicts); +void ra_set_finalize(struct ra_regs *regs, unsigned int **conflicts); +/** @} */ + +/** @{ Interference graph setup. + * + * Each interference graph node is a virtual variable in the IL. It + * is up to the user to ra_set_node_class() for the virtual variable, + * and compute live ranges and ra_node_interfere() between conflicting + * live ranges. Note that an interference *must not* be added between + * two nodes if their classes haven't been assigned yet. The user + * should set the class of each node before building the interference + * graph. + */ +struct ra_graph *ra_alloc_interference_graph(struct ra_regs *regs, + unsigned int count); +void ra_set_node_class(struct ra_graph *g, unsigned int n, unsigned int c); +void ra_add_node_interference(struct ra_graph *g, + unsigned int n1, unsigned int n2); +/** @} */ + +/** @{ Graph-coloring register allocation */ +bool ra_allocate(struct ra_graph *g); + +unsigned int ra_get_node_reg(struct ra_graph *g, unsigned int n); +void ra_set_node_reg(struct ra_graph * g, unsigned int n, unsigned int reg); +void ra_set_node_spill_cost(struct ra_graph *g, unsigned int n, float cost); +int ra_get_best_spill_node(struct ra_graph *g); +/** @} */ + -- cgit v1.2.3