diff options
Diffstat (limited to 'mesalib/src')
563 files changed, 7696 insertions, 5358 deletions
diff --git a/mesalib/src/Makefile.am b/mesalib/src/Makefile.am index d6a7946ef..b3dc44d6f 100644 --- a/mesalib/src/Makefile.am +++ b/mesalib/src/Makefile.am @@ -1,4 +1,53 @@ -SUBDIRS=$(SRC_DIRS) +# Copyright © 2013 Intel Corporation +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. -all-local: - $(MKDIR_P) $(top_builddir)/$(LIB_DIR) +SUBDIRS = gtest mapi + +if NEED_OPENGL_COMMON +SUBDIRS += glsl mesa +endif + +if HAVE_DRI_GLX +SUBDIRS += glx +endif + +if HAVE_GBM +SUBDIRS += gbm +endif + +if HAVE_EGL +SUBDIRS += egl +endif + +if HAVE_GALLIUM +SUBDIRS += \ + gallium/auxiliary \ + gallium/drivers \ + gallium/state_trackers \ + gallium/winsys \ + gallium/targets + +if HAVE_GALLIUM_TESTS +SUBDIRS += \ + gallium/tests/trivial \ + gallium/tests/unit +endif +endif diff --git a/mesalib/src/gallium/Android.mk b/mesalib/src/gallium/Android.mk index 1d002d053..4e5acc86f 100644 --- a/mesalib/src/gallium/Android.mk +++ b/mesalib/src/gallium/Android.mk @@ -39,6 +39,11 @@ ifneq ($(filter i915g, $(MESA_GPU_DRIVERS)),) SUBDIRS += winsys/i915/drm drivers/i915 endif +# ilo +ifneq ($(filter ilo, $(MESA_GPU_DRIVERS)),) +SUBDIRS += winsys/intel/drm drivers/ilo +endif + # nouveau ifneq ($(filter nouveau, $(MESA_GPU_DRIVERS)),) SUBDIRS += \ diff --git a/mesalib/src/gallium/SConscript b/mesalib/src/gallium/SConscript index f281f4c65..ca75f37f9 100644 --- a/mesalib/src/gallium/SConscript +++ b/mesalib/src/gallium/SConscript @@ -27,28 +27,6 @@ if not env['msvc']: 'drivers/i915/SConscript', ]) -if env['drm']: - # These drivers depend on drm headers - if env['drm_radeon']: - SConscript([ - 'drivers/r300/SConscript', - 'drivers/r600/SConscript', - ]) - if env['llvm']: - SConscript([ - 'drivers/radeonsi/SConscript', - ]) - # XXX: nouveau drivers have a tight dependency on libdrm, so to enable - # we need some version logic before we enable them. Also, ATM there is - # no nouveau target in scons - # if env['drm_nouveau']: - # SConscript([ - # 'drivers/nouveau/SConscript', - # 'drivers/nv50/SConscript', - # 'drivers/nvc0/SConscript', - # 'drivers/nvfx/SConscript', - # ]) - # # State trackers # @@ -96,6 +74,11 @@ if not env['msvc']: 'winsys/i915/sw/SConscript', ]) +if env['platform'] == 'haiku': + SConscript([ + 'winsys/sw/hgl/SConscript', + ]) + if env['dri']: SConscript([ 'winsys/sw/dri/SConscript', @@ -110,11 +93,6 @@ if env['dri']: 'winsys/i915/drm/SConscript', ]) - if env['drm_radeon']: - SConscript([ - 'winsys/radeon/drm/SConscript', - ]) - # # Targets # @@ -141,32 +119,25 @@ if not env['embedded']: 'targets/libgl-gdi/SConscript', ]) + if env['platform'] == 'haiku': + SConscript([ + 'targets/haiku-softpipe/SConscript', + ]) + if env['dri']: SConscript([ 'targets/SConscript.dri', 'targets/dri-swrast/SConscript', 'targets/dri-vmwgfx/SConscript', - #'targets/dri-nouveau/SConscript', ]) if env['drm_intel']: SConscript([ 'targets/dri-i915/SConscript', ]) - if env['drm_radeon']: - SConscript([ - 'targets/dri-r300/SConscript', - 'targets/dri-r600/SConscript', - ]) - if env['llvm']: - SConscript([ - 'targets/dri-radeonsi/SConscript', - ]) if env['xorg'] and env['drm']: SConscript([ #'targets/xorg-i915/SConscript', - #'targets/xorg-nouveau/SConscript', - #'targets/xorg-radeon/SConscript', ]) diff --git a/mesalib/src/gallium/auxiliary/Makefile.sources b/mesalib/src/gallium/auxiliary/Makefile.sources index 79def2177..20ff5ba73 100644 --- a/mesalib/src/gallium/auxiliary/Makefile.sources +++ b/mesalib/src/gallium/auxiliary/Makefile.sources @@ -23,6 +23,7 @@ C_SOURCES := \ draw/draw_pipe_vbuf.c \ draw/draw_pipe_wide_line.c \ draw/draw_pipe_wide_point.c \ + draw/draw_prim_assembler.c \ draw/draw_pt.c \ draw/draw_pt_emit.c \ draw/draw_pt_fetch.c \ diff --git a/mesalib/src/gallium/auxiliary/SConscript b/mesalib/src/gallium/auxiliary/SConscript index bfd5ec34c..31dfed316 100644 --- a/mesalib/src/gallium/auxiliary/SConscript +++ b/mesalib/src/gallium/auxiliary/SConscript @@ -51,10 +51,6 @@ if env['llvm']: 'GALLIVM_CPP_SOURCES' ]) - if env['toolchain'] == 'crossmingw': - # compile lp_bld_misc.cpp without -gstabs option - source = env.compile_without_gstabs(source, "gallivm/lp_bld_misc.cpp") - gallium = env.ConvenienceLibrary( target = 'gallium', source = source, diff --git a/mesalib/src/gallium/auxiliary/hud/hud_context.c b/mesalib/src/gallium/auxiliary/hud/hud_context.c index 983f05756..de032b6ba 100644 --- a/mesalib/src/gallium/auxiliary/hud/hud_context.c +++ b/mesalib/src/gallium/auxiliary/hud/hud_context.c @@ -90,10 +90,6 @@ struct hud_context { unsigned max_num_vertices; unsigned num_vertices; } text, bg, whitelines; - - struct { - boolean query_pipeline_statistics; - } cap; }; @@ -467,7 +463,7 @@ hud_draw(struct hud_context *hud, struct pipe_resource *tex) cso_set_constant_buffer(cso, PIPE_SHADER_VERTEX, 0, &hud->constbuf); /* prepare vertex buffers */ - hud_alloc_vertices(hud, &hud->bg, 4 * 64, 2 * sizeof(float)); + hud_alloc_vertices(hud, &hud->bg, 4 * 128, 2 * sizeof(float)); hud_alloc_vertices(hud, &hud->whitelines, 4 * 256, 2 * sizeof(float)); hud_alloc_vertices(hud, &hud->text, 4 * 512, 4 * sizeof(float)); @@ -695,6 +691,12 @@ has_streamout(struct pipe_screen *screen) return screen->get_param(screen, PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS) != 0; } +static boolean +has_pipeline_stats_query(struct pipe_screen *screen) +{ + return screen->get_param(screen, PIPE_CAP_QUERY_PIPELINE_STATISTICS) != 0; +} + static void hud_parse_env_var(struct hud_context *hud, const char *env) { @@ -728,7 +730,8 @@ hud_parse_env_var(struct hud_context *hud, const char *env) return; } - /* add a graph */ + /* Add a graph. */ + /* IF YOU CHANGE THIS, UPDATE print_help! */ if (strcmp(name, "fps") == 0) { hud_fps_graph_install(pane); } @@ -748,8 +751,11 @@ hud_parse_env_var(struct hud_context *hud, const char *env) hud_pipe_query_install(pane, hud->pipe, "primitives-generated", PIPE_QUERY_PRIMITIVES_GENERATED, 0, 0, FALSE); } - else if (strncmp(name, "pipeline-statistics-", 20) == 0) { - if (hud->cap.query_pipeline_statistics) { + else { + boolean processed = FALSE; + + /* pipeline statistics queries */ + if (has_pipeline_stats_query(hud->pipe->screen)) { static const char *pipeline_statistics_names[] = { "ia-vertices", @@ -765,22 +771,21 @@ hud_parse_env_var(struct hud_context *hud, const char *env) "cs-invocations" }; for (i = 0; i < Elements(pipeline_statistics_names); ++i) - if (strcmp(&name[20], pipeline_statistics_names[i]) == 0) + if (strcmp(name, pipeline_statistics_names[i]) == 0) break; - if (i < Elements(pipeline_statistics_names)) - hud_pipe_query_install(pane, hud->pipe, &name[20], + if (i < Elements(pipeline_statistics_names)) { + hud_pipe_query_install(pane, hud->pipe, name, PIPE_QUERY_PIPELINE_STATISTICS, i, 0, FALSE); - else - fprintf(stderr, "gallium_hud: invalid pipeline-statistics-*\n"); - } else { - fprintf(stderr, "gallium_hud: PIPE_QUERY_PIPELINE_STATISTICS " - "not supported by the driver\n"); + processed = TRUE; + } } - } - else { - if (!hud_driver_query_install(pane, hud->pipe, name)){ - fprintf(stderr, "gallium_hud: unknown driver query '%s'\n", name); + + /* driver queries */ + if (!processed) { + if (!hud_driver_query_install(pane, hud->pipe, name)){ + fprintf(stderr, "gallium_hud: unknown driver query '%s'\n", name); + } } } @@ -877,10 +882,24 @@ print_help(struct pipe_screen *screen) printf(" cpu%i\n", i); if (has_occlusion_query(screen)) - puts(" pixels-rendered"); + puts(" samples-passed"); if (has_streamout(screen)) puts(" primitives-generated"); + if (has_pipeline_stats_query(screen)) { + puts(" ia-vertices"); + puts(" ia-primitives"); + puts(" vs-invocations"); + puts(" gs-invocations"); + puts(" gs-primitives"); + puts(" clipper-invocations"); + puts(" clipper-primitives-generated"); + puts(" ps-invocations"); + puts(" hs-invocations"); + puts(" ds-invocations"); + puts(" cs-invocations"); + } + if (screen->get_driver_query_info){ struct pipe_driver_query_info info; num_queries = screen->get_driver_query_info(screen, 0, NULL); @@ -971,7 +990,8 @@ hud_create(struct pipe_context *pipe, struct cso_context *cso) } /* rasterizer */ - hud->rasterizer.gl_rasterization_rules = 1; + hud->rasterizer.half_pixel_center = 1; + hud->rasterizer.bottom_edge_rule = 1; hud->rasterizer.depth_clip = 1; hud->rasterizer.line_width = 1; hud->rasterizer.line_last_pixel = 1; @@ -1045,9 +1065,6 @@ hud_create(struct pipe_context *pipe, struct cso_context *cso) LIST_INITHEAD(&hud->pane_list); - hud->cap.query_pipeline_statistics = - pipe->screen->get_param(pipe->screen, PIPE_CAP_QUERY_PIPELINE_STATISTICS); - hud_parse_env_var(hud, env); return hud; } diff --git a/mesalib/src/gallium/auxiliary/hud/hud_fps.c b/mesalib/src/gallium/auxiliary/hud/hud_fps.c index 71cdfd04e..80381f547 100644 --- a/mesalib/src/gallium/auxiliary/hud/hud_fps.c +++ b/mesalib/src/gallium/auxiliary/hud/hud_fps.c @@ -47,7 +47,8 @@ query_fps(struct hud_graph *gr) if (info->last_time) { if (info->last_time + gr->pane->period <= now) { - double fps = info->frames * 1000000 / (double)(now - info->last_time); + double fps = (uint64_t)info->frames * 1000000 / + (double)(now - info->last_time); info->frames = 0; info->last_time = now; diff --git a/mesalib/src/gallium/auxiliary/util/u_blit.c b/mesalib/src/gallium/auxiliary/util/u_blit.c index 9fe15b810..cda66d157 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blit.c +++ b/mesalib/src/gallium/auxiliary/util/u_blit.c @@ -118,7 +118,8 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso) /* rasterizer */ ctx->rasterizer.cull_face = PIPE_FACE_NONE; - ctx->rasterizer.gl_rasterization_rules = 1; + ctx->rasterizer.half_pixel_center = 1; + ctx->rasterizer.bottom_edge_rule = 1; ctx->rasterizer.depth_clip = 1; /* samplers */ diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c index 2a4a13e9f..8c871fdf9 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blitter.c +++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c @@ -100,7 +100,7 @@ struct blitter_context_priv void *velem_state; void *velem_uint_state; void *velem_sint_state; - void *velem_state_readbuf; + void *velem_state_readbuf[4]; /**< X, XY, XYZ, XYZW */ /* Sampler state. */ void *sampler_state; @@ -239,7 +239,8 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe) /* rasterizer state */ memset(&rs_state, 0, sizeof(rs_state)); rs_state.cull_face = PIPE_FACE_NONE; - rs_state.gl_rasterization_rules = 1; + rs_state.half_pixel_center = 1; + rs_state.bottom_edge_rule = 1; rs_state.flatshade = 1; rs_state.depth_clip = 1; ctx->rs_state = pipe->create_rasterizer_state(pipe, &rs_state); @@ -285,9 +286,19 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe) } if (ctx->has_stream_out) { - velem[0].src_format = PIPE_FORMAT_R32_UINT; - velem[0].vertex_buffer_index = ctx->base.vb_slot; - ctx->velem_state_readbuf = pipe->create_vertex_elements_state(pipe, 1, &velem[0]); + static enum pipe_format formats[4] = { + PIPE_FORMAT_R32_UINT, + PIPE_FORMAT_R32G32_UINT, + PIPE_FORMAT_R32G32B32_UINT, + PIPE_FORMAT_R32G32B32A32_UINT + }; + + for (i = 0; i < 4; i++) { + velem[0].src_format = formats[i]; + velem[0].vertex_buffer_index = ctx->base.vb_slot; + ctx->velem_state_readbuf[i] = + pipe->create_vertex_elements_state(pipe, 1, &velem[0]); + } } /* fragment shaders are created on-demand */ @@ -352,8 +363,11 @@ void util_blitter_destroy(struct blitter_context *blitter) pipe->delete_vertex_elements_state(pipe, ctx->velem_sint_state); pipe->delete_vertex_elements_state(pipe, ctx->velem_uint_state); } - if (ctx->velem_state_readbuf) - pipe->delete_vertex_elements_state(pipe, ctx->velem_state_readbuf); + for (i = 0; i < 4; i++) { + if (ctx->velem_state_readbuf[i]) { + pipe->delete_vertex_elements_state(pipe, ctx->velem_state_readbuf[i]); + } + } for (i = 0; i < PIPE_MAX_TEXTURE_TYPES; i++) { if (ctx->fs_texfetch_col[i]) @@ -490,7 +504,7 @@ static void blitter_restore_fragment_states(struct blitter_context_priv *ctx) /* XXX check whether these are saved and whether they need to be restored * (depending on the operation) */ pipe->set_stencil_ref(pipe, &ctx->base.saved_stencil_ref); - pipe->set_viewport_state(pipe, &ctx->base.saved_viewport); + pipe->set_viewport_states(pipe, 0, 1, &ctx->base.saved_viewport); } static void blitter_check_saved_fb_state(struct blitter_context_priv *ctx) @@ -585,7 +599,7 @@ static void blitter_set_rectangle(struct blitter_context_priv *ctx, ctx->viewport.translate[1] = 0.5f * ctx->dst_height; ctx->viewport.translate[2] = 0.0f; ctx->viewport.translate[3] = 0.0f; - ctx->base.pipe->set_viewport_state(ctx->base.pipe, &ctx->viewport); + ctx->base.pipe->set_viewport_states(ctx->base.pipe, 0, 1, &ctx->viewport); } static void blitter_set_clear_color(struct blitter_context_priv *ctx, @@ -1387,7 +1401,7 @@ void util_blitter_blit_generic(struct blitter_context *blitter, pipe->bind_vertex_elements_state(pipe, ctx->velem_state); if (scissor) { - pipe->set_scissor_state(pipe, scissor); + pipe->set_scissor_states(pipe, 0, 1, scissor); } blitter_set_common_draw_rect_state(ctx, scissor != NULL); @@ -1482,7 +1496,7 @@ void util_blitter_blit_generic(struct blitter_context *blitter, blitter_restore_textures(ctx); blitter_restore_fb_state(ctx); if (scissor) { - pipe->set_scissor_state(pipe, &ctx->base.saved_scissor); + pipe->set_scissor_states(pipe, 0, 1, &ctx->base.saved_scissor); } blitter_restore_render_cond(ctx); blitter_unset_running_flag(ctx); @@ -1739,7 +1753,7 @@ void util_blitter_copy_buffer(struct blitter_context *blitter, vb.stride = 4; pipe->set_vertex_buffers(pipe, ctx->base.vb_slot, 1, &vb); - pipe->bind_vertex_elements_state(pipe, ctx->velem_state_readbuf); + pipe->bind_vertex_elements_state(pipe, ctx->velem_state_readbuf[0]); pipe->bind_vs_state(pipe, ctx->vs_pos_only); if (ctx->has_geometry_shader) pipe->bind_gs_state(pipe, NULL); @@ -1756,6 +1770,66 @@ void util_blitter_copy_buffer(struct blitter_context *blitter, pipe_so_target_reference(&so_target, NULL); } +void util_blitter_clear_buffer(struct blitter_context *blitter, + struct pipe_resource *dst, + unsigned offset, unsigned size, + unsigned num_channels, + const union pipe_color_union *clear_value) +{ + struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; + struct pipe_context *pipe = ctx->base.pipe; + struct pipe_vertex_buffer vb = {0}; + struct pipe_stream_output_target *so_target; + + assert(num_channels >= 1); + assert(num_channels <= 4); + + /* IMPORTANT: DON'T DO ANY BOUNDS CHECKING HERE! + * + * R600 uses this to initialize texture resources, so width0 might not be + * what you think it is. + */ + + /* Streamout is required. */ + if (!ctx->has_stream_out) { + assert(!"Streamout unsupported in util_blitter_clear_buffer()"); + return; + } + + /* Some alignment is required. */ + if (offset % 4 != 0 || size % 4 != 0) { + assert(!"Bad alignment in util_blitter_clear_buffer()"); + return; + } + + u_upload_data(ctx->upload, 0, num_channels*4, clear_value, + &vb.buffer_offset, &vb.buffer); + vb.stride = 0; + + blitter_set_running_flag(ctx); + blitter_check_saved_vertex_states(ctx); + blitter_disable_render_cond(ctx); + + pipe->set_vertex_buffers(pipe, ctx->base.vb_slot, 1, &vb); + pipe->bind_vertex_elements_state(pipe, + ctx->velem_state_readbuf[num_channels-1]); + pipe->bind_vs_state(pipe, ctx->vs_pos_only); + if (ctx->has_geometry_shader) + pipe->bind_gs_state(pipe, NULL); + pipe->bind_rasterizer_state(pipe, ctx->rs_discard_state); + + so_target = pipe->create_stream_output_target(pipe, dst, offset, size); + pipe->set_stream_output_targets(pipe, 1, &so_target, 0); + + util_draw_arrays(pipe, PIPE_PRIM_POINTS, 0, size / 4); + + blitter_restore_vertex_states(ctx); + blitter_restore_render_cond(ctx); + blitter_unset_running_flag(ctx); + pipe_so_target_reference(&so_target, NULL); + pipe_resource_reference(&vb.buffer, NULL); +} + /* probably radeon specific */ void util_blitter_custom_resolve_color(struct blitter_context *blitter, struct pipe_resource *dst, diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.h b/mesalib/src/gallium/auxiliary/util/u_blitter.h index 20e69ed5b..19015844e 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blitter.h +++ b/mesalib/src/gallium/auxiliary/util/u_blitter.h @@ -276,7 +276,7 @@ void util_blitter_default_src_texture(struct pipe_sampler_view *src_templ, /** * Copy data from one buffer to another using the Stream Output functionality. - * Some alignment is required, otherwise software fallback is used. + * 4-byte alignment is required, otherwise software fallback is used. */ void util_blitter_copy_buffer(struct blitter_context *blitter, struct pipe_resource *dst, @@ -286,6 +286,22 @@ void util_blitter_copy_buffer(struct blitter_context *blitter, unsigned size); /** + * Clear the contents of a buffer using the Stream Output functionality. + * 4-byte alignment is required. + * + * "num_channels" can be 1, 2, 3, or 4, and specifies if the clear value is + * R, RG, RGB, or RGBA. + * + * For each element, only "num_channels" components of "clear_value" are + * copied to the buffer, then the offset is incremented by num_channels*4. + */ +void util_blitter_clear_buffer(struct blitter_context *blitter, + struct pipe_resource *dst, + unsigned offset, unsigned size, + unsigned num_channels, + const union pipe_color_union *clear_value); + +/** * Clear a region of a (color) surface to a constant value. * * These states must be saved in the blitter in addition to the state objects diff --git a/mesalib/src/gallium/auxiliary/util/u_debug_symbol.c b/mesalib/src/gallium/auxiliary/util/u_debug_symbol.c index 3d2f8ebc3..0ef111c3b 100644 --- a/mesalib/src/gallium/auxiliary/util/u_debug_symbol.c +++ b/mesalib/src/gallium/auxiliary/util/u_debug_symbol.c @@ -151,10 +151,8 @@ debug_symbol_name_dbghelp(const void *addr, char* buf, unsigned size) } #endif -#ifdef __GLIBC__ -#ifndef __UCLIBC__ +#if defined(__GLIBC__) && !defined(__UCLIBC__) #include <execinfo.h> -#endif /* This can only provide dynamic symbols, or binary offsets into a file. * @@ -179,7 +177,7 @@ debug_symbol_name(const void *addr, char* buf, unsigned size) return; #endif -#ifdef __GLIBC__ +#if defined(__GLIBC__) && !defined(__UCLIBC__) debug_symbol_name_glibc(addr, buf, size); if(buf[0]) return; diff --git a/mesalib/src/gallium/auxiliary/util/u_dump_state.c b/mesalib/src/gallium/auxiliary/util/u_dump_state.c index 2f28f3c84..12f1d2d6e 100644 --- a/mesalib/src/gallium/auxiliary/util/u_dump_state.c +++ b/mesalib/src/gallium/auxiliary/util/u_dump_state.c @@ -327,7 +327,8 @@ util_dump_rasterizer_state(FILE *stream, const struct pipe_rasterizer_state *sta util_dump_member(stream, uint, state, line_stipple_pattern); util_dump_member(stream, bool, state, line_last_pixel); util_dump_member(stream, bool, state, flatshade_first); - util_dump_member(stream, bool, state, gl_rasterization_rules); + util_dump_member(stream, bool, state, half_pixel_center); + util_dump_member(stream, bool, state, bottom_edge_rule); util_dump_member(stream, bool, state, rasterizer_discard); util_dump_member(stream, bool, state, depth_clip); util_dump_member(stream, uint, state, clip_plane_enable); diff --git a/mesalib/src/gallium/auxiliary/util/u_format.c b/mesalib/src/gallium/auxiliary/util/u_format.c index 18456371c..9bdc2eabf 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format.c +++ b/mesalib/src/gallium/auxiliary/util/u_format.c @@ -632,6 +632,40 @@ void util_format_compose_swizzles(const unsigned char swz1[4], } } +void util_format_apply_color_swizzle(union pipe_color_union *dst, + const union pipe_color_union *src, + const unsigned char swz[4], + const boolean is_integer) +{ + unsigned c; + + if (is_integer) { + for (c = 0; c < 4; ++c) { + switch (swz[c]) { + case PIPE_SWIZZLE_RED: dst->ui[c] = src->ui[0]; break; + case PIPE_SWIZZLE_GREEN: dst->ui[c] = src->ui[1]; break; + case PIPE_SWIZZLE_BLUE: dst->ui[c] = src->ui[2]; break; + case PIPE_SWIZZLE_ALPHA: dst->ui[c] = src->ui[3]; break; + default: + dst->ui[c] = (swz[c] == PIPE_SWIZZLE_ONE) ? 1 : 0; + break; + } + } + } else { + for (c = 0; c < 4; ++c) { + switch (swz[c]) { + case PIPE_SWIZZLE_RED: dst->f[c] = src->f[0]; break; + case PIPE_SWIZZLE_GREEN: dst->f[c] = src->f[1]; break; + case PIPE_SWIZZLE_BLUE: dst->f[c] = src->f[2]; break; + case PIPE_SWIZZLE_ALPHA: dst->f[c] = src->f[3]; break; + default: + dst->f[c] = (swz[c] == PIPE_SWIZZLE_ONE) ? 1.0f : 0.0f; + break; + } + } + } +} + void util_format_swizzle_4f(float *dst, const float *src, const unsigned char swz[4]) { diff --git a/mesalib/src/gallium/auxiliary/util/u_format.h b/mesalib/src/gallium/auxiliary/util/u_format.h index ed942fb16..e4b9c365c 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format.h +++ b/mesalib/src/gallium/auxiliary/util/u_format.h @@ -33,6 +33,9 @@ #include "pipe/p_format.h" #include "util/u_debug.h" +union pipe_color_union; + + #ifdef __cplusplus extern "C" { #endif @@ -1117,6 +1120,15 @@ void util_format_compose_swizzles(const unsigned char swz1[4], const unsigned char swz2[4], unsigned char dst[4]); +/* Apply the swizzle provided in \param swz (which is one of PIPE_SWIZZLE_x) + * to \param src and store the result in \param dst. + * \param is_integer determines the value written for PIPE_SWIZZLE_ONE. + */ +void util_format_apply_color_swizzle(union pipe_color_union *dst, + const union pipe_color_union *src, + const unsigned char swz[4], + const boolean is_integer); + void util_format_swizzle_4f(float *dst, const float *src, const unsigned char swz[4]); diff --git a/mesalib/src/gallium/auxiliary/util/u_format_latc.c b/mesalib/src/gallium/auxiliary/util/u_format_latc.c index 20feb241e..caab7e87a 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format_latc.c +++ b/mesalib/src/gallium/auxiliary/util/u_format_latc.c @@ -15,9 +15,10 @@ * 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 - * BRIAN PAUL 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. + * 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. * **************************************************************************/ diff --git a/mesalib/src/gallium/auxiliary/util/u_format_rgtc.c b/mesalib/src/gallium/auxiliary/util/u_format_rgtc.c index ff04e37b5..758e33774 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format_rgtc.c +++ b/mesalib/src/gallium/auxiliary/util/u_format_rgtc.c @@ -15,9 +15,10 @@ * 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 - * BRIAN PAUL 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. + * 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. * **************************************************************************/ diff --git a/mesalib/src/gallium/auxiliary/util/u_format_s3tc.c b/mesalib/src/gallium/auxiliary/util/u_format_s3tc.c index 4a9dc2237..35e3d3445 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format_s3tc.c +++ b/mesalib/src/gallium/auxiliary/util/u_format_s3tc.c @@ -16,9 +16,10 @@ * 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 - * BRIAN PAUL 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. + * 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. * **************************************************************************/ diff --git a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c index e1f18f39c..7974b1d76 100644 --- a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -1271,7 +1271,8 @@ util_create_gen_mipmap(struct pipe_context *pipe, /* rasterizer */ memset(&ctx->rasterizer, 0, sizeof(ctx->rasterizer)); ctx->rasterizer.cull_face = PIPE_FACE_NONE; - ctx->rasterizer.gl_rasterization_rules = 1; + ctx->rasterizer.half_pixel_center = 1; + ctx->rasterizer.bottom_edge_rule = 1; ctx->rasterizer.depth_clip = 1; /* sampler state */ diff --git a/mesalib/src/gallium/auxiliary/util/u_inlines.h b/mesalib/src/gallium/auxiliary/util/u_inlines.h index 7770cd514..6e65ee6c9 100644 --- a/mesalib/src/gallium/auxiliary/util/u_inlines.h +++ b/mesalib/src/gallium/auxiliary/util/u_inlines.h @@ -485,8 +485,7 @@ util_get_min_point_size(const struct pipe_rasterizer_state *state) { /* The point size should be clamped to this value at the rasterizer stage. */ - return state->gl_rasterization_rules && - !state->point_quad_rasterization && + return !state->point_quad_rasterization && !state->point_smooth && !state->multisample ? 1.0f : 0.0f; } diff --git a/mesalib/src/gallium/auxiliary/util/u_prim.h b/mesalib/src/gallium/auxiliary/util/u_prim.h index d62c636f2..8f444a305 100644 --- a/mesalib/src/gallium/auxiliary/util/u_prim.h +++ b/mesalib/src/gallium/auxiliary/util/u_prim.h @@ -26,8 +26,8 @@ **************************************************************************/ -#ifndef U_BLIT_H -#define U_BLIT_H +#ifndef U_PRIM_H +#define U_PRIM_H #include "pipe/p_defines.h" @@ -37,95 +37,125 @@ extern "C" { #endif -static INLINE boolean u_validate_pipe_prim( unsigned pipe_prim, unsigned nr ) -{ - boolean ok = TRUE; +struct u_prim_vertex_count { + int min; + int incr; +}; - switch (pipe_prim) { - case PIPE_PRIM_POINTS: - ok = (nr >= 1); - break; - case PIPE_PRIM_LINES: - ok = (nr >= 2); - break; - case PIPE_PRIM_LINE_STRIP: +/** + * Decompose a primitive that is a loop, a strip, or a fan. Return the + * original primitive if it is already decomposed. + */ +static INLINE unsigned +u_decomposed_prim(unsigned prim) +{ + switch (prim) { case PIPE_PRIM_LINE_LOOP: - ok = (nr >= 2); - break; - case PIPE_PRIM_TRIANGLES: - ok = (nr >= 3); - break; + case PIPE_PRIM_LINE_STRIP: + return PIPE_PRIM_LINES; case PIPE_PRIM_TRIANGLE_STRIP: case PIPE_PRIM_TRIANGLE_FAN: - case PIPE_PRIM_POLYGON: - ok = (nr >= 3); - break; - case PIPE_PRIM_QUADS: - ok = (nr >= 4); - break; + return PIPE_PRIM_TRIANGLES; case PIPE_PRIM_QUAD_STRIP: - ok = (nr >= 4); - break; + return PIPE_PRIM_QUADS; + case PIPE_PRIM_LINE_STRIP_ADJACENCY: + return PIPE_PRIM_LINES_ADJACENCY; + case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: + return PIPE_PRIM_TRIANGLES_ADJACENCY; default: - ok = 0; - break; + return prim; } +} - return ok; +/** + * Reduce a primitive to one of PIPE_PRIM_POINTS, PIPE_PRIM_LINES, and + * PIPE_PRIM_TRIANGLES. + */ +static INLINE unsigned +u_reduced_prim(unsigned prim) +{ + switch (prim) { + case PIPE_PRIM_POINTS: + return PIPE_PRIM_POINTS; + case PIPE_PRIM_LINES: + case PIPE_PRIM_LINE_LOOP: + case PIPE_PRIM_LINE_STRIP: + case PIPE_PRIM_LINES_ADJACENCY: + case PIPE_PRIM_LINE_STRIP_ADJACENCY: + return PIPE_PRIM_LINES; + default: + return PIPE_PRIM_TRIANGLES; + } } +/** + * Re-assemble a primitive to remove its adjacency. + */ +static INLINE unsigned +u_assembled_prim(unsigned prim) +{ + switch (prim) { + case PIPE_PRIM_LINES_ADJACENCY: + case PIPE_PRIM_LINE_STRIP_ADJACENCY: + return PIPE_PRIM_LINES; + case PIPE_PRIM_TRIANGLES_ADJACENCY: + case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: + return PIPE_PRIM_TRIANGLES; + default: + return prim; + } +} -static INLINE boolean u_trim_pipe_prim( unsigned pipe_prim, unsigned *nr ) +/** + * Return the vertex count information for a primitive. + * + * Note that if this function is called directly or indirectly anywhere in a + * source file, it will increase the size of the binary slightly more than + * expected because of the use of a table. + */ +static INLINE const struct u_prim_vertex_count * +u_prim_vertex_count(unsigned prim) { - boolean ok = TRUE; - const static unsigned values[][2] = { - { 1, 0 }, /* PIPE_PRIM_POINTS */ + static const struct u_prim_vertex_count prim_table[PIPE_PRIM_MAX] = { + { 1, 1 }, /* PIPE_PRIM_POINTS */ { 2, 2 }, /* PIPE_PRIM_LINES */ - { 2, 0 }, /* PIPE_PRIM_LINE_LOOP */ - { 2, 0 }, /* PIPE_PRIM_LINE_STRIP */ + { 2, 1 }, /* PIPE_PRIM_LINE_LOOP */ + { 2, 1 }, /* PIPE_PRIM_LINE_STRIP */ { 3, 3 }, /* PIPE_PRIM_TRIANGLES */ - { 3, 0 }, /* PIPE_PRIM_TRIANGLE_STRIP */ - { 3, 0 }, /* PIPE_PRIM_TRIANGLE_FAN */ - { 4, 4 }, /* PIPE_PRIM_TRIANGLE_QUADS */ - { 4, 2 }, /* PIPE_PRIM_TRIANGLE_QUAD_STRIP */ - { 3, 0 }, /* PIPE_PRIM_TRIANGLE_POLYGON */ + { 3, 1 }, /* PIPE_PRIM_TRIANGLE_STRIP */ + { 3, 1 }, /* PIPE_PRIM_TRIANGLE_FAN */ + { 4, 4 }, /* PIPE_PRIM_QUADS */ + { 4, 2 }, /* PIPE_PRIM_QUAD_STRIP */ + { 3, 1 }, /* PIPE_PRIM_POLYGON */ { 4, 4 }, /* PIPE_PRIM_LINES_ADJACENCY */ - { 4, 0 }, /* PIPE_PRIM_LINE_STRIP_ADJACENCY */ - { 6, 5 }, /* PIPE_PRIM_TRIANGLES_ADJACENCY */ - { 4, 0 }, /* PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY */ + { 4, 1 }, /* PIPE_PRIM_LINE_STRIP_ADJACENCY */ + { 6, 6 }, /* PIPE_PRIM_TRIANGLES_ADJACENCY */ + { 6, 2 }, /* PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY */ }; - if (unlikely(pipe_prim >= PIPE_PRIM_MAX)) { - *nr = 0; - return FALSE; - } - - ok = (*nr >= values[pipe_prim][0]); - if (values[pipe_prim][1]) - *nr -= (*nr % values[pipe_prim][1]); + return (likely(prim < PIPE_PRIM_MAX)) ? &prim_table[prim] : NULL; +} - if (!ok) - *nr = 0; +static INLINE boolean u_validate_pipe_prim( unsigned pipe_prim, unsigned nr ) +{ + const struct u_prim_vertex_count *count = u_prim_vertex_count(pipe_prim); - return ok; + return (count && nr >= count->min); } -static INLINE unsigned u_reduced_prim( unsigned pipe_prim ) +static INLINE boolean u_trim_pipe_prim( unsigned pipe_prim, unsigned *nr ) { - switch (pipe_prim) { - case PIPE_PRIM_POINTS: - return PIPE_PRIM_POINTS; + const struct u_prim_vertex_count *count = u_prim_vertex_count(pipe_prim); - case PIPE_PRIM_LINES: - case PIPE_PRIM_LINES_ADJACENCY: - case PIPE_PRIM_LINE_STRIP: - case PIPE_PRIM_LINE_STRIP_ADJACENCY: - case PIPE_PRIM_LINE_LOOP: - return PIPE_PRIM_LINES; - - default: - return PIPE_PRIM_TRIANGLES; + if (count && *nr >= count->min) { + if (count->incr > 1) + *nr -= (*nr % count->incr); + return TRUE; + } + else { + *nr = 0; + return FALSE; } } @@ -165,46 +195,71 @@ u_vertices_per_prim(int primitive) /** * Returns the number of decomposed primitives for the given * vertex count. - * Geometry shader is invoked once for each triangle in + * Parts of the pipline are invoked once for each triangle in * triangle strip, triangle fans and triangles and once - * for each line in line strip, line loop, lines. + * for each line in line strip, line loop, lines. Also + * statistics depend on knowing the exact number of decomposed + * primitives for a set of vertices. */ static INLINE unsigned -u_gs_prims_for_vertices(int primitive, int vertices) +u_decomposed_prims_for_vertices(int primitive, int vertices) { - switch(primitive) { + switch (primitive) { case PIPE_PRIM_POINTS: return vertices; case PIPE_PRIM_LINES: return vertices / 2; case PIPE_PRIM_LINE_LOOP: - return vertices; + return (vertices >= 2) ? vertices : 0; case PIPE_PRIM_LINE_STRIP: - return vertices - 1; + return (vertices >= 2) ? vertices - 1 : 0; case PIPE_PRIM_TRIANGLES: - return vertices / 3; + return vertices / 3; case PIPE_PRIM_TRIANGLE_STRIP: - return vertices - 2; + return (vertices >= 3) ? vertices - 2 : 0; case PIPE_PRIM_TRIANGLE_FAN: - return vertices - 2; + return (vertices >= 3) ? vertices - 2 : 0; case PIPE_PRIM_LINES_ADJACENCY: - return vertices / 2; + return vertices / 4; case PIPE_PRIM_LINE_STRIP_ADJACENCY: - return vertices - 1; + return (vertices >= 4) ? vertices - 3 : 0; case PIPE_PRIM_TRIANGLES_ADJACENCY: - return vertices / 3; + return vertices / 6; case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: - return vertices - 2; - - /* following primitives should never be used - * with geometry shaders abd their size is - * undefined */ + return (vertices >= 6) ? 1 + (vertices - 6) / 2 : 0; + case PIPE_PRIM_QUADS: + return vertices / 4; + case PIPE_PRIM_QUAD_STRIP: + return (vertices >= 4) ? (vertices - 2) / 2 : 0; + /* Polygons can't be decomposed + * because the number of their vertices isn't known so + * for them and whatever else we don't recognize just + * return 1 if the number of vertices is greater than + * or equal to 3 and zero otherwise */ case PIPE_PRIM_POLYGON: + default: + debug_printf("Invalid decomposition primitive!\n"); + return (vertices >= 3) ? 1 : 0; + } +} + +/** + * Returns the number of reduced/tessellated primitives for the given vertex + * count. Each quad is treated as two triangles. Polygons are treated as + * triangle fans. + */ +static INLINE unsigned +u_reduced_prims_for_vertices(int primitive, int vertices) +{ + switch (primitive) { case PIPE_PRIM_QUADS: case PIPE_PRIM_QUAD_STRIP: + return u_decomposed_prims_for_vertices(primitive, vertices) * 2; + case PIPE_PRIM_POLYGON: + primitive = PIPE_PRIM_TRIANGLE_FAN; + /* fall through */ default: - debug_printf("Unrecognized geometry shader primitive"); - return 3; + return u_decomposed_prims_for_vertices(primitive, vertices); } } diff --git a/mesalib/src/gallium/auxiliary/util/u_simple_list.h b/mesalib/src/gallium/auxiliary/util/u_simple_list.h index fe5977137..7a47c1a78 100644 --- a/mesalib/src/gallium/auxiliary/util/u_simple_list.h +++ b/mesalib/src/gallium/auxiliary/util/u_simple_list.h @@ -28,9 +28,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/gallium/auxiliary/util/u_sse.h b/mesalib/src/gallium/auxiliary/util/u_sse.h index 1df6c8726..d100c4706 100644 --- a/mesalib/src/gallium/auxiliary/util/u_sse.h +++ b/mesalib/src/gallium/auxiliary/util/u_sse.h @@ -175,7 +175,12 @@ static INLINE void u_print_ps(const char *name, __m128 r) * MSVC will never get in here as its intrinsics support do not rely on * compiler command line options. */ -static __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +static __inline __m128i +#ifdef __clang__ + __attribute__((__always_inline__, __nodebug__)) +#else + __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +#endif _mm_shuffle_epi8(__m128i a, __m128i mask) { __m128i result; diff --git a/mesalib/src/glsl/Makefile.am b/mesalib/src/glsl/Makefile.am index d0e5cd1d0..2bbad3d65 100644 --- a/mesalib/src/glsl/Makefile.am +++ b/mesalib/src/glsl/Makefile.am @@ -27,8 +27,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/src/mesa/ \ -I$(top_srcdir)/src/glsl/glcpp \ -I$(top_srcdir)/src/gtest/include \ - $(DEFINES) \ - $(API_DEFINES) + $(DEFINES) AM_CFLAGS = $(VISIBILITY_CFLAGS) AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS) diff --git a/mesalib/src/glsl/Makefile.sources b/mesalib/src/glsl/Makefile.sources index b5282a604..50bad85ad 100644 --- a/mesalib/src/glsl/Makefile.sources +++ b/mesalib/src/glsl/Makefile.sources @@ -16,6 +16,7 @@ LIBGLCPP_GENERATED_FILES = \ # libglsl LIBGLSL_FILES = \ + $(GLSL_SRCDIR)/ast_array_index.cpp \ $(GLSL_SRCDIR)/ast_expr.cpp \ $(GLSL_SRCDIR)/ast_function.cpp \ $(GLSL_SRCDIR)/ast_to_hir.cpp \ @@ -45,6 +46,7 @@ LIBGLSL_FILES = \ $(GLSL_SRCDIR)/ir_variable_refcount.cpp \ $(GLSL_SRCDIR)/linker.cpp \ $(GLSL_SRCDIR)/link_functions.cpp \ + $(GLSL_SRCDIR)/link_interface_blocks.cpp \ $(GLSL_SRCDIR)/link_uniforms.cpp \ $(GLSL_SRCDIR)/link_uniform_initializers.cpp \ $(GLSL_SRCDIR)/link_uniform_block_active_visitor.cpp \ @@ -62,12 +64,14 @@ LIBGLSL_FILES = \ $(GLSL_SRCDIR)/lower_mat_op_to_vec.cpp \ $(GLSL_SRCDIR)/lower_noise.cpp \ $(GLSL_SRCDIR)/lower_packed_varyings.cpp \ + $(GLSL_SRCDIR)/lower_named_interface_blocks.cpp \ $(GLSL_SRCDIR)/lower_packing_builtins.cpp \ $(GLSL_SRCDIR)/lower_texture_projection.cpp \ $(GLSL_SRCDIR)/lower_variable_index_to_cond_assign.cpp \ $(GLSL_SRCDIR)/lower_vec_index_to_cond_assign.cpp \ $(GLSL_SRCDIR)/lower_vec_index_to_swizzle.cpp \ $(GLSL_SRCDIR)/lower_vector.cpp \ + $(GLSL_SRCDIR)/lower_vector_insert.cpp \ $(GLSL_SRCDIR)/lower_output_reads.cpp \ $(GLSL_SRCDIR)/lower_ubo_reference.cpp \ $(GLSL_SRCDIR)/opt_algebraic.cpp \ @@ -81,6 +85,7 @@ LIBGLSL_FILES = \ $(GLSL_SRCDIR)/opt_dead_code_local.cpp \ $(GLSL_SRCDIR)/opt_dead_functions.cpp \ $(GLSL_SRCDIR)/opt_flatten_nested_if_blocks.cpp \ + $(GLSL_SRCDIR)/opt_flip_matrices.cpp \ $(GLSL_SRCDIR)/opt_function_inlining.cpp \ $(GLSL_SRCDIR)/opt_if_simplification.cpp \ $(GLSL_SRCDIR)/opt_noop_swizzle.cpp \ diff --git a/mesalib/src/glsl/ast.h b/mesalib/src/glsl/ast.h index fcc6b4566..df2a21f79 100644 --- a/mesalib/src/glsl/ast.h +++ b/mesalib/src/glsl/ast.h @@ -805,9 +805,9 @@ public: ast_compound_statement *body; }; -class ast_uniform_block : public ast_node { +class ast_interface_block : public ast_node { public: - ast_uniform_block(ast_type_qualifier layout, + ast_interface_block(ast_type_qualifier layout, const char *instance_name, ast_expression *array_size) : layout(layout), block_name(NULL), instance_name(instance_name), @@ -854,7 +854,17 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr, exec_list *instructions, struct _mesa_glsl_parse_state *state); +extern ir_rvalue * +_mesa_ast_array_index_to_hir(void *mem_ctx, + struct _mesa_glsl_parse_state *state, + ir_rvalue *array, ir_rvalue *idx, + YYLTYPE &loc, YYLTYPE &idx_loc); + void emit_function(_mesa_glsl_parse_state *state, ir_function *f); +extern void +check_builtin_array_max_size(const char *name, unsigned size, + YYLTYPE loc, struct _mesa_glsl_parse_state *state); + #endif /* AST_H */ diff --git a/mesalib/src/glsl/ast_array_index.cpp b/mesalib/src/glsl/ast_array_index.cpp new file mode 100644 index 000000000..4baeb6f9d --- /dev/null +++ b/mesalib/src/glsl/ast_array_index.cpp @@ -0,0 +1,190 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "ast.h" +#include "glsl_types.h" +#include "ir.h" + +ir_rvalue * +_mesa_ast_array_index_to_hir(void *mem_ctx, + struct _mesa_glsl_parse_state *state, + ir_rvalue *array, ir_rvalue *idx, + YYLTYPE &loc, YYLTYPE &idx_loc) +{ + if (!array->type->is_error() + && !array->type->is_array() + && !array->type->is_matrix() + && !array->type->is_vector()) { + _mesa_glsl_error(& idx_loc, state, + "cannot dereference non-array / non-matrix / " + "non-vector"); + } + + if (!idx->type->is_error()) { + if (!idx->type->is_integer()) { + _mesa_glsl_error(& idx_loc, state, "array index must be integer type"); + } else if (!idx->type->is_scalar()) { + _mesa_glsl_error(& idx_loc, state, "array index must be scalar"); + } + } + + /* If the array index is a constant expression and the array has a + * declared size, ensure that the access is in-bounds. If the array + * index is not a constant expression, ensure that the array has a + * declared size. + */ + ir_constant *const const_index = idx->constant_expression_value(); + if (const_index != NULL && idx->type->is_integer()) { + const int idx = const_index->value.i[0]; + const char *type_name = "error"; + unsigned bound = 0; + + /* From page 24 (page 30 of the PDF) of the GLSL 1.50 spec: + * + * "It is illegal to declare an array with a size, and then + * later (in the same shader) index the same array with an + * integral constant expression greater than or equal to the + * declared size. It is also illegal to index an array with a + * negative constant expression." + */ + if (array->type->is_matrix()) { + if (array->type->row_type()->vector_elements <= idx) { + type_name = "matrix"; + bound = array->type->row_type()->vector_elements; + } + } else if (array->type->is_vector()) { + if (array->type->vector_elements <= idx) { + type_name = "vector"; + bound = array->type->vector_elements; + } + } else { + /* glsl_type::array_size() returns 0 for non-array types. This means + * that we don't need to verify that the type is an array before + * doing the bounds checking. + */ + if ((array->type->array_size() > 0) + && (array->type->array_size() <= idx)) { + type_name = "array"; + bound = array->type->array_size(); + } + } + + if (bound > 0) { + _mesa_glsl_error(& loc, state, "%s index must be < %u", + type_name, bound); + } else if (idx < 0) { + _mesa_glsl_error(& loc, state, "%s index must be >= 0", + type_name); + } + + if (array->type->is_array()) { + /* If the array is a variable dereference, it dereferences the + * whole array, by definition. Use this to get the variable. + * + * FINISHME: Should some methods for getting / setting / testing + * FINISHME: array access limits be added to ir_dereference? + */ + ir_variable *const v = array->whole_variable_referenced(); + if ((v != NULL) && (unsigned(idx) > v->max_array_access)) { + v->max_array_access = idx; + + /* Check whether this access will, as a side effect, implicitly + * cause the size of a built-in array to be too large. + */ + check_builtin_array_max_size(v->name, idx+1, loc, state); + } + } + } else if (const_index == NULL && array->type->is_array()) { + if (array->type->array_size() == 0) { + _mesa_glsl_error(&loc, state, "unsized array index must be constant"); + } else if (array->type->fields.array->is_interface()) { + /* Page 46 in section 4.3.7 of the OpenGL ES 3.00 spec says: + * + * "All indexes used to index a uniform block array must be + * constant integral expressions." + */ + _mesa_glsl_error(&loc, state, + "uniform block array index must be constant"); + } else { + /* whole_variable_referenced can return NULL if the array is a + * member of a structure. In this case it is safe to not update + * the max_array_access field because it is never used for fields + * of structures. + */ + ir_variable *v = array->whole_variable_referenced(); + if (v != NULL) + v->max_array_access = array->type->array_size() - 1; + } + + /* From page 23 (29 of the PDF) of the GLSL 1.30 spec: + * + * "Samplers aggregated into arrays within a shader (using square + * brackets [ ]) can only be indexed with integral constant + * expressions [...]." + * + * This restriction was added in GLSL 1.30. Shaders using earlier + * version of the language should not be rejected by the compiler + * front-end for using this construct. This allows useful things such + * as using a loop counter as the index to an array of samplers. If the + * loop in unrolled, the code should compile correctly. Instead, emit a + * warning. + */ + if (array->type->element_type()->is_sampler()) { + if (!state->is_version(130, 100)) { + if (state->es_shader) { + _mesa_glsl_warning(&loc, state, + "sampler arrays indexed with non-constant " + "expressions is optional in %s", + state->get_version_string()); + } else { + _mesa_glsl_warning(&loc, state, + "sampler arrays indexed with non-constant " + "expressions will be forbidden in GLSL 1.30 " + "and later"); + } + } else { + _mesa_glsl_error(&loc, state, + "sampler arrays indexed with non-constant " + "expressions is forbidden in GLSL 1.30 and " + "later"); + } + } + } + + /* After performing all of the error checking, generate the IR for the + * expression. + */ + if (array->type->is_array() + || array->type->is_matrix()) { + return new(mem_ctx) ir_dereference_array(array, idx); + } else if (array->type->is_vector()) { + return new(mem_ctx) ir_expression(ir_binop_vector_extract, array, idx); + } else if (array->type->is_error()) { + return array; + } else { + ir_rvalue *result = new(mem_ctx) ir_dereference_array(array, idx); + result->type = glsl_type::error_type; + + return result; + } +} diff --git a/mesalib/src/glsl/ast_function.cpp b/mesalib/src/glsl/ast_function.cpp index 26f72cf8e..00e0c05dd 100644 --- a/mesalib/src/glsl/ast_function.cpp +++ b/mesalib/src/glsl/ast_function.cpp @@ -165,10 +165,18 @@ verify_parameter_modes(_mesa_glsl_parse_state *state, actual->variable_referenced()->name); return false; } else if (!actual->is_lvalue()) { - _mesa_glsl_error(&loc, state, - "function parameter '%s %s' is not an lvalue", - mode, formal->name); - return false; + /* Even though ir_binop_vector_extract is not an l-value, let it + * slop through. generate_call will handle it correctly. + */ + ir_expression *const expr = ((ir_rvalue *) actual)->as_expression(); + if (expr == NULL + || expr->operation != ir_binop_vector_extract + || !expr->operands[0]->is_lvalue()) { + _mesa_glsl_error(&loc, state, + "function parameter '%s %s' is not an lvalue", + mode, formal->name); + return false; + } } } @@ -178,6 +186,93 @@ verify_parameter_modes(_mesa_glsl_parse_state *state, return true; } +static void +fix_parameter(void *mem_ctx, ir_rvalue *actual, const glsl_type *formal_type, + exec_list *before_instructions, exec_list *after_instructions, + bool parameter_is_inout) +{ + ir_expression *const expr = actual->as_expression(); + + /* If the types match exactly and the parameter is not a vector-extract, + * nothing needs to be done to fix the parameter. + */ + if (formal_type == actual->type + && (expr == NULL || expr->operation != ir_binop_vector_extract)) + return; + + /* To convert an out parameter, we need to create a temporary variable to + * hold the value before conversion, and then perform the conversion after + * the function call returns. + * + * This has the effect of transforming code like this: + * + * void f(out int x); + * float value; + * f(value); + * + * Into IR that's equivalent to this: + * + * void f(out int x); + * float value; + * int out_parameter_conversion; + * f(out_parameter_conversion); + * value = float(out_parameter_conversion); + * + * If the parameter is an ir_expression of ir_binop_vector_extract, + * additional conversion is needed in the post-call re-write. + */ + ir_variable *tmp = + new(mem_ctx) ir_variable(formal_type, "inout_tmp", ir_var_temporary); + + before_instructions->push_tail(tmp); + + /* If the parameter is an inout parameter, copy the value of the actual + * parameter to the new temporary. Note that no type conversion is allowed + * here because inout parameters must match types exactly. + */ + if (parameter_is_inout) { + /* Inout parameters should never require conversion, since that would + * require an implicit conversion to exist both to and from the formal + * parameter type, and there are no bidirectional implicit conversions. + */ + assert (actual->type == formal_type); + + ir_dereference_variable *const deref_tmp_1 = + new(mem_ctx) ir_dereference_variable(tmp); + ir_assignment *const assignment = + new(mem_ctx) ir_assignment(deref_tmp_1, actual); + before_instructions->push_tail(assignment); + } + + /* Replace the parameter in the call with a dereference of the new + * temporary. + */ + ir_dereference_variable *const deref_tmp_2 = + new(mem_ctx) ir_dereference_variable(tmp); + actual->replace_with(deref_tmp_2); + + + /* Copy the temporary variable to the actual parameter with optional + * type conversion applied. + */ + ir_rvalue *rhs = new(mem_ctx) ir_dereference_variable(tmp); + if (actual->type != formal_type) + rhs = convert_component(rhs, actual->type); + + ir_rvalue *lhs = actual; + if (expr != NULL && expr->operation == ir_binop_vector_extract) { + rhs = new(mem_ctx) ir_expression(ir_triop_vector_insert, + expr->operands[0]->type, + expr->operands[0]->clone(mem_ctx, NULL), + rhs, + expr->operands[1]->clone(mem_ctx, NULL)); + lhs = expr->operands[0]->clone(mem_ctx, NULL); + } + + ir_assignment *const assignment_2 = new(mem_ctx) ir_assignment(lhs, rhs); + after_instructions->push_tail(assignment_2); +} + /** * If a function call is generated, \c call_ir will point to it on exit. * Otherwise \c call_ir will be set to \c NULL. @@ -218,50 +313,10 @@ generate_call(exec_list *instructions, ir_function_signature *sig, break; } case ir_var_function_out: - if (actual->type != formal->type) { - /* To convert an out parameter, we need to create a - * temporary variable to hold the value before conversion, - * and then perform the conversion after the function call - * returns. - * - * This has the effect of transforming code like this: - * - * void f(out int x); - * float value; - * f(value); - * - * Into IR that's equivalent to this: - * - * void f(out int x); - * float value; - * int out_parameter_conversion; - * f(out_parameter_conversion); - * value = float(out_parameter_conversion); - */ - ir_variable *tmp = - new(ctx) ir_variable(formal->type, - "out_parameter_conversion", - ir_var_temporary); - instructions->push_tail(tmp); - ir_dereference_variable *deref_tmp_1 - = new(ctx) ir_dereference_variable(tmp); - ir_dereference_variable *deref_tmp_2 - = new(ctx) ir_dereference_variable(tmp); - ir_rvalue *converted_tmp - = convert_component(deref_tmp_1, actual->type); - ir_assignment *assignment - = new(ctx) ir_assignment(actual, converted_tmp); - post_call_conversions.push_tail(assignment); - actual->replace_with(deref_tmp_2); - } - break; case ir_var_function_inout: - /* Inout parameters should never require conversion, since that - * would require an implicit conversion to exist both to and - * from the formal parameter type, and there are no - * bidirectional implicit conversions. - */ - assert (actual->type == formal->type); + fix_parameter(ctx, actual, formal->type, + instructions, &post_call_conversions, + formal->mode == ir_var_function_inout); break; default: assert (!"Illegal formal parameter mode"); diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp index 92065f5b7..e918adeef 100644 --- a/mesalib/src/glsl/ast_to_hir.cpp +++ b/mesalib/src/glsl/ast_to_hir.cpp @@ -672,6 +672,30 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state, void *ctx = state; bool error_emitted = (lhs->type->is_error() || rhs->type->is_error()); + /* If the assignment LHS comes back as an ir_binop_vector_extract + * expression, move it to the RHS as an ir_triop_vector_insert. + */ + if (lhs->ir_type == ir_type_expression) { + ir_expression *const expr = lhs->as_expression(); + + if (unlikely(expr->operation == ir_binop_vector_extract)) { + ir_rvalue *new_rhs = + validate_assignment(state, lhs->type, rhs, is_initializer); + + if (new_rhs == NULL) { + _mesa_glsl_error(& lhs_loc, state, "type mismatch"); + return lhs; + } else { + rhs = new(ctx) ir_expression(ir_triop_vector_insert, + expr->operands[0]->type, + expr->operands[0], + new_rhs, + expr->operands[1]); + lhs = expr->operands[0]->clone(ctx, NULL); + } + } + } + ir_variable *lhs_var = lhs->variable_referenced(); if (lhs_var) lhs_var->assigned = true; @@ -904,7 +928,7 @@ get_scalar_boolean_operand(exec_list *instructions, * If name refers to a builtin array whose maximum allowed size is less than * size, report an error and return true. Otherwise return false. */ -static bool +void check_builtin_array_max_size(const char *name, unsigned size, YYLTYPE loc, struct _mesa_glsl_parse_state *state) { @@ -918,7 +942,6 @@ check_builtin_array_max_size(const char *name, unsigned size, _mesa_glsl_error(&loc, state, "`gl_TexCoord' array size cannot " "be larger than gl_MaxTextureCoords (%u)\n", state->Const.MaxTextureCoords); - return true; } else if (strcmp("gl_ClipDistance", name) == 0 && size > state->Const.MaxClipPlanes) { /* From section 7.1 (Vertex Shader Special Variables) of the @@ -933,9 +956,7 @@ check_builtin_array_max_size(const char *name, unsigned size, _mesa_glsl_error(&loc, state, "`gl_ClipDistance' array size cannot " "be larger than gl_MaxClipDistances (%u)\n", state->Const.MaxClipPlanes); - return true; } - return false; } /** @@ -1517,172 +1538,11 @@ ast_expression::hir(exec_list *instructions, op[0] = subexpressions[0]->hir(instructions, state); op[1] = subexpressions[1]->hir(instructions, state); - error_emitted = op[0]->type->is_error() || op[1]->type->is_error(); - - ir_rvalue *const array = op[0]; - - result = new(ctx) ir_dereference_array(op[0], op[1]); - - /* Do not use op[0] after this point. Use array. - */ - op[0] = NULL; - + result = _mesa_ast_array_index_to_hir(ctx, state, op[0], op[1], + loc, index_loc); - if (error_emitted) - break; - - if (!array->type->is_array() - && !array->type->is_matrix() - && !array->type->is_vector()) { - _mesa_glsl_error(& index_loc, state, - "cannot dereference non-array / non-matrix / " - "non-vector"); + if (result->type->is_error()) error_emitted = true; - } - - if (!op[1]->type->is_integer()) { - _mesa_glsl_error(& index_loc, state, - "array index must be integer type"); - error_emitted = true; - } else if (!op[1]->type->is_scalar()) { - _mesa_glsl_error(& index_loc, state, - "array index must be scalar"); - error_emitted = true; - } - - /* If the array index is a constant expression and the array has a - * declared size, ensure that the access is in-bounds. If the array - * index is not a constant expression, ensure that the array has a - * declared size. - */ - ir_constant *const const_index = op[1]->constant_expression_value(); - if (const_index != NULL) { - const int idx = const_index->value.i[0]; - const char *type_name; - unsigned bound = 0; - - if (array->type->is_matrix()) { - type_name = "matrix"; - } else if (array->type->is_vector()) { - type_name = "vector"; - } else { - type_name = "array"; - } - - /* From page 24 (page 30 of the PDF) of the GLSL 1.50 spec: - * - * "It is illegal to declare an array with a size, and then - * later (in the same shader) index the same array with an - * integral constant expression greater than or equal to the - * declared size. It is also illegal to index an array with a - * negative constant expression." - */ - if (array->type->is_matrix()) { - if (array->type->row_type()->vector_elements <= idx) { - bound = array->type->row_type()->vector_elements; - } - } else if (array->type->is_vector()) { - if (array->type->vector_elements <= idx) { - bound = array->type->vector_elements; - } - } else { - if ((array->type->array_size() > 0) - && (array->type->array_size() <= idx)) { - bound = array->type->array_size(); - } - } - - if (bound > 0) { - _mesa_glsl_error(& loc, state, "%s index must be < %u", - type_name, bound); - error_emitted = true; - } else if (idx < 0) { - _mesa_glsl_error(& loc, state, "%s index must be >= 0", - type_name); - error_emitted = true; - } - - if (array->type->is_array()) { - /* If the array is a variable dereference, it dereferences the - * whole array, by definition. Use this to get the variable. - * - * FINISHME: Should some methods for getting / setting / testing - * FINISHME: array access limits be added to ir_dereference? - */ - ir_variable *const v = array->whole_variable_referenced(); - if ((v != NULL) && (unsigned(idx) > v->max_array_access)) { - v->max_array_access = idx; - - /* Check whether this access will, as a side effect, implicitly - * cause the size of a built-in array to be too large. - */ - if (check_builtin_array_max_size(v->name, idx+1, loc, state)) - error_emitted = true; - } - } - } else if (array->type->array_size() == 0) { - _mesa_glsl_error(&loc, state, "unsized array index must be constant"); - } else if (array->type->is_array() - && array->type->fields.array->is_interface()) { - /* Page 46 in section 4.3.7 of the OpenGL ES 3.00 spec says: - * - * "All indexes used to index a uniform block array must be - * constant integral expressions." - */ - _mesa_glsl_error(&loc, state, - "uniform block array index must be constant"); - } else { - if (array->type->is_array()) { - /* whole_variable_referenced can return NULL if the array is a - * member of a structure. In this case it is safe to not update - * the max_array_access field because it is never used for fields - * of structures. - */ - ir_variable *v = array->whole_variable_referenced(); - if (v != NULL) - v->max_array_access = array->type->array_size() - 1; - } - } - - /* From page 23 (29 of the PDF) of the GLSL 1.30 spec: - * - * "Samplers aggregated into arrays within a shader (using square - * brackets [ ]) can only be indexed with integral constant - * expressions [...]." - * - * This restriction was added in GLSL 1.30. Shaders using earlier version - * of the language should not be rejected by the compiler front-end for - * using this construct. This allows useful things such as using a loop - * counter as the index to an array of samplers. If the loop in unrolled, - * the code should compile correctly. Instead, emit a warning. - */ - if (array->type->is_array() && - array->type->element_type()->is_sampler() && - const_index == NULL) { - - if (!state->is_version(130, 100)) { - if (state->es_shader) { - _mesa_glsl_warning(&loc, state, - "sampler arrays indexed with non-constant " - "expressions is optional in %s", - state->get_version_string()); - } else { - _mesa_glsl_warning(&loc, state, - "sampler arrays indexed with non-constant " - "expressions will be forbidden in GLSL 1.30 and " - "later"); - } - } else { - _mesa_glsl_error(&loc, state, - "sampler arrays indexed with non-constant " - "expressions is forbidden in GLSL 1.30 and " - "later"); - error_emitted = true; - } - } - - if (error_emitted) - result->type = glsl_type::error_type; break; } @@ -1842,6 +1702,9 @@ process_array_type(YYLTYPE *loc, const glsl_type *base, ast_node *array_size, { unsigned length = 0; + if (base == NULL) + return glsl_type::error_type; + /* From page 19 (page 25) of the GLSL 1.20 spec: * * "Only one-dimensional arrays may be declared." @@ -1894,7 +1757,8 @@ process_array_type(YYLTYPE *loc, const glsl_type *base, ast_node *array_size, "allowed in GLSL ES 1.00."); } - return glsl_type::get_array_instance(base, length); + const glsl_type *array_type = glsl_type::get_array_instance(base, length); + return array_type != NULL ? array_type : glsl_type::error_type; } @@ -3365,10 +3229,17 @@ ast_function::hir(exec_list *instructions, "match prototype", name); } - if (is_definition && sig->is_defined) { - YYLTYPE loc = this->get_location(); - - _mesa_glsl_error(& loc, state, "function `%s' redefined", name); + if (sig->is_defined) { + if (is_definition) { + YYLTYPE loc = this->get_location(); + _mesa_glsl_error(& loc, state, "function `%s' redefined", name); + } else { + /* We just encountered a prototype that exactly matches a + * function that's already been defined. This is redundant, + * and we should ignore it. + */ + return NULL; + } } } } else { @@ -4149,8 +4020,14 @@ ast_process_structure_or_interface_block(exec_list *instructions, * blocks. All other types, arrays, and structures * allowed for uniforms are allowed within a uniform * block." + * + * It should be impossible for decl_type to be NULL here. Cases that + * might naturally lead to decl_type being NULL, especially for the + * is_interface case, will have resulted in compilation having + * already halted due to a syntax error. */ - const struct glsl_type *field_type = decl_type; + const struct glsl_type *field_type = + decl_type != NULL ? decl_type : glsl_type::error_type; if (is_interface && field_type->contains_sampler()) { YYLTYPE loc = decl_list->get_location(); @@ -4173,12 +4050,15 @@ ast_process_structure_or_interface_block(exec_list *instructions, field_type = process_array_type(&loc, decl_type, decl->array_size, state); } - fields[i].type = (field_type != NULL) - ? field_type : glsl_type::error_type; + fields[i].type = field_type; fields[i].name = decl->identifier; if (qual->flags.q.row_major || qual->flags.q.column_major) { - if (!field_type->is_matrix() && !field_type->is_record()) { + if (!qual->flags.q.uniform) { + _mesa_glsl_error(&loc, state, + "row_major and column_major can only be " + "applied to uniform interface blocks."); + } else if (!field_type->is_matrix() && !field_type->is_record()) { _mesa_glsl_error(&loc, state, "uniform block layout qualifiers row_major and " "column_major can only be applied to matrix and " @@ -4187,6 +4067,12 @@ ast_process_structure_or_interface_block(exec_list *instructions, validate_matrix_layout_for_type(state, &loc, field_type); } + if (qual->flags.q.uniform && qual->has_interpolation()) { + _mesa_glsl_error(&loc, state, + "interpolation qualifiers cannot be used " + "with uniform interface blocks"); + } + if (field_type->is_matrix() || (field_type->is_array() && field_type->fields.array->is_matrix())) { fields[i].row_major = block_row_major; @@ -4244,12 +4130,12 @@ ast_struct_specifier::hir(exec_list *instructions, } ir_rvalue * -ast_uniform_block::hir(exec_list *instructions, - struct _mesa_glsl_parse_state *state) +ast_interface_block::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) { YYLTYPE loc = this->get_location(); - /* The ast_uniform_block has a list of ast_declarator_lists. We + /* The ast_interface_block has a list of ast_declarator_lists. We * need to turn those into ir_variables with an association * with this uniform block. */ @@ -4276,16 +4162,32 @@ ast_uniform_block::hir(exec_list *instructions, true, block_row_major); + ir_variable_mode var_mode; + const char *iface_type_name; + if (this->layout.flags.q.in) { + var_mode = ir_var_shader_in; + iface_type_name = "in"; + } else if (this->layout.flags.q.out) { + var_mode = ir_var_shader_out; + iface_type_name = "out"; + } else if (this->layout.flags.q.uniform) { + var_mode = ir_var_uniform; + iface_type_name = "uniform"; + } else { + assert(!"interface block layout qualifier not found!"); + } + const glsl_type *block_type = glsl_type::get_interface_instance(fields, num_variables, packing, this->block_name); - if (!state->symbols->add_type(block_type->name, block_type)) { + if (!state->symbols->add_interface(block_type->name, block_type, var_mode)) { YYLTYPE loc = this->get_location(); - _mesa_glsl_error(&loc, state, "Uniform block name `%s' already taken in " - "the current scope.\n", this->block_name); + _mesa_glsl_error(&loc, state, "Interface block `%s' with type `%s' " + "already taken in the current scope.\n", + this->block_name, iface_type_name); } /* Since interface blocks cannot contain statements, it should be @@ -4309,11 +4211,11 @@ ast_uniform_block::hir(exec_list *instructions, var = new(state) ir_variable(block_array_type, this->instance_name, - ir_var_uniform); + var_mode); } else { var = new(state) ir_variable(block_type, this->instance_name, - ir_var_uniform); + var_mode); } var->interface_type = block_type; @@ -4329,7 +4231,7 @@ ast_uniform_block::hir(exec_list *instructions, ir_variable *var = new(state) ir_variable(fields[i].type, ralloc_strdup(state, fields[i].name), - ir_var_uniform); + var_mode); var->interface_type = block_type; state->symbols->add_variable(var); diff --git a/mesalib/src/glsl/builtin_variables.cpp b/mesalib/src/glsl/builtin_variables.cpp index b0c7a2035..4bb361c2e 100644 --- a/mesalib/src/glsl/builtin_variables.cpp +++ b/mesalib/src/glsl/builtin_variables.cpp @@ -39,6 +39,12 @@ generate_ARB_draw_instanced_variables(exec_list *, struct _mesa_glsl_parse_state *, bool, _mesa_glsl_parser_targets); +static void +generate_AMD_vertex_shader_layer_variables(exec_list *instructions, + struct _mesa_glsl_parse_state *state, + bool warn, + _mesa_glsl_parser_targets target); + struct builtin_variable { enum ir_variable_mode mode; int slot; @@ -535,7 +541,7 @@ generate_common_ES_uniforms(exec_list *instructions, add_builtin_constant(instructions, symtab, "gl_MaxTextureImageUnits", state->Const.MaxTextureImageUnits); add_builtin_constant(instructions, symtab, "gl_MaxFragmentUniformVectors", - state->Const.MaxFragmentUniformComponents); + state->Const.MaxFragmentUniformComponents / 4); add_uniform(instructions, symtab, "gl_DepthRange", state->symbols->get_type("gl_DepthRangeParameters")); @@ -818,6 +824,8 @@ generate_130_vs_variables(exec_list *instructions, "gl_ClipDistance", clip_distance_array_type, ir_var_shader_out, VARYING_SLOT_CLIP_DIST0); + generate_AMD_vertex_shader_layer_variables(instructions, state, false, + vertex_shader); } @@ -1020,6 +1028,29 @@ generate_ARB_draw_instanced_variables(exec_list *instructions, } } +static void +generate_AMD_vertex_shader_layer_variables(exec_list *instructions, + struct _mesa_glsl_parse_state *state, + bool warn, + _mesa_glsl_parser_targets target) +{ + /* gl_Layer is only available in the vertex shader for the + * AMD_vertex_shader_layer extension. It will also be available in the + * geometry shader when GLSL 1.50 is supported. + */ + if (target != vertex_shader) + return; + + if (state->AMD_vertex_shader_layer_enable) { + ir_variable *inst = + add_variable(instructions, state->symbols, + "gl_Layer", glsl_type::int_type, + ir_var_shader_out, VARYING_SLOT_LAYER); + + if (warn) + inst->warn_extension = "GL_AMD_vertex_shader_layer"; + } +} static void generate_ARB_shader_stencil_export_variables(exec_list *instructions, diff --git a/mesalib/src/glsl/glcpp/glcpp-parse.y b/mesalib/src/glsl/glcpp/glcpp-parse.y index 00edbbfbd..81ba04bcc 100644 --- a/mesalib/src/glsl/glcpp/glcpp-parse.y +++ b/mesalib/src/glsl/glcpp/glcpp-parse.y @@ -1236,6 +1236,12 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api) if (extensions->ARB_texture_query_lod) add_builtin_define(parser, "GL_ARB_texture_query_lod", 1); + + if (extensions->ARB_gpu_shader5) + add_builtin_define(parser, "GL_ARB_gpu_shader5", 1); + + if (extensions->AMD_vertex_shader_layer) + add_builtin_define(parser, "GL_AMD_vertex_shader_layer", 1); } } diff --git a/mesalib/src/glsl/glcpp/pp.c b/mesalib/src/glsl/glcpp/pp.c index 789f7f941..7e1b6c689 100644 --- a/mesalib/src/glsl/glcpp/pp.c +++ b/mesalib/src/glsl/glcpp/pp.c @@ -97,8 +97,10 @@ remove_line_continuations(glcpp_parser_t *ctx, const char *shader) { ralloc_strncat(&clean, shader, newline - shader + 1); - while (collapsed_newlines--) + while (collapsed_newlines) { ralloc_strcat(&clean, "\n"); + collapsed_newlines--; + } shader = newline + 1; search_start = shader; } diff --git a/mesalib/src/glsl/glsl_parser.yy b/mesalib/src/glsl/glsl_parser.yy index f52ed9b0a..6e92c2651 100644 --- a/mesalib/src/glsl/glsl_parser.yy +++ b/mesalib/src/glsl/glsl_parser.yy @@ -79,7 +79,7 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state *st, const char *msg) ast_case_label_list *case_label_list; ast_case_statement *case_statement; ast_case_statement_list *case_statement_list; - ast_uniform_block *uniform_block; + ast_interface_block *interface_block; struct { ast_node *cond; @@ -115,7 +115,7 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state *st, const char *msg) %token STRUCT VOID_TOK WHILE %token <identifier> IDENTIFIER TYPE_IDENTIFIER NEW_IDENTIFIER %type <identifier> any_identifier -%type <uniform_block> instance_name_opt +%type <interface_block> instance_name_opt %token <real> FLOATCONSTANT %token <n> INTCONSTANT UINTCONSTANT BOOLCONSTANT %token <identifier> FIELD_SELECTION @@ -164,7 +164,8 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state *st, const char *msg) %type <type_qualifier> interpolation_qualifier %type <type_qualifier> layout_qualifier %type <type_qualifier> layout_qualifier_id_list layout_qualifier_id -%type <type_qualifier> uniform_block_layout_qualifier +%type <type_qualifier> interface_block_layout_qualifier +%type <type_qualifier> interface_qualifier %type <type_specifier> type_specifier %type <type_specifier> type_specifier_no_prec %type <type_specifier> type_specifier_nonarray @@ -223,8 +224,8 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state *st, const char *msg) %type <node> declaration %type <node> declaration_statement %type <node> jump_statement -%type <node> uniform_block -%type <uniform_block> basic_uniform_block +%type <node> interface_block +%type <interface_block> basic_interface_block %type <struct_specifier> struct_specifier %type <declarator_list> struct_declaration_list %type <declarator_list> struct_declaration @@ -784,7 +785,7 @@ declaration: $3->is_precision_statement = true; $$ = $3; } - | uniform_block + | interface_block { $$ = $1; } @@ -1140,7 +1141,7 @@ layout_qualifier_id: } } - /* See also uniform_block_layout_qualifier. */ + /* See also interface_block_layout_qualifier. */ if (!$$.flags.i && state->ARB_uniform_buffer_object_enable) { if (strcmp($1, "std140") == 0) { $$.flags.q.std140 = 1; @@ -1211,15 +1212,15 @@ layout_qualifier_id: "identifier `%s' used\n", $1); } } - | uniform_block_layout_qualifier + | interface_block_layout_qualifier { $$ = $1; /* Layout qualifiers for ARB_uniform_buffer_object. */ - if (!state->ARB_uniform_buffer_object_enable) { + if ($$.flags.q.uniform && !state->ARB_uniform_buffer_object_enable) { _mesa_glsl_error(& @1, state, "#version 140 / GL_ARB_uniform_buffer_object " "layout qualifier `%s' is used\n", $1); - } else if (state->ARB_uniform_buffer_object_warn) { + } else if ($$.flags.q.uniform && state->ARB_uniform_buffer_object_warn) { _mesa_glsl_warning(& @1, state, "#version 140 / GL_ARB_uniform_buffer_object " "layout qualifier `%s' is used\n", $1); @@ -1232,7 +1233,7 @@ layout_qualifier_id: * most qualifiers. See the any_identifier path of * layout_qualifier_id for the others. */ -uniform_block_layout_qualifier: +interface_block_layout_qualifier: ROW_MAJOR { memset(& $$, 0, sizeof($$)); @@ -1893,14 +1894,14 @@ function_definition: ; /* layout_qualifieropt is packed into this rule */ -uniform_block: - basic_uniform_block +interface_block: + basic_interface_block { $$ = $1; } - | layout_qualifier basic_uniform_block + | layout_qualifier basic_interface_block { - ast_uniform_block *block = $2; + ast_interface_block *block = $2; if (!block->layout.merge_qualifier(& @1, state, $1)) { YYERROR; } @@ -1908,55 +1909,137 @@ uniform_block: } ; -basic_uniform_block: - UNIFORM NEW_IDENTIFIER '{' member_list '}' instance_name_opt ';' +basic_interface_block: + interface_qualifier NEW_IDENTIFIER '{' member_list '}' instance_name_opt ';' { - ast_uniform_block *const block = $6; + ast_interface_block *const block = $6; block->block_name = $2; block->declarations.push_degenerate_list_at_head(& $4->link); - if (!state->ARB_uniform_buffer_object_enable) { + if ($1.flags.q.uniform) { + if (!state->ARB_uniform_buffer_object_enable) { + _mesa_glsl_error(& @1, state, + "#version 140 / GL_ARB_uniform_buffer_object " + "required for defining uniform blocks\n"); + } else if (state->ARB_uniform_buffer_object_warn) { + _mesa_glsl_warning(& @1, state, + "#version 140 / GL_ARB_uniform_buffer_object " + "required for defining uniform blocks\n"); + } + } else { + if (state->es_shader || state->language_version < 150) { + _mesa_glsl_error(& @1, state, + "#version 150 required for using " + "interface blocks.\n"); + } + } + + /* From the GLSL 1.50.11 spec, section 4.3.7 ("Interface Blocks"): + * "It is illegal to have an input block in a vertex shader + * or an output block in a fragment shader" + */ + if ((state->target == vertex_shader) && $1.flags.q.in) { _mesa_glsl_error(& @1, state, - "#version 140 / GL_ARB_uniform_buffer_object " - "required for defining uniform blocks\n"); - } else if (state->ARB_uniform_buffer_object_warn) { - _mesa_glsl_warning(& @1, state, - "#version 140 / GL_ARB_uniform_buffer_object " - "required for defining uniform blocks\n"); + "`in' interface block is not allowed for " + "a vertex shader\n"); + } else if ((state->target == fragment_shader) && $1.flags.q.out) { + _mesa_glsl_error(& @1, state, + "`out' interface block is not allowed for " + "a fragment shader\n"); } /* Since block arrays require names, and both features are added in * the same language versions, we don't have to explicitly * version-check both things. */ - if (block->instance_name != NULL - && !(state->language_version == 300 && state->es_shader)) { - _mesa_glsl_error(& @1, state, - "#version 300 es required for using uniform " - "blocks with an instance name\n"); + if (block->instance_name != NULL) { + state->check_version(150, 300, & @1, "interface blocks with " + "an instance name are not allowed"); + } + + unsigned interface_type_mask; + struct ast_type_qualifier temp_type_qualifier; + + /* Get a bitmask containing only the in/out/uniform flags, allowing us + * to ignore other irrelevant flags like interpolation qualifiers. + */ + temp_type_qualifier.flags.i = 0; + temp_type_qualifier.flags.q.uniform = true; + temp_type_qualifier.flags.q.in = true; + temp_type_qualifier.flags.q.out = true; + interface_type_mask = temp_type_qualifier.flags.i; + + /* Get the block's interface qualifier. The interface_qualifier + * production rule guarantees that only one bit will be set (and + * it will be in/out/uniform). + */ + unsigned block_interface_qualifier = $1.flags.i; + + block->layout.flags.i |= block_interface_qualifier; + + foreach_list_typed (ast_declarator_list, member, link, &block->declarations) { + ast_type_qualifier& qualifier = member->type->qualifier; + if ((qualifier.flags.i & interface_type_mask) == 0) { + /* GLSLangSpec.1.50.11, 4.3.7 (Interface Blocks): + * "If no optional qualifier is used in a member declaration, the + * qualifier of the variable is just in, out, or uniform as declared + * by interface-qualifier." + */ + qualifier.flags.i |= block_interface_qualifier; + } else if ((qualifier.flags.i & interface_type_mask) != + block_interface_qualifier) { + /* GLSLangSpec.1.50.11, 4.3.7 (Interface Blocks): + * "If optional qualifiers are used, they can include interpolation + * and storage qualifiers and they must declare an input, output, + * or uniform variable consistent with the interface qualifier of + * the block." + */ + _mesa_glsl_error(& @1, state, + "uniform/in/out qualifier on " + "interface block member does not match " + "the interface block\n"); + } } $$ = block; } ; +interface_qualifier: + IN_TOK + { + memset(& $$, 0, sizeof($$)); + $$.flags.q.in = 1; + } + | OUT_TOK + { + memset(& $$, 0, sizeof($$)); + $$.flags.q.out = 1; + } + | UNIFORM + { + memset(& $$, 0, sizeof($$)); + $$.flags.q.uniform = 1; + } + ; + instance_name_opt: /* empty */ { - $$ = new(state) ast_uniform_block(*state->default_uniform_qualifier, + $$ = new(state) ast_interface_block(*state->default_uniform_qualifier, NULL, NULL); } | NEW_IDENTIFIER { - $$ = new(state) ast_uniform_block(*state->default_uniform_qualifier, + $$ = new(state) ast_interface_block(*state->default_uniform_qualifier, $1, NULL); } | NEW_IDENTIFIER '[' constant_expression ']' { - $$ = new(state) ast_uniform_block(*state->default_uniform_qualifier, + $$ = new(state) ast_interface_block(*state->default_uniform_qualifier, $1, $3); } @@ -1965,7 +2048,7 @@ instance_name_opt: _mesa_glsl_error(& @1, state, "instance block arrays must be explicitly sized\n"); - $$ = new(state) ast_uniform_block(*state->default_uniform_qualifier, + $$ = new(state) ast_interface_block(*state->default_uniform_qualifier, $1, NULL); } @@ -1984,41 +2067,28 @@ member_list: } ; -/* Specifying "uniform" inside of a uniform block is redundant. */ -uniformopt: - /* nothing */ - | UNIFORM - ; - member_declaration: - layout_qualifier uniformopt type_specifier struct_declarator_list ';' + fully_specified_type struct_declarator_list ';' { void *ctx = state; - ast_fully_specified_type *type = new(ctx) ast_fully_specified_type(); + ast_fully_specified_type *type = $1; type->set_location(yylloc); - type->qualifier = $1; - type->qualifier.flags.q.uniform = true; - type->specifier = $3; - $$ = new(ctx) ast_declarator_list(type); - $$->set_location(yylloc); - $$->ubo_qualifiers_valid = true; - - $$->declarations.push_degenerate_list_at_head(& $4->link); - } - | uniformopt type_specifier struct_declarator_list ';' - { - void *ctx = state; - ast_fully_specified_type *type = new(ctx) ast_fully_specified_type(); - type->set_location(yylloc); + if (type->qualifier.flags.q.attribute) { + _mesa_glsl_error(& @1, state, + "keyword 'attribute' cannot be used with " + "interface block member\n"); + } else if (type->qualifier.flags.q.varying) { + _mesa_glsl_error(& @1, state, + "keyword 'varying' cannot be used with " + "interface block member\n"); + } - type->qualifier.flags.q.uniform = true; - type->specifier = $2; $$ = new(ctx) ast_declarator_list(type); $$->set_location(yylloc); $$->ubo_qualifiers_valid = true; - $$->declarations.push_degenerate_list_at_head(& $3->link); + $$->declarations.push_degenerate_list_at_head(& $2->link); } ; diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp index 099229410..c0dd71370 100644 --- a/mesalib/src/glsl/glsl_parser_extras.cpp +++ b/mesalib/src/glsl/glsl_parser_extras.cpp @@ -93,9 +93,9 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx, this->Const.MaxVertexAttribs = ctx->Const.VertexProgram.MaxAttribs; this->Const.MaxVertexUniformComponents = ctx->Const.VertexProgram.MaxUniformComponents; this->Const.MaxVaryingFloats = ctx->Const.MaxVarying * 4; - this->Const.MaxVertexTextureImageUnits = ctx->Const.MaxVertexTextureImageUnits; + this->Const.MaxVertexTextureImageUnits = ctx->Const.VertexProgram.MaxTextureImageUnits; this->Const.MaxCombinedTextureImageUnits = ctx->Const.MaxCombinedTextureImageUnits; - this->Const.MaxTextureImageUnits = ctx->Const.MaxTextureImageUnits; + this->Const.MaxTextureImageUnits = ctx->Const.FragmentProgram.MaxTextureImageUnits; this->Const.MaxFragmentUniformComponents = ctx->Const.FragmentProgram.MaxUniformComponents; this->Const.MinProgramTexelOffset = ctx->Const.MinProgramTexelOffset; this->Const.MaxProgramTexelOffset = ctx->Const.MaxProgramTexelOffset; @@ -468,6 +468,8 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = { EXT(ARB_shading_language_packing, true, false, true, true, false, ARB_shading_language_packing), EXT(ARB_texture_multisample, true, false, true, true, false, ARB_texture_multisample), EXT(ARB_texture_query_lod, false, false, true, true, false, ARB_texture_query_lod), + EXT(ARB_gpu_shader5, true, true, true, true, false, ARB_gpu_shader5), + EXT(AMD_vertex_shader_layer, true, false, false, true, false, AMD_vertex_shader_layer), }; #undef EXT @@ -1202,11 +1204,13 @@ ast_struct_specifier::ast_struct_specifier(const char *identifier, * \param max_unroll_iterations Maximum number of loop iterations to be * unrolled. Setting to 0 disables loop * unrolling. + * \param options The driver's preferred shader options. */ bool do_common_optimization(exec_list *ir, bool linked, bool uniform_locations_assigned, - unsigned max_unroll_iterations) + unsigned max_unroll_iterations, + const struct gl_shader_compiler_options *options) { GLboolean progress = GL_FALSE; @@ -1221,6 +1225,10 @@ do_common_optimization(exec_list *ir, bool linked, progress = opt_flatten_nested_if_blocks(ir) || progress; progress = do_copy_propagation(ir) || progress; progress = do_copy_propagation_elements(ir) || progress; + + if (options->PreferDP4 && !linked) + progress = opt_flip_matrices(ir) || progress; + if (linked) progress = do_dead_code(ir, uniform_locations_assigned) || progress; else @@ -1236,6 +1244,7 @@ do_common_optimization(exec_list *ir, bool linked, progress = do_algebraic(ir) || progress; progress = do_lower_jumps(ir) || progress; progress = do_vec_index_to_swizzle(ir) || progress; + progress = lower_vector_insert(ir, false) || progress; progress = do_swizzle_swizzle(ir) || progress; progress = do_noop_swizzle(ir) || progress; diff --git a/mesalib/src/glsl/glsl_parser_extras.h b/mesalib/src/glsl/glsl_parser_extras.h index 95891b595..16e180d3e 100644 --- a/mesalib/src/glsl/glsl_parser_extras.h +++ b/mesalib/src/glsl/glsl_parser_extras.h @@ -284,6 +284,10 @@ struct _mesa_glsl_parse_state { bool ARB_texture_multisample_warn; bool ARB_texture_query_lod_enable; bool ARB_texture_query_lod_warn; + bool ARB_gpu_shader5_enable; + bool ARB_gpu_shader5_warn; + bool AMD_vertex_shader_layer_enable; + bool AMD_vertex_shader_layer_warn; /*@}*/ /** Extensions supported by the OpenGL implementation. */ diff --git a/mesalib/src/glsl/glsl_symbol_table.cpp b/mesalib/src/glsl/glsl_symbol_table.cpp index 8d34547c6..50bf11302 100644 --- a/mesalib/src/glsl/glsl_symbol_table.cpp +++ b/mesalib/src/glsl/glsl_symbol_table.cpp @@ -41,13 +41,67 @@ public: ralloc_free(entry); } - symbol_table_entry(ir_variable *v) : v(v), f(0), t(0) {} - symbol_table_entry(ir_function *f) : v(0), f(f), t(0) {} - symbol_table_entry(const glsl_type *t) : v(0), f(0), t(t) {} + bool add_interface(const glsl_type *i, enum ir_variable_mode mode) + { + const glsl_type **dest; + + switch (mode) { + case ir_var_uniform: + dest = &ibu; + break; + case ir_var_shader_in: + dest = &ibi; + break; + case ir_var_shader_out: + dest = &ibo; + break; + default: + assert(!"Unsupported interface variable mode!"); + return false; + } + + if (*dest != NULL) { + return false; + } else { + *dest = i; + return true; + } + } + + const glsl_type *get_interface(enum ir_variable_mode mode) + { + switch (mode) { + case ir_var_uniform: + return ibu; + case ir_var_shader_in: + return ibi; + case ir_var_shader_out: + return ibo; + default: + assert(!"Unsupported interface variable mode!"); + return NULL; + } + } + + symbol_table_entry(ir_variable *v) : + v(v), f(0), t(0), ibu(0), ibi(0), ibo(0) {} + symbol_table_entry(ir_function *f) : + v(0), f(f), t(0), ibu(0), ibi(0), ibo(0) {} + symbol_table_entry(const glsl_type *t) : + v(0), f(0), t(t), ibu(0), ibi(0), ibo(0) {} + symbol_table_entry(const glsl_type *t, enum ir_variable_mode mode) : + v(0), f(0), t(0), ibu(0), ibi(0), ibo(0) + { + assert(t->is_interface()); + add_interface(t, mode); + } ir_variable *v; ir_function *f; const glsl_type *t; + const glsl_type *ibu; + const glsl_type *ibi; + const glsl_type *ibo; }; glsl_symbol_table::glsl_symbol_table() @@ -118,6 +172,23 @@ bool glsl_symbol_table::add_type(const char *name, const glsl_type *t) return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0; } +bool glsl_symbol_table::add_interface(const char *name, const glsl_type *i, + enum ir_variable_mode mode) +{ + assert(i->is_interface()); + symbol_table_entry *entry = get_entry(name); + if (entry == NULL) { + symbol_table_entry *entry = + new(mem_ctx) symbol_table_entry(i, mode); + bool add_interface_symbol_result = + _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0; + assert(add_interface_symbol_result); + return add_interface_symbol_result; + } else { + return entry->add_interface(i, mode); + } +} + bool glsl_symbol_table::add_function(ir_function *f) { if (this->separate_function_namespace && name_declared_this_scope(f->name)) { @@ -152,6 +223,13 @@ const glsl_type *glsl_symbol_table::get_type(const char *name) return entry != NULL ? entry->t : NULL; } +const glsl_type *glsl_symbol_table::get_interface(const char *name, + enum ir_variable_mode mode) +{ + symbol_table_entry *entry = get_entry(name); + return entry != NULL ? entry->get_interface(mode) : NULL; +} + ir_function *glsl_symbol_table::get_function(const char *name) { symbol_table_entry *entry = get_entry(name); diff --git a/mesalib/src/glsl/glsl_symbol_table.h b/mesalib/src/glsl/glsl_symbol_table.h index 9f5602787..2753bdf31 100644 --- a/mesalib/src/glsl/glsl_symbol_table.h +++ b/mesalib/src/glsl/glsl_symbol_table.h @@ -99,6 +99,8 @@ public: bool add_variable(ir_variable *v); bool add_type(const char *name, const glsl_type *t); bool add_function(ir_function *f); + bool add_interface(const char *name, const glsl_type *i, + enum ir_variable_mode mode); /*@}*/ /** @@ -113,6 +115,8 @@ public: ir_variable *get_variable(const char *name); const glsl_type *get_type(const char *name); ir_function *get_function(const char *name); + const glsl_type *get_interface(const char *name, + enum ir_variable_mode mode); /*@}*/ private: diff --git a/mesalib/src/glsl/glsl_types.cpp b/mesalib/src/glsl/glsl_types.cpp index 419761a7d..df9c5d36f 100644 --- a/mesalib/src/glsl/glsl_types.cpp +++ b/mesalib/src/glsl/glsl_types.cpp @@ -57,6 +57,7 @@ glsl_type::glsl_type(GLenum gl_type, length(0) { init_ralloc_type_ctx(); + assert(name != NULL); this->name = ralloc_strdup(this->mem_ctx, name); /* Neither dimension is zero or both dimensions are zero. */ @@ -75,6 +76,7 @@ glsl_type::glsl_type(GLenum gl_type, length(0) { init_ralloc_type_ctx(); + assert(name != NULL); this->name = ralloc_strdup(this->mem_ctx, name); memset(& fields, 0, sizeof(fields)); } @@ -91,6 +93,7 @@ glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields, unsigned int i; init_ralloc_type_ctx(); + assert(name != NULL); this->name = ralloc_strdup(this->mem_ctx, name); this->fields.structure = ralloc_array(this->mem_ctx, glsl_struct_field, length); @@ -114,6 +117,7 @@ glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields, unsigned int i; init_ralloc_type_ctx(); + assert(name != NULL); this->name = ralloc_strdup(this->mem_ctx, name); this->fields.structure = ralloc_array(this->mem_ctx, glsl_struct_field, length); diff --git a/mesalib/src/glsl/glsl_types.h b/mesalib/src/glsl/glsl_types.h index 2f3b19f51..31e3dd253 100644 --- a/mesalib/src/glsl/glsl_types.h +++ b/mesalib/src/glsl/glsl_types.h @@ -132,8 +132,7 @@ struct glsl_type { /** * Name of the data type * - * This may be \c NULL for anonymous structures, for arrays, or for - * function types. + * Will never be \c NULL. */ const char *name; diff --git a/mesalib/src/glsl/ir.cpp b/mesalib/src/glsl/ir.cpp index 05b77da2c..dad58deeb 100644 --- a/mesalib/src/glsl/ir.cpp +++ b/mesalib/src/glsl/ir.cpp @@ -399,6 +399,10 @@ ir_expression::ir_expression(int op, ir_rvalue *op0, ir_rvalue *op1) this->type = op0->type; break; + case ir_binop_vector_extract: + this->type = op0->type->get_scalar_type(); + break; + default: assert(!"not reached: missing automatic type setup for ir_expression"); this->type = glsl_type::float_type; @@ -419,7 +423,7 @@ ir_expression::get_num_operands(ir_expression_operation op) if (op <= ir_last_triop) return 3; - if (op == ir_quadop_vector) + if (op <= ir_last_quadop) return 4; assert(false); @@ -477,6 +481,10 @@ static const char *const operator_strs[] = { "unpackHalf2x16", "unpackHalf2x16_split_x", "unpackHalf2x16_split_y", + "bitfield_reverse", + "bit_count", + "find_msb", + "find_lsb", "noise", "+", "-", @@ -504,8 +512,14 @@ static const char *const operator_strs[] = { "max", "pow", "packHalf2x16_split", + "bfm", "ubo_load", + "vector_extract", "lrp", + "bfi", + "bitfield_extract", + "vector_insert", + "bitfield_insert", "vector", }; diff --git a/mesalib/src/glsl/ir.h b/mesalib/src/glsl/ir.h index 0c3e39979..6d4150136 100644 --- a/mesalib/src/glsl/ir.h +++ b/mesalib/src/glsl/ir.h @@ -131,6 +131,7 @@ public: virtual class ir_swizzle * as_swizzle() { return NULL; } virtual class ir_constant * as_constant() { return NULL; } virtual class ir_discard * as_discard() { return NULL; } + virtual class ir_jump * as_jump() { return NULL; } /*@}*/ protected: @@ -273,7 +274,8 @@ enum ir_variable_mode { ir_var_function_inout, ir_var_const_in, /**< "in" param that must be a constant expression */ ir_var_system_value, /**< Ex: front-face, instance-id, etc. */ - ir_var_temporary /**< Temporary variable generated during compilation. */ + ir_var_temporary, /**< Temporary variable generated during compilation. */ + ir_var_mode_count /**< Number of variable modes */ }; /** @@ -1031,6 +1033,16 @@ enum ir_expression_operation { ir_unop_unpack_half_2x16_split_y, /*@}*/ + /** + * \name Bit operations, part of ARB_gpu_shader5. + */ + /*@{*/ + ir_unop_bitfield_reverse, + ir_unop_bit_count, + ir_unop_find_msb, + ir_unop_find_lsb, + /*@}*/ + ir_unop_noise, /** @@ -1107,6 +1119,15 @@ enum ir_expression_operation { /*@}*/ /** + * \name First half of a lowered bitfieldInsert() operation. + * + * \see lower_instructions::bitfield_insert_to_bfm_bfi + */ + /*@{*/ + ir_binop_bfm, + /*@}*/ + + /** * Load a value the size of a given GLSL type from a uniform block. * * operand0 is the ir_constant uniform block index in the linked shader. @@ -1115,20 +1136,55 @@ enum ir_expression_operation { ir_binop_ubo_load, /** + * Extract a scalar from a vector + * + * operand0 is the vector + * operand1 is the index of the field to read from operand0 + */ + ir_binop_vector_extract, + + /** * A sentinel marking the last of the binary operations. */ - ir_last_binop = ir_binop_ubo_load, + ir_last_binop = ir_binop_vector_extract, ir_triop_lrp, /** + * \name Second half of a lowered bitfieldInsert() operation. + * + * \see lower_instructions::bitfield_insert_to_bfm_bfi + */ + /*@{*/ + ir_triop_bfi, + /*@}*/ + + ir_triop_bitfield_extract, + + /** + * Generate a value with one field of a vector changed + * + * operand0 is the vector + * operand1 is the value to write into the vector result + * operand2 is the index in operand0 to be modified + */ + ir_triop_vector_insert, + + /** * A sentinel marking the last of the ternary operations. */ - ir_last_triop = ir_triop_lrp, + ir_last_triop = ir_triop_vector_insert, + + ir_quadop_bitfield_insert, ir_quadop_vector, /** + * A sentinel marking the last of the ternary operations. + */ + ir_last_quadop = ir_quadop_vector, + + /** * A sentinel marking the last of all operations. */ ir_last_opcode = ir_quadop_vector @@ -1297,6 +1353,12 @@ protected: { ir_type = ir_type_unset; } + +public: + virtual ir_jump *as_jump() + { + return this; + } }; class ir_return : public ir_jump { diff --git a/mesalib/src/glsl/ir_basic_block.cpp b/mesalib/src/glsl/ir_basic_block.cpp index 86e0cf795..2cbc682d4 100644 --- a/mesalib/src/glsl/ir_basic_block.cpp +++ b/mesalib/src/glsl/ir_basic_block.cpp @@ -77,7 +77,7 @@ void call_for_basic_blocks(exec_list *instructions, callback(leader, ir, data); leader = NULL; call_for_basic_blocks(&ir_loop->body_instructions, callback, data); - } else if (ir->as_return() || ir->as_call()) { + } else if (ir->as_jump() || ir->as_call()) { callback(leader, ir, data); leader = NULL; } else if ((ir_function = ir->as_function())) { diff --git a/mesalib/src/glsl/ir_constant_expression.cpp b/mesalib/src/glsl/ir_constant_expression.cpp index c09e56a3d..0a725b45b 100644 --- a/mesalib/src/glsl/ir_constant_expression.cpp +++ b/mesalib/src/glsl/ir_constant_expression.cpp @@ -391,9 +391,17 @@ ir_expression::constant_expression_value(struct hash_table *variable_context) } if (op[1] != NULL) - assert(op[0]->type->base_type == op[1]->type->base_type || - this->operation == ir_binop_lshift || - this->operation == ir_binop_rshift); + switch (this->operation) { + case ir_binop_lshift: + case ir_binop_rshift: + case ir_binop_vector_extract: + case ir_triop_bitfield_extract: + break; + + default: + assert(op[0]->type->base_type == op[1]->type->base_type); + break; + } bool op0_scalar = op[0]->type->is_scalar(); bool op1_scalar = op[1] != NULL && op[1]->type->is_scalar(); @@ -1230,6 +1238,29 @@ ir_expression::constant_expression_value(struct hash_table *variable_context) } break; + case ir_binop_vector_extract: { + const int c = CLAMP(op[1]->value.i[0], 0, + (int) op[0]->type->vector_elements - 1); + + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[0] = op[0]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.i[0] = op[0]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.f[0] = op[0]->value.f[c]; + break; + case GLSL_TYPE_BOOL: + data.b[0] = op[0]->value.b[c]; + break; + default: + assert(0); + } + break; + } + case ir_binop_bit_xor: for (unsigned c = 0, c0 = 0, c1 = 0; c < components; @@ -1248,6 +1279,102 @@ ir_expression::constant_expression_value(struct hash_table *variable_context) } break; + case ir_unop_bitfield_reverse: + /* http://graphics.stanford.edu/~seander/bithacks.html#BitReverseObvious */ + for (unsigned c = 0; c < components; c++) { + unsigned int v = op[0]->value.u[c]; // input bits to be reversed + unsigned int r = v; // r will be reversed bits of v; first get LSB of v + int s = sizeof(v) * CHAR_BIT - 1; // extra shift needed at end + + for (v >>= 1; v; v >>= 1) { + r <<= 1; + r |= v & 1; + s--; + } + r <<= s; // shift when v's highest bits are zero + + data.u[c] = r; + } + break; + + case ir_unop_bit_count: + for (unsigned c = 0; c < components; c++) { + unsigned count = 0; + unsigned v = op[0]->value.u[c]; + + for (; v; count++) { + v &= v - 1; + } + data.u[c] = count; + } + break; + + case ir_unop_find_msb: + for (unsigned c = 0; c < components; c++) { + int v = op[0]->value.i[c]; + + if (v == 0 || (op[0]->type->base_type == GLSL_TYPE_INT && v == -1)) + data.i[c] = -1; + else { + int count = 0; + int top_bit = op[0]->type->base_type == GLSL_TYPE_UINT + ? 0 : v & (1 << 31); + + while (((v & (1 << 31)) == top_bit) && count != 32) { + count++; + v <<= 1; + } + + data.i[c] = 31 - count; + } + } + break; + + case ir_unop_find_lsb: + for (unsigned c = 0; c < components; c++) { + if (op[0]->value.i[c] == 0) + data.i[c] = -1; + else { + unsigned pos = 0; + unsigned v = op[0]->value.u[c]; + + for (; !(v & 1); v >>= 1) { + pos++; + } + data.u[c] = pos; + } + } + break; + + case ir_triop_bitfield_extract: { + int offset = op[1]->value.i[0]; + int bits = op[2]->value.i[0]; + + for (unsigned c = 0; c < components; c++) { + if (bits == 0) + data.u[c] = 0; + else if (offset < 0 || bits < 0) + data.u[c] = 0; /* Undefined, per spec. */ + else if (offset + bits > 32) + data.u[c] = 0; /* Undefined, per spec. */ + else { + if (op[0]->type->base_type == GLSL_TYPE_INT) { + /* int so that the right shift will sign-extend. */ + int value = op[0]->value.i[c]; + value <<= 32 - bits - offset; + value >>= 32 - bits; + data.i[c] = value; + } else { + unsigned value = op[0]->value.u[c]; + value <<= 32 - bits - offset; + value >>= 32 - bits; + data.u[c] = value; + } + } + } + break; + } + case ir_triop_lrp: { assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); assert(op[1]->type->base_type == GLSL_TYPE_FLOAT); @@ -1261,6 +1388,58 @@ ir_expression::constant_expression_value(struct hash_table *variable_context) break; } + case ir_triop_vector_insert: { + const unsigned idx = op[2]->value.u[0]; + + memcpy(&data, &op[0]->value, sizeof(data)); + + switch (this->type->base_type) { + case GLSL_TYPE_INT: + data.i[idx] = op[1]->value.i[0]; + break; + case GLSL_TYPE_UINT: + data.u[idx] = op[1]->value.u[0]; + break; + case GLSL_TYPE_FLOAT: + data.f[idx] = op[1]->value.f[0]; + break; + case GLSL_TYPE_BOOL: + data.b[idx] = op[1]->value.b[0]; + break; + default: + assert(!"Should not get here."); + break; + } + break; + } + + case ir_quadop_bitfield_insert: { + int offset = op[2]->value.i[0]; + int bits = op[3]->value.i[0]; + + for (unsigned c = 0; c < components; c++) { + if (bits == 0) + data.u[c] = op[0]->value.u[c]; + else if (offset < 0 || bits < 0) + data.u[c] = 0; /* Undefined, per spec. */ + else if (offset + bits > 32) + data.u[c] = 0; /* Undefined, per spec. */ + else { + unsigned insert_mask = ((1 << bits) - 1) << offset; + + unsigned insert = op[1]->value.u[c]; + insert <<= offset; + insert &= insert_mask; + + unsigned base = op[0]->value.u[c]; + base &= ~insert_mask; + + data.u[c] = base | insert; + } + } + break; + } + case ir_quadop_vector: for (unsigned c = 0; c < this->type->vector_elements; c++) { switch (this->type->base_type) { diff --git a/mesalib/src/glsl/ir_optimization.h b/mesalib/src/glsl/ir_optimization.h index a8885d722..d38d5e303 100644 --- a/mesalib/src/glsl/ir_optimization.h +++ b/mesalib/src/glsl/ir_optimization.h @@ -37,6 +37,7 @@ #define MOD_TO_FRACT 0x20 #define INT_DIV_TO_MUL_RCP 0x40 #define LRP_TO_ARITH 0x80 +#define BITFIELD_INSERT_TO_BFM_BFI 0x100 /** * \see class lower_packing_builtins_visitor @@ -65,7 +66,8 @@ enum lower_packing_builtins_op { bool do_common_optimization(exec_list *ir, bool linked, bool uniform_locations_assigned, - unsigned max_unroll_iterations); + unsigned max_unroll_iterations, + const struct gl_shader_compiler_options *options); bool do_algebraic(exec_list *instructions); bool do_constant_folding(exec_list *instructions); @@ -78,6 +80,7 @@ bool do_dead_code(exec_list *instructions, bool uniform_locations_assigned); bool do_dead_code_local(exec_list *instructions); bool do_dead_code_unlinked(exec_list *instructions); bool do_dead_functions(exec_list *instructions); +bool opt_flip_matrices(exec_list *instructions); bool do_function_inlining(exec_list *instructions); bool do_lower_jumps(exec_list *instructions, bool pull_out_jumps = true, bool lower_sub_return = true, bool lower_main_return = false, bool lower_continue = false, bool lower_break = false); bool do_lower_texture_projection(exec_list *instructions); @@ -106,6 +109,8 @@ void lower_ubo_reference(struct gl_shader *shader, exec_list *instructions); void lower_packed_varyings(void *mem_ctx, unsigned location_base, unsigned locations_used, ir_variable_mode mode, gl_shader *shader); +bool lower_vector_insert(exec_list *instructions, bool lower_nonconstant_index); +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); diff --git a/mesalib/src/glsl/ir_print_visitor.cpp b/mesalib/src/glsl/ir_print_visitor.cpp index 597d2813f..f01019c98 100644 --- a/mesalib/src/glsl/ir_print_visitor.cpp +++ b/mesalib/src/glsl/ir_print_visitor.cpp @@ -24,6 +24,7 @@ #include "ir_print_visitor.h" #include "glsl_types.h" #include "glsl_parser_extras.h" +#include "main/macros.h" #include "program/hash_table.h" static void print_type(const glsl_type *t); @@ -149,7 +150,9 @@ void ir_print_visitor::visit(ir_variable *ir) const char *const mode[] = { "", "uniform ", "shader_in ", "shader_out ", "in ", "out ", "inout ", "const_in ", "sys ", "temporary " }; - const char *const interp[] = { "", "flat", "noperspective" }; + STATIC_ASSERT(ARRAY_SIZE(mode) == ir_var_mode_count); + const char *const interp[] = { "", "smooth", "flat", "noperspective" }; + STATIC_ASSERT(ARRAY_SIZE(interp) == INTERP_QUALIFIER_COUNT); printf("(%s%s%s%s) ", cent, inv, mode[ir->mode], interp[ir->interpolation]); diff --git a/mesalib/src/glsl/ir_reader.cpp b/mesalib/src/glsl/ir_reader.cpp index 16fdc41b4..b3667124f 100644 --- a/mesalib/src/glsl/ir_reader.cpp +++ b/mesalib/src/glsl/ir_reader.cpp @@ -676,16 +676,18 @@ ir_reader::read_expression(s_expression *expr) { s_expression *s_type; s_symbol *s_op; - s_expression *s_arg[3]; + s_expression *s_arg[4] = {NULL}; s_pattern pat[] = { "expression", s_type, s_op, s_arg[0] }; if (!PARTIAL_MATCH(expr, pat)) { ir_read_error(expr, "expected (expression <type> <operator> " - "<operand> [<operand>])"); + "<operand> [<operand>] [<operand>] [<operand>])"); return NULL; } s_arg[1] = (s_expression *) s_arg[0]->next; // may be tail sentinel s_arg[2] = (s_expression *) s_arg[1]->next; // may be tail sentinel or NULL + if (s_arg[2]) + s_arg[3] = (s_expression *) s_arg[2]->next; // may be tail sentinel or NULL const glsl_type *type = read_type(s_type); if (type == NULL) @@ -709,7 +711,7 @@ ir_reader::read_expression(s_expression *expr) return NULL; } - ir_rvalue *arg[3] = {NULL, NULL, NULL}; + ir_rvalue *arg[4] = {NULL}; for (int i = 0; i < num_operands; i++) { arg[i] = read_rvalue(s_arg[i]); if (arg[i] == NULL) { @@ -718,7 +720,7 @@ ir_reader::read_expression(s_expression *expr) } } - return new(mem_ctx) ir_expression(op, type, arg[0], arg[1], arg[2]); + return new(mem_ctx) ir_expression(op, type, arg[0], arg[1], arg[2], arg[3]); } ir_swizzle * diff --git a/mesalib/src/glsl/ir_uniform.h b/mesalib/src/glsl/ir_uniform.h index 30e6f260d..8198c4819 100644 --- a/mesalib/src/glsl/ir_uniform.h +++ b/mesalib/src/glsl/ir_uniform.h @@ -99,15 +99,24 @@ struct gl_uniform_storage { */ bool initialized; - /** - * Base sampler index - * - * If \c ::base_type is \c GLSL_TYPE_SAMPLER, this represents the index of - * this sampler. If \c ::array_elements is not zero, the array will use - * sampler indexes \c ::sampler through \c ::sampler + \c ::array_elements - * - 1, inclusive. - */ - uint8_t sampler; + struct { + /** + * Base sampler index + * + * If \c ::base_type is \c GLSL_TYPE_SAMPLER, this represents the index + * of this sampler. If \c ::array_elements is not zero, the array will + * use sampler indices \c ::sampler through \c ::sampler + + * \c ::array_elements - 1, inclusive. + * + * Note that the index may be different in each shader stage. + */ + uint8_t index; + + /** + * Whether this sampler is used in this shader stage. + */ + bool active; + } sampler[MESA_SHADER_TYPES]; /** * Storage used by the driver for the uniform diff --git a/mesalib/src/glsl/ir_validate.cpp b/mesalib/src/glsl/ir_validate.cpp index 699c192cd..ce96f6855 100644 --- a/mesalib/src/glsl/ir_validate.cpp +++ b/mesalib/src/glsl/ir_validate.cpp @@ -69,6 +69,8 @@ public: virtual ir_visitor_status visit_leave(ir_expression *ir); virtual ir_visitor_status visit_leave(ir_swizzle *ir); + virtual ir_visitor_status visit_enter(class ir_dereference_array *); + virtual ir_visitor_status visit_enter(ir_assignment *ir); virtual ir_visitor_status visit_enter(ir_call *ir); @@ -102,6 +104,33 @@ ir_validate::visit(ir_dereference_variable *ir) } ir_visitor_status +ir_validate::visit_enter(class ir_dereference_array *ir) +{ + if (!ir->array->type->is_array() && !ir->array->type->is_matrix()) { + printf("ir_dereference_array @ %p does not specify an array or a " + "matrix\n", + (void *) ir); + ir->print(); + printf("\n"); + abort(); + } + + if (!ir->array_index->type->is_scalar()) { + printf("ir_dereference_array @ %p does not have scalar index: %s\n", + (void *) ir, ir->array_index->type->name); + abort(); + } + + if (!ir->array_index->type->is_integer()) { + printf("ir_dereference_array @ %p does not have integer index: %s\n", + (void *) ir, ir->array_index->type->name); + abort(); + } + + return visit_continue; +} + +ir_visitor_status ir_validate::visit_enter(ir_if *ir) { if (ir->condition->type != glsl_type::bool_type) { @@ -361,6 +390,19 @@ ir_validate::visit_leave(ir_expression *ir) assert(ir->operands[0]->type == glsl_type::uint_type); break; + case ir_unop_bitfield_reverse: + assert(ir->operands[0]->type == ir->type); + assert(ir->type->is_integer()); + break; + + case ir_unop_bit_count: + case ir_unop_find_msb: + case ir_unop_find_lsb: + assert(ir->operands[0]->type->vector_elements == ir->type->vector_elements); + assert(ir->operands[0]->type->is_integer()); + assert(ir->type->base_type == GLSL_TYPE_INT); + break; + case ir_unop_noise: /* XXX what can we assert here? */ break; @@ -461,6 +503,12 @@ ir_validate::visit_leave(ir_expression *ir) assert(ir->operands[1]->type == glsl_type::float_type); break; + case ir_binop_bfm: + assert(ir->type->is_integer()); + assert(ir->operands[0]->type->is_integer()); + assert(ir->operands[1]->type->is_integer()); + break; + case ir_binop_ubo_load: assert(ir->operands[0]->as_constant()); assert(ir->operands[0]->type == glsl_type::uint_type); @@ -468,12 +516,46 @@ ir_validate::visit_leave(ir_expression *ir) assert(ir->operands[1]->type == glsl_type::uint_type); break; + case ir_binop_vector_extract: + assert(ir->operands[0]->type->is_vector()); + assert(ir->operands[1]->type->is_scalar() + && ir->operands[1]->type->is_integer()); + break; + case ir_triop_lrp: assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT); assert(ir->operands[0]->type == ir->operands[1]->type); assert(ir->operands[2]->type == ir->operands[0]->type || ir->operands[2]->type == glsl_type::float_type); break; + case ir_triop_bfi: + assert(ir->operands[0]->type->is_integer()); + assert(ir->operands[1]->type == ir->operands[2]->type); + assert(ir->operands[1]->type == ir->type); + break; + + case ir_triop_bitfield_extract: + assert(ir->operands[0]->type == ir->type); + assert(ir->operands[1]->type == glsl_type::int_type); + assert(ir->operands[2]->type == glsl_type::int_type); + break; + + case ir_triop_vector_insert: + assert(ir->operands[0]->type->is_vector()); + assert(ir->operands[1]->type->is_scalar()); + assert(ir->operands[0]->type->base_type == ir->operands[1]->type->base_type); + assert(ir->operands[2]->type->is_scalar() + && ir->operands[2]->type->is_integer()); + assert(ir->type == ir->operands[0]->type); + break; + + case ir_quadop_bitfield_insert: + assert(ir->operands[0]->type == ir->type); + assert(ir->operands[1]->type == ir->type); + assert(ir->operands[2]->type == glsl_type::int_type); + assert(ir->operands[3]->type == glsl_type::int_type); + break; + case ir_quadop_vector: /* The vector operator collects some number of scalars and generates a * vector from them. diff --git a/mesalib/src/glsl/link_interface_blocks.cpp b/mesalib/src/glsl/link_interface_blocks.cpp new file mode 100644 index 000000000..b91860d03 --- /dev/null +++ b/mesalib/src/glsl/link_interface_blocks.cpp @@ -0,0 +1,110 @@ +/* + * Copyright © 2013 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file link_interface_blocks.cpp + * Linker support for GLSL's interface blocks. + */ + +#include "ir.h" +#include "glsl_symbol_table.h" +#include "linker.h" +#include "main/macros.h" + +bool +validate_intrastage_interface_blocks(const gl_shader **shader_list, + unsigned num_shaders) +{ + glsl_symbol_table interfaces; + + for (unsigned int i = 0; i < num_shaders; i++) { + if (shader_list[i] == NULL) + continue; + + foreach_list(node, shader_list[i]->ir) { + ir_variable *var = ((ir_instruction *) node)->as_variable(); + if (!var) + continue; + + const glsl_type *iface_type = var->interface_type; + + if (iface_type == NULL) + continue; + + const glsl_type *old_iface_type = + interfaces.get_interface(iface_type->name, + (enum ir_variable_mode) var->mode); + + if (old_iface_type == NULL) { + /* This is the first time we've seen the interface, so save + * it into our symbol table. + */ + interfaces.add_interface(iface_type->name, iface_type, + (enum ir_variable_mode) var->mode); + } else if (old_iface_type != iface_type) { + return false; + } + } + } + + return true; +} + +bool +validate_interstage_interface_blocks(const gl_shader *producer, + const gl_shader *consumer) +{ + glsl_symbol_table interfaces; + + /* Add non-output interfaces from the consumer to the symbol table. */ + foreach_list(node, consumer->ir) { + ir_variable *var = ((ir_instruction *) node)->as_variable(); + if (!var || !var->interface_type || var->mode == ir_var_shader_out) + continue; + + interfaces.add_interface(var->interface_type->name, + var->interface_type, + (enum ir_variable_mode) var->mode); + } + + /* Verify that the producer's interfaces match. */ + foreach_list(node, producer->ir) { + ir_variable *var = ((ir_instruction *) node)->as_variable(); + if (!var || !var->interface_type || var->mode == ir_var_shader_in) + continue; + + enum ir_variable_mode consumer_mode = + var->mode == ir_var_uniform ? ir_var_uniform : ir_var_shader_in; + const glsl_type *expected_type = + interfaces.get_interface(var->interface_type->name, consumer_mode); + + /* The consumer doesn't use this output block. Ignore it. */ + if (expected_type == NULL) + continue; + + if (var->interface_type != expected_type) + return false; + } + + return true; +} diff --git a/mesalib/src/glsl/link_uniform_initializers.cpp b/mesalib/src/glsl/link_uniform_initializers.cpp index 836a360fa..54d9bf1f5 100644 --- a/mesalib/src/glsl/link_uniform_initializers.cpp +++ b/mesalib/src/glsl/link_uniform_initializers.cpp @@ -138,8 +138,16 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog, } if (base_type == GLSL_TYPE_SAMPLER) { - for (unsigned int i = 0; i < storage->array_elements; i++) { - prog->SamplerUnits[storage->sampler + i] = storage->storage[i].i; + for (int sh = 0; sh < MESA_SHADER_TYPES; sh++) { + gl_shader *shader = prog->_LinkedShaders[sh]; + + if (shader && storage->sampler[sh].active) { + for (unsigned i = 0; i < storage->array_elements; i++) { + unsigned index = storage->sampler[sh].index + i; + + shader->SamplerUnits[index] = storage->storage[i].i; + } + } } } } else { @@ -148,8 +156,17 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog, val->type->base_type, val->type->components()); - if (storage->type->is_sampler()) - prog->SamplerUnits[storage->sampler] = storage->storage[0].i; + if (storage->type->is_sampler()) { + for (int sh = 0; sh < MESA_SHADER_TYPES; sh++) { + gl_shader *shader = prog->_LinkedShaders[sh]; + + if (shader && storage->sampler[sh].active) { + unsigned index = storage->sampler[sh].index; + + shader->SamplerUnits[index] = storage->storage[0].i; + } + } + } } storage->initialized = true; diff --git a/mesalib/src/glsl/link_uniforms.cpp b/mesalib/src/glsl/link_uniforms.cpp index d457e4d0c..ad636681f 100644 --- a/mesalib/src/glsl/link_uniforms.cpp +++ b/mesalib/src/glsl/link_uniforms.cpp @@ -263,15 +263,19 @@ public: parcel_out_uniform_storage(struct string_to_uint_map *map, struct gl_uniform_storage *uniforms, union gl_constant_value *values) - : map(map), uniforms(uniforms), next_sampler(0), values(values) + : map(map), uniforms(uniforms), values(values) { - memset(this->targets, 0, sizeof(this->targets)); } - void start_shader() + void start_shader(gl_shader_type shader_type) { + assert(shader_type < MESA_SHADER_TYPES); + this->shader_type = shader_type; + this->shader_samplers_used = 0; this->shader_shadow_samplers = 0; + this->next_sampler = 0; + memset(this->targets, 0, sizeof(this->targets)); } void set_and_process(struct gl_shader_program *prog, @@ -335,8 +339,37 @@ public: int ubo_block_index; int ubo_byte_offset; bool ubo_row_major; + gl_shader_type shader_type; private: + void handle_samplers(const glsl_type *base_type, + struct gl_uniform_storage *uniform) + { + if (base_type->is_sampler()) { + uniform->sampler[shader_type].index = this->next_sampler; + uniform->sampler[shader_type].active = true; + + /* Increment the sampler by 1 for non-arrays and by the number of + * array elements for arrays. + */ + this->next_sampler += + MAX2(1, uniform->array_elements); + + const gl_texture_index target = base_type->sampler_index(); + const unsigned shadow = base_type->sampler_shadow; + for (unsigned i = uniform->sampler[shader_type].index; + i < MIN2(this->next_sampler, MAX_SAMPLERS); + i++) { + this->targets[i] = target; + this->shader_samplers_used |= 1U << i; + this->shader_shadow_samplers |= shadow << i; + } + } else { + uniform->sampler[shader_type].index = ~0; + uniform->sampler[shader_type].active = false; + } + } + virtual void visit_field(const glsl_type *type, const char *name, bool row_major) { @@ -354,31 +387,6 @@ private: if (!found) return; - /* If there is already storage associated with this uniform, it means - * that it was set while processing an earlier shader stage. For - * example, we may be processing the uniform in the fragment shader, but - * the uniform was already processed in the vertex shader. - */ - if (this->uniforms[id].storage != NULL) { - /* If the uniform already has storage set from another shader stage, - * mark the samplers used for this shader stage. - */ - if (type->contains_sampler()) { - const unsigned count = MAX2(1, this->uniforms[id].array_elements); - const unsigned shadow = (type->is_array()) - ? type->fields.array->sampler_shadow : type->sampler_shadow; - - for (unsigned i = 0; i < count; i++) { - const unsigned s = this->uniforms[id].sampler + i; - - this->shader_samplers_used |= 1U << s; - this->shader_shadow_samplers |= shadow << s; - } - } - - return; - } - const glsl_type *base_type; if (type->is_array()) { this->uniforms[id].array_elements = type->length; @@ -388,26 +396,16 @@ private: base_type = type; } - if (base_type->is_sampler()) { - this->uniforms[id].sampler = this->next_sampler; + /* This assigns sampler uniforms to sampler units. */ + handle_samplers(base_type, &this->uniforms[id]); - /* Increment the sampler by 1 for non-arrays and by the number of - * array elements for arrays. - */ - this->next_sampler += MAX2(1, this->uniforms[id].array_elements); - - const gl_texture_index target = base_type->sampler_index(); - const unsigned shadow = base_type->sampler_shadow; - for (unsigned i = this->uniforms[id].sampler - ; i < MIN2(this->next_sampler, MAX_SAMPLERS) - ; i++) { - this->targets[i] = target; - this->shader_samplers_used |= 1U << i; - this->shader_shadow_samplers |= shadow << i; - } - - } else { - this->uniforms[id].sampler = ~0; + /* If there is already storage associated with this uniform, it means + * that it was set while processing an earlier shader stage. For + * example, we may be processing the uniform in the fragment shader, but + * the uniform was already processed in the vertex shader. + */ + if (this->uniforms[id].storage != NULL) { + return; } this->uniforms[id].name = ralloc_strdup(this->uniforms, name); @@ -633,17 +631,6 @@ link_assign_uniform_locations(struct gl_shader_program *prog) prog->UniformHash = new string_to_uint_map; } - /* Uniforms that lack an initializer in the shader code have an initial - * value of zero. This includes sampler uniforms. - * - * Page 24 (page 30 of the PDF) of the GLSL 1.20 spec says: - * - * "The link time initial value is either the value of the variable's - * initializer, if present, or 0 if no initializer is present. Sampler - * types cannot have initializers." - */ - memset(prog->SamplerUnits, 0, sizeof(prog->SamplerUnits)); - /* First pass: Count the uniform resources used by the user-defined * uniforms. While this happens, each active uniform will have an index * assigned to it. @@ -656,6 +643,18 @@ link_assign_uniform_locations(struct gl_shader_program *prog) if (prog->_LinkedShaders[i] == NULL) continue; + /* Uniforms that lack an initializer in the shader code have an initial + * value of zero. This includes sampler uniforms. + * + * Page 24 (page 30 of the PDF) of the GLSL 1.20 spec says: + * + * "The link time initial value is either the value of the variable's + * initializer, if present, or 0 if no initializer is present. Sampler + * types cannot have initializers." + */ + memset(prog->_LinkedShaders[i]->SamplerUnits, 0, + sizeof(prog->_LinkedShaders[i]->SamplerUnits)); + link_update_uniform_buffer_variables(prog->_LinkedShaders[i]); /* Reset various per-shader target counts. @@ -706,9 +705,7 @@ link_assign_uniform_locations(struct gl_shader_program *prog) if (prog->_LinkedShaders[i] == NULL) continue; - /* Reset various per-shader target counts. - */ - parcel.start_shader(); + parcel.start_shader((gl_shader_type)i); foreach_list(node, prog->_LinkedShaders[i]->ir) { ir_variable *const var = ((ir_instruction *) node)->as_variable(); @@ -726,10 +723,11 @@ link_assign_uniform_locations(struct gl_shader_program *prog) prog->_LinkedShaders[i]->active_samplers = parcel.shader_samplers_used; prog->_LinkedShaders[i]->shadow_samplers = parcel.shader_shadow_samplers; - } - assert(sizeof(prog->SamplerTargets) == sizeof(parcel.targets)); - memcpy(prog->SamplerTargets, parcel.targets, sizeof(prog->SamplerTargets)); + STATIC_ASSERT(sizeof(prog->_LinkedShaders[i]->SamplerTargets) == sizeof(parcel.targets)); + memcpy(prog->_LinkedShaders[i]->SamplerTargets, parcel.targets, + sizeof(prog->_LinkedShaders[i]->SamplerTargets)); + } #ifndef NDEBUG for (unsigned i = 0; i < num_user_uniforms; i++) { diff --git a/mesalib/src/glsl/link_varyings.cpp b/mesalib/src/glsl/link_varyings.cpp index 04c9fdd7c..34e3440d6 100644 --- a/mesalib/src/glsl/link_varyings.cpp +++ b/mesalib/src/glsl/link_varyings.cpp @@ -541,7 +541,7 @@ store_tfeedback_info(struct gl_context *ctx, struct gl_shader_program *prog, class varying_matches { public: - varying_matches(bool disable_varying_packing); + varying_matches(bool disable_varying_packing, bool consumer_is_fs); ~varying_matches(); void record(ir_variable *producer_var, ir_variable *consumer_var); unsigned assign_locations(); @@ -621,11 +621,15 @@ private: * it was allocated. */ unsigned matches_capacity; + + const bool consumer_is_fs; }; -varying_matches::varying_matches(bool disable_varying_packing) - : disable_varying_packing(disable_varying_packing) +varying_matches::varying_matches(bool disable_varying_packing, + bool consumer_is_fs) + : disable_varying_packing(disable_varying_packing), + consumer_is_fs(consumer_is_fs) { /* Note: this initial capacity is rather arbitrarily chosen to be large * enough for many cases without wasting an unreasonable amount of space. @@ -656,6 +660,10 @@ varying_matches::~varying_matches() * If \c producer_var has already been paired up with a consumer_var, or * producer_var is part of fixed pipeline functionality (and hence already has * a location assigned), this function has no effect. + * + * Note: as a side effect this function may change the interpolation type of + * \c producer_var, but only when the change couldn't possibly affect + * rendering. */ void varying_matches::record(ir_variable *producer_var, ir_variable *consumer_var) @@ -668,6 +676,25 @@ varying_matches::record(ir_variable *producer_var, ir_variable *consumer_var) return; } + if ((consumer_var == NULL && producer_var->type->contains_integer()) || + !consumer_is_fs) { + /* Since this varying is not being consumed by the fragment shader, its + * interpolation type varying cannot possibly affect rendering. Also, + * this variable is non-flat and is (or contains) an integer. + * + * lower_packed_varyings requires all integer varyings to flat, + * regardless of where they appear. We can trivially satisfy that + * requirement by changing the interpolation type to flat here. + */ + producer_var->centroid = false; + producer_var->interpolation = INTERP_QUALIFIER_FLAT; + + if (consumer_var) { + consumer_var->centroid = false; + consumer_var->interpolation = INTERP_QUALIFIER_FLAT; + } + } + if (this->num_matches == this->matches_capacity) { this->matches_capacity *= 2; this->matches = (match *) @@ -960,11 +987,14 @@ assign_varying_locations(struct gl_context *ctx, { const unsigned producer_base = VARYING_SLOT_VAR0; const unsigned consumer_base = VARYING_SLOT_VAR0; - varying_matches matches(ctx->Const.DisableVaryingPacking); + varying_matches matches(ctx->Const.DisableVaryingPacking, + consumer && consumer->Type == GL_FRAGMENT_SHADER); hash_table *tfeedback_candidates = hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare); hash_table *consumer_inputs = hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare); + hash_table *consumer_interface_inputs + = hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare); /* Operate in a total of three passes. * @@ -983,8 +1013,17 @@ assign_varying_locations(struct gl_context *ctx, ((ir_instruction *) node)->as_variable(); if ((input_var != NULL) && (input_var->mode == ir_var_shader_in)) { - hash_table_insert(consumer_inputs, input_var, - ralloc_strdup(mem_ctx, input_var->name)); + if (input_var->interface_type != NULL) { + char *const iface_field_name = + ralloc_asprintf(mem_ctx, "%s.%s", + input_var->interface_type->name, + input_var->name); + hash_table_insert(consumer_interface_inputs, input_var, + iface_field_name); + } else { + hash_table_insert(consumer_inputs, input_var, + ralloc_strdup(mem_ctx, input_var->name)); + } } } } @@ -998,8 +1037,19 @@ assign_varying_locations(struct gl_context *ctx, tfeedback_candidate_generator g(mem_ctx, tfeedback_candidates); g.process(output_var); - ir_variable *input_var = - (ir_variable *) hash_table_find(consumer_inputs, output_var->name); + ir_variable *input_var; + if (output_var->interface_type != NULL) { + char *const iface_field_name = + ralloc_asprintf(mem_ctx, "%s.%s", + output_var->interface_type->name, + output_var->name); + input_var = + (ir_variable *) hash_table_find(consumer_interface_inputs, + iface_field_name); + } else { + input_var = + (ir_variable *) hash_table_find(consumer_inputs, output_var->name); + } if (input_var && input_var->mode != ir_var_shader_in) input_var = NULL; @@ -1019,6 +1069,7 @@ assign_varying_locations(struct gl_context *ctx, if (matched_candidate == NULL) { hash_table_dtor(tfeedback_candidates); hash_table_dtor(consumer_inputs); + hash_table_dtor(consumer_interface_inputs); return false; } @@ -1036,12 +1087,14 @@ assign_varying_locations(struct gl_context *ctx, if (!tfeedback_decls[i].assign_location(ctx, prog)) { hash_table_dtor(tfeedback_candidates); hash_table_dtor(consumer_inputs); + hash_table_dtor(consumer_interface_inputs); return false; } } hash_table_dtor(tfeedback_candidates); hash_table_dtor(consumer_inputs); + hash_table_dtor(consumer_interface_inputs); if (ctx->Const.DisableVaryingPacking) { /* Transform feedback code assumes varyings are packed, so if the driver diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp index 2b30d2b65..982fe46bd 100644 --- a/mesalib/src/glsl/linker.cpp +++ b/mesalib/src/glsl/linker.cpp @@ -938,6 +938,12 @@ link_intrastage_shaders(void *mem_ctx, if (!cross_validate_globals(prog, shader_list, num_shaders, false)) return NULL; + /* Check that interface blocks defined in multiple shaders are consistent. + */ + if (!validate_intrastage_interface_blocks((const gl_shader **)shader_list, + num_shaders)) + return NULL; + /* Check that uniform blocks between shaders for a stage agree. */ const int num_uniform_blocks = link_uniform_blocks(mem_ctx, prog, shader_list, num_shaders, @@ -1512,15 +1518,15 @@ check_resources(struct gl_context *ctx, struct gl_shader_program *prog) }; const unsigned max_samplers[MESA_SHADER_TYPES] = { - ctx->Const.MaxVertexTextureImageUnits, - ctx->Const.MaxTextureImageUnits, - ctx->Const.MaxGeometryTextureImageUnits + ctx->Const.VertexProgram.MaxTextureImageUnits, + ctx->Const.FragmentProgram.MaxTextureImageUnits, + ctx->Const.GeometryProgram.MaxTextureImageUnits }; const unsigned max_uniform_components[MESA_SHADER_TYPES] = { ctx->Const.VertexProgram.MaxUniformComponents, ctx->Const.FragmentProgram.MaxUniformComponents, - 0 /* FINISHME: Geometry shaders. */ + ctx->Const.GeometryProgram.MaxUniformComponents }; const unsigned max_uniform_blocks[MESA_SHADER_TYPES] = { @@ -1722,6 +1728,12 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) if (prog->_LinkedShaders[i] == NULL) continue; + if (!validate_interstage_interface_blocks(prog->_LinkedShaders[prev], + prog->_LinkedShaders[i])) { + linker_error(prog, "interface block mismatch between shader stages\n"); + goto done; + } + if (!cross_validate_outputs_to_inputs(prog, prog->_LinkedShaders[prev], prog->_LinkedShaders[i])) @@ -1733,6 +1745,12 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) prog->LinkStatus = true; } + + for (unsigned int i = 0; i < MESA_SHADER_TYPES; i++) { + if (prog->_LinkedShaders[i] != NULL) + lower_named_interface_blocks(mem_ctx, prog->_LinkedShaders[i]); + } + /* Implement the GLSL 1.30+ rule for discard vs infinite loops Do * it before optimization because we want most of the checks to get * dropped thanks to constant propagation. @@ -1767,7 +1785,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) unsigned max_unroll = ctx->ShaderCompilerOptions[i].MaxUnrollIterations; - while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, false, max_unroll)) + while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, false, max_unroll, &ctx->ShaderCompilerOptions[i])) ; } diff --git a/mesalib/src/glsl/linker.h b/mesalib/src/glsl/linker.h index f1ce50ace..2fe2410c2 100644 --- a/mesalib/src/glsl/linker.h +++ b/mesalib/src/glsl/linker.h @@ -60,6 +60,14 @@ link_uniform_blocks(void *mem_ctx, unsigned num_shaders, struct gl_uniform_block **blocks_ret); +bool +validate_intrastage_interface_blocks(const gl_shader **shader_list, + unsigned num_shaders); + +bool +validate_interstage_interface_blocks(const gl_shader *producer, + const gl_shader *consumer); + /** * Class for processing all of the leaf fields of a variable that corresponds * to a program resource. diff --git a/mesalib/src/glsl/lower_clip_distance.cpp b/mesalib/src/glsl/lower_clip_distance.cpp index 643807de8..d6cf94438 100644 --- a/mesalib/src/glsl/lower_clip_distance.cpp +++ b/mesalib/src/glsl/lower_clip_distance.cpp @@ -46,10 +46,11 @@ */ #include "glsl_symbol_table.h" -#include "ir_hierarchical_visitor.h" +#include "ir_rvalue_visitor.h" #include "ir.h" +#include "program/prog_instruction.h" /* For WRITEMASK_* */ -class lower_clip_distance_visitor : public ir_hierarchical_visitor { +class lower_clip_distance_visitor : public ir_rvalue_visitor { public: lower_clip_distance_visitor() : progress(false), old_clip_distance_var(NULL), @@ -59,11 +60,14 @@ public: virtual ir_visitor_status visit(ir_variable *); void create_indices(ir_rvalue*, ir_rvalue *&, ir_rvalue *&); - virtual ir_visitor_status visit_leave(ir_dereference_array *); virtual ir_visitor_status visit_leave(ir_assignment *); void visit_new_assignment(ir_assignment *ir); virtual ir_visitor_status visit_leave(ir_call *); + virtual void handle_rvalue(ir_rvalue **rvalue); + + void fix_lhs(ir_assignment *); + bool progress; /** @@ -173,35 +177,70 @@ lower_clip_distance_visitor::create_indices(ir_rvalue *old_index, } -/** - * Replace any expression that indexes into the gl_ClipDistance array with an - * expression that indexes into one of the vec4's in gl_ClipDistanceMESA and - * accesses the appropriate component. - */ -ir_visitor_status -lower_clip_distance_visitor::visit_leave(ir_dereference_array *ir) +void +lower_clip_distance_visitor::handle_rvalue(ir_rvalue **rv) { /* If the gl_ClipDistance var hasn't been declared yet, then * there's no way this deref can refer to it. */ - if (!this->old_clip_distance_var) - return visit_continue; + if (!this->old_clip_distance_var || *rv == NULL) + return; + + ir_dereference_array *const array_deref = (*rv)->as_dereference_array(); + if (array_deref == NULL) + return; - ir_dereference_variable *old_var_ref = ir->array->as_dereference_variable(); + /* Replace any expression that indexes into the gl_ClipDistance array + * with an expression that indexes into one of the vec4's in + * gl_ClipDistanceMESA and accesses the appropriate component. + */ + ir_dereference_variable *old_var_ref = + array_deref->array->as_dereference_variable(); if (old_var_ref && old_var_ref->var == this->old_clip_distance_var) { this->progress = true; ir_rvalue *array_index; ir_rvalue *swizzle_index; - this->create_indices(ir->array_index, array_index, swizzle_index); - void *mem_ctx = ralloc_parent(ir); - ir->array = new(mem_ctx) ir_dereference_array( - this->new_clip_distance_var, array_index); - ir->array_index = swizzle_index; - } + this->create_indices(array_deref->array_index, array_index, swizzle_index); + void *mem_ctx = ralloc_parent(array_deref); - return visit_continue; + ir_dereference_array *const ClipDistanceMESA_deref = + new(mem_ctx) ir_dereference_array(this->new_clip_distance_var, + array_index); + + ir_expression *const expr = + new(mem_ctx) ir_expression(ir_binop_vector_extract, + ClipDistanceMESA_deref, + swizzle_index); + + *rv = expr; + } } +void +lower_clip_distance_visitor::fix_lhs(ir_assignment *ir) +{ + if (ir->lhs->ir_type == ir_type_expression) { + void *mem_ctx = ralloc_parent(ir); + ir_expression *const expr = (ir_expression *) ir->lhs; + + /* The expression must be of the form: + * + * (vector_extract gl_ClipDistanceMESA[i], j). + */ + assert(expr->operation == ir_binop_vector_extract); + assert(expr->operands[0]->ir_type == ir_type_dereference_array); + assert(expr->operands[0]->type == glsl_type::vec4_type); + + ir_dereference *const new_lhs = (ir_dereference *) expr->operands[0]; + ir->rhs = new(mem_ctx) ir_expression(ir_triop_vector_insert, + glsl_type::vec4_type, + new_lhs->clone(mem_ctx, NULL), + ir->rhs, + expr->operands[1]); + ir->set_lhs(new_lhs); + ir->write_mask = WRITEMASK_XYZW; + } +} /** * Replace any assignment having gl_ClipDistance (undereferenced) as its LHS @@ -223,29 +262,50 @@ lower_clip_distance_visitor::visit_leave(ir_assignment *ir) * each of them. * * Note: to unroll into element-by-element assignments, we need to make - * clones of the LHS and RHS. This is only safe if the LHS and RHS are - * side-effect free. Fortunately, we know that they are, because the - * only kind of rvalue that can have side effects is an ir_call, and - * ir_calls only appear (a) as a statement on their own, or (b) as the - * RHS of an assignment that stores the result of the call in a - * temporary variable. + * clones of the LHS and RHS. This is safe because expressions and + * l-values are side-effect free. */ void *ctx = ralloc_parent(ir); int array_size = this->old_clip_distance_var->type->array_size(); for (int i = 0; i < array_size; ++i) { ir_dereference_array *new_lhs = new(ctx) ir_dereference_array( ir->lhs->clone(ctx, NULL), new(ctx) ir_constant(i)); - new_lhs->accept(this); ir_dereference_array *new_rhs = new(ctx) ir_dereference_array( ir->rhs->clone(ctx, NULL), new(ctx) ir_constant(i)); - new_rhs->accept(this); - this->base_ir->insert_before( - new(ctx) ir_assignment(new_lhs, new_rhs)); + this->handle_rvalue((ir_rvalue **) &new_rhs); + + /* Handle the LHS after creating the new assignment. This must + * happen in this order because handle_rvalue may replace the old LHS + * with an ir_expression of ir_binop_vector_extract. Since this is + * not a valide l-value, this will cause an assertion in the + * ir_assignment constructor to fail. + * + * If this occurs, replace the mangled LHS with a dereference of the + * vector, and replace the RHS with an ir_triop_vector_insert. + */ + ir_assignment *const assign = new(ctx) ir_assignment(new_lhs, new_rhs); + this->handle_rvalue((ir_rvalue **) &assign->lhs); + this->fix_lhs(assign); + + this->base_ir->insert_before(assign); } ir->remove(); + + return visit_continue; } - return visit_continue; + /* Handle the LHS as if it were an r-value. Normally + * rvalue_visit(ir_assignment *) only visits the RHS, but we need to lower + * expressions in the LHS as well. + * + * This may cause the LHS to get replaced with an ir_expression of + * ir_binop_vector_extract. If this occurs, replace it with a dereference + * of the vector, and replace the RHS with an ir_triop_vector_insert. + */ + handle_rvalue((ir_rvalue **)&ir->lhs); + this->fix_lhs(ir); + + return rvalue_visit(ir); } @@ -330,7 +390,7 @@ lower_clip_distance_visitor::visit_leave(ir_call *ir) } } - return visit_continue; + return rvalue_visit(ir); } diff --git a/mesalib/src/glsl/lower_instructions.cpp b/mesalib/src/glsl/lower_instructions.cpp index 1ce7b7c9d..d32ec80d6 100644 --- a/mesalib/src/glsl/lower_instructions.cpp +++ b/mesalib/src/glsl/lower_instructions.cpp @@ -38,6 +38,7 @@ * - LOG_TO_LOG2 * - MOD_TO_FRACT * - LRP_TO_ARITH + * - BITFIELD_INSERT_TO_BFM_BFI * * SUB_TO_ADD_NEG: * --------------- @@ -84,6 +85,15 @@ * LRP_TO_ARITH: * ------------- * Converts ir_triop_lrp to (op0 * (1.0f - op2)) + (op1 * op2). + * + * BITFIELD_INSERT_TO_BFM_BFI: + * --------------------------- + * Breaks ir_quadop_bitfield_insert into ir_binop_bfm (bitfield mask) and + * ir_triop_bfi (bitfield insert). + * + * Many GPUs implement the bitfieldInsert() built-in from ARB_gpu_shader_5 + * with a pair of instructions. + * */ #include "main/core.h" /* for M_LOG2E */ @@ -114,6 +124,7 @@ private: void pow_to_exp2(ir_expression *); void log_to_log2(ir_expression *); void lrp_to_arith(ir_expression *); + void bitfield_insert_to_bfm_bfi(ir_expression *); }; /** @@ -298,6 +309,29 @@ lower_instructions_visitor::lrp_to_arith(ir_expression *ir) this->progress = true; } +void +lower_instructions_visitor::bitfield_insert_to_bfm_bfi(ir_expression *ir) +{ + /* Translates + * ir_quadop_bitfield_insert base insert offset bits + * into + * ir_triop_bfi (ir_binop_bfm bits offset) insert base + */ + + ir_rvalue *base_expr = ir->operands[0]; + + ir->operation = ir_triop_bfi; + ir->operands[0] = new(ir) ir_expression(ir_binop_bfm, + ir->type->get_base_type(), + ir->operands[3], + ir->operands[2]); + /* ir->operands[1] is still the value to insert. */ + ir->operands[2] = base_expr; + ir->operands[3] = NULL; + + this->progress = true; +} + ir_visitor_status lower_instructions_visitor::visit_leave(ir_expression *ir) { @@ -339,6 +373,11 @@ lower_instructions_visitor::visit_leave(ir_expression *ir) lrp_to_arith(ir); break; + case ir_quadop_bitfield_insert: + if (lowering(BITFIELD_INSERT_TO_BFM_BFI)) + bitfield_insert_to_bfm_bfi(ir); + break; + default: return visit_continue; } diff --git a/mesalib/src/glsl/lower_named_interface_blocks.cpp b/mesalib/src/glsl/lower_named_interface_blocks.cpp new file mode 100644 index 000000000..eba667a8b --- /dev/null +++ b/mesalib/src/glsl/lower_named_interface_blocks.cpp @@ -0,0 +1,238 @@ +/* + * Copyright (c) 2013 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file lower_named_interface_blocks.cpp + * + * This lowering pass converts all interface blocks with instance names + * into interface blocks without an instance name. + * + * For example, the following shader: + * + * out block { + * float block_var; + * } inst_name; + * + * main() + * { + * inst_name.block_var = 0.0; + * } + * + * Is rewritten to: + * + * out block { + * float block_var; + * }; + * + * main() + * { + * block_var = 0.0; + * } + * + * This takes place after the shader code has already been verified with + * the interface name in place. + * + * The linking phase will use the interface block name rather than the + * interface's instance name when linking interfaces. + * + * This modification to the ir allows our currently existing dead code + * elimination to work with interface blocks without changes. + */ + +#include "glsl_symbol_table.h" +#include "ir.h" +#include "ir_optimization.h" +#include "ir_rvalue_visitor.h" +#include "program/hash_table.h" + +class flatten_named_interface_blocks_declarations : public ir_rvalue_visitor +{ +public: + void * const mem_ctx; + hash_table *interface_namespace; + + flatten_named_interface_blocks_declarations(void *mem_ctx) + : mem_ctx(mem_ctx) + { + } + + void run(exec_list *instructions); + + virtual ir_visitor_status visit_leave(ir_assignment *); + virtual void handle_rvalue(ir_rvalue **rvalue); +}; + +void +flatten_named_interface_blocks_declarations::run(exec_list *instructions) +{ + interface_namespace = hash_table_ctor(0, hash_table_string_hash, + hash_table_string_compare); + + /* First pass: adjust instance block variables with an instance name + * to not have an instance name. + * + * The interface block variables are stored in the interface_namespace + * hash table so they can be used in the second pass. + */ + foreach_list_safe(node, instructions) { + ir_variable *var = ((ir_instruction *) node)->as_variable(); + if (!var || !var->is_interface_instance()) + continue; + + /* It should be possible to handle uniforms during this pass, + * but, this will require changes to the other uniform block + * support code. + */ + if (var->mode == ir_var_uniform) + continue; + + const glsl_type * iface_t = var->type; + const glsl_type * array_t = NULL; + exec_node *insert_pos = var; + + if (iface_t->is_array()) { + array_t = iface_t; + iface_t = array_t->fields.array; + } + + assert (iface_t->is_interface()); + + for (unsigned i = 0; i < iface_t->length; i++) { + const char * field_name = iface_t->fields.structure[i].name; + char *iface_field_name = + ralloc_asprintf(mem_ctx, "%s.%s", + iface_t->name, field_name); + + ir_variable *found_var = + (ir_variable *) hash_table_find(interface_namespace, + iface_field_name); + if (!found_var) { + ir_variable *new_var; + if (array_t == NULL) { + char *var_name = + ralloc_strdup(mem_ctx, iface_t->fields.structure[i].name); + new_var = + new(mem_ctx) ir_variable(iface_t->fields.structure[i].type, + var_name, + (ir_variable_mode) var->mode); + } else { + const glsl_type *new_array_type = + glsl_type::get_array_instance( + iface_t->fields.structure[i].type, + array_t->length); + char *var_name = + ralloc_asprintf(mem_ctx, "%s[%d]", + iface_t->fields.structure[i].name, + array_t->length); + new_var = + new(mem_ctx) ir_variable(new_array_type, + var_name, + (ir_variable_mode) var->mode); + } + + new_var->interface_type = iface_t; + hash_table_insert(interface_namespace, new_var, + iface_field_name); + insert_pos->insert_after(new_var); + insert_pos = new_var; + } + } + var->remove(); + } + + /* Second pass: visit all ir_dereference_record instances, and if they + * reference an interface block, then flatten the refererence out. + */ + visit_list_elements(this, instructions); + hash_table_dtor(interface_namespace); + interface_namespace = NULL; +} + +ir_visitor_status +flatten_named_interface_blocks_declarations::visit_leave(ir_assignment *ir) +{ + ir_dereference_record *lhs_rec = ir->lhs->as_dereference_record(); + if (lhs_rec) { + ir_rvalue *lhs_rec_tmp = lhs_rec; + handle_rvalue(&lhs_rec_tmp); + if (lhs_rec_tmp != lhs_rec) { + ir->set_lhs(lhs_rec_tmp); + } + } + return rvalue_visit(ir); +} + +void +flatten_named_interface_blocks_declarations::handle_rvalue(ir_rvalue **rvalue) +{ + if (*rvalue == NULL) + return; + + ir_dereference_record *ir = (*rvalue)->as_dereference_record(); + if (ir == NULL) + return; + + ir_variable *var = ir->variable_referenced(); + + if (!var->is_interface_instance()) + return; + + /* It should be possible to handle uniforms during this pass, + * but, this will require changes to the other uniform block + * support code. + */ + if (var->mode == ir_var_uniform) + return; + + if (var->interface_type != NULL) { + char *iface_field_name = + ralloc_asprintf(mem_ctx, "%s.%s", var->interface_type->name, + ir->field); + /* Find the variable in the set of flattened interface blocks */ + ir_variable *found_var = + (ir_variable *) hash_table_find(interface_namespace, + iface_field_name); + assert(found_var); + + ir_dereference_variable *deref_var = + new(mem_ctx) ir_dereference_variable(found_var); + + ir_dereference_array *deref_array = + ir->record->as_dereference_array(); + if (deref_array != NULL) { + *rvalue = + new(mem_ctx) ir_dereference_array(deref_var, + deref_array->array_index); + } else { + *rvalue = deref_var; + } + } +} + +void +lower_named_interface_blocks(void *mem_ctx, gl_shader *shader) +{ + flatten_named_interface_blocks_declarations v_decl(mem_ctx); + v_decl.run(shader->ir); +} + diff --git a/mesalib/src/glsl/lower_packed_varyings.cpp b/mesalib/src/glsl/lower_packed_varyings.cpp index b4cc5cd0d..cdf2289b4 100644 --- a/mesalib/src/glsl/lower_packed_varyings.cpp +++ b/mesalib/src/glsl/lower_packed_varyings.cpp @@ -178,6 +178,14 @@ lower_packed_varyings_visitor::run(exec_list *instructions) !this->needs_lowering(var)) continue; + /* This lowering pass is only capable of packing floats and ints + * together when their interpolation mode is "flat". Therefore, to be + * safe, caller should ensure that integral varyings always use flat + * interpolation, even when this is not required by GLSL. + */ + assert(var->interpolation == INTERP_QUALIFIER_FLAT || + !var->type->contains_integer()); + /* Change the old varying into an ordinary global. */ var->mode = ir_var_auto; diff --git a/mesalib/src/glsl/lower_vec_index_to_cond_assign.cpp b/mesalib/src/glsl/lower_vec_index_to_cond_assign.cpp index f85875f49..880859688 100644 --- a/mesalib/src/glsl/lower_vec_index_to_cond_assign.cpp +++ b/mesalib/src/glsl/lower_vec_index_to_cond_assign.cpp @@ -52,7 +52,12 @@ public: progress = false; } - ir_rvalue *convert_vec_index_to_cond_assign(ir_rvalue *val); + ir_rvalue *convert_vec_index_to_cond_assign(void *mem_ctx, + ir_rvalue *orig_vector, + ir_rvalue *orig_index, + const glsl_type *type); + + ir_rvalue *convert_vector_extract_to_cond_assign(ir_rvalue *ir); virtual ir_visitor_status visit_enter(ir_expression *); virtual ir_visitor_status visit_enter(ir_swizzle *); @@ -65,24 +70,16 @@ public: }; ir_rvalue * -ir_vec_index_to_cond_assign_visitor::convert_vec_index_to_cond_assign(ir_rvalue *ir) +ir_vec_index_to_cond_assign_visitor::convert_vec_index_to_cond_assign(void *mem_ctx, + ir_rvalue *orig_vector, + ir_rvalue *orig_index, + const glsl_type *type) { - ir_dereference_array *orig_deref = ir->as_dereference_array(); ir_assignment *assign, *value_assign; ir_variable *index, *var, *value; ir_dereference *deref, *deref_value; unsigned i; - if (!orig_deref) - return ir; - - if (orig_deref->array->type->is_matrix() || - orig_deref->array->type->is_array()) - return ir; - - void *mem_ctx = ralloc_parent(ir); - - assert(orig_deref->array_index->type->base_type == GLSL_TYPE_INT); exec_list list; @@ -92,19 +89,19 @@ ir_vec_index_to_cond_assign_visitor::convert_vec_index_to_cond_assign(ir_rvalue ir_var_temporary); list.push_tail(index); deref = new(base_ir) ir_dereference_variable(index); - assign = new(base_ir) ir_assignment(deref, orig_deref->array_index, NULL); + assign = new(base_ir) ir_assignment(deref, orig_index, NULL); list.push_tail(assign); /* Store the value inside a temp, thus avoiding matrixes duplication */ - value = new(base_ir) ir_variable(orig_deref->array->type, "vec_value_tmp", - ir_var_temporary); + value = new(base_ir) ir_variable(orig_vector->type, "vec_value_tmp", + ir_var_temporary); list.push_tail(value); deref_value = new(base_ir) ir_dereference_variable(value); - value_assign = new(base_ir) ir_assignment(deref_value, orig_deref->array); + value_assign = new(base_ir) ir_assignment(deref_value, orig_vector); list.push_tail(value_assign); /* Temporary where we store whichever value we swizzle out. */ - var = new(base_ir) ir_variable(ir->type, "vec_index_tmp_v", + var = new(base_ir) ir_variable(type, "vec_index_tmp_v", ir_var_temporary); list.push_tail(var); @@ -113,13 +110,14 @@ ir_vec_index_to_cond_assign_visitor::convert_vec_index_to_cond_assign(ir_rvalue */ ir_rvalue *const cond_deref = compare_index_block(&list, index, 0, - orig_deref->array->type->vector_elements, + orig_vector->type->vector_elements, mem_ctx); /* Generate a conditional move of each vector element to the temp. */ - for (i = 0; i < orig_deref->array->type->vector_elements; i++) { + for (i = 0; i < orig_vector->type->vector_elements; i++) { ir_rvalue *condition_swizzle = - new(base_ir) ir_swizzle(cond_deref->clone(ir, NULL), i, 0, 0, 0, 1); + new(base_ir) ir_swizzle(cond_deref->clone(mem_ctx, NULL), + i, 0, 0, 0, 1); /* Just clone the rest of the deref chain when trying to get at the * underlying variable. @@ -142,13 +140,27 @@ ir_vec_index_to_cond_assign_visitor::convert_vec_index_to_cond_assign(ir_rvalue return new(base_ir) ir_dereference_variable(var); } +ir_rvalue * +ir_vec_index_to_cond_assign_visitor::convert_vector_extract_to_cond_assign(ir_rvalue *ir) +{ + ir_expression *const expr = ir->as_expression(); + + if (expr == NULL || expr->operation != ir_binop_vector_extract) + return ir; + + return convert_vec_index_to_cond_assign(ralloc_parent(ir), + expr->operands[0], + expr->operands[1], + ir->type); +} + ir_visitor_status ir_vec_index_to_cond_assign_visitor::visit_enter(ir_expression *ir) { unsigned int i; for (i = 0; i < ir->get_num_operands(); i++) { - ir->operands[i] = convert_vec_index_to_cond_assign(ir->operands[i]); + ir->operands[i] = convert_vector_extract_to_cond_assign(ir->operands[i]); } return visit_continue; @@ -161,7 +173,7 @@ ir_vec_index_to_cond_assign_visitor::visit_enter(ir_swizzle *ir) * the result of indexing a vector is. But maybe at some point we'll end up * using swizzling of scalars for vector construction. */ - ir->val = convert_vec_index_to_cond_assign(ir->val); + ir->val = convert_vector_extract_to_cond_assign(ir->val); return visit_continue; } @@ -169,91 +181,12 @@ ir_vec_index_to_cond_assign_visitor::visit_enter(ir_swizzle *ir) ir_visitor_status ir_vec_index_to_cond_assign_visitor::visit_leave(ir_assignment *ir) { - ir_variable *index, *var; - ir_dereference_variable *deref; - ir_assignment *assign; - unsigned i; - - ir->rhs = convert_vec_index_to_cond_assign(ir->rhs); - if (ir->condition) - ir->condition = convert_vec_index_to_cond_assign(ir->condition); - - /* Last, handle the LHS */ - ir_dereference_array *orig_deref = ir->lhs->as_dereference_array(); - - if (!orig_deref || - orig_deref->array->type->is_matrix() || - orig_deref->array->type->is_array()) - return visit_continue; - - void *mem_ctx = ralloc_parent(ir); - - assert(orig_deref->array_index->type->base_type == GLSL_TYPE_INT); - - exec_list list; - - /* Store the index to a temporary to avoid reusing its tree. */ - index = new(ir) ir_variable(glsl_type::int_type, "vec_index_tmp_i", - ir_var_temporary); - list.push_tail(index); - deref = new(ir) ir_dereference_variable(index); - assign = new(ir) ir_assignment(deref, orig_deref->array_index, NULL); - list.push_tail(assign); - - /* Store the RHS to a temporary to avoid reusing its tree. */ - var = new(ir) ir_variable(ir->rhs->type, "vec_index_tmp_v", - ir_var_temporary); - list.push_tail(var); - deref = new(ir) ir_dereference_variable(var); - assign = new(ir) ir_assignment(deref, ir->rhs, NULL); - list.push_tail(assign); - - /* Generate a single comparison condition "mask" for all of the components - * in the vector. - */ - ir_rvalue *const cond_deref = - compare_index_block(&list, index, 0, - orig_deref->array->type->vector_elements, - mem_ctx); + ir->rhs = convert_vector_extract_to_cond_assign(ir->rhs); - /* Generate a conditional move of each vector element to the temp. */ - for (i = 0; i < orig_deref->array->type->vector_elements; i++) { - ir_rvalue *condition_swizzle = - new(ir) ir_swizzle(cond_deref->clone(ir, NULL), i, 0, 0, 0, 1); - - - /* Just clone the rest of the deref chain when trying to get at the - * underlying variable. - */ - ir_rvalue *swizzle = - new(ir) ir_swizzle(orig_deref->array->clone(mem_ctx, NULL), - i, 0, 0, 0, 1); - - deref = new(ir) ir_dereference_variable(var); - assign = new(ir) ir_assignment(swizzle, deref, condition_swizzle); - list.push_tail(assign); + if (ir->condition) { + ir->condition = convert_vector_extract_to_cond_assign(ir->condition); } - /* If the original assignment has a condition, respect that original - * condition! This is acomplished by wrapping the new conditional - * assignments in an if-statement that uses the original condition. - */ - if (ir->condition != NULL) { - /* No need to clone the condition because the IR that it hangs on is - * going to be removed from the instruction sequence. - */ - ir_if *if_stmt = new(mem_ctx) ir_if(ir->condition); - - list.move_nodes_to(&if_stmt->then_instructions); - ir->insert_before(if_stmt); - } else { - ir->insert_before(&list); - } - - ir->remove(); - - this->progress = true; - return visit_continue; } @@ -262,7 +195,7 @@ ir_vec_index_to_cond_assign_visitor::visit_enter(ir_call *ir) { foreach_iter(exec_list_iterator, iter, *ir) { ir_rvalue *param = (ir_rvalue *)iter.get(); - ir_rvalue *new_param = convert_vec_index_to_cond_assign(param); + ir_rvalue *new_param = convert_vector_extract_to_cond_assign(param); if (new_param != param) { param->replace_with(new_param); @@ -276,7 +209,7 @@ ir_visitor_status ir_vec_index_to_cond_assign_visitor::visit_enter(ir_return *ir) { if (ir->value) { - ir->value = convert_vec_index_to_cond_assign(ir->value); + ir->value = convert_vector_extract_to_cond_assign(ir->value); } return visit_continue; @@ -285,7 +218,7 @@ ir_vec_index_to_cond_assign_visitor::visit_enter(ir_return *ir) ir_visitor_status ir_vec_index_to_cond_assign_visitor::visit_enter(ir_if *ir) { - ir->condition = convert_vec_index_to_cond_assign(ir->condition); + ir->condition = convert_vector_extract_to_cond_assign(ir->condition); return visit_continue; } diff --git a/mesalib/src/glsl/lower_vec_index_to_swizzle.cpp b/mesalib/src/glsl/lower_vec_index_to_swizzle.cpp index 264d6dc07..d5ad692c2 100644 --- a/mesalib/src/glsl/lower_vec_index_to_swizzle.cpp +++ b/mesalib/src/glsl/lower_vec_index_to_swizzle.cpp @@ -46,7 +46,7 @@ public: progress = false; } - ir_rvalue *convert_vec_index_to_swizzle(ir_rvalue *val); + ir_rvalue *convert_vector_extract_to_swizzle(ir_rvalue *val); virtual ir_visitor_status visit_enter(ir_expression *); virtual ir_visitor_status visit_enter(ir_swizzle *); @@ -59,20 +59,14 @@ public: }; ir_rvalue * -ir_vec_index_to_swizzle_visitor::convert_vec_index_to_swizzle(ir_rvalue *ir) +ir_vec_index_to_swizzle_visitor::convert_vector_extract_to_swizzle(ir_rvalue *ir) { - ir_dereference_array *deref = ir->as_dereference_array(); - ir_constant *ir_constant; - - if (!deref) - return ir; - - if (deref->array->type->is_matrix() || deref->array->type->is_array()) + ir_expression *const expr = ir->as_expression(); + if (expr == NULL || expr->operation != ir_binop_vector_extract) return ir; - assert(deref->array_index->type->base_type == GLSL_TYPE_INT); - ir_constant = deref->array_index->constant_expression_value(); - if (!ir_constant) + ir_constant *const idx = expr->operands[1]->constant_expression_value(); + if (idx == NULL) return ir; void *ctx = ralloc_parent(ir); @@ -92,10 +86,10 @@ ir_vec_index_to_swizzle_visitor::convert_vec_index_to_swizzle(ir_rvalue *ir) * The ir_swizzle constructor gets angry if the index is negative or too * large. For simplicity sake, just clamp the index to [0, size-1]. */ - const int i = MIN2(MAX2(ir_constant->value.i[0], 0), - ((int) deref->array->type->vector_elements - 1)); + const int i = CLAMP(idx->value.i[0], 0, + (int) expr->operands[0]->type->vector_elements - 1); - return new(ctx) ir_swizzle(deref->array, i, 0, 0, 0, 1); + return new(ctx) ir_swizzle(expr->operands[0], i, 0, 0, 0, 1); } ir_visitor_status @@ -104,7 +98,7 @@ ir_vec_index_to_swizzle_visitor::visit_enter(ir_expression *ir) unsigned int i; for (i = 0; i < ir->get_num_operands(); i++) { - ir->operands[i] = convert_vec_index_to_swizzle(ir->operands[i]); + ir->operands[i] = convert_vector_extract_to_swizzle(ir->operands[i]); } return visit_continue; @@ -117,7 +111,7 @@ ir_vec_index_to_swizzle_visitor::visit_enter(ir_swizzle *ir) * the result of indexing a vector is. But maybe at some point we'll end up * using swizzling of scalars for vector construction. */ - ir->val = convert_vec_index_to_swizzle(ir->val); + ir->val = convert_vector_extract_to_swizzle(ir->val); return visit_continue; } @@ -125,8 +119,7 @@ ir_vec_index_to_swizzle_visitor::visit_enter(ir_swizzle *ir) ir_visitor_status ir_vec_index_to_swizzle_visitor::visit_enter(ir_assignment *ir) { - ir->set_lhs(convert_vec_index_to_swizzle(ir->lhs)); - ir->rhs = convert_vec_index_to_swizzle(ir->rhs); + ir->rhs = convert_vector_extract_to_swizzle(ir->rhs); return visit_continue; } @@ -136,7 +129,7 @@ ir_vec_index_to_swizzle_visitor::visit_enter(ir_call *ir) { foreach_iter(exec_list_iterator, iter, *ir) { ir_rvalue *param = (ir_rvalue *)iter.get(); - ir_rvalue *new_param = convert_vec_index_to_swizzle(param); + ir_rvalue *new_param = convert_vector_extract_to_swizzle(param); if (new_param != param) { param->replace_with(new_param); @@ -150,7 +143,7 @@ ir_visitor_status ir_vec_index_to_swizzle_visitor::visit_enter(ir_return *ir) { if (ir->value) { - ir->value = convert_vec_index_to_swizzle(ir->value); + ir->value = convert_vector_extract_to_swizzle(ir->value); } return visit_continue; @@ -159,7 +152,7 @@ ir_vec_index_to_swizzle_visitor::visit_enter(ir_return *ir) ir_visitor_status ir_vec_index_to_swizzle_visitor::visit_enter(ir_if *ir) { - ir->condition = convert_vec_index_to_swizzle(ir->condition); + ir->condition = convert_vector_extract_to_swizzle(ir->condition); return visit_continue; } diff --git a/mesalib/src/glsl/lower_vector_insert.cpp b/mesalib/src/glsl/lower_vector_insert.cpp new file mode 100644 index 000000000..0e640cc32 --- /dev/null +++ b/mesalib/src/glsl/lower_vector_insert.cpp @@ -0,0 +1,139 @@ +/* + * Copyright © 2013 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +#include "ir.h" +#include "ir_builder.h" +#include "ir_rvalue_visitor.h" +#include "ir_optimization.h" + +using namespace ir_builder; + +class vector_insert_visitor : public ir_rvalue_visitor { +public: + vector_insert_visitor(bool lower_nonconstant_index) + : progress(false), lower_nonconstant_index(lower_nonconstant_index) + { + factory.instructions = &factory_instructions; + } + + virtual ~vector_insert_visitor() + { + assert(factory_instructions.is_empty()); + } + + virtual void handle_rvalue(ir_rvalue **rv); + + ir_factory factory; + exec_list factory_instructions; + bool progress; + bool lower_nonconstant_index; +}; + + +void +vector_insert_visitor::handle_rvalue(ir_rvalue **rv) +{ + if (*rv == NULL || (*rv)->ir_type != ir_type_expression) + return; + + ir_expression *const expr = (ir_expression *) *rv; + + if (likely(expr->operation != ir_triop_vector_insert)) + return; + + factory.mem_ctx = ralloc_parent(expr); + + ir_constant *const idx = expr->operands[2]->constant_expression_value(); + if (idx != NULL) { + /* Replace (vector_insert (vec) (scalar) (index)) with a dereference of + * a new temporary. The new temporary gets assigned as + * + * t = vec + * t.mask = scalar + * + * where mask is the component selected by index. + */ + ir_variable *const temp = + factory.make_temp(expr->operands[0]->type, "vec_tmp"); + + const int mask = 1 << idx->value.i[0]; + + factory.emit(assign(temp, expr->operands[0])); + factory.emit(assign(temp, expr->operands[1], mask)); + + this->progress = true; + *rv = new(factory.mem_ctx) ir_dereference_variable(temp); + } else if (this->lower_nonconstant_index) { + /* Replace (vector_insert (vec) (scalar) (index)) with a dereference of + * a new temporary. The new temporary gets assigned as + * + * t = vec + * if (index == 0) + * t.x = scalar + * if (index == 1) + * t.y = scalar + * if (index == 2) + * t.z = scalar + * if (index == 3) + * t.w = scalar + */ + ir_variable *const temp = + factory.make_temp(expr->operands[0]->type, "vec_tmp"); + + ir_variable *const src_temp = + factory.make_temp(expr->operands[1]->type, "src_temp"); + + factory.emit(assign(temp, expr->operands[0])); + factory.emit(assign(src_temp, expr->operands[1])); + + for (unsigned i = 0; i < expr->type->vector_elements; i++) { + ir_constant *const cmp_index = + new(factory.mem_ctx) ir_constant(int(i)); + + ir_variable *const cmp_result = + factory.make_temp(glsl_type::bool_type, "index_condition"); + + factory.emit(assign(cmp_result, + equal(expr->operands[2]->clone(factory.mem_ctx, + NULL), + cmp_index))); + + factory.emit(if_tree(cmp_result, + assign(temp, src_temp, WRITEMASK_X << i))); + } + + this->progress = true; + *rv = new(factory.mem_ctx) ir_dereference_variable(temp); + } + + base_ir->insert_before(factory.instructions); +} + +bool +lower_vector_insert(exec_list *instructions, bool lower_nonconstant_index) +{ + vector_insert_visitor v(lower_nonconstant_index); + + visit_list_elements(&v, instructions); + + return v.progress; +} diff --git a/mesalib/src/glsl/main.cpp b/mesalib/src/glsl/main.cpp index ce084b4d7..d7e35bcb3 100644 --- a/mesalib/src/glsl/main.cpp +++ b/mesalib/src/glsl/main.cpp @@ -174,9 +174,11 @@ compile_shader(struct gl_context *ctx, struct gl_shader *shader) /* Optimization passes */ if (!state->error && !shader->ir->is_empty()) { + const struct gl_shader_compiler_options *opts = + &ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(shader->Type)]; bool progress; do { - progress = do_common_optimization(shader->ir, false, false, 32); + progress = do_common_optimization(shader->ir, false, false, 32, opts); } while (progress); validate_ir_tree(shader->ir); diff --git a/mesalib/src/glsl/opt_algebraic.cpp b/mesalib/src/glsl/opt_algebraic.cpp index 70e016d22..d706a6ad1 100644 --- a/mesalib/src/glsl/opt_algebraic.cpp +++ b/mesalib/src/glsl/opt_algebraic.cpp @@ -186,12 +186,12 @@ ir_algebraic_visitor::swizzle_if_required(ir_expression *expr, ir_rvalue * ir_algebraic_visitor::handle_expression(ir_expression *ir) { - ir_constant *op_const[3] = {NULL, NULL, NULL}; - ir_expression *op_expr[3] = {NULL, NULL, NULL}; + ir_constant *op_const[4] = {NULL, NULL, NULL, NULL}; + ir_expression *op_expr[4] = {NULL, NULL, NULL, NULL}; ir_expression *temp; unsigned int i; - assert(ir->get_num_operands() <= 3); + assert(ir->get_num_operands() <= 4); for (i = 0; i < ir->get_num_operands(); i++) { if (ir->operands[i]->type->is_matrix()) return ir; diff --git a/mesalib/src/glsl/opt_flip_matrices.cpp b/mesalib/src/glsl/opt_flip_matrices.cpp new file mode 100644 index 000000000..497513fe8 --- /dev/null +++ b/mesalib/src/glsl/opt_flip_matrices.cpp @@ -0,0 +1,122 @@ +/* + * Copyright © 2013 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file opt_flip_matrices.cpp + * + * Convert (matrix * vector) operations to (vector * matrixTranspose), + * which can be done using dot products rather than multiplies and adds. + * On some hardware, this is more efficient. + * + * This currently only does the conversion for built-in matrices which + * already have transposed equivalents. Namely, gl_ModelViewProjectionMatrix + * and gl_TextureMatrix. + */ +#include "ir.h" +#include "ir_optimization.h" +#include "main/macros.h" + +namespace { +class matrix_flipper : public ir_hierarchical_visitor { +public: + matrix_flipper(exec_list *instructions) + { + progress = false; + mvp_transpose = NULL; + texmat_transpose = NULL; + + foreach_list(n, instructions) { + ir_instruction *ir = (ir_instruction *) n; + ir_variable *var = ir->as_variable(); + if (!var) + continue; + if (strcmp(var->name, "gl_ModelViewProjectionMatrixTranspose") == 0) + mvp_transpose = var; + if (strcmp(var->name, "gl_TextureMatrixTranspose") == 0) + texmat_transpose = var; + } + } + + ir_visitor_status visit_enter(ir_expression *ir); + + bool progress; + +private: + ir_variable *mvp_transpose; + ir_variable *texmat_transpose; +}; +} + +ir_visitor_status +matrix_flipper::visit_enter(ir_expression *ir) +{ + if (ir->operation != ir_binop_mul || + !ir->operands[0]->type->is_matrix() || + !ir->operands[1]->type->is_vector()) + return visit_continue; + + ir_variable *mat_var = ir->operands[0]->variable_referenced(); + if (!mat_var) + return visit_continue; + + if (mvp_transpose && + strcmp(mat_var->name, "gl_ModelViewProjectionMatrix") == 0) { + ir_dereference_variable *deref = ir->operands[0]->as_dereference_variable(); + assert(deref && deref->var == mat_var); + + void *mem_ctx = ralloc_parent(ir); + + ir->operands[0] = ir->operands[1]; + ir->operands[1] = new(mem_ctx) ir_dereference_variable(mvp_transpose); + + progress = true; + } else if (texmat_transpose && + strcmp(mat_var->name, "gl_TextureMatrix") == 0) { + ir_dereference_array *array_ref = ir->operands[0]->as_dereference_array(); + assert(array_ref != NULL); + ir_dereference_variable *var_ref = array_ref->array->as_dereference_variable(); + assert(var_ref && var_ref->var == mat_var); + + ir->operands[0] = ir->operands[1]; + ir->operands[1] = array_ref; + + var_ref->var = texmat_transpose; + + texmat_transpose->max_array_access = + MAX2(texmat_transpose->max_array_access, mat_var->max_array_access); + + progress = true; + } + + return visit_continue; +} + +bool +opt_flip_matrices(struct exec_list *instructions) +{ + matrix_flipper v(instructions); + + visit_list_elements(&v, instructions); + + return v.progress; +} diff --git a/mesalib/src/glsl/opt_if_simplification.cpp b/mesalib/src/glsl/opt_if_simplification.cpp index e1a23d94a..db59b131d 100644 --- a/mesalib/src/glsl/opt_if_simplification.cpp +++ b/mesalib/src/glsl/opt_if_simplification.cpp @@ -25,7 +25,8 @@ * \file opt_if_simplification.cpp * * Moves constant branches of if statements out to the surrounding - * instruction stream. + * instruction stream, and inverts if conditionals to avoid empty + * "then" blocks. */ #include "ir.h" @@ -101,6 +102,30 @@ ir_if_simplification_visitor::visit_leave(ir_if *ir) } ir->remove(); this->made_progress = true; + return visit_continue; + } + + /* Turn: + * + * if (cond) { + * } else { + * do_work(); + * } + * + * into : + * + * if (!cond) + * do_work(); + * + * which avoids control flow for "else" (which is usually more + * expensive than normal operations), and the "not" can usually be + * folded into the generation of "cond" anyway. + */ + if (ir->then_instructions.is_empty()) { + ir->condition = new(ralloc_parent(ir->condition)) + ir_expression(ir_unop_logic_not, ir->condition); + ir->else_instructions.move_nodes_to(&ir->then_instructions); + this->made_progress = true; } return visit_continue; diff --git a/mesalib/src/glsl/program.h b/mesalib/src/glsl/program.h index 46ce9dccc..6a76d4d54 100644 --- a/mesalib/src/glsl/program.h +++ b/mesalib/src/glsl/program.h @@ -16,9 +16,10 @@ * 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 - * BRIAN PAUL 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. + * 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 "main/core.h" diff --git a/mesalib/src/glsl/ralloc.c b/mesalib/src/glsl/ralloc.c index 59e71c48b..e79dad764 100644 --- a/mesalib/src/glsl/ralloc.c +++ b/mesalib/src/glsl/ralloc.c @@ -107,9 +107,13 @@ void * ralloc_size(const void *ctx, size_t size) { void *block = calloc(1, size + sizeof(ralloc_header)); + ralloc_header *info; + ralloc_header *parent; - ralloc_header *info = (ralloc_header *) block; - ralloc_header *parent = ctx != NULL ? get_header(ctx) : NULL; + if (unlikely(block == NULL)) + return NULL; + info = (ralloc_header *) block; + parent = ctx != NULL ? get_header(ctx) : NULL; add_child(parent, info); diff --git a/mesalib/src/glsl/standalone_scaffolding.cpp b/mesalib/src/glsl/standalone_scaffolding.cpp index 0c1f52f48..11cd6cdc0 100644 --- a/mesalib/src/glsl/standalone_scaffolding.cpp +++ b/mesalib/src/glsl/standalone_scaffolding.cpp @@ -104,6 +104,7 @@ void initialize_context_to_defaults(struct gl_context *ctx, gl_api api) ctx->Extensions.ARB_texture_cube_map_array = true; ctx->Extensions.ARB_texture_multisample = true; ctx->Extensions.ARB_texture_query_lod = true; + ctx->Extensions.ARB_gpu_shader5 = true; ctx->Const.GLSLVersion = 120; @@ -116,10 +117,22 @@ void initialize_context_to_defaults(struct gl_context *ctx, gl_api api) ctx->Const.VertexProgram.MaxUniformComponents = 512; ctx->Const.MaxVarying = 8; /* == gl_MaxVaryingFloats / 4 */ - ctx->Const.MaxVertexTextureImageUnits = 0; + ctx->Const.VertexProgram.MaxTextureImageUnits = 0; ctx->Const.MaxCombinedTextureImageUnits = 2; - ctx->Const.MaxTextureImageUnits = 2; + ctx->Const.FragmentProgram.MaxTextureImageUnits = 2; ctx->Const.FragmentProgram.MaxUniformComponents = 64; ctx->Const.MaxDrawBuffers = 1; + + /* Set up default shader compiler options. */ + struct gl_shader_compiler_options options; + memset(&options, 0, sizeof(options)); + options.MaxUnrollIterations = 32; + options.MaxIfDepth = UINT_MAX; + + /* Default pragma settings */ + options.DefaultPragmas.Optimize = true; + + for (int sh = 0; sh < MESA_SHADER_TYPES; ++sh) + memcpy(&ctx->ShaderCompilerOptions[sh], &options, sizeof(options)); } diff --git a/mesalib/src/glsl/standalone_scaffolding.h b/mesalib/src/glsl/standalone_scaffolding.h index 0a2cde8a3..7afb1c313 100644 --- a/mesalib/src/glsl/standalone_scaffolding.h +++ b/mesalib/src/glsl/standalone_scaffolding.h @@ -31,6 +31,7 @@ #ifndef STANDALONE_SCAFFOLDING_H #define STANDALONE_SCAFFOLDING_H +#include <assert.h> #include "main/mtypes.h" extern "C" void @@ -47,6 +48,22 @@ extern "C" void _mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint *id, const char *msg, int len); +static inline gl_shader_type +_mesa_shader_type_to_index(GLenum v) +{ + switch (v) { + case GL_VERTEX_SHADER: + return MESA_SHADER_VERTEX; + case GL_FRAGMENT_SHADER: + return MESA_SHADER_FRAGMENT; + case GL_GEOMETRY_SHADER: + return MESA_SHADER_GEOMETRY; + default: + assert(!"bad value in _mesa_shader_type_to_index()"); + return MESA_SHADER_TYPES; + } +} + /** * Initialize the given gl_context structure to a reasonable set of * defaults representing the minimum capabilities required by the diff --git a/mesalib/src/glsl/test_optpass.cpp b/mesalib/src/glsl/test_optpass.cpp index 117b0b006..fc10cbbde 100644 --- a/mesalib/src/glsl/test_optpass.cpp +++ b/mesalib/src/glsl/test_optpass.cpp @@ -54,7 +54,8 @@ static string read_stdin_to_eof() } static GLboolean -do_optimization(struct exec_list *ir, const char *optimization) +do_optimization(struct exec_list *ir, const char *optimization, + const struct gl_shader_compiler_options *options) { int int_0; int int_1; @@ -64,7 +65,7 @@ do_optimization(struct exec_list *ir, const char *optimization) if (sscanf(optimization, "do_common_optimization ( %d , %d ) ", &int_0, &int_1) == 2) { - return do_common_optimization(ir, int_0 != 0, false, int_1); + return do_common_optimization(ir, int_0 != 0, false, int_1, options); } else if (strcmp(optimization, "do_algebraic") == 0) { return do_algebraic(ir); } else if (strcmp(optimization, "do_constant_folding") == 0) { @@ -141,7 +142,8 @@ do_optimization(struct exec_list *ir, const char *optimization) static GLboolean do_optimization_passes(struct exec_list *ir, char **optimizations, - int num_optimizations, bool quiet) + int num_optimizations, bool quiet, + const struct gl_shader_compiler_options *options) { GLboolean overall_progress = false; @@ -150,7 +152,7 @@ do_optimization_passes(struct exec_list *ir, char **optimizations, if (!quiet) { printf("*** Running optimization %s...", optimization); } - GLboolean progress = do_optimization(ir, optimization); + GLboolean progress = do_optimization(ir, optimization, options); if (!quiet) { printf("%s\n", progress ? "progress" : "no progress"); } @@ -240,9 +242,11 @@ int test_optpass(int argc, char **argv) /* Optimization passes */ if (!state->error) { GLboolean progress; + const struct gl_shader_compiler_options *options = + &ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(shader_type)]; do { progress = do_optimization_passes(shader->ir, &argv[optind], - argc - optind, quiet != 0); + argc - optind, quiet != 0, options); } while (loop && progress); } diff --git a/mesalib/src/mapi/Android.mk b/mesalib/src/mapi/Android.mk index d1749a262..f10437874 100644 --- a/mesalib/src/mapi/Android.mk +++ b/mesalib/src/mapi/Android.mk @@ -36,12 +36,12 @@ include $(CLEAR_VARS) abi_header := shared-glapi/glapi_mapi_tmp.h LOCAL_SRC_FILES := \ - mapi/entry.c \ - mapi/mapi_glapi.c \ - mapi/stub.c \ - mapi/table.c \ - mapi/u_current.c \ - mapi/u_execmem.c + entry.c \ + mapi_glapi.c \ + stub.c \ + table.c \ + u_current.c \ + u_execmem.c LOCAL_CFLAGS := \ -DMAPI_MODE_GLAPI \ @@ -68,9 +68,9 @@ include $(BUILD_SHARED_LIBRARY) mapi_abi_deps := \ $(wildcard $(LOCAL_PATH)/glapi/gen/*.py) \ $(wildcard $(LOCAL_PATH)/glapi/gen/*.xml) \ - $(LOCAL_PATH)/mapi/mapi_abi.py + $(LOCAL_PATH)/mapi_abi.py -$(mapi_abi_headers): PRIVATE_SCRIPT := $(MESA_PYTHON2) $(LOCAL_PATH)/mapi/mapi_abi.py +$(mapi_abi_headers): PRIVATE_SCRIPT := $(MESA_PYTHON2) $(LOCAL_PATH)/mapi_abi.py $(mapi_abi_headers): PRIVATE_APIXML := $(LOCAL_PATH)/glapi/gen/gl_and_es_API.xml $(mapi_abi_headers): $(mapi_abi_deps) @mkdir -p $(dir $@) diff --git a/mesalib/src/gallium/Makefile.am b/mesalib/src/mapi/Makefile.am index e7cff8920..ef538039b 100644 --- a/mesalib/src/gallium/Makefile.am +++ b/mesalib/src/mapi/Makefile.am @@ -1,4 +1,4 @@ -# Copyright © 2012 Intel Corporation +# Copyright © 2013 Intel Corporation # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), @@ -19,4 +19,24 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -SUBDIRS = $(GALLIUM_DIRS) +SUBDIRS = glapi/gen + +if HAVE_SHARED_GLAPI +SUBDIRS += shared-glapi +endif + +if HAVE_OPENGL +SUBDIRS += glapi +endif + +if HAVE_OPENGL_ES1 +SUBDIRS += es1api +endif + +if HAVE_OPENGL_ES2 +SUBDIRS += es2api +endif + +if HAVE_OPENVG +SUBDIRS += vgapi +endif diff --git a/mesalib/src/mapi/mapi/sources.mak b/mesalib/src/mapi/Makefile.sources index 56f4afd3e..aff465a60 100644 --- a/mesalib/src/mapi/mapi/sources.mak +++ b/mesalib/src/mapi/Makefile.sources @@ -1,4 +1,4 @@ -# src/mapi/mapi/sources.mak +# src/mapi/Makefile.sources # # mapi may be used in several ways # @@ -15,22 +15,22 @@ # this mode, compile MAPI_BRIDGE_FILES with MAPI_MODE_BRIDGE defined. MAPI_UTIL_FILES = \ - $(TOP)/src/mapi/mapi/u_current.c \ - $(TOP)/src/mapi/mapi/u_execmem.c + $(TOP)/src/mapi/u_current.c \ + $(TOP)/src/mapi/u_execmem.c MAPI_FILES = \ - $(TOP)/src/mapi/mapi/entry.c \ - $(TOP)/src/mapi/mapi/mapi.c \ - $(TOP)/src/mapi/mapi/stub.c \ - $(TOP)/src/mapi/mapi/table.c \ + $(TOP)/src/mapi/entry.c \ + $(TOP)/src/mapi/mapi.c \ + $(TOP)/src/mapi/stub.c \ + $(TOP)/src/mapi/table.c \ $(MAPI_UTIL_FILES) MAPI_GLAPI_FILES = \ - $(TOP)/src/mapi/mapi/entry.c \ - $(TOP)/src/mapi/mapi/mapi_glapi.c \ - $(TOP)/src/mapi/mapi/stub.c \ - $(TOP)/src/mapi/mapi/table.c \ + $(TOP)/src/mapi/entry.c \ + $(TOP)/src/mapi/mapi_glapi.c \ + $(TOP)/src/mapi/stub.c \ + $(TOP)/src/mapi/table.c \ $(MAPI_UTIL_FILES) MAPI_BRIDGE_FILES = \ - $(TOP)/src/mapi/mapi/entry.c + $(TOP)/src/mapi/entry.c diff --git a/mesalib/src/mapi/mapi/entry.c b/mesalib/src/mapi/entry.c index 3d9168a72..3d9168a72 100644 --- a/mesalib/src/mapi/mapi/entry.c +++ b/mesalib/src/mapi/entry.c diff --git a/mesalib/src/mapi/mapi/entry.h b/mesalib/src/mapi/entry.h index 9df810004..9df810004 100644 --- a/mesalib/src/mapi/mapi/entry.h +++ b/mesalib/src/mapi/entry.h diff --git a/mesalib/src/mapi/mapi/entry_x86-64_tls.h b/mesalib/src/mapi/entry_x86-64_tls.h index 72d4125a6..36cad00c2 100644 --- a/mesalib/src/mapi/mapi/entry_x86-64_tls.h +++ b/mesalib/src/mapi/entry_x86-64_tls.h @@ -28,19 +28,6 @@ #include "u_macros.h" -#ifdef __linux__ -__asm__(".section .note.ABI-tag, \"a\"\n\t" - ".p2align 2\n\t" - ".long 1f - 0f\n\t" /* name length */ - ".long 3f - 2f\n\t" /* data length */ - ".long 1\n\t" /* note length */ - "0: .asciz \"GNU\"\n\t" /* vendor name */ - "1: .p2align 2\n\t" - "2: .long 0\n\t" /* note data: the ABI tag */ - ".long 2,4,20\n\t" /* Minimum kernel version w/TLS */ - "3: .p2align 2\n\t"); /* pad out section */ -#endif /* __linux__ */ - __asm__(".text\n" ".balign 32\n" "x86_64_entry_start:"); diff --git a/mesalib/src/mapi/mapi/entry_x86_tls.h b/mesalib/src/mapi/entry_x86_tls.h index de918128e..58d09caa6 100644 --- a/mesalib/src/mapi/mapi/entry_x86_tls.h +++ b/mesalib/src/mapi/entry_x86_tls.h @@ -29,19 +29,6 @@ #include <string.h> #include "u_macros.h" -#ifdef __linux__ -__asm__(".section .note.ABI-tag, \"a\"\n\t" - ".p2align 2\n\t" - ".long 1f - 0f\n\t" /* name length */ - ".long 3f - 2f\n\t" /* data length */ - ".long 1\n\t" /* note length */ - "0: .asciz \"GNU\"\n\t" /* vendor name */ - "1: .p2align 2\n\t" - "2: .long 0\n\t" /* note data: the ABI tag */ - ".long 2,4,20\n\t" /* Minimum kernel version w/TLS */ - "3: .p2align 2\n\t"); /* pad out section */ -#endif /* __linux__ */ - __asm__(".text"); __asm__("x86_current_tls:\n\t" diff --git a/mesalib/src/mapi/mapi/entry_x86_tsd.h b/mesalib/src/mapi/entry_x86_tsd.h index c479c199e..c479c199e 100644 --- a/mesalib/src/mapi/mapi/entry_x86_tsd.h +++ b/mesalib/src/mapi/entry_x86_tsd.h diff --git a/mesalib/src/mapi/glapi/Makefile.am b/mesalib/src/mapi/glapi/Makefile.am index bdb527d5c..1698d1474 100644 --- a/mesalib/src/mapi/glapi/Makefile.am +++ b/mesalib/src/mapi/glapi/Makefile.am @@ -20,8 +20,8 @@ # IN THE SOFTWARE. TOP = $(top_srcdir) -include sources.mak -include ../mapi/sources.mak +include Makefile.sources +include ../Makefile.sources AM_CPPFLAGS = \ $(DEFINES) \ diff --git a/mesalib/src/mapi/glapi/sources.mak b/mesalib/src/mapi/glapi/Makefile.sources index aa8a4d40a..58d28c52c 100644 --- a/mesalib/src/mapi/glapi/sources.mak +++ b/mesalib/src/mapi/glapi/Makefile.sources @@ -1,4 +1,4 @@ -# src/mapi/glapi/sources.mak +# src/mapi/glapi/Makefile.sources GLAPI_SOURCES = \ glapi_dispatch.c \ diff --git a/mesalib/src/mapi/glapi/SConscript b/mesalib/src/mapi/glapi/SConscript index 00cce3e7f..c4ac080aa 100644 --- a/mesalib/src/mapi/glapi/SConscript +++ b/mesalib/src/mapi/glapi/SConscript @@ -43,13 +43,14 @@ mapi_sources = [ 'u_execmem.c', ] for s in mapi_sources: - o = env.SharedObject(s[:-2], '../mapi/' + s) + o = env.SharedObject(s[:-2], '../' + s) glapi_sources.append(o) # # Assembly sources # -if env['gcc'] and env['platform'] not in ('cygwin', 'darwin', 'windows'): +if (env['gcc'] or env['clang']) and \ + env['platform'] not in ('cygwin', 'darwin', 'windows'): GLAPI = '#src/mapi/glapi/' if env['machine'] == 'x86': @@ -94,11 +95,6 @@ if env['gcc'] and env['platform'] not in ('cygwin', 'darwin', 'windows'): else: pass -if env['toolchain'] == 'crossmingw': - # compile these files without -gstabs option - glapi_sources = env.compile_without_gstabs(glapi_sources, "glapi_dispatch.c") - glapi_sources = env.compile_without_gstabs(glapi_sources, "glapi_getproc.c") - glapi = env.ConvenienceLibrary( target = 'glapi', source = glapi_sources, diff --git a/mesalib/src/mapi/glapi/gen/GL3x.xml b/mesalib/src/mapi/glapi/gen/GL3x.xml index c17a64402..5078f7b6d 100644 --- a/mesalib/src/mapi/glapi/gen/GL3x.xml +++ b/mesalib/src/mapi/glapi/gen/GL3x.xml @@ -424,26 +424,26 @@ <function name="Uniform1uiv" es2="3.0" offset="assign"> <param name="location" type="GLint"/> - <param name="count" type="GLsizei"/> - <param name="value" type="const GLuint *"/> + <param name="count" type="GLsizei" counter="true"/> + <param name="value" type="const GLuint *" count="count"/> </function> <function name="Uniform2uiv" es2="3.0" offset="assign"> <param name="location" type="GLint"/> - <param name="count" type="GLsizei"/> - <param name="value" type="const GLuint *"/> + <param name="count" type="GLsizei" counter="true"/> + <param name="value" type="const GLuint *" count="count" count_scale="2"/> </function> <function name="Uniform3uiv" es2="3.0" offset="assign"> <param name="location" type="GLint"/> - <param name="count" type="GLsizei"/> - <param name="value" type="const GLuint *"/> + <param name="count" type="GLsizei" counter="true"/> + <param name="value" type="const GLuint *" count="count" count_scale="3"/> </function> <function name="Uniform4uiv" es2="3.0" offset="assign"> <param name="location" type="GLint"/> - <param name="count" type="GLsizei"/> - <param name="value" type="const GLuint *"/> + <param name="count" type="GLsizei" counter="true"/> + <param name="value" type="const GLuint *" count="count" count_scale="4"/> </function> <!-- These functions alias ones from GL_EXT_texture_integer --> @@ -607,7 +607,7 @@ <param name="params" type="GLint64 *"/> </function> - <function name="FramebufferTexture" offset="assign" exec="skip"> + <function name="FramebufferTexture" offset="assign"> <param name="target" type="GLenum"/> <param name="attachment" type="GLenum"/> <param name="texture" type="GLuint"/> diff --git a/mesalib/src/mapi/glapi/gen/Makefile.am b/mesalib/src/mapi/glapi/gen/Makefile.am index 36e47e21e..97200598e 100644 --- a/mesalib/src/mapi/glapi/gen/Makefile.am +++ b/mesalib/src/mapi/glapi/gen/Makefile.am @@ -20,7 +20,7 @@ XORG_INDENT_FLAGS = -linux -bad -bap -blf -bli0 -cbi0 -cdw -nce -cs -i4 -lc80 -p MESA_DIR = $(top_srcdir)/src/mesa MESA_GLAPI_DIR = $(top_srcdir)/src/mapi/glapi -MESA_MAPI_DIR = $(top_srcdir)/src/mapi/mapi +MESA_MAPI_DIR = $(top_srcdir)/src/mapi MESA_GLX_DIR = $(top_srcdir)/src/glx MESA_GLAPI_OUTPUTS = \ diff --git a/mesalib/src/mapi/glapi/gen/es_EXT.xml b/mesalib/src/mapi/glapi/gen/es_EXT.xml index ff378acf1..f412333df 100644 --- a/mesalib/src/mapi/glapi/gen/es_EXT.xml +++ b/mesalib/src/mapi/glapi/gen/es_EXT.xml @@ -689,22 +689,25 @@ <!-- 71. GL_OES_vertex_array_object --> <category name="GL_OES_vertex_array_object" number="71"> - <function name="BindVertexArrayOES" alias="BindVertexArray" es2="2.0"> + <function name="BindVertexArrayOES" alias="BindVertexArray" + static_dispatch="false" es2="2.0"> <param name="array" type="GLuint"/> </function> <function name="DeleteVertexArraysOES" alias="DeleteVertexArrays" - es2="2.0"> + static_dispatch="false" es2="2.0"> <param name="n" type="GLsizei"/> <param name="arrays" type="const GLuint *" count="n"/> </function> - <function name="GenVertexArraysOES" alias="GenVertexArrays" es2="2.0"> + <function name="GenVertexArraysOES" alias="GenVertexArrays" + static_dispatch="false" es2="2.0"> <param name="n" type="GLsizei"/> <param name="arrays" type="GLuint *" output="true" count="n"/> </function> - <function name="IsVertexArrayOES" alias="IsVertexArray" es2="2.0"> + <function name="IsVertexArrayOES" alias="IsVertexArray" + static_dispatch="false" es2="2.0"> <param name="array" type="GLuint"/> <return type="GLboolean"/> </function> @@ -779,7 +782,8 @@ <size name="Get" mode="get"/> </enum> - <function name="DrawBuffersNV" alias="DrawBuffers" es2="2.0"> + <function name="DrawBuffersNV" alias="DrawBuffers" + static_dispatch="false" es2="2.0"> <param name="n" type="GLsizei" counter="true"/> <param name="bufs" type="const GLenum *" count="n"/> </function> @@ -787,7 +791,8 @@ <!-- 93. GL_NV_read_buffer --> <category name="GL_NV_read_buffer"> - <function name="ReadBufferNV" alias="ReadBuffer" es2="2.0"> + <function name="ReadBufferNV" alias="ReadBuffer" + static_dispatch="false" es2="2.0"> <param name="mode" type="GLenum"/> </function> </category> @@ -815,8 +820,8 @@ <enum name="MAP_FLUSH_EXPLICIT_BIT_EXT" value="0x0010"/> <enum name="MAP_UNSYNCHRONIZED_BIT_EXT" value="0x0020"/> - <function name="MapBufferRangeEXT" alias="MapBufferRange" es1="1.0" - es2="2.0"> + <function name="MapBufferRangeEXT" alias="MapBufferRange" + static_dispatch="false" es1="1.0" es2="2.0"> <param name="target" type="GLenum"/> <param name="offset" type="GLintptr"/> <param name="size" type="GLsizeiptr"/> @@ -825,7 +830,7 @@ </function> <function name="FlushMappedBufferRangeEXT" alias="FlushMappedBufferRange" - es1="1.0" es2="2.0"> + static_dispatch="false" es1="1.0" es2="2.0"> <param name="target" type="GLenum"/> <param name="offset" type="GLintptr"/> <param name="length" type="GLsizeiptr"/> diff --git a/mesalib/src/mapi/glapi/gen/gl_API.xml b/mesalib/src/mapi/glapi/gen/gl_API.xml index df9592477..f7257978f 100644 --- a/mesalib/src/mapi/glapi/gen/gl_API.xml +++ b/mesalib/src/mapi/glapi/gen/gl_API.xml @@ -5685,83 +5685,83 @@ <function name="Uniform1fv" es2="2.0" offset="assign"> <param name="location" type="GLint"/> - <param name="count" type="GLsizei"/> - <param name="value" type="const GLfloat *"/> + <param name="count" type="GLsizei" counter="true"/> + <param name="value" type="const GLfloat *" count="count"/> <glx ignore="true"/> <glx ignore="true"/> </function> <function name="Uniform2fv" es2="2.0" offset="assign"> <param name="location" type="GLint"/> - <param name="count" type="GLsizei"/> - <param name="value" type="const GLfloat *"/> + <param name="count" type="GLsizei" counter="true"/> + <param name="value" type="const GLfloat *" count="count" count_scale="2"/> <glx ignore="true"/> <glx ignore="true"/> </function> <function name="Uniform3fv" es2="2.0" offset="assign"> <param name="location" type="GLint"/> - <param name="count" type="GLsizei"/> - <param name="value" type="const GLfloat *"/> + <param name="count" type="GLsizei" counter="true"/> + <param name="value" type="const GLfloat *" count="count" count_scale="3"/> <glx ignore="true"/> <glx ignore="true"/> </function> <function name="Uniform4fv" es2="2.0" offset="assign"> <param name="location" type="GLint"/> - <param name="count" type="GLsizei"/> - <param name="value" type="const GLfloat *"/> + <param name="count" type="GLsizei" counter="true"/> + <param name="value" type="const GLfloat *" count="count" count_scale="4"/> <glx ignore="true"/> <glx ignore="true"/> </function> <function name="Uniform1iv" es2="2.0" offset="assign"> <param name="location" type="GLint"/> - <param name="count" type="GLsizei"/> - <param name="value" type="const GLint *"/> + <param name="count" type="GLsizei" counter="true"/> + <param name="value" type="const GLint *" count="count"/> <glx ignore="true"/> <glx ignore="true"/> </function> <function name="Uniform2iv" es2="2.0" offset="assign"> <param name="location" type="GLint"/> - <param name="count" type="GLsizei"/> - <param name="value" type="const GLint *"/> + <param name="count" type="GLsizei" counter="true"/> + <param name="value" type="const GLint *" count="count" count_scale="2"/> <glx ignore="true"/> <glx ignore="true"/> </function> <function name="Uniform3iv" es2="2.0" offset="assign"> <param name="location" type="GLint"/> - <param name="count" type="GLsizei"/> - <param name="value" type="const GLint *"/> + <param name="count" type="GLsizei" counter="true"/> + <param name="value" type="const GLint *" count="count" count_scale="3"/> <glx ignore="true"/> <glx ignore="true"/> </function> <function name="Uniform4iv" es2="2.0" offset="assign"> <param name="location" type="GLint"/> - <param name="count" type="GLsizei"/> - <param name="value" type="const GLint *"/> + <param name="count" type="GLsizei" counter="true"/> + <param name="value" type="const GLint *" count="count" count_scale="4"/> <glx ignore="true"/> <glx ignore="true"/> </function> <function name="UniformMatrix2fv" es2="2.0" offset="assign"> <param name="location" type="GLint"/> - <param name="count" type="GLsizei"/> + <param name="count" type="GLsizei" counter="true"/> <param name="transpose" type="GLboolean"/> - <param name="value" type="const GLfloat *"/> + <param name="value" type="const GLfloat *" count="count" count_scale="4"/> <glx ignore="true"/> <glx ignore="true"/> </function> <function name="UniformMatrix3fv" es2="2.0" offset="assign"> <param name="location" type="GLint"/> - <param name="count" type="GLsizei"/> + <param name="count" type="GLsizei" counter="true"/> <param name="transpose" type="GLboolean"/> - <param name="value" type="const GLfloat *"/> + <param name="value" type="const GLfloat *" count="count" count_scale="9"/> <glx ignore="true"/> <glx ignore="true"/> </function> <function name="UniformMatrix4fv" es2="2.0" offset="assign"> <param name="location" type="GLint"/> - <param name="count" type="GLsizei"/> + <param name="count" type="GLsizei" counter="true"/> <param name="transpose" type="GLboolean"/> - <param name="value" type="const GLfloat *"/> + <param name="value" type="const GLfloat *" count="count" count_scale="16"/> <glx ignore="true"/> <glx ignore="true"/> </function> @@ -6004,44 +6004,44 @@ <function name="UniformMatrix2x3fv" offset="assign" es2="3.0"> <param name="location" type="GLint"/> - <param name="count" type="GLsizei"/> + <param name="count" type="GLsizei" counter="true"/> <param name="transpose" type="GLboolean"/> - <param name="value" type="const GLfloat *"/> + <param name="value" type="const GLfloat *" count="count" count_scale="6"/> <glx ignore="true"/> </function> <function name="UniformMatrix3x2fv" offset="assign" es2="3.0"> <param name="location" type="GLint"/> - <param name="count" type="GLsizei"/> + <param name="count" type="GLsizei" counter="true"/> <param name="transpose" type="GLboolean"/> - <param name="value" type="const GLfloat *"/> + <param name="value" type="const GLfloat *" count="count" count_scale="6"/> <glx ignore="true"/> </function> <function name="UniformMatrix2x4fv" offset="assign" es2="3.0"> <param name="location" type="GLint"/> - <param name="count" type="GLsizei"/> + <param name="count" type="GLsizei" counter="true"/> <param name="transpose" type="GLboolean"/> - <param name="value" type="const GLfloat *"/> + <param name="value" type="const GLfloat *" count="count" count_scale="6"/> <glx ignore="true"/> </function> <function name="UniformMatrix4x2fv" offset="assign" es2="3.0"> <param name="location" type="GLint"/> - <param name="count" type="GLsizei"/> + <param name="count" type="GLsizei" counter="true"/> <param name="transpose" type="GLboolean"/> - <param name="value" type="const GLfloat *"/> + <param name="value" type="const GLfloat *" count="count" count_scale="8"/> <glx ignore="true"/> </function> <function name="UniformMatrix3x4fv" offset="assign" es2="3.0"> <param name="location" type="GLint"/> - <param name="count" type="GLsizei"/> + <param name="count" type="GLsizei" counter="true"/> <param name="transpose" type="GLboolean"/> - <param name="value" type="const GLfloat *"/> + <param name="value" type="const GLfloat *" count="count" count_scale="12"/> <glx ignore="true"/> </function> <function name="UniformMatrix4x3fv" offset="assign" es2="3.0"> <param name="location" type="GLint"/> - <param name="count" type="GLsizei"/> + <param name="count" type="GLsizei" counter="true"/> <param name="transpose" type="GLboolean"/> - <param name="value" type="const GLfloat *"/> + <param name="value" type="const GLfloat *" count="count" count_scale="12"/> <glx ignore="true"/> </function> @@ -7656,8 +7656,8 @@ <function name="BufferDataARB" alias="BufferData"> <param name="target" type="GLenum"/> - <param name="size" type="GLsizeiptrARB"/> - <param name="data" type="const GLvoid *"/> + <param name="size" type="GLsizeiptrARB" counter="true"/> + <param name="data" type="const GLvoid *" count="size"/> <param name="usage" type="GLenum"/> </function> diff --git a/mesalib/src/mapi/glapi/gen/gl_XML.py b/mesalib/src/mapi/glapi/gen/gl_XML.py index 227e9fcd9..3bbc79439 100644 --- a/mesalib/src/mapi/glapi/gen/gl_XML.py +++ b/mesalib/src/mapi/glapi/gen/gl_XML.py @@ -802,6 +802,8 @@ class gl_function( gl_item ): comma = "" for p in self.parameterIterator(): + if p.is_padding: + continue p_string = p_string + comma + p.name comma = ", " diff --git a/mesalib/src/mapi/glapi/gen/gl_enums.py b/mesalib/src/mapi/glapi/gen/gl_enums.py index 0bf8b0a9c..806d38445 100644 --- a/mesalib/src/mapi/glapi/gen/gl_enums.py +++ b/mesalib/src/mapi/glapi/gen/gl_enums.py @@ -43,7 +43,6 @@ class PrintGlEnums(gl_XML.gl_print_base): def printRealHeader(self): print '#include "main/glheader.h"' - print '#include "main/mfeatures.h"' print '#include "main/enums.h"' print '#include "main/imports.h"' print '#include "main/mtypes.h"' @@ -115,7 +114,7 @@ const char *_mesa_lookup_enum_by_nr( int nr ) /** * Primitive names */ -static const char *prim_names[PRIM_UNKNOWN + 1] = { +static const char *prim_names[PRIM_MAX+3] = { "GL_POINTS", "GL_LINES", "GL_LINE_LOOP", @@ -126,8 +125,11 @@ static const char *prim_names[PRIM_UNKNOWN + 1] = { "GL_QUADS", "GL_QUAD_STRIP", "GL_POLYGON", + "GL_LINES_ADJACENCY", + "GL_LINE_STRIP_ADJACENCY", + "GL_TRIANGLES_ADJACENCY", + "GL_TRIANGLE_STRIP_ADJACENCY", "outside begin/end", - "inside unknown primitive", "unknown state" }; diff --git a/mesalib/src/mapi/glapi/gen/gl_genexec.py b/mesalib/src/mapi/glapi/gen/gl_genexec.py index a85b4471a..e91d4e9ac 100644 --- a/mesalib/src/mapi/glapi/gen/gl_genexec.py +++ b/mesalib/src/mapi/glapi/gen/gl_genexec.py @@ -44,7 +44,6 @@ header = """/** */ -#include "main/mfeatures.h" #include "main/accum.h" #include "main/api_loopback.h" #include "main/api_exec.h" @@ -110,6 +109,7 @@ header = """/** #include "main/syncobj.h" #include "main/formatquery.h" #include "main/dispatch.h" +#include "vbo/vbo.h" /** @@ -129,6 +129,8 @@ _mesa_initialize_exec_table(struct gl_context *ctx) assert(exec != NULL); assert(ctx->Version > 0); + + vbo_initialize_exec_dispatch(ctx, exec); """ diff --git a/mesalib/src/mapi/glapi/gen/gl_table.py b/mesalib/src/mapi/glapi/gen/gl_table.py index 382eaafd9..fd384689f 100644 --- a/mesalib/src/mapi/glapi/gen/gl_table.py +++ b/mesalib/src/mapi/glapi/gen/gl_table.py @@ -97,12 +97,6 @@ class PrintRemapTable(gl_XML.gl_print_base): * can SET_FuncName, are used to get and set the dispatch pointer for the * named function in the specified dispatch table. */ - -/* GLXEXT is defined when building the GLX extension in the xserver. - */ -#if !defined(GLXEXT) -#include "main/mfeatures.h" -#endif """ return @@ -147,17 +141,6 @@ class PrintRemapTable(gl_XML.gl_print_base): for f, index in abi_functions: print '#define _gloffset_%s %d' % (f.name, f.offset) - print '' - print '#if !FEATURE_remap_table' - print '' - - for f, index in functions: - print '#define _gloffset_%s %d' % (f.name, f.offset) - - print '' - print '#else /* !FEATURE_remap_table */' - print '' - if self.es: remap_table = "esLocalRemapTable" @@ -180,8 +163,6 @@ class PrintRemapTable(gl_XML.gl_print_base): print '#define _gloffset_%s %s[%s_remap_index]' % (f.name, remap_table, f.name) print '' - print '#endif /* !FEATURE_remap_table */' - print '' for f, index in abi_functions + functions: arg_string = gl_XML.create_parameter_string( f.parameters, 0 ) @@ -209,12 +190,10 @@ class PrintRemapTable(gl_XML.gl_print_base): print '#define SET_%s(disp, fn) SET_%s(disp, fn)' % (name, f.name) print '' - print '#if FEATURE_remap_table' for f in alias_functions: for name in f.entry_points: if name != f.name: print '#define %s_remap_index %s_remap_index' % (name, f.name) - print '#endif /* FEATURE_remap_table */' print '' return diff --git a/mesalib/src/mapi/glapi/gen/gl_x86-64_asm.py b/mesalib/src/mapi/glapi/gen/gl_x86-64_asm.py index a3548c295..19e0e15b0 100644 --- a/mesalib/src/mapi/glapi/gen/gl_x86-64_asm.py +++ b/mesalib/src/mapi/glapi/gen/gl_x86-64_asm.py @@ -181,19 +181,6 @@ class PrintGenericStubs(gl_XML.gl_print_base): def printRealFooter(self): print '' - print '#if defined(GLX_USE_TLS) && defined(__linux__)' - print ' .section ".note.ABI-tag", "a"' - print ' .p2align 2' - print ' .long 1f - 0f /* name length */' - print ' .long 3f - 2f /* data length */' - print ' .long 1 /* note length */' - print '0: .asciz "GNU" /* vendor name */' - print '1: .p2align 2' - print '2: .long 0 /* note data: the ABI tag */' - print ' .long 2,4,20 /* Minimum kernel version w/TLS */' - print '3: .p2align 2 /* pad out section */' - print '#endif /* GLX_USE_TLS */' - print '' print '#if defined (__ELF__) && defined (__linux__)' print ' .section .note.GNU-stack,"",%progbits' print '#endif' diff --git a/mesalib/src/mapi/glapi/gen/gl_x86_asm.py b/mesalib/src/mapi/glapi/gen/gl_x86_asm.py index 8b0f6ee24..919bbc032 100644 --- a/mesalib/src/mapi/glapi/gen/gl_x86_asm.py +++ b/mesalib/src/mapi/glapi/gen/gl_x86_asm.py @@ -189,19 +189,6 @@ class PrintGenericStubs(gl_XML.gl_print_base): print '\t\tALIGNTEXT16' print 'GLNAME(gl_dispatch_functions_end):' print '' - print '#if defined(GLX_USE_TLS) && defined(__linux__)' - print ' .section ".note.ABI-tag", "a"' - print ' .p2align 2' - print ' .long 1f - 0f /* name length */' - print ' .long 3f - 2f /* data length */' - print ' .long 1 /* note length */' - print '0: .asciz "GNU" /* vendor name */' - print '1: .p2align 2' - print '2: .long 0 /* note data: the ABI tag */' - print ' .long 2,4,20 /* Minimum kernel version w/TLS */' - print '3: .p2align 2 /* pad out section */' - print '#endif /* GLX_USE_TLS */' - print '' print '#if defined (__ELF__) && defined (__linux__)' print ' .section .note.GNU-stack,"",%progbits' print '#endif' diff --git a/mesalib/src/mapi/glapi/gen/glapi_gen.mk b/mesalib/src/mapi/glapi/gen/glapi_gen.mk index f65286fbd..242ae5fd9 100644 --- a/mesalib/src/mapi/glapi/gen/glapi_gen.mk +++ b/mesalib/src/mapi/glapi/gen/glapi_gen.mk @@ -4,7 +4,7 @@ glapi_gen_common_deps := \ $(wildcard $(top_srcdir)/src/mapi/glapi/gen/*.xml) \ $(wildcard $(top_srcdir)/src/mapi/glapi/gen/*.py) -glapi_gen_mapi_script := $(top_srcdir)/src/mapi/mapi/mapi_abi.py +glapi_gen_mapi_script := $(top_srcdir)/src/mapi/mapi_abi.py glapi_gen_mapi_deps := \ $(glapi_gen_mapi_script) \ $(glapi_gen_common_deps) diff --git a/mesalib/src/mapi/glapi/gen/mesadef.py b/mesalib/src/mapi/glapi/gen/mesadef.py index 473baaee5..eefda7643 100644 --- a/mesalib/src/mapi/glapi/gen/mesadef.py +++ b/mesalib/src/mapi/glapi/gen/mesadef.py @@ -19,9 +19,10 @@ # 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 -# BRIAN PAUL 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. +# 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. # Generate the mesa.def file for Windows. diff --git a/mesalib/src/mapi/glapi/glapi.c b/mesalib/src/mapi/glapi/glapi.c index f7655c558..18a7d31a7 100644 --- a/mesalib/src/mapi/glapi/glapi.c +++ b/mesalib/src/mapi/glapi/glapi.c @@ -27,7 +27,7 @@ */ #include "glapi/glapi.h" -#include "mapi/u_current.h" +#include "u_current.h" /* * Global variables, _glapi_get_context, and _glapi_get_dispatch are defined in diff --git a/mesalib/src/mapi/glapi/glapi.h b/mesalib/src/mapi/glapi/glapi.h index f6854754b..bacc4c5f6 100644 --- a/mesalib/src/mapi/glapi/glapi.h +++ b/mesalib/src/mapi/glapi/glapi.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mapi/glapi/glapi_dispatch.c b/mesalib/src/mapi/glapi/glapi_dispatch.c index be65ebedd..7f8056242 100644 --- a/mesalib/src/mapi/glapi/glapi_dispatch.c +++ b/mesalib/src/mapi/glapi/glapi_dispatch.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mapi/glapi/glapi_entrypoint.c b/mesalib/src/mapi/glapi/glapi_entrypoint.c index 7a0eb3537..6b03548fe 100644 --- a/mesalib/src/mapi/glapi/glapi_entrypoint.c +++ b/mesalib/src/mapi/glapi/glapi_entrypoint.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** @@ -30,7 +31,7 @@ #include "glapi/glapi_priv.h" -#include "mapi/u_execmem.h" +#include "u_execmem.h" #ifdef USE_X86_ASM diff --git a/mesalib/src/mapi/glapi/glapi_getproc.c b/mesalib/src/mapi/glapi/glapi_getproc.c index f976d5808..3cbd68fda 100644 --- a/mesalib/src/mapi/glapi/glapi_getproc.c +++ b/mesalib/src/mapi/glapi/glapi_getproc.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** diff --git a/mesalib/src/mapi/glapi/glapi_nop.c b/mesalib/src/mapi/glapi/glapi_nop.c index 69b1ae6dd..bdd1786fe 100644 --- a/mesalib/src/mapi/glapi/glapi_nop.c +++ b/mesalib/src/mapi/glapi/glapi_nop.c @@ -18,9 +18,10 @@ * 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 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. + * 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. */ diff --git a/mesalib/src/mapi/glapi/glapi_priv.h b/mesalib/src/mapi/glapi/glapi_priv.h index 3ab553a2b..ea32f302f 100644 --- a/mesalib/src/mapi/glapi/glapi_priv.h +++ b/mesalib/src/mapi/glapi/glapi_priv.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mapi/glapi/glthread.h b/mesalib/src/mapi/glapi/glthread.h index 1c3f4e2bf..2399abb2b 100644 --- a/mesalib/src/mapi/glapi/glthread.h +++ b/mesalib/src/mapi/glapi/glthread.h @@ -1,7 +1,7 @@ #ifndef GLTHREAD_H #define GLTHREAD_H -#include "mapi/u_thread.h" +#include "u_thread.h" #ifdef __cplusplus extern "C" { diff --git a/mesalib/src/mapi/mapi/mapi.c b/mesalib/src/mapi/mapi.c index b471c40b1..b471c40b1 100644 --- a/mesalib/src/mapi/mapi/mapi.c +++ b/mesalib/src/mapi/mapi.c diff --git a/mesalib/src/mapi/mapi/mapi.h b/mesalib/src/mapi/mapi.h index c7e43e22e..c7e43e22e 100644 --- a/mesalib/src/mapi/mapi/mapi.h +++ b/mesalib/src/mapi/mapi.h diff --git a/mesalib/src/mapi/mapi/mapi_abi.py b/mesalib/src/mapi/mapi_abi.py index c645c02f9..6bfcfa9af 100644 --- a/mesalib/src/mapi/mapi/mapi_abi.py +++ b/mesalib/src/mapi/mapi_abi.py @@ -29,7 +29,7 @@ import sys # make it possible to import glapi import os -GLAPI = os.path.join(".", os.path.dirname(sys.argv[0]), "../glapi/gen") +GLAPI = os.path.join(".", os.path.dirname(sys.argv[0]), "glapi/gen") sys.path.append(GLAPI) import re diff --git a/mesalib/src/mapi/mapi/mapi_glapi.c b/mesalib/src/mapi/mapi_glapi.c index 4627c4de0..a6838ce61 100644 --- a/mesalib/src/mapi/mapi/mapi_glapi.c +++ b/mesalib/src/mapi/mapi_glapi.c @@ -29,9 +29,9 @@ #include <string.h> #include "glapi/glapi.h" -#include "mapi/u_current.h" -#include "mapi/table.h" /* for MAPI_TABLE_NUM_SLOTS */ -#include "mapi/stub.h" +#include "u_current.h" +#include "table.h" /* for MAPI_TABLE_NUM_SLOTS */ +#include "stub.h" /* * Global variables, _glapi_get_context, and _glapi_get_dispatch are defined in diff --git a/mesalib/src/mapi/mapi/mapi_tmp.h b/mesalib/src/mapi/mapi_tmp.h index f326b4a4e..f326b4a4e 100644 --- a/mesalib/src/mapi/mapi/mapi_tmp.h +++ b/mesalib/src/mapi/mapi_tmp.h diff --git a/mesalib/src/mapi/mapi/stub.c b/mesalib/src/mapi/stub.c index 688dc8143..688dc8143 100644 --- a/mesalib/src/mapi/mapi/stub.c +++ b/mesalib/src/mapi/stub.c diff --git a/mesalib/src/mapi/mapi/stub.h b/mesalib/src/mapi/stub.h index 98e2553ec..98e2553ec 100644 --- a/mesalib/src/mapi/mapi/stub.h +++ b/mesalib/src/mapi/stub.h diff --git a/mesalib/src/mapi/mapi/table.c b/mesalib/src/mapi/table.c index 9bb9f654a..9bb9f654a 100644 --- a/mesalib/src/mapi/mapi/table.c +++ b/mesalib/src/mapi/table.c diff --git a/mesalib/src/mapi/mapi/table.h b/mesalib/src/mapi/table.h index d84523f77..d84523f77 100644 --- a/mesalib/src/mapi/mapi/table.h +++ b/mesalib/src/mapi/table.h diff --git a/mesalib/src/mapi/mapi/u_compiler.h b/mesalib/src/mapi/u_compiler.h index f376e97a0..f376e97a0 100644 --- a/mesalib/src/mapi/mapi/u_compiler.h +++ b/mesalib/src/mapi/u_compiler.h diff --git a/mesalib/src/mapi/mapi/u_current.c b/mesalib/src/mapi/u_current.c index d902375f8..344344939 100644 --- a/mesalib/src/mapi/mapi/u_current.c +++ b/mesalib/src/mapi/u_current.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mapi/mapi/u_current.h b/mesalib/src/mapi/u_current.h index f9cffd8c3..f9cffd8c3 100644 --- a/mesalib/src/mapi/mapi/u_current.h +++ b/mesalib/src/mapi/u_current.h diff --git a/mesalib/src/mapi/mapi/u_execmem.c b/mesalib/src/mapi/u_execmem.c index e5072e06e..b6751edb5 100644 --- a/mesalib/src/mapi/mapi/u_execmem.c +++ b/mesalib/src/mapi/u_execmem.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -46,7 +47,7 @@ static unsigned int head = 0; static unsigned char *exec_mem = (unsigned char *)0; -#if defined(__linux__) || defined(__OpenBSD__) || defined(_NetBSD__) || defined(__sun) +#if defined(__linux__) || defined(__OpenBSD__) || defined(_NetBSD__) || defined(__sun) || defined(__HAIKU__) #include <unistd.h> #include <sys/mman.h> diff --git a/mesalib/src/mapi/mapi/u_execmem.h b/mesalib/src/mapi/u_execmem.h index 13fff8df2..13fff8df2 100644 --- a/mesalib/src/mapi/mapi/u_execmem.h +++ b/mesalib/src/mapi/u_execmem.h diff --git a/mesalib/src/mapi/mapi/u_macros.h b/mesalib/src/mapi/u_macros.h index 72345b5f1..72345b5f1 100644 --- a/mesalib/src/mapi/mapi/u_macros.h +++ b/mesalib/src/mapi/u_macros.h diff --git a/mesalib/src/mapi/mapi/u_thread.h b/mesalib/src/mapi/u_thread.h index a5e504370..2f8154373 100644 --- a/mesalib/src/mapi/mapi/u_thread.h +++ b/mesalib/src/mapi/u_thread.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/Android.gen.mk b/mesalib/src/mesa/Android.gen.mk index 35f00da09..c6280f5cb 100644 --- a/mesalib/src/mesa/Android.gen.mk +++ b/mesalib/src/mesa/Android.gen.mk @@ -111,8 +111,7 @@ $(intermediates)/main/api_exec.c: $(dispatch_deps) $(call es-gen) GET_HASH_GEN := $(LOCAL_PATH)/main/get_hash_generator.py -GET_HASH_GEN_FLAGS := $(patsubst %,-a %,$(MESA_ENABLED_APIS)) $(intermediates)/main/get_hash.h: $(glapi)/gl_and_es_API.xml \ $(LOCAL_PATH)/main/get_hash_params.py $(GET_HASH_GEN) - @$(MESA_PYTHON2) $(GET_HASH_GEN) $(GET_HASH_GEN_FLAGS) -f $< > $@ + @$(MESA_PYTHON2) $(GET_HASH_GEN) -f $< > $@ diff --git a/mesalib/src/mesa/Android.libmesa_dricore.mk b/mesalib/src/mesa/Android.libmesa_dricore.mk index 093d7a189..00c06943c 100644 --- a/mesalib/src/mesa/Android.libmesa_dricore.mk +++ b/mesalib/src/mesa/Android.libmesa_dricore.mk @@ -31,7 +31,7 @@ LOCAL_PATH := $(call my-dir) # Import the following variables: # MESA_FILES # X86_FILES -include $(LOCAL_PATH)/sources.mak +include $(LOCAL_PATH)/Makefile.sources include $(CLEAR_VARS) diff --git a/mesalib/src/mesa/Android.libmesa_st_mesa.mk b/mesalib/src/mesa/Android.libmesa_st_mesa.mk index 79914caf1..e7203c41d 100644 --- a/mesalib/src/mesa/Android.libmesa_st_mesa.mk +++ b/mesalib/src/mesa/Android.libmesa_st_mesa.mk @@ -31,7 +31,7 @@ LOCAL_PATH := $(call my-dir) # Import variables: # MESA_GALLIUM_FILES. # X86_FILES -include $(LOCAL_PATH)/sources.mak +include $(LOCAL_PATH)/Makefile.sources include $(CLEAR_VARS) diff --git a/mesalib/src/mesa/Makefile.am b/mesalib/src/mesa/Makefile.am index c341c48e7..d5f5f5b86 100644 --- a/mesalib/src/mesa/Makefile.am +++ b/mesalib/src/mesa/Makefile.am @@ -23,7 +23,19 @@ if NEED_LIBDRICORE DRICORE_SUBDIR = libdricore endif -SUBDIRS = program x86 x86-64 . $(DRICORE_SUBDIR) drivers +SUBDIRS = program x86 x86-64 . $(DRICORE_SUBDIR) + +if HAVE_X11_DRIVER +SUBDIRS += drivers/x11 +endif + +if HAVE_DRI +SUBDIRS += drivers/dri +endif + +if HAVE_OSMESA +SUBDIRS += drivers/osmesa +endif gldir = $(includedir)/GL gl_HEADERS = $(top_srcdir)/include/GL/*.h @@ -59,14 +71,12 @@ CLEANFILES = \ git_sha1.h.tmp GET_HASH_GEN = main/get_hash_generator.py -GET_HASH_GEN_FLAGS := $(patsubst -DFEATURE_%=1,-a %, \ - $(patsubst -DFEATURE_%=0,,$(API_DEFINES))) main/get_hash.h: $(GLAPI)/gl_and_es_API.xml main/get_hash_params.py \ $(GET_HASH_GEN) Makefile $(AM_V_GEN)set -e; \ - $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/$(GET_HASH_GEN) \ - $(GET_HASH_GEN_FLAGS) -f $< > $@.tmp; \ + $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/$(GET_HASH_GEN) \ + -f $< > $@.tmp; \ mv $@.tmp $@; noinst_LTLIBRARIES = @@ -81,9 +91,9 @@ endif SRCDIR = $(top_srcdir)/src/mesa/ BUILDDIR = $(top_builddir)/src/mesa/ -include sources.mak +include Makefile.sources -AM_CPPFLAGS = $(API_DEFINES) $(DEFINES) $(INCLUDE_DIRS) +AM_CPPFLAGS = $(DEFINES) $(INCLUDE_DIRS) AM_CFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CFLAGS) AM_CXXFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CXXFLAGS) diff --git a/mesalib/src/mesa/sources.mak b/mesalib/src/mesa/Makefile.sources index 3c881082c..a5c1f5dea 100644 --- a/mesalib/src/mesa/sources.mak +++ b/mesalib/src/mesa/Makefile.sources @@ -224,6 +224,7 @@ STATETRACKER_FILES = \ $(SRCDIR)state_tracker/st_cb_eglimage.c \ $(SRCDIR)state_tracker/st_cb_fbo.c \ $(SRCDIR)state_tracker/st_cb_feedback.c \ + $(SRCDIR)state_tracker/st_cb_msaa.c \ $(SRCDIR)state_tracker/st_cb_program.c \ $(SRCDIR)state_tracker/st_cb_queryobj.c \ $(SRCDIR)state_tracker/st_cb_rasterpos.c \ diff --git a/mesalib/src/mesa/SConscript b/mesalib/src/mesa/SConscript index ca9b70bad..0f1543802 100644 --- a/mesalib/src/mesa/SConscript +++ b/mesalib/src/mesa/SConscript @@ -31,7 +31,6 @@ if env['platform'] == 'windows': env.Append(CPPDEFINES = ['_GLAPI_NO_EXPORTS']) else: env.Append(CPPDEFINES = [ - 'IN_DRI_DRIVER', # enable the remap table (for DRI drivers) ('HAVE_DLOPEN', '1'), ]) @@ -263,6 +262,7 @@ statetracker_sources = [ 'state_tracker/st_cb_eglimage.c', 'state_tracker/st_cb_fbo.c', 'state_tracker/st_cb_feedback.c', + 'state_tracker/st_cb_msaa.c', 'state_tracker/st_cb_program.c', 'state_tracker/st_cb_queryobj.c', 'state_tracker/st_cb_rasterpos.c', @@ -340,22 +340,18 @@ if env['gles']: enabled_apis += ['ES1', 'ES2'] -env.Append(CPPDEFINES = ["FEATURE_%s=1" % api for api in enabled_apis]) - -get_hash_gen_opts = ' '.join(["-a %s" % api for api in enabled_apis]) - get_hash_header = env.CodeGenerate( target = 'main/get_hash.h', script = 'main/get_hash_generator.py', source = GLAPI + 'gen/gl_and_es_API.xml', - command = python_cmd + ' $SCRIPT ' + get_hash_gen_opts + - ' -f $SOURCE > $TARGET' + command = python_cmd + ' $SCRIPT ' + ' -f $SOURCE > $TARGET' ) # # Assembly sources # -if env['gcc'] and env['platform'] not in ('cygwin', 'darwin', 'windows', 'haiku'): +if (env['gcc'] or env['clang']) and \ + env['platform'] not in ('cygwin', 'darwin', 'windows', 'haiku'): if env['machine'] == 'x86': env.Append(CPPDEFINES = [ 'USE_X86_ASM', diff --git a/mesalib/src/mesa/drivers/Makefile.am b/mesalib/src/mesa/drivers/Makefile.am deleted file mode 100644 index 1bc74eadf..000000000 --- a/mesalib/src/mesa/drivers/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright © 2012 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. - -SUBDIRS = $(DRIVER_DIRS) diff --git a/mesalib/src/mesa/drivers/common/driverfuncs.c b/mesalib/src/mesa/drivers/common/driverfuncs.c index a98dfc607..4f7696c4c 100644 --- a/mesalib/src/mesa/drivers/common/driverfuncs.c +++ b/mesalib/src/mesa/drivers/common/driverfuncs.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -40,6 +41,7 @@ #include "main/texgetimage.h" #include "main/teximage.h" #include "main/texobj.h" +#include "main/texstorage.h" #include "main/texstore.h" #include "main/bufferobj.h" #include "main/fbobject.h" @@ -209,7 +211,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->EndCallList = NULL; /* GL_ARB_texture_storage */ - driver->AllocTextureStorage = _swrast_AllocTextureStorage; + driver->AllocTextureStorage = _mesa_alloc_texture_storage; /* GL_ARB_texture_multisample */ driver->GetSamplePosition = NULL; diff --git a/mesalib/src/mesa/drivers/common/driverfuncs.h b/mesalib/src/mesa/drivers/common/driverfuncs.h index 212f30742..806c8b0af 100644 --- a/mesalib/src/mesa/drivers/common/driverfuncs.h +++ b/mesalib/src/mesa/drivers/common/driverfuncs.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c index e3ab82bfe..1250bd35c 100644 --- a/mesalib/src/mesa/drivers/common/meta.c +++ b/mesalib/src/mesa/drivers/common/meta.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** @@ -3048,16 +3049,33 @@ _mesa_meta_check_generate_mipmap_fallback(struct gl_context *ctx, GLenum target, GLenum status; /* check for fallbacks */ - if (!ctx->Extensions.EXT_framebuffer_object || - target == GL_TEXTURE_3D || + if (!ctx->Extensions.EXT_framebuffer_object) { + _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH, + "glGenerateMipmap() without FBOs\n"); + return GL_TRUE; + } + + if (target == GL_TEXTURE_3D || target == GL_TEXTURE_1D_ARRAY || target == GL_TEXTURE_2D_ARRAY) { + _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH, + "glGenerateMipmap() to %s target\n", + _mesa_lookup_enum_by_nr(target)); return GL_TRUE; } srcLevel = texObj->BaseLevel; baseImage = _mesa_select_tex_image(ctx, texObj, target, srcLevel); - if (!baseImage || _mesa_is_format_compressed(baseImage->TexFormat)) { + if (!baseImage) { + _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH, + "glGenerateMipmap() couldn't find base teximage\n"); + return GL_TRUE; + } + + if (_mesa_is_format_compressed(baseImage->TexFormat)) { + _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH, + "glGenerateMipmap() with %s format\n", + _mesa_get_format_name(baseImage->TexFormat)); return GL_TRUE; } @@ -3067,6 +3085,9 @@ _mesa_meta_check_generate_mipmap_fallback(struct gl_context *ctx, GLenum target, * texture sample conversion. So we won't be able to generate the * right colors when rendering. Need to use a fallback. */ + _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH, + "glGenerateMipmap() of sRGB texture without " + "sRGB decode\n"); return GL_TRUE; } @@ -3103,6 +3124,8 @@ _mesa_meta_check_generate_mipmap_fallback(struct gl_context *ctx, GLenum target, _mesa_BindFramebuffer(GL_FRAMEBUFFER_EXT, fboSave); if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { + _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH, + "glGenerateMipmap() got incomplete FBO\n"); return GL_TRUE; } @@ -3374,6 +3397,8 @@ setup_glsl_generate_mipmap(struct gl_context *ctx, sizeof(struct vertex), OFFSET(x)); _mesa_VertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(struct vertex), OFFSET(tex)); + _mesa_EnableVertexAttribArray(0); + _mesa_EnableVertexAttribArray(1); } /* Generate a fragment shader program appropriate for the texture target */ @@ -3445,8 +3470,6 @@ setup_glsl_generate_mipmap(struct gl_context *ctx, _mesa_DeleteObjectARB(vs); _mesa_BindAttribLocation(mipmap->ShaderProg, 0, "position"); _mesa_BindAttribLocation(mipmap->ShaderProg, 1, "texcoords"); - _mesa_EnableVertexAttribArray(0); - _mesa_EnableVertexAttribArray(1); link_program_with_debug(ctx, mipmap->ShaderProg); sampler->shader_prog = mipmap->ShaderProg; ralloc_free(mem_ctx); @@ -3741,10 +3764,20 @@ get_temp_image_type(struct gl_context *ctx, gl_format format) return datatype; return GL_FLOAT; } - case GL_DEPTH_COMPONENT: - return GL_UNSIGNED_INT; - case GL_DEPTH_STENCIL: - return GL_UNSIGNED_INT_24_8; + case GL_DEPTH_COMPONENT: { + GLenum datatype = _mesa_get_format_datatype(format); + if (datatype == GL_FLOAT) + return GL_FLOAT; + else + return GL_UNSIGNED_INT; + } + case GL_DEPTH_STENCIL: { + GLenum datatype = _mesa_get_format_datatype(format); + if (datatype == GL_FLOAT) + return GL_FLOAT_32_UNSIGNED_INT_24_8_REV; + else + return GL_UNSIGNED_INT_24_8; + } default: _mesa_problem(ctx, "Unexpected format %d in get_temp_image_type()", baseFormat); diff --git a/mesalib/src/mesa/drivers/common/meta.h b/mesalib/src/mesa/drivers/common/meta.h index a6bdd3947..823be14c7 100644 --- a/mesalib/src/mesa/drivers/common/meta.h +++ b/mesalib/src/mesa/drivers/common/meta.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/drivers/dri/common/Makefile.am b/mesalib/src/mesa/drivers/dri/common/Makefile.am index dfc8f3b7a..ce4119d0f 100644 --- a/mesalib/src/mesa/drivers/dri/common/Makefile.am +++ b/mesalib/src/mesa/drivers/dri/common/Makefile.am @@ -27,7 +27,6 @@ AM_CFLAGS = \ -I$(top_srcdir)/src/mapi \ -I$(top_srcdir)/src/mesa/ \ $(DEFINES) \ - $(API_DEFINES) \ $(LIBDRM_CFLAGS) \ $(VISIBILITY_CFLAGS) diff --git a/mesalib/src/mesa/drivers/dri/common/drisw_util.c b/mesalib/src/mesa/drivers/dri/common/drisw_util.c index 6af101c31..89f03c310 100644 --- a/mesalib/src/mesa/drivers/dri/common/drisw_util.c +++ b/mesalib/src/mesa/drivers/dri/common/drisw_util.c @@ -16,9 +16,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool.h b/mesalib/src/mesa/drivers/dri/common/xmlpool.h index ffea43002..ebd4e7c86 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool.h +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool.h @@ -60,6 +60,13 @@ #define DRI_CONF_OPT_BEGIN(name,type,def) \ "<option name=\""#name"\" type=\""#type"\" default=\""#def"\">\n" +/** + * \brief Begin a boolean option definition, with the default value passed in + * as a string + */ +#define DRI_CONF_OPT_BEGIN_B(name,def) \ +"<option name=\""#name"\" type=\"bool\" default="#def">\n" + /** \brief Begin an option definition with quoted default value */ #define DRI_CONF_OPT_BEGIN_Q(name,type,def) \ "<option name=\""#name"\" type=\""#type"\" default="#def">\n" diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h b/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h index 7b441c68f..ca4772003 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h @@ -56,42 +56,42 @@ DRI_CONF_SECTION_BEGIN \ DRI_CONF_DESC(en,gettext("Debugging")) #define DRI_CONF_NO_RAST(def) \ -DRI_CONF_OPT_BEGIN(no_rast,bool,def) \ +DRI_CONF_OPT_BEGIN_B(no_rast, def) \ DRI_CONF_DESC(en,gettext("Disable 3D acceleration")) \ DRI_CONF_OPT_END #define DRI_CONF_PERFORMANCE_BOXES(def) \ -DRI_CONF_OPT_BEGIN(performance_boxes,bool,def) \ +DRI_CONF_OPT_BEGIN_B(performance_boxes, def) \ DRI_CONF_DESC(en,gettext("Show performance boxes")) \ DRI_CONF_OPT_END #define DRI_CONF_ALWAYS_FLUSH_BATCH(def) \ -DRI_CONF_OPT_BEGIN(always_flush_batch,bool,def) \ +DRI_CONF_OPT_BEGIN_B(always_flush_batch, def) \ DRI_CONF_DESC(en,gettext("Enable flushing batchbuffer after each draw call")) \ DRI_CONF_OPT_END #define DRI_CONF_ALWAYS_FLUSH_CACHE(def) \ -DRI_CONF_OPT_BEGIN(always_flush_cache,bool,def) \ +DRI_CONF_OPT_BEGIN_B(always_flush_cache, def) \ DRI_CONF_DESC(en,gettext("Enable flushing GPU caches with each draw call")) \ DRI_CONF_OPT_END #define DRI_CONF_DISABLE_THROTTLING(def) \ -DRI_CONF_OPT_BEGIN(disable_throttling,bool,def) \ +DRI_CONF_OPT_BEGIN_B(disable_throttling, def) \ DRI_CONF_DESC(en,gettext("Disable throttling on first batch after flush")) \ DRI_CONF_OPT_END #define DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN(def) \ -DRI_CONF_OPT_BEGIN(force_glsl_extensions_warn,bool,def) \ +DRI_CONF_OPT_BEGIN_B(force_glsl_extensions_warn, def) \ DRI_CONF_DESC(en,gettext("Force GLSL extension default behavior to 'warn'")) \ DRI_CONF_OPT_END #define DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED(def) \ -DRI_CONF_OPT_BEGIN(disable_blend_func_extended,bool,def) \ +DRI_CONF_OPT_BEGIN_B(disable_blend_func_extended, def) \ DRI_CONF_DESC(en,gettext("Disable dual source blending")) \ DRI_CONF_OPT_END #define DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS(def) \ -DRI_CONF_OPT_BEGIN(disable_glsl_line_continuations,bool,def) \ +DRI_CONF_OPT_BEGIN_B(disable_glsl_line_continuations, def) \ DRI_CONF_DESC(en,gettext("Disable backslash-based line continuations in GLSL source")) \ DRI_CONF_OPT_END @@ -105,7 +105,7 @@ DRI_CONF_SECTION_BEGIN \ DRI_CONF_DESC(en,gettext("Image Quality")) #define DRI_CONF_EXCESS_MIPMAP(def) \ -DRI_CONF_OPT_BEGIN(excess_mipmap,bool,def) \ +DRI_CONF_OPT_BEGIN_B(excess_mipmap, def) \ DRI_CONF_DESC(en,"Enable extra mipmap level") \ DRI_CONF_OPT_END @@ -129,12 +129,12 @@ DRI_CONF_OPT_BEGIN_V(def_max_anisotropy,float,def,range) \ DRI_CONF_OPT_END #define DRI_CONF_NO_NEG_LOD_BIAS(def) \ -DRI_CONF_OPT_BEGIN(no_neg_lod_bias,bool,def) \ +DRI_CONF_OPT_BEGIN_B(no_neg_lod_bias, def) \ DRI_CONF_DESC(en,gettext("Forbid negative texture LOD bias")) \ DRI_CONF_OPT_END #define DRI_CONF_FORCE_S3TC_ENABLE(def) \ -DRI_CONF_OPT_BEGIN(force_s3tc_enable,bool,def) \ +DRI_CONF_OPT_BEGIN_B(force_s3tc_enable, def) \ DRI_CONF_DESC(en,gettext("Enable S3TC texture compression even if software support is not available")) \ DRI_CONF_OPT_END @@ -171,7 +171,7 @@ DRI_CONF_OPT_BEGIN_V(dither_mode,enum,def,"0:2") \ DRI_CONF_OPT_END #define DRI_CONF_FLOAT_DEPTH(def) \ -DRI_CONF_OPT_BEGIN(float_depth,bool,def) \ +DRI_CONF_OPT_BEGIN_B(float_depth, def) \ DRI_CONF_DESC(en,gettext("Floating point depth buffer")) \ DRI_CONF_OPT_END @@ -257,7 +257,7 @@ DRI_CONF_OPT_END #define DRI_CONF_HYPERZ_DISABLED 0 #define DRI_CONF_HYPERZ_ENABLED 1 #define DRI_CONF_HYPERZ(def) \ -DRI_CONF_OPT_BEGIN(hyperz,bool,def) \ +DRI_CONF_OPT_BEGIN_B(hyperz, def) \ DRI_CONF_DESC(en,gettext("Use HyperZ to boost performance")) \ DRI_CONF_OPT_END @@ -303,7 +303,7 @@ DRI_CONF_SECTION_BEGIN \ DRI_CONF_DESC(en,gettext("Features that are not hardware-accelerated")) #define DRI_CONF_ARB_VERTEX_PROGRAM(def) \ -DRI_CONF_OPT_BEGIN(arb_vertex_program,bool,def) \ +DRI_CONF_OPT_BEGIN_B(arb_vertex_program, def) \ DRI_CONF_DESC(en,gettext("Enable extension GL_ARB_vertex_program")) \ DRI_CONF_OPT_END @@ -317,6 +317,6 @@ DRI_CONF_SECTION_BEGIN \ DRI_CONF_DESC(en,gettext("Miscellaneous")) #define DRI_CONF_ALWAYS_HAVE_DEPTH_BUFFER(def) \ -DRI_CONF_OPT_BEGIN(always_have_depth_buffer, bool, def) \ +DRI_CONF_OPT_BEGIN_B(always_have_depth_buffer, def) \ DRI_CONF_DESC(en,gettext("Create all visuals with a depth buffer")) \ DRI_CONF_OPT_END diff --git a/mesalib/src/mesa/drivers/dri/swrast/Makefile.am b/mesalib/src/mesa/drivers/dri/swrast/Makefile.am index 3e539073c..d3da19651 100644 --- a/mesalib/src/mesa/drivers/dri/swrast/Makefile.am +++ b/mesalib/src/mesa/drivers/dri/swrast/Makefile.am @@ -31,7 +31,6 @@ AM_CFLAGS = \ -I$(top_srcdir)/src/mesa/ \ -I$(top_srcdir)/src/mesa/drivers/dri/common \ $(DEFINES) \ - $(API_DEFINES) \ $(VISIBILITY_CFLAGS) dridir = $(DRI_DRIVER_INSTALL_DIR) diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c index b380de307..91bcc5944 100644 --- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c +++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c @@ -14,9 +14,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h b/mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h index b25de931a..b51993c94 100644 --- a/mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h +++ b/mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/accum.c b/mesalib/src/mesa/main/accum.c index f5888017f..b4677397b 100644 --- a/mesalib/src/mesa/main/accum.c +++ b/mesalib/src/mesa/main/accum.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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 "glheader.h" @@ -30,7 +31,6 @@ #include "format_pack.h" #include "imports.h" #include "macros.h" -#include "mfeatures.h" #include "state.h" #include "mtypes.h" #include "main/dispatch.h" diff --git a/mesalib/src/mesa/main/accum.h b/mesalib/src/mesa/main/accum.h index 00c24b2db..7e4d9f6b9 100644 --- a/mesalib/src/mesa/main/accum.h +++ b/mesalib/src/mesa/main/accum.h @@ -27,9 +27,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -38,7 +39,6 @@ #define ACCUM_H #include "main/glheader.h" -#include "main/mfeatures.h" struct _glapi_table; struct gl_context; diff --git a/mesalib/src/mesa/main/api_arrayelt.c b/mesalib/src/mesa/main/api_arrayelt.c index ea3361488..8e581c8d9 100644 --- a/mesalib/src/mesa/main/api_arrayelt.c +++ b/mesalib/src/mesa/main/api_arrayelt.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** @@ -40,7 +41,6 @@ #include "context.h" #include "imports.h" #include "macros.h" -#include "mfeatures.h" #include "mtypes.h" #include "main/dispatch.h" @@ -64,13 +64,19 @@ typedef struct { AEattrib attribs[VERT_ATTRIB_MAX + 1]; GLuint NewState; + /* List of VBOs we need to map before executing ArrayElements */ struct gl_buffer_object *vbo[VERT_ATTRIB_MAX]; GLuint nr_vbos; - GLboolean mapped_vbos; - + GLboolean mapped_vbos; /**< Any currently mapped VBOs? */ } AEcontext; -#define AE_CONTEXT(ctx) ((AEcontext *)(ctx)->aelt_context) + +/** Cast wrapper */ +static INLINE AEcontext * +AE_CONTEXT(struct gl_context *ctx) +{ + return (AEcontext *) ctx->aelt_context; +} /* @@ -78,7 +84,12 @@ typedef struct { * in the range [0, 7]. Luckily these type tokens are sequentially * numbered in gl.h, except for GL_DOUBLE. */ -#define TYPE_IDX(t) ( (t) == GL_DOUBLE ? 7 : (t) & 7 ) +static INLINE int +TYPE_IDX(GLenum t) +{ + return t == GL_DOUBLE ? 7 : t & 7; +} + #define NUM_TYPES 8 @@ -1245,8 +1256,6 @@ VertexAttribI4uiv(GLuint index, const GLuint *v) } - - /* * Array [unnormalized/normalized/integer][size][type] of VertexAttrib * functions @@ -1396,10 +1405,9 @@ static attrib_func AttribFuncsARB[3][4][NUM_TYPES] = { } }; -/**********************************************************************/ - -GLboolean _ae_create_context( struct gl_context *ctx ) +GLboolean +_ae_create_context(struct gl_context *ctx) { if (ctx->aelt_context) return GL_TRUE; @@ -1432,22 +1440,29 @@ GLboolean _ae_create_context( struct gl_context *ctx ) } -void _ae_destroy_context( struct gl_context *ctx ) +void +_ae_destroy_context(struct gl_context *ctx) { - if ( AE_CONTEXT( ctx ) ) { + if (AE_CONTEXT(ctx)) { free(ctx->aelt_context); ctx->aelt_context = NULL; } } -static void check_vbo( AEcontext *actx, - struct gl_buffer_object *vbo ) + +/** + * Check if the given vertex buffer object exists and is not mapped. + * If so, add it to the list of buffers we must map before executing + * an glArrayElement call. + */ +static void +check_vbo(AEcontext *actx, struct gl_buffer_object *vbo) { if (_mesa_is_bufferobj(vbo) && !_mesa_bufferobj_mapped(vbo)) { GLuint i; for (i = 0; i < actx->nr_vbos; i++) - if (actx->vbo[i] == vbo) - return; + if (actx->vbo[i] == vbo) + return; /* already in the list, we're done */ assert(actx->nr_vbos < VERT_ATTRIB_MAX); actx->vbo[actx->nr_vbos++] = vbo; } @@ -1460,11 +1475,12 @@ static void check_vbo( AEcontext *actx, * etc). * Note: this may be called during display list construction. */ -static void _ae_update_state( struct gl_context *ctx ) +static void +_ae_update_state(struct gl_context *ctx) { AEcontext *actx = AE_CONTEXT(ctx); - AEarray *aa = actx->arrays; - AEattrib *at = actx->attribs; + AEarray *aa = actx->arrays; /* non-indexed arrays (ex: glNormal) */ + AEattrib *at = actx->attribs; /* indexed arrays (ex: glMultiTexCoord) */ GLuint i; struct gl_array_object *arrayObj = ctx->Array.ArrayObj; @@ -1508,7 +1524,8 @@ static void _ae_update_state( struct gl_context *ctx ) aa++; } for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { - struct gl_client_array *attribArray = &arrayObj->VertexAttrib[VERT_ATTRIB_TEX(i)]; + struct gl_client_array *attribArray = + &arrayObj->VertexAttrib[VERT_ATTRIB_TEX(i)]; if (attribArray->Enabled) { /* NOTE: we use generic glVertexAttribNV functions here. * If we ever remove GL_NV_vertex_program this will have to change. @@ -1524,9 +1541,10 @@ static void _ae_update_state( struct gl_context *ctx ) } } - /* generic vertex attribute arrays */ + /* generic vertex attribute arrays */ for (i = 1; i < VERT_ATTRIB_GENERIC_MAX; i++) { /* skip zero! */ - struct gl_client_array *attribArray = &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(i)]; + struct gl_client_array *attribArray = + &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(i)]; if (attribArray->Enabled) { GLint intOrNorm; at->array = attribArray; @@ -1580,11 +1598,17 @@ static void _ae_update_state( struct gl_context *ctx ) actx->NewState = 0; } -void _ae_map_vbos( struct gl_context *ctx ) + +/** + * Before replaying glArrayElements calls we need to map (for reading) any + * VBOs referenced by the enabled vertex arrays. + */ +void +_ae_map_vbos(struct gl_context *ctx) { AEcontext *actx = AE_CONTEXT(ctx); GLuint i; - + if (actx->mapped_vbos) return; @@ -1601,7 +1625,12 @@ void _ae_map_vbos( struct gl_context *ctx ) actx->mapped_vbos = GL_TRUE; } -void _ae_unmap_vbos( struct gl_context *ctx ) + +/** + * Unmap VBOs + */ +void +_ae_unmap_vbos(struct gl_context *ctx) { AEcontext *actx = AE_CONTEXT(ctx); GLuint i; @@ -1624,7 +1653,8 @@ void _ae_unmap_vbos( struct gl_context *ctx ) * for all enabled vertex arrays (for elt-th element). * Note: this may be called during display list construction. */ -void GLAPIENTRY _ae_ArrayElement( GLint elt ) +void GLAPIENTRY +_ae_ArrayElement(GLint elt) { GET_CURRENT_CONTEXT(ctx); const AEcontext *actx = AE_CONTEXT(ctx); @@ -1636,14 +1666,14 @@ void GLAPIENTRY _ae_ArrayElement( GLint elt ) /* If PrimitiveRestart is enabled and the index is the RestartIndex * then we call PrimitiveRestartNV and return. */ - if (ctx->Array._PrimitiveRestart && (elt == ctx->Array._RestartIndex)) { + if (ctx->Array.PrimitiveRestart && (elt == ctx->Array.RestartIndex)) { CALL_PrimitiveRestartNV((struct _glapi_table *)disp, ()); return; } if (actx->NewState) { assert(!actx->mapped_vbos); - _ae_update_state( ctx ); + _ae_update_state(ctx); } /* Determine if we need to map/unmap VBOs */ @@ -1651,13 +1681,13 @@ void GLAPIENTRY _ae_ArrayElement( GLint elt ) if (do_map) _ae_map_vbos(ctx); - + /* emit generic attribute elements */ for (at = actx->attribs; at->func; at++) { const GLubyte *src = ADD_POINTERS(at->array->BufferObj->Pointer, at->array->Ptr) + elt * at->array->StrideB; - at->func( at->index, src ); + at->func(at->index, src); } /* emit conventional arrays elements */ @@ -1665,8 +1695,7 @@ void GLAPIENTRY _ae_ArrayElement( GLint elt ) const GLubyte *src = ADD_POINTERS(aa->array->BufferObj->Pointer, aa->array->Ptr) + elt * aa->array->StrideB; - CALL_by_offset( disp, (array_func), aa->offset, - ((const void *) src) ); + CALL_by_offset(disp, (array_func), aa->offset, ((const void *) src)); } if (do_map) @@ -1674,16 +1703,16 @@ void GLAPIENTRY _ae_ArrayElement( GLint elt ) } -void _ae_invalidate_state( struct gl_context *ctx, GLuint new_state ) +void +_ae_invalidate_state(struct gl_context *ctx, GLuint new_state) { AEcontext *actx = AE_CONTEXT(ctx); - /* Only interested in this subset of mesa state. Need to prune * this down as both tnl/ and the drivers can raise statechanges * for arcane reasons in the middle of seemingly atomic operations * like DrawElements, over which we'd like to keep a known set of - * arrays and vbo's mapped. + * arrays and vbo's mapped. * * Luckily, neither the drivers nor tnl muck with the state that * concerns us here: @@ -1696,8 +1725,9 @@ void _ae_invalidate_state( struct gl_context *ctx, GLuint new_state ) } -void _mesa_install_arrayelt_vtxfmt(struct _glapi_table *disp, - const GLvertexformat *vfmt) +void +_mesa_install_arrayelt_vtxfmt(struct _glapi_table *disp, + const GLvertexformat *vfmt) { SET_ArrayElement(disp, vfmt->ArrayElement); } diff --git a/mesalib/src/mesa/main/api_arrayelt.h b/mesalib/src/mesa/main/api_arrayelt.h index 988703259..e250cb4c8 100644 --- a/mesalib/src/mesa/main/api_arrayelt.h +++ b/mesalib/src/mesa/main/api_arrayelt.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -28,13 +29,8 @@ #define API_ARRAYELT_H -#include "main/mfeatures.h" #include "main/mtypes.h" -#define _MESA_INIT_ARRAYELT_VTXFMT(vfmt, impl) \ - do { \ - (vfmt)->ArrayElement = impl ## ArrayElement; \ - } while (0) extern GLboolean _ae_create_context( struct gl_context *ctx ); extern void _ae_destroy_context( struct gl_context *ctx ); diff --git a/mesalib/src/mesa/main/api_exec.h b/mesalib/src/mesa/main/api_exec.h index 94f7f41c1..bcf461163 100644 --- a/mesalib/src/mesa/main/api_exec.h +++ b/mesalib/src/mesa/main/api_exec.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/api_loopback.c b/mesalib/src/mesa/main/api_loopback.c index 59d399b42..938e9b5c0 100644 --- a/mesalib/src/mesa/main/api_loopback.c +++ b/mesalib/src/mesa/main/api_loopback.c @@ -23,9 +23,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -36,7 +37,6 @@ #include "glapi/glapi.h" #include "glapi/glthread.h" #include "main/dispatch.h" -#include "mfeatures.h" #include "main/context.h" /* KW: A set of functions to convert unusual Color/Normal/Vertex/etc diff --git a/mesalib/src/mesa/main/api_loopback.h b/mesalib/src/mesa/main/api_loopback.h index c35d57bff..af6572d1b 100644 --- a/mesalib/src/mesa/main/api_loopback.h +++ b/mesalib/src/mesa/main/api_loopback.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -28,14 +29,12 @@ #define API_LOOPBACK_H #include "main/compiler.h" -#include "main/mfeatures.h" #include "main/glheader.h" // ? #include "main/macros.h" // ? #include "main/mtypes.h" // ? #include "glapi/glapi.h" // ? #include "glapi/glthread.h" // ? #include "main/dispatch.h" // ? -#include "main/mfeatures.h" // ? #include "main/context.h" // ? struct _glapi_table; diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c index 53b00211b..30a195350 100644 --- a/mesalib/src/mesa/main/api_validate.c +++ b/mesalib/src/mesa/main/api_validate.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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 <stdbool.h> @@ -28,7 +29,6 @@ #include "bufferobj.h" #include "context.h" #include "imports.h" -#include "mfeatures.h" #include "mtypes.h" #include "enums.h" #include "vbo/vbo.h" @@ -201,12 +201,11 @@ check_index_bounds(struct gl_context *ctx, GLsizei count, GLenum type, * Is 'mode' a valid value for glBegin(), glDrawArrays(), glDrawElements(), * etc? The set of legal values depends on whether geometry shaders/programs * are supported. + * Note: This may be called during display list compilation. */ -GLboolean -_mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name) +bool +_mesa_is_valid_prim_mode(struct gl_context *ctx, GLenum mode) { - bool valid_enum; - switch (mode) { case GL_POINTS: case GL_LINES: @@ -215,24 +214,32 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name) case GL_TRIANGLES: case GL_TRIANGLE_STRIP: case GL_TRIANGLE_FAN: - valid_enum = true; - break; + return true; case GL_QUADS: case GL_QUAD_STRIP: case GL_POLYGON: - valid_enum = (ctx->API == API_OPENGL_COMPAT); - break; + return (ctx->API == API_OPENGL_COMPAT); case GL_LINES_ADJACENCY: case GL_LINE_STRIP_ADJACENCY: case GL_TRIANGLES_ADJACENCY: case GL_TRIANGLE_STRIP_ADJACENCY: - valid_enum = _mesa_is_desktop_gl(ctx) - && ctx->Extensions.ARB_geometry_shader4; - break; + return _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_geometry_shader4; default: - valid_enum = false; - break; + return false; } +} + + +/** + * Is 'mode' a valid value for glBegin(), glDrawArrays(), glDrawElements(), + * etc? Also, do additional checking related to transformation feedback. + * Note: this function cannot be called during glNewList(GL_COMPILE) because + * this code depends on current transform feedback state. + */ +GLboolean +_mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name) +{ + bool valid_enum = _mesa_is_valid_prim_mode(ctx, mode); if (!valid_enum) { _mesa_error(ctx, GL_INVALID_ENUM, "%s(mode=%x)", name, mode); diff --git a/mesalib/src/mesa/main/api_validate.h b/mesalib/src/mesa/main/api_validate.h index 0ca9c90d9..a5004b8a3 100644 --- a/mesalib/src/mesa/main/api_validate.h +++ b/mesalib/src/mesa/main/api_validate.h @@ -18,18 +18,18 @@ * 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 - * BRIAN PAUL 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. + * 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. */ #ifndef API_VALIDATE_H #define API_VALIDATE_H - +#include <stdbool.h> #include "glheader.h" -#include "mfeatures.h" struct gl_buffer_object; struct gl_context; @@ -42,6 +42,9 @@ _mesa_max_buffer_index(struct gl_context *ctx, GLuint count, GLenum type, struct gl_buffer_object *elementBuf); +extern bool +_mesa_is_valid_prim_mode(struct gl_context *ctx, GLenum mode); + extern GLboolean _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name); diff --git a/mesalib/src/mesa/main/arbprogram.c b/mesalib/src/mesa/main/arbprogram.c index 5730ea495..327f582cb 100644 --- a/mesalib/src/mesa/main/arbprogram.c +++ b/mesalib/src/mesa/main/arbprogram.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** diff --git a/mesalib/src/mesa/main/arbprogram.h b/mesalib/src/mesa/main/arbprogram.h index 4f40a70c5..2b31b9984 100644 --- a/mesalib/src/mesa/main/arbprogram.h +++ b/mesalib/src/mesa/main/arbprogram.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/arrayobj.c b/mesalib/src/mesa/main/arrayobj.c index ac3e7e666..34d50955f 100644 --- a/mesalib/src/mesa/main/arrayobj.c +++ b/mesalib/src/mesa/main/arrayobj.c @@ -19,10 +19,10 @@ * 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 - * BRIAN PAUL OR IBM 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. + * 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. */ @@ -44,7 +44,6 @@ #include "image.h" #include "imports.h" #include "context.h" -#include "mfeatures.h" #include "bufferobj.h" #include "arrayobj.h" #include "macros.h" diff --git a/mesalib/src/mesa/main/arrayobj.h b/mesalib/src/mesa/main/arrayobj.h index 0d58bb75a..d7ff35a56 100644 --- a/mesalib/src/mesa/main/arrayobj.h +++ b/mesalib/src/mesa/main/arrayobj.h @@ -19,10 +19,10 @@ * 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 - * BRIAN PAUL OR IBM 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. + * 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. */ #ifndef ARRAYOBJ_H diff --git a/mesalib/src/mesa/main/atifragshader.c b/mesalib/src/mesa/main/atifragshader.c index 2a0790862..7077c96f1 100644 --- a/mesalib/src/mesa/main/atifragshader.c +++ b/mesalib/src/mesa/main/atifragshader.c @@ -26,7 +26,6 @@ #include "main/hash.h" #include "main/imports.h" #include "main/macros.h" -#include "main/mfeatures.h" #include "main/enums.h" #include "main/mtypes.h" #include "main/dispatch.h" diff --git a/mesalib/src/mesa/main/atifragshader.h b/mesalib/src/mesa/main/atifragshader.h index c47a7d56e..afaea009d 100644 --- a/mesalib/src/mesa/main/atifragshader.h +++ b/mesalib/src/mesa/main/atifragshader.h @@ -10,7 +10,6 @@ #include "compiler.h" #include "glheader.h" -#include "mfeatures.h" struct _glapi_table; struct gl_context; diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c index a672845bf..249e88a4a 100644 --- a/mesalib/src/mesa/main/attrib.c +++ b/mesalib/src/mesa/main/attrib.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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 "glheader.h" @@ -43,7 +44,6 @@ #include "lines.h" #include "macros.h" #include "matrix.h" -#include "mfeatures.h" #include "multisample.h" #include "points.h" #include "polygon.h" @@ -1399,7 +1399,6 @@ copy_array_attrib(struct gl_context *ctx, dest->PrimitiveRestartFixedIndex = src->PrimitiveRestartFixedIndex; dest->_PrimitiveRestart = src->_PrimitiveRestart; dest->RestartIndex = src->RestartIndex; - dest->_RestartIndex = src->_RestartIndex; /* skip NewState */ /* skip RebindArrays */ @@ -1578,7 +1577,6 @@ _mesa_PopClientAttrib(void) copy_pixelstore(ctx, &ctx->Pack, store); _mesa_reference_buffer_object(ctx, &store->BufferObj, NULL); } - ctx->NewState |= _NEW_PACKUNPACK; break; case GL_CLIENT_UNPACK_BIT: { @@ -1587,7 +1585,6 @@ _mesa_PopClientAttrib(void) copy_pixelstore(ctx, &ctx->Unpack, store); _mesa_reference_buffer_object(ctx, &store->BufferObj, NULL); } - ctx->NewState |= _NEW_PACKUNPACK; break; case GL_CLIENT_VERTEX_ARRAY_BIT: { struct gl_array_attrib * attr = diff --git a/mesalib/src/mesa/main/attrib.h b/mesalib/src/mesa/main/attrib.h index 1ecf3a591..bb9fc5a94 100644 --- a/mesalib/src/mesa/main/attrib.h +++ b/mesalib/src/mesa/main/attrib.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ #ifndef ATTRIB_H @@ -28,7 +29,6 @@ #include "compiler.h" #include "glheader.h" -#include "mfeatures.h" struct _glapi_table; struct gl_context; diff --git a/mesalib/src/mesa/main/bitset.h b/mesalib/src/mesa/main/bitset.h index 28b3c127e..aceaa0d4d 100644 --- a/mesalib/src/mesa/main/bitset.h +++ b/mesalib/src/mesa/main/bitset.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** @@ -42,8 +43,8 @@ /* bitset declarations */ -#define BITSET_DECLARE(name, size) \ - BITSET_WORD name[((size) + BITSET_WORDBITS - 1) / BITSET_WORDBITS] +#define BITSET_WORDS(bits) (ALIGN(bits, BITSET_WORDBITS) / BITSET_WORDBITS) +#define BITSET_DECLARE(name, bits) BITSET_WORD name[BITSET_WORDS(bits)] /* bitset operations */ diff --git a/mesalib/src/mesa/main/blend.c b/mesalib/src/mesa/main/blend.c index 09a1c9ae8..0c28352b2 100644 --- a/mesalib/src/mesa/main/blend.c +++ b/mesalib/src/mesa/main/blend.c @@ -22,9 +22,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -783,7 +784,6 @@ _mesa_ClampColor(GLenum target, GLenum clamp) _mesa_update_clamp_fragment_color(ctx); break; case GL_CLAMP_READ_COLOR_ARB: - FLUSH_VERTICES(ctx, _NEW_COLOR); ctx->Color.ClampReadColor = clamp; break; default: @@ -856,6 +856,23 @@ _mesa_update_clamp_vertex_color(struct gl_context *ctx) ctx->Light._ClampVertexColor = _mesa_get_clamp_vertex_color(ctx); } +/** + * Returns an appropriate gl_format for color rendering based on the + * GL_FRAMEBUFFER_SRGB state. + * + * Some drivers implement GL_FRAMEBUFFER_SRGB using a flag on the blend state + * (which GL_FRAMEBUFFER_SRGB maps to reasonably), but some have to do so by + * overriding the format of the surface. This is a helper for doing the + * surface format override variant. + */ +gl_format +_mesa_get_render_format(const struct gl_context *ctx, gl_format format) +{ + if (ctx->Color.sRGBEnabled) + return format; + else + return _mesa_get_srgb_format_linear(format); +} /**********************************************************************/ /** \name Initialization */ diff --git a/mesalib/src/mesa/main/blend.h b/mesalib/src/mesa/main/blend.h index 621311d55..b43b3ccb3 100644 --- a/mesalib/src/mesa/main/blend.h +++ b/mesalib/src/mesa/main/blend.h @@ -22,9 +22,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -34,6 +35,7 @@ #include "glheader.h" +#include "formats.h" struct gl_context; @@ -114,6 +116,9 @@ _mesa_update_clamp_fragment_color(struct gl_context *ctx); extern void _mesa_update_clamp_vertex_color(struct gl_context *ctx); +extern gl_format +_mesa_get_render_format(const struct gl_context *ctx, gl_format format); + extern void _mesa_init_color( struct gl_context * ctx ); diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c index b82ba7b4c..ffb67b9b3 100644 --- a/mesalib/src/mesa/main/bufferobj.c +++ b/mesalib/src/mesa/main/bufferobj.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -39,7 +40,6 @@ #include "context.h" #include "bufferobj.h" #include "fbobject.h" -#include "mfeatures.h" #include "mtypes.h" #include "texobj.h" #include "transformfeedback.h" @@ -619,13 +619,10 @@ _mesa_init_buffer_objects( struct gl_context *ctx ) _mesa_reference_buffer_object(ctx, &ctx->CopyWriteBuffer, ctx->Shared->NullBufferObj); - ctx->UniformBufferBindings = calloc(ctx->Const.MaxUniformBufferBindings, - sizeof(*ctx->UniformBufferBindings)); - _mesa_reference_buffer_object(ctx, &ctx->UniformBuffer, ctx->Shared->NullBufferObj); - for (i = 0; i < ctx->Const.MaxUniformBufferBindings; i++) { + for (i = 0; i < MAX_COMBINED_UNIFORM_BUFFERS; i++) { _mesa_reference_buffer_object(ctx, &ctx->UniformBufferBindings[i].BufferObject, ctx->Shared->NullBufferObj); @@ -647,14 +644,11 @@ _mesa_free_buffer_objects( struct gl_context *ctx ) _mesa_reference_buffer_object(ctx, &ctx->UniformBuffer, NULL); - for (i = 0; i < ctx->Const.MaxUniformBufferBindings; i++) { + for (i = 0; i < MAX_COMBINED_UNIFORM_BUFFERS; i++) { _mesa_reference_buffer_object(ctx, &ctx->UniformBufferBindings[i].BufferObject, NULL); } - - free(ctx->UniformBufferBindings); - ctx->UniformBufferBindings = NULL; } static bool @@ -2060,7 +2054,8 @@ set_ubo_binding(struct gl_context *ctx, return; } - FLUSH_VERTICES(ctx, _NEW_BUFFER_OBJECT); + FLUSH_VERTICES(ctx, 0); + ctx->NewDriverState |= ctx->DriverFlags.NewUniformBuffer; _mesa_reference_buffer_object(ctx, &binding->BufferObject, bufObj); binding->Offset = offset; diff --git a/mesalib/src/mesa/main/bufferobj.h b/mesalib/src/mesa/main/bufferobj.h index e98e47670..249178a7a 100644 --- a/mesalib/src/mesa/main/bufferobj.h +++ b/mesalib/src/mesa/main/bufferobj.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -29,7 +30,6 @@ #define BUFFEROBJ_H -#include "mfeatures.h" #include "mtypes.h" diff --git a/mesalib/src/mesa/main/buffers.c b/mesalib/src/mesa/main/buffers.c index 3f5cbcda7..12e636b17 100644 --- a/mesalib/src/mesa/main/buffers.c +++ b/mesalib/src/mesa/main/buffers.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -226,8 +227,8 @@ read_buffer_enum_to_index(GLenum buffer) * \param buffer buffer token such as GL_LEFT or GL_FRONT_AND_BACK, etc. * * Note that the behaviour of this function depends on whether the - * current ctx->DrawBuffer is a window-system framebuffer (Name=0) or - * a user-created framebuffer object (Name!=0). + * current ctx->DrawBuffer is a window-system framebuffer or a user-created + * framebuffer object. * In the former case, we update the per-context ctx->Color.DrawBuffer * state var _and_ the FB's ColorDrawBuffer state. * In the later case, we update the FB's ColorDrawBuffer state only. @@ -645,7 +646,6 @@ _mesa_ReadBuffer(GLenum buffer) /* OK, all error checking has been completed now */ _mesa_readbuffer(ctx, buffer, srcBuffer); - ctx->NewState |= _NEW_BUFFERS; /* * Call device driver function. diff --git a/mesalib/src/mesa/main/buffers.h b/mesalib/src/mesa/main/buffers.h index e9768f944..59fce4b05 100644 --- a/mesalib/src/mesa/main/buffers.h +++ b/mesalib/src/mesa/main/buffers.h @@ -22,9 +22,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/clear.c b/mesalib/src/mesa/main/clear.c index af9433306..fb3e576e6 100644 --- a/mesalib/src/mesa/main/clear.c +++ b/mesalib/src/mesa/main/clear.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -46,10 +47,6 @@ _mesa_ClearIndex( GLfloat c ) { GET_CURRENT_CONTEXT(ctx); - if (ctx->Color.ClearIndex == (GLuint) c) - return; - - FLUSH_VERTICES(ctx, _NEW_COLOR); ctx->Color.ClearIndex = (GLuint) c; } @@ -71,19 +68,12 @@ _mesa_ClearIndex( GLfloat c ) void GLAPIENTRY _mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) { - GLfloat tmp[4]; GET_CURRENT_CONTEXT(ctx); - tmp[0] = red; - tmp[1] = green; - tmp[2] = blue; - tmp[3] = alpha; - - if (TEST_EQ_4V(tmp, ctx->Color.ClearColor.f)) - return; /* no change */ - - FLUSH_VERTICES(ctx, _NEW_COLOR); - COPY_4V(ctx->Color.ClearColor.f, tmp); + ctx->Color.ClearColor.f[0] = red; + ctx->Color.ClearColor.f[1] = green; + ctx->Color.ClearColor.f[2] = blue; + ctx->Color.ClearColor.f[3] = alpha; } @@ -93,19 +83,12 @@ _mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) void GLAPIENTRY _mesa_ClearColorIiEXT(GLint r, GLint g, GLint b, GLint a) { - GLint tmp[4]; GET_CURRENT_CONTEXT(ctx); - tmp[0] = r; - tmp[1] = g; - tmp[2] = b; - tmp[3] = a; - - if (TEST_EQ_4V(tmp, ctx->Color.ClearColor.i)) - return; /* no change */ - - FLUSH_VERTICES(ctx, _NEW_COLOR); - COPY_4V(ctx->Color.ClearColor.i, tmp); + ctx->Color.ClearColor.i[0] = r; + ctx->Color.ClearColor.i[1] = g; + ctx->Color.ClearColor.i[2] = b; + ctx->Color.ClearColor.i[3] = a; } @@ -115,19 +98,12 @@ _mesa_ClearColorIiEXT(GLint r, GLint g, GLint b, GLint a) void GLAPIENTRY _mesa_ClearColorIuiEXT(GLuint r, GLuint g, GLuint b, GLuint a) { - GLuint tmp[4]; GET_CURRENT_CONTEXT(ctx); - tmp[0] = r; - tmp[1] = g; - tmp[2] = b; - tmp[3] = a; - - if (TEST_EQ_4V(tmp, ctx->Color.ClearColor.ui)) - return; /* no change */ - - FLUSH_VERTICES(ctx, _NEW_COLOR); - COPY_4V(ctx->Color.ClearColor.ui, tmp); + ctx->Color.ClearColor.ui[0] = r; + ctx->Color.ClearColor.ui[1] = g; + ctx->Color.ClearColor.ui[2] = b; + ctx->Color.ClearColor.ui[3] = a; } diff --git a/mesalib/src/mesa/main/clear.h b/mesalib/src/mesa/main/clear.h index 783271920..e410ee6f1 100644 --- a/mesalib/src/mesa/main/clear.h +++ b/mesalib/src/mesa/main/clear.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/clip.c b/mesalib/src/mesa/main/clip.c index b01dd3c97..ebca202be 100644 --- a/mesalib/src/mesa/main/clip.c +++ b/mesalib/src/mesa/main/clip.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/clip.h b/mesalib/src/mesa/main/clip.h index a8e6d7687..dc65cf36c 100644 --- a/mesalib/src/mesa/main/clip.h +++ b/mesalib/src/mesa/main/clip.h @@ -21,9 +21,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/colormac.h b/mesalib/src/mesa/main/colormac.h index 4294f3239..16c245225 100644 --- a/mesalib/src/mesa/main/colormac.h +++ b/mesalib/src/mesa/main/colormac.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/colortab.c b/mesalib/src/mesa/main/colortab.c index c201a27cb..18f993adf 100644 --- a/mesalib/src/mesa/main/colortab.c +++ b/mesalib/src/mesa/main/colortab.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -29,7 +30,6 @@ #include "context.h" #include "image.h" #include "macros.h" -#include "mfeatures.h" #include "mtypes.h" #include "pack.h" #include "pbo.h" diff --git a/mesalib/src/mesa/main/colortab.h b/mesalib/src/mesa/main/colortab.h index f25fbe8a5..1c1854868 100644 --- a/mesalib/src/mesa/main/colortab.h +++ b/mesalib/src/mesa/main/colortab.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -29,7 +30,6 @@ #include "compiler.h" #include "glheader.h" -#include "mfeatures.h" struct _glapi_table; diff --git a/mesalib/src/mesa/main/compiler.h b/mesalib/src/mesa/main/compiler.h index 8431534c3..1e10f2749 100644 --- a/mesalib/src/mesa/main/compiler.h +++ b/mesalib/src/mesa/main/compiler.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/config.h b/mesalib/src/mesa/main/config.h index 99910d7f3..4a4fdc98c 100644 --- a/mesalib/src/mesa/main/config.h +++ b/mesalib/src/mesa/main/config.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** @@ -90,9 +91,6 @@ /** Line width granularity */ #define LINE_WIDTH_GRANULARITY 0.1 -/** Max texture palette / color table size */ -#define MAX_COLOR_TABLE_SIZE 256 - /** Max memory to allow for a single texture image (in megabytes) */ #define MAX_TEXTURE_MBYTES 1024 @@ -170,6 +168,9 @@ /*@{*/ #define MAX_PROGRAM_LOCAL_PARAMS 4096 #define MAX_UNIFORMS 4096 +#define MAX_UNIFORM_BUFFERS 15 /* + 1 default uniform buffer */ +/* 6 is for vertex, hull, domain, geometry, fragment, and compute shader. */ +#define MAX_COMBINED_UNIFORM_BUFFERS (MAX_UNIFORM_BUFFERS * 6) /*@}*/ /** @@ -218,9 +219,8 @@ /** For GL_ARB_vertex_shader */ /*@{*/ #define MAX_VERTEX_GENERIC_ATTRIBS 16 -#define MAX_VERTEX_TEXTURE_IMAGE_UNITS MAX_TEXTURE_IMAGE_UNITS -#define MAX_COMBINED_TEXTURE_IMAGE_UNITS (MAX_VERTEX_TEXTURE_IMAGE_UNITS + \ - MAX_TEXTURE_IMAGE_UNITS) +/* 6 is for vertex, hull, domain, geometry, fragment, and compute shader. */ +#define MAX_COMBINED_TEXTURE_IMAGE_UNITS (MAX_TEXTURE_IMAGE_UNITS * 6) /*@}*/ @@ -245,9 +245,6 @@ /** For GL_ARB_geometry_shader4 */ /*@{*/ -#define MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 8 -#define MAX_GEOMETRY_VARYING_COMPONENTS 32 -#define MAX_VERTEX_VARYING_COMPONENTS 32 #define MAX_GEOMETRY_UNIFORM_COMPONENTS 512 #define MAX_GEOMETRY_OUTPUT_VERTICES 256 #define MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 1024 diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index 053993421..0053525e8 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** @@ -77,7 +78,6 @@ #include "glheader.h" -#include "mfeatures.h" #include "imports.h" #include "accum.h" #include "api_exec.h" @@ -552,9 +552,9 @@ _mesa_init_constants(struct gl_context *ctx) ctx->Const.MaxTextureRectSize = MAX_TEXTURE_RECT_SIZE; ctx->Const.MaxArrayTextureLayers = MAX_ARRAY_TEXTURE_LAYERS; ctx->Const.MaxTextureCoordUnits = MAX_TEXTURE_COORD_UNITS; - ctx->Const.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS; + ctx->Const.FragmentProgram.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS; ctx->Const.MaxTextureUnits = MIN2(ctx->Const.MaxTextureCoordUnits, - ctx->Const.MaxTextureImageUnits); + ctx->Const.FragmentProgram.MaxTextureImageUnits); ctx->Const.MaxTextureMaxAnisotropy = MAX_TEXTURE_MAX_ANISOTROPY; ctx->Const.MaxTextureLodBias = MAX_TEXTURE_LOD_BIAS; ctx->Const.MaxTextureBufferSize = 65536; @@ -571,7 +571,6 @@ _mesa_init_constants(struct gl_context *ctx) ctx->Const.MinLineWidthAA = MIN_LINE_WIDTH; ctx->Const.MaxLineWidthAA = MAX_LINE_WIDTH; ctx->Const.LineWidthGranularity = (GLfloat) LINE_WIDTH_GRANULARITY; - ctx->Const.MaxColorTableSize = MAX_COLOR_TABLE_SIZE; ctx->Const.MaxClipPlanes = 6; ctx->Const.MaxLights = MAX_LIGHTS; ctx->Const.MaxShininess = 128.0; @@ -601,12 +600,10 @@ _mesa_init_constants(struct gl_context *ctx) ctx->Const.MaxColorAttachments = MAX_COLOR_ATTACHMENTS; ctx->Const.MaxRenderbufferSize = MAX_RENDERBUFFER_SIZE; - ctx->Const.MaxVertexTextureImageUnits = MAX_VERTEX_TEXTURE_IMAGE_UNITS; + ctx->Const.VertexProgram.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS; ctx->Const.MaxCombinedTextureImageUnits = MAX_COMBINED_TEXTURE_IMAGE_UNITS; ctx->Const.MaxVarying = 16; /* old limit not to break tnl and swrast */ - ctx->Const.MaxGeometryTextureImageUnits = MAX_GEOMETRY_TEXTURE_IMAGE_UNITS; - ctx->Const.MaxVertexVaryingComponents = MAX_VERTEX_VARYING_COMPONENTS; - ctx->Const.MaxGeometryVaryingComponents = MAX_GEOMETRY_VARYING_COMPONENTS; + ctx->Const.GeometryProgram.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS; ctx->Const.MaxGeometryOutputVertices = MAX_GEOMETRY_OUTPUT_VERTICES; ctx->Const.MaxGeometryTotalOutputComponents = MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS; @@ -676,27 +673,25 @@ check_context_limits(struct gl_context *ctx) assert(VARYING_SLOT_MAX <= (8 * sizeof(ctx->FragmentProgram._Current->Base.InputsRead))); - assert(MAX_COMBINED_TEXTURE_IMAGE_UNITS <= 8 * sizeof(GLbitfield)); - /* shader-related checks */ assert(ctx->Const.FragmentProgram.MaxLocalParams <= MAX_PROGRAM_LOCAL_PARAMS); assert(ctx->Const.VertexProgram.MaxLocalParams <= MAX_PROGRAM_LOCAL_PARAMS); /* Texture unit checks */ - assert(ctx->Const.MaxTextureImageUnits > 0); - assert(ctx->Const.MaxTextureImageUnits <= MAX_TEXTURE_IMAGE_UNITS); + assert(ctx->Const.FragmentProgram.MaxTextureImageUnits > 0); + assert(ctx->Const.FragmentProgram.MaxTextureImageUnits <= MAX_TEXTURE_IMAGE_UNITS); assert(ctx->Const.MaxTextureCoordUnits > 0); assert(ctx->Const.MaxTextureCoordUnits <= MAX_TEXTURE_COORD_UNITS); assert(ctx->Const.MaxTextureUnits > 0); assert(ctx->Const.MaxTextureUnits <= MAX_TEXTURE_IMAGE_UNITS); assert(ctx->Const.MaxTextureUnits <= MAX_TEXTURE_COORD_UNITS); - assert(ctx->Const.MaxTextureUnits == MIN2(ctx->Const.MaxTextureImageUnits, + assert(ctx->Const.MaxTextureUnits == MIN2(ctx->Const.FragmentProgram.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits)); assert(ctx->Const.MaxCombinedTextureImageUnits > 0); assert(ctx->Const.MaxCombinedTextureImageUnits <= MAX_COMBINED_TEXTURE_IMAGE_UNITS); assert(ctx->Const.MaxTextureCoordUnits <= MAX_COMBINED_TEXTURE_IMAGE_UNITS); /* number of coord units cannot be greater than number of image units */ - assert(ctx->Const.MaxTextureCoordUnits <= ctx->Const.MaxTextureImageUnits); + assert(ctx->Const.MaxTextureCoordUnits <= ctx->Const.FragmentProgram.MaxTextureImageUnits); /* Texture size checks */ @@ -924,7 +919,6 @@ create_beginend_table(const struct gl_context *ctx) COPY_DISPATCH(MapBuffer); COPY_DISPATCH(UnmapBuffer); COPY_DISPATCH(MapBufferRange); - COPY_DISPATCH(MapBufferRange); COPY_DISPATCH(ObjectPurgeableAPPLE); COPY_DISPATCH(ObjectUnpurgeableAPPLE); @@ -1080,6 +1074,7 @@ _mesa_initialize_context(struct gl_context *ctx, return GL_TRUE; fail: + _mesa_reference_shared_state(ctx, &ctx->Shared, NULL); free(ctx->BeginEnd); free(ctx->Exec); free(ctx->Save); @@ -1180,6 +1175,7 @@ _mesa_free_context_data( struct gl_context *ctx ) _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, NULL); /* free dispatch tables */ + free(ctx->BeginEnd); free(ctx->Exec); free(ctx->Save); @@ -1724,18 +1720,6 @@ _mesa_Flush(void) } -/** - * Set mvp_with_dp4 flag. If a driver has a preference for DP4 over - * MUL/MAD, or vice versa, call this function to register that. - * Otherwise we default to MUL/MAD. - */ -void -_mesa_set_mvp_with_dp4( struct gl_context *ctx, - GLboolean flag ) -{ - ctx->mvp_with_dp4 = flag; -} - /* * ARB_blend_func_extended - ERRORS section * "The error INVALID_OPERATION is generated by Begin or any procedure that diff --git a/mesalib/src/mesa/main/context.h b/mesalib/src/mesa/main/context.h index 1b881f3f3..0118e5f6a 100644 --- a/mesalib/src/mesa/main/context.h +++ b/mesalib/src/mesa/main/context.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -154,11 +155,6 @@ extern struct _glapi_table * _mesa_get_dispatch(struct gl_context *ctx); -void -_mesa_set_mvp_with_dp4( struct gl_context *ctx, - GLboolean flag ); - - extern GLboolean _mesa_valid_to_render(struct gl_context *ctx, const char *where); @@ -190,6 +186,28 @@ _mesa_Flush( void ); /** + * Are we currently between glBegin and glEnd? + * During execution, not display list compilation. + */ +static inline GLboolean +_mesa_inside_begin_end(const struct gl_context *ctx) +{ + return ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END; +} + + +/** + * Are we currently between glBegin and glEnd in a display list? + */ +static inline GLboolean +_mesa_inside_dlist_begin_end(const struct gl_context *ctx) +{ + return ctx->Driver.CurrentSavePrimitive <= PRIM_MAX; +} + + + +/** * \name Macros for flushing buffered rendering commands before state changes, * checking if inside glBegin/glEnd, etc. */ @@ -242,7 +260,7 @@ do { \ */ #define ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval) \ do { \ - if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { \ + if (_mesa_inside_begin_end(ctx)) { \ _mesa_error(ctx, GL_INVALID_OPERATION, "Inside glBegin/glEnd"); \ return retval; \ } \ @@ -256,7 +274,7 @@ do { \ */ #define ASSERT_OUTSIDE_BEGIN_END(ctx) \ do { \ - if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { \ + if (_mesa_inside_begin_end(ctx)) { \ _mesa_error(ctx, GL_INVALID_OPERATION, "Inside glBegin/glEnd"); \ return; \ } \ diff --git a/mesalib/src/mesa/main/convolve.c b/mesalib/src/mesa/main/convolve.c index dfc1b9465..5f1e85b6b 100644 --- a/mesalib/src/mesa/main/convolve.c +++ b/mesalib/src/mesa/main/convolve.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -36,7 +37,6 @@ #include "colormac.h" #include "convolve.h" #include "macros.h" -#include "mfeatures.h" #include "mtypes.h" #include "main/dispatch.h" diff --git a/mesalib/src/mesa/main/convolve.h b/mesalib/src/mesa/main/convolve.h index 812debd61..3d4c999d9 100644 --- a/mesalib/src/mesa/main/convolve.h +++ b/mesalib/src/mesa/main/convolve.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -29,7 +30,6 @@ #include "compiler.h" -#include "mfeatures.h" struct _glapi_table; diff --git a/mesalib/src/mesa/main/cpuinfo.c b/mesalib/src/mesa/main/cpuinfo.c index 41505f637..3b4ff8cd1 100644 --- a/mesalib/src/mesa/main/cpuinfo.c +++ b/mesalib/src/mesa/main/cpuinfo.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/cpuinfo.h b/mesalib/src/mesa/main/cpuinfo.h index bf846ef40..31de9b2e4 100644 --- a/mesalib/src/mesa/main/cpuinfo.h +++ b/mesalib/src/mesa/main/cpuinfo.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h index 8f3cd3d6b..13c7a83d4 100644 --- a/mesalib/src/mesa/main/dd.h +++ b/mesalib/src/mesa/main/dd.h @@ -22,9 +22,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -354,7 +355,9 @@ struct dd_function_table { * \param mode bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT and * GL_MAP_INVALIDATE_RANGE_BIT (if writing) * \param mapOut returns start of mapping of region of interest - * \param rowStrideOut returns row stride (in bytes) + * \param rowStrideOut returns row stride (in bytes). In the case of a + * compressed texture, this is the byte stride between one row of blocks + * and another. */ void (*MapTextureImage)(struct gl_context *ctx, struct gl_texture_image *texImage, @@ -622,7 +625,7 @@ struct dd_function_table { struct gl_framebuffer *fb, struct gl_renderbuffer_attachment *att); void (*FinishRenderTexture)(struct gl_context *ctx, - struct gl_renderbuffer_attachment *att); + struct gl_renderbuffer *rb); void (*ValidateFramebuffer)(struct gl_context *ctx, struct gl_framebuffer *fb); /*@}*/ @@ -682,10 +685,9 @@ struct dd_function_table { GLuint CurrentExecPrimitive; /** - * Current state of an in-progress compilation. - * - * May take on any of the additional values PRIM_OUTSIDE_BEGIN_END, - * PRIM_INSIDE_UNKNOWN_PRIM or PRIM_UNKNOWN defined above. + * Current glBegin state of an in-progress compilation. May be + * GL_POINTS, GL_TRIANGLE_STRIP, etc. or PRIM_OUTSIDE_BEGIN_END + * or PRIM_UNKNOWN. */ GLuint CurrentSavePrimitive; @@ -694,15 +696,16 @@ struct dd_function_table { #define FLUSH_UPDATE_CURRENT 0x2 /** * Set by the driver-supplied T&L engine whenever vertices are buffered - * between glBegin()/glEnd() objects or __struct gl_contextRec::Current is not - * updated. + * between glBegin()/glEnd() objects or __struct gl_contextRec::Current + * is not updated. A bitmask of the FLUSH_x values above. * * The dd_function_table::FlushVertices call below may be used to resolve * these conditions. */ - GLuint NeedFlush; - GLuint SaveNeedFlush; + GLbitfield NeedFlush; + /** Need to call SaveFlushVertices() upon state change? */ + GLboolean SaveNeedFlush; /* Called prior to any of the GLvertexformat functions being * called. Paired with Driver.FlushVertices(). @@ -848,28 +851,17 @@ struct dd_function_table { /** - * Transform/Clip/Lighting interface - * - * Drivers present a reduced set of the functions possible in - * glBegin()/glEnd() objects. Core mesa provides translation stubs for the - * remaining functions to map down to these entry points. + * Per-vertex functions. * - * These are the initial values to be installed into dispatch by - * mesa. If the T&L driver wants to modify the dispatch table - * while installed, it must do so itself. It would be possible for - * the vertexformat to install its own initial values for these - * functions, but this way there is an obvious list of what is - * expected of the driver. + * These are the functions which can appear between glBegin and glEnd. + * Depending on whether we're inside or outside a glBegin/End pair + * and whether we're in immediate mode or building a display list, these + * functions behave differently. This structure allows us to switch + * between those modes more easily. * - * If the driver wants to hook in entry points other than those - * listed, it must restore them to their original values in - * the disable() callback, below. + * Generally, these pointers point to functions in the VBO module. */ typedef struct { - /** - * \name Vertex - */ - /*@{*/ void (GLAPIENTRYP ArrayElement)( GLint ); void (GLAPIENTRYP Color3f)( GLfloat, GLfloat, GLfloat ); void (GLAPIENTRYP Color3fv)( const GLfloat * ); @@ -1017,84 +1009,6 @@ typedef struct { void (GLAPIENTRYP VertexAttribP4uiv)( GLuint index, GLenum type, GLboolean normalized, const GLuint *value); - - /*@}*/ - - void (GLAPIENTRYP Rectf)( GLfloat, GLfloat, GLfloat, GLfloat ); - - /** - * \name Array - */ - /*@{*/ - void (GLAPIENTRYP DrawArrays)( GLenum mode, GLint start, GLsizei count ); - void (GLAPIENTRYP DrawElements)( GLenum mode, GLsizei count, GLenum type, - const GLvoid *indices ); - void (GLAPIENTRYP DrawRangeElements)( GLenum mode, GLuint start, - GLuint end, GLsizei count, - GLenum type, const GLvoid *indices ); - void (GLAPIENTRYP MultiDrawElementsEXT)( GLenum mode, const GLsizei *count, - GLenum type, - const GLvoid **indices, - GLsizei primcount); - void (GLAPIENTRYP DrawElementsBaseVertex)( GLenum mode, GLsizei count, - GLenum type, - const GLvoid *indices, - GLint basevertex ); - void (GLAPIENTRYP DrawRangeElementsBaseVertex)( GLenum mode, GLuint start, - GLuint end, GLsizei count, - GLenum type, - const GLvoid *indices, - GLint basevertex); - void (GLAPIENTRYP MultiDrawElementsBaseVertex)( GLenum mode, - const GLsizei *count, - GLenum type, - const GLvoid * const *indices, - GLsizei primcount, - const GLint *basevertex); - void (GLAPIENTRYP DrawArraysInstanced)(GLenum mode, GLint first, - GLsizei count, GLsizei primcount); - void (GLAPIENTRYP DrawArraysInstancedBaseInstance)(GLenum mode, GLint first, - GLsizei count, GLsizei primcount, - GLuint baseinstance); - void (GLAPIENTRYP DrawElementsInstanced)(GLenum mode, GLsizei count, - GLenum type, const GLvoid *indices, - GLsizei primcount); - void (GLAPIENTRYP DrawElementsInstancedBaseInstance)(GLenum mode, GLsizei count, - GLenum type, const GLvoid *indices, - GLsizei primcount, GLuint baseinstance); - void (GLAPIENTRYP DrawElementsInstancedBaseVertex)(GLenum mode, GLsizei count, - GLenum type, const GLvoid *indices, - GLsizei primcount, GLint basevertex); - void (GLAPIENTRYP DrawElementsInstancedBaseVertexBaseInstance)(GLenum mode, GLsizei count, - GLenum type, const GLvoid *indices, - GLsizei primcount, GLint basevertex, - GLuint baseinstance); - void (GLAPIENTRYP DrawTransformFeedback)(GLenum mode, GLuint name); - void (GLAPIENTRYP DrawTransformFeedbackStream)(GLenum mode, GLuint name, - GLuint stream); - void (GLAPIENTRYP DrawTransformFeedbackInstanced)(GLenum mode, GLuint name, - GLsizei primcount); - void (GLAPIENTRYP DrawTransformFeedbackStreamInstanced)(GLenum mode, - GLuint name, - GLuint stream, - GLsizei primcount); - /*@}*/ - - /** - * \name Eval - * - * If you don't support eval, fallback to the default vertex format - * on receiving an eval call and use the pipeline mechanism to - * provide partial T&L acceleration. - * - * Mesa will provide a set of helper functions to do eval within - * accelerated vertex formats, eventually... - */ - /*@{*/ - void (GLAPIENTRYP EvalMesh1)( GLenum mode, GLint i1, GLint i2 ); - void (GLAPIENTRYP EvalMesh2)( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); - /*@}*/ - } GLvertexformat; diff --git a/mesalib/src/mesa/main/debug.c b/mesalib/src/mesa/main/debug.c index aee8ae2dc..bd75e4158 100644 --- a/mesalib/src/mesa/main/debug.c +++ b/mesalib/src/mesa/main/debug.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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 "mtypes.h" @@ -66,7 +67,7 @@ void _mesa_print_state( const char *msg, GLuint state ) { _mesa_debug(NULL, - "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", + "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", msg, state, (state & _NEW_MODELVIEW) ? "ctx->ModelView, " : "", @@ -88,7 +89,6 @@ _mesa_print_state( const char *msg, GLuint state ) (state & _NEW_TEXTURE) ? "ctx->Texture, " : "", (state & _NEW_TRANSFORM) ? "ctx->Transform, " : "", (state & _NEW_VIEWPORT) ? "ctx->Viewport, " : "", - (state & _NEW_PACKUNPACK) ? "ctx->Pack/Unpack, " : "", (state & _NEW_ARRAY) ? "ctx->Array, " : "", (state & _NEW_RENDERMODE) ? "ctx->RenderMode, " : "", (state & _NEW_BUFFERS) ? "ctx->Visual, ctx->DrawBuffer,, " : ""); @@ -96,27 +96,6 @@ _mesa_print_state( const char *msg, GLuint state ) -void -_mesa_print_tri_caps( const char *name, GLuint flags ) -{ - _mesa_debug(NULL, - "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s\n", - name, - flags, - (flags & DD_SEPARATE_SPECULAR) ? "separate-specular, " : "", - (flags & DD_TRI_LIGHT_TWOSIDE) ? "tri-light-twoside, " : "", - (flags & DD_TRI_UNFILLED) ? "tri-unfilled, " : "", - (flags & DD_TRI_STIPPLE) ? "tri-stipple, " : "", - (flags & DD_TRI_OFFSET) ? "tri-offset, " : "", - (flags & DD_TRI_SMOOTH) ? "tri-smooth, " : "", - (flags & DD_LINE_SMOOTH) ? "line-smooth, " : "", - (flags & DD_LINE_STIPPLE) ? "line-stipple, " : "", - (flags & DD_POINT_SMOOTH) ? "point-smooth, " : "", - (flags & DD_POINT_ATTEN) ? "point-atten, " : "" - ); -} - - /** * Print information about this Mesa version and build options. */ diff --git a/mesalib/src/mesa/main/debug.h b/mesalib/src/mesa/main/debug.h index 6bc536591..919a6f3a1 100644 --- a/mesalib/src/mesa/main/debug.h +++ b/mesalib/src/mesa/main/debug.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** @@ -37,12 +38,10 @@ #define _DEBUG_H #include "glheader.h" -#include "mfeatures.h" struct gl_context; struct gl_texture_image; -extern void _mesa_print_tri_caps( const char *name, GLuint flags ); extern void _mesa_print_enable_flags( const char *msg, GLuint flags ); extern void _mesa_print_state( const char *msg, GLuint state ); extern void _mesa_print_info( void ); diff --git a/mesalib/src/mesa/main/depth.c b/mesalib/src/mesa/main/depth.c index 8aec94a2d..68ad56184 100644 --- a/mesalib/src/mesa/main/depth.c +++ b/mesalib/src/mesa/main/depth.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -46,13 +47,7 @@ _mesa_ClearDepth( GLclampd depth ) if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glClearDepth(%f)\n", depth); - depth = CLAMP( depth, 0.0, 1.0 ); - - if (ctx->Depth.Clear == depth) - return; - - FLUSH_VERTICES(ctx, _NEW_DEPTH); - ctx->Depth.Clear = depth; + ctx->Depth.Clear = CLAMP( depth, 0.0, 1.0 ); } diff --git a/mesalib/src/mesa/main/depth.h b/mesalib/src/mesa/main/depth.h index fe6b33f36..80e753837 100644 --- a/mesalib/src/mesa/main/depth.h +++ b/mesalib/src/mesa/main/depth.h @@ -22,9 +22,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -33,7 +34,6 @@ #include "glheader.h" -#include "mfeatures.h" struct gl_context; diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c index 4b20d890d..18e3eb760 100644 --- a/mesalib/src/mesa/main/dlist.c +++ b/mesalib/src/mesa/main/dlist.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -37,7 +38,6 @@ #include "api_validate.h" #include "atifragshader.h" #include "config.h" -#include "mfeatures.h" #include "bufferobj.h" #include "arrayobj.h" #include "context.h" @@ -69,6 +69,8 @@ #include "main/dispatch.h" +#include "vbo/vbo.h" + /** @@ -122,8 +124,7 @@ do { \ */ #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \ do { \ - if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \ - ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \ + if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \ _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \ return retval; \ } \ @@ -137,8 +138,7 @@ do { \ */ #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \ do { \ - if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \ - ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \ + if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \ _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \ return; \ } \ @@ -1356,7 +1356,14 @@ save_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode, "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile"); } -static void invalidate_saved_current_state( struct gl_context *ctx ) + +/** + * While building a display list we cache some OpenGL state. + * Under some circumstances we need to invalidate that state (immediately + * when we start compiling a list, or after glCallList(s)). + */ +static void +invalidate_saved_current_state(struct gl_context *ctx) { GLint i; @@ -1371,6 +1378,7 @@ static void invalidate_saved_current_state( struct gl_context *ctx ) ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; } + static void GLAPIENTRY save_CallList(GLuint list) { @@ -3771,15 +3779,16 @@ save_ShadeModel(GLenum mode) CALL_ShadeModel(ctx->Exec, (mode)); } + /* Don't compile this call if it's a no-op. + * By avoiding this state change we have a better chance of + * coalescing subsequent drawing commands into one batch. + */ if (ctx->ListState.Current.ShadeModel == mode) return; SAVE_FLUSH_VERTICES(ctx); - /* Only save the value if we know the statechange will take effect: - */ - if (ctx->Driver.CurrentSavePrimitive == PRIM_OUTSIDE_BEGIN_END) - ctx->ListState.Current.ShadeModel = mode; + ctx->ListState.Current.ShadeModel = mode; n = alloc_instruction(ctx, OPCODE_SHADE_MODEL, 1); if (n) { @@ -5645,28 +5654,20 @@ static void GLAPIENTRY save_Begin(GLenum mode) { GET_CURRENT_CONTEXT(ctx); - Node *n; - GLboolean error = GL_FALSE; - if (ctx->ExecuteFlag && !_mesa_valid_prim_mode(ctx, mode, "glBegin")) { - error = GL_TRUE; + if (!_mesa_is_valid_prim_mode(ctx, mode)) { + /* compile this error into the display list */ + _mesa_compile_error(ctx, GL_INVALID_ENUM, "glBegin(mode)"); } - else if (ctx->Driver.CurrentSavePrimitive == PRIM_UNKNOWN) { - /* Typically the first begin. This may raise an error on - * playback, depending on whether CallList is issued from inside - * a begin/end or not. - */ - ctx->Driver.CurrentSavePrimitive = PRIM_INSIDE_UNKNOWN_PRIM; - } - else if (ctx->Driver.CurrentSavePrimitive == PRIM_OUTSIDE_BEGIN_END) { - ctx->Driver.CurrentSavePrimitive = mode; + else if (_mesa_inside_dlist_begin_end(ctx)) { + /* compile this error into the display list */ + _mesa_compile_error(ctx, GL_INVALID_OPERATION, "recursive glBegin"); } else { - _mesa_compile_error(ctx, GL_INVALID_OPERATION, "recursive begin"); - error = GL_TRUE; - } + Node *n; + + ctx->Driver.CurrentSavePrimitive = mode; - if (!error) { /* Give the driver an opportunity to hook in an optimized * display list compiler. */ @@ -5678,10 +5679,10 @@ save_Begin(GLenum mode) if (n) { n[1].e = mode; } - } - if (ctx->ExecuteFlag) { - CALL_Begin(ctx->Exec, (mode)); + if (ctx->ExecuteFlag) { + CALL_Begin(ctx->Exec, (mode)); + } } } @@ -5702,7 +5703,7 @@ save_Rectf(GLfloat a, GLfloat b, GLfloat c, GLfloat d) { GET_CURRENT_CONTEXT(ctx); Node *n; - SAVE_FLUSH_VERTICES(ctx); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = alloc_instruction(ctx, OPCODE_RECTF, 4); if (n) { n[1].f = a; @@ -7055,7 +7056,10 @@ save_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params) static void GLAPIENTRY save_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param) { - save_SamplerParameterfv(sampler, pname, ¶m); + GLfloat parray[4]; + parray[0] = param; + parray[1] = parray[2] = parray[3] = 0.0F; + save_SamplerParameterfv(sampler, pname, parray); } static void GLAPIENTRY @@ -8631,8 +8635,7 @@ _mesa_NewList(GLuint name, GLenum mode) ctx->CompileFlag = GL_TRUE; ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE); - /* Reset acumulated list state: - */ + /* Reset accumulated list state */ invalidate_saved_current_state( ctx ); /* Allocate new display list */ @@ -8660,6 +8663,11 @@ _mesa_EndList(void) if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glEndList\n"); + if (ctx->ExecuteFlag && _mesa_inside_dlist_begin_end(ctx)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glEndList() called inside glBegin/End"); + } + /* Check that a list is under construction */ if (!ctx->ListState.CurrentList) { _mesa_error(ctx, GL_INVALID_OPERATION, "glEndList"); @@ -8817,6 +8825,9 @@ _mesa_initialize_save_table(const struct gl_context *ctx) _mesa_loopback_init_api_table(ctx, table); + /* VBO functions */ + vbo_initialize_save_dispatch(ctx, table); + /* GL 1.0 */ SET_Accum(table, save_Accum); SET_AlphaFunc(table, save_AlphaFunc); @@ -8927,6 +8938,7 @@ _mesa_initialize_save_table(const struct gl_context *ctx) SET_RasterPos4s(table, save_RasterPos4s); SET_RasterPos4sv(table, save_RasterPos4sv); SET_ReadBuffer(table, save_ReadBuffer); + SET_Rectf(table, save_Rectf); SET_Rotated(table, save_Rotated); SET_Rotatef(table, save_Rotatef); SET_Scaled(table, save_Scaled); @@ -9256,6 +9268,18 @@ _mesa_initialize_save_table(const struct gl_context *ctx) /* GL_ARB_uniform_buffer_object */ SET_UniformBlockBinding(table, save_UniformBlockBinding); + + /* GL_ARB_draw_instanced */ + SET_DrawArraysInstancedARB(table, save_DrawArraysInstancedARB); + SET_DrawElementsInstancedARB(table, save_DrawElementsInstancedARB); + + /* GL_ARB_draw_elements_base_vertex */ + SET_DrawElementsInstancedBaseVertex(table, save_DrawElementsInstancedBaseVertexARB); + + /* GL_ARB_base_instance */ + SET_DrawArraysInstancedBaseInstance(table, save_DrawArraysInstancedBaseInstance); + SET_DrawElementsInstancedBaseInstance(table, save_DrawElementsInstancedBaseInstance); + SET_DrawElementsInstancedBaseVertexBaseInstance(table, save_DrawElementsInstancedBaseVertexBaseInstance); } @@ -9548,14 +9572,15 @@ mesa_print_display_list(GLuint list) /***** Initialization *****/ /**********************************************************************/ -void -_mesa_save_vtxfmt_init(GLvertexformat * vfmt) +static void +save_vtxfmt_init(GLvertexformat * vfmt) { - _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_); + vfmt->ArrayElement = _ae_ArrayElement; vfmt->Begin = save_Begin; - _MESA_INIT_DLIST_VTXFMT(vfmt, save_); + vfmt->CallList = save_CallList; + vfmt->CallLists = save_CallLists; vfmt->Color3f = save_Color3f; vfmt->Color3fv = save_Color3fv; @@ -9564,7 +9589,12 @@ _mesa_save_vtxfmt_init(GLvertexformat * vfmt) vfmt->EdgeFlag = save_EdgeFlag; vfmt->End = save_End; - _MESA_INIT_EVAL_VTXFMT(vfmt, save_); + vfmt->EvalCoord1f = save_EvalCoord1f; + vfmt->EvalCoord1fv = save_EvalCoord1fv; + vfmt->EvalCoord2f = save_EvalCoord2f; + vfmt->EvalCoord2fv = save_EvalCoord2fv; + vfmt->EvalPoint1 = save_EvalPoint1; + vfmt->EvalPoint2 = save_EvalPoint2; vfmt->FogCoordfEXT = save_FogCoordfEXT; vfmt->FogCoordfvEXT = save_FogCoordfvEXT; @@ -9605,36 +9635,6 @@ _mesa_save_vtxfmt_init(GLvertexformat * vfmt) vfmt->VertexAttrib3fvARB = save_VertexAttrib3fvARB; vfmt->VertexAttrib4fARB = save_VertexAttrib4fARB; vfmt->VertexAttrib4fvARB = save_VertexAttrib4fvARB; - - vfmt->Rectf = save_Rectf; - - /* GL_ARB_draw_instanced */ - vfmt->DrawArraysInstanced = save_DrawArraysInstancedARB; - vfmt->DrawElementsInstanced = save_DrawElementsInstancedARB; - - /* GL_ARB_draw_elements_base_vertex */ - vfmt->DrawElementsInstancedBaseVertex = save_DrawElementsInstancedBaseVertexARB; - - /* GL_ARB_base_instance */ - vfmt->DrawArraysInstancedBaseInstance = save_DrawArraysInstancedBaseInstance; - vfmt->DrawElementsInstancedBaseInstance = save_DrawElementsInstancedBaseInstance; - vfmt->DrawElementsInstancedBaseVertexBaseInstance = save_DrawElementsInstancedBaseVertexBaseInstance; - - /* The driver is required to implement these as - * 1) They can probably do a better job. - * 2) A lot of new mechanisms would have to be added to this module - * to support it. That code would probably never get used, - * because of (1). - */ -#if 0 - vfmt->DrawArrays = 0; - vfmt->DrawElements = 0; - vfmt->DrawRangeElements = 0; - vfmt->MultiDrawElemementsEXT = 0; - vfmt->DrawElementsBaseVertex = 0; - vfmt->DrawRangeElementsBaseVertex = 0; - vfmt->MultiDrawElemementsBaseVertex = 0; -#endif } @@ -9674,7 +9674,7 @@ _mesa_init_display_list(struct gl_context *ctx) /* Display List group */ ctx->List.ListBase = 0; - _mesa_save_vtxfmt_init(&ctx->ListState.ListVtxfmt); + save_vtxfmt_init(&ctx->ListState.ListVtxfmt); } diff --git a/mesalib/src/mesa/main/dlist.h b/mesalib/src/mesa/main/dlist.h index e049476c1..4672d3e60 100644 --- a/mesalib/src/mesa/main/dlist.h +++ b/mesalib/src/mesa/main/dlist.h @@ -22,9 +22,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -33,16 +34,9 @@ #define DLIST_H -#include "main/mfeatures.h" #include "main/mtypes.h" -#define _MESA_INIT_DLIST_VTXFMT(vfmt, impl) \ - do { \ - (vfmt)->CallList = impl ## CallList; \ - (vfmt)->CallLists = impl ## CallLists; \ - } while (0) - GLboolean GLAPIENTRY _mesa_IsList(GLuint list); void GLAPIENTRY @@ -72,8 +66,6 @@ extern GLint _mesa_dlist_alloc_opcode( struct gl_context *ctx, GLuint sz, extern void _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist); -extern void _mesa_save_vtxfmt_init( GLvertexformat *vfmt ); - extern void _mesa_initialize_save_table(const struct gl_context *); extern void _mesa_install_dlist_vtxfmt(struct _glapi_table *disp, diff --git a/mesalib/src/mesa/main/dlopen.h b/mesalib/src/mesa/main/dlopen.h index a5366a14e..55a56f0d7 100644 --- a/mesalib/src/mesa/main/dlopen.h +++ b/mesalib/src/mesa/main/dlopen.h @@ -16,9 +16,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/drawpix.c b/mesalib/src/mesa/main/drawpix.c index d9f55d3af..e69113bb1 100644 --- a/mesalib/src/mesa/main/drawpix.c +++ b/mesalib/src/mesa/main/drawpix.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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 "glheader.h" @@ -31,7 +32,6 @@ #include "feedback.h" #include "framebuffer.h" #include "image.h" -#include "mfeatures.h" #include "pbo.h" #include "state.h" #include "dispatch.h" diff --git a/mesalib/src/mesa/main/drawpix.h b/mesalib/src/mesa/main/drawpix.h index 087b3a8c9..57accbf0a 100644 --- a/mesalib/src/mesa/main/drawpix.h +++ b/mesalib/src/mesa/main/drawpix.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ #ifndef DRAWPIX_H @@ -27,7 +28,6 @@ #include "compiler.h" -#include "mfeatures.h" struct _glapi_table; diff --git a/mesalib/src/mesa/main/drawtex.c b/mesalib/src/mesa/main/drawtex.c index 7285805c8..7c0ec832b 100644 --- a/mesalib/src/mesa/main/drawtex.c +++ b/mesalib/src/mesa/main/drawtex.c @@ -24,7 +24,6 @@ #include "main/drawtex.h" #include "main/state.h" #include "main/imports.h" -#include "main/mfeatures.h" #include "main/mtypes.h" diff --git a/mesalib/src/mesa/main/drawtex.h b/mesalib/src/mesa/main/drawtex.h index b916150b7..28e2435c8 100644 --- a/mesalib/src/mesa/main/drawtex.h +++ b/mesalib/src/mesa/main/drawtex.h @@ -26,7 +26,6 @@ #include "glheader.h" -#include "mfeatures.h" extern void GLAPIENTRY diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c index b688f050b..fdde24e36 100644 --- a/mesalib/src/mesa/main/enable.c +++ b/mesalib/src/mesa/main/enable.c @@ -21,9 +21,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -33,7 +34,6 @@ #include "enable.h" #include "light.h" #include "simple_list.h" -#include "mfeatures.h" #include "mtypes.h" #include "enums.h" #include "api_arrayelt.h" @@ -53,11 +53,6 @@ update_derived_primitive_restart_state(struct gl_context *ctx) { /* Update derived primitive restart state. */ - if (ctx->Array.PrimitiveRestart) - ctx->Array._RestartIndex = ctx->Array.RestartIndex; - else - ctx->Array._RestartIndex = ~0; - ctx->Array._PrimitiveRestart = ctx->Array.PrimitiveRestart || ctx->Array.PrimitiveRestartFixedIndex; } @@ -140,8 +135,6 @@ client_state(struct gl_context *ctx, GLenum cap, GLboolean state) else arrayObj->_Enabled &= ~flag; - arrayObj->NewArrays |= flag; - if (ctx->Driver.Enable) { ctx->Driver.Enable( ctx, cap, state ); } @@ -419,10 +412,6 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); ctx->Light.Enabled = state; - if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) - ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE; - else - ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE; break; case GL_LINE_SMOOTH: if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES) @@ -431,7 +420,6 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) return; FLUSH_VERTICES(ctx, _NEW_LINE); ctx->Line.SmoothFlag = state; - ctx->_TriangleCaps ^= DD_LINE_SMOOTH; break; case GL_LINE_STIPPLE: if (ctx->API != API_OPENGL_COMPAT) @@ -440,7 +428,6 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) return; FLUSH_VERTICES(ctx, _NEW_LINE); ctx->Line.StippleFlag = state; - ctx->_TriangleCaps ^= DD_LINE_STIPPLE; break; case GL_INDEX_LOGIC_OP: if (ctx->API != API_OPENGL_COMPAT) @@ -617,7 +604,6 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) return; FLUSH_VERTICES(ctx, _NEW_POINT); ctx->Point.SmoothFlag = state; - ctx->_TriangleCaps ^= DD_POINT_SMOOTH; break; case GL_POLYGON_SMOOTH: if (!_mesa_is_desktop_gl(ctx)) @@ -626,7 +612,6 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) return; FLUSH_VERTICES(ctx, _NEW_POLYGON); ctx->Polygon.SmoothFlag = state; - ctx->_TriangleCaps ^= DD_TRI_SMOOTH; break; case GL_POLYGON_STIPPLE: if (ctx->API != API_OPENGL_COMPAT) @@ -635,7 +620,6 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) return; FLUSH_VERTICES(ctx, _NEW_POLYGON); ctx->Polygon.StippleFlag = state; - ctx->_TriangleCaps ^= DD_TRI_STIPPLE; break; case GL_POLYGON_OFFSET_POINT: if (!_mesa_is_desktop_gl(ctx)) @@ -966,7 +950,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; CHECK_EXTENSION(EXT_transform_feedback, cap); if (ctx->RasterDiscard != state) { - FLUSH_VERTICES(ctx, _NEW_RASTERIZER_DISCARD); + FLUSH_VERTICES(ctx, 0); + ctx->NewDriverState |= ctx->DriverFlags.NewRasterizerDiscard; ctx->RasterDiscard = state; } break; diff --git a/mesalib/src/mesa/main/enable.h b/mesalib/src/mesa/main/enable.h index 5b2515d59..060da5656 100644 --- a/mesalib/src/mesa/main/enable.h +++ b/mesalib/src/mesa/main/enable.h @@ -22,9 +22,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/enums.h b/mesalib/src/mesa/main/enums.h index 8f4069426..b2f373a4c 100644 --- a/mesalib/src/mesa/main/enums.h +++ b/mesalib/src/mesa/main/enums.h @@ -27,16 +27,16 @@ * 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 - * BRIAN PAUL 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. + * 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. */ #ifndef _ENUMS_H_ #define _ENUMS_H_ -#include "mfeatures.h" extern const char *_mesa_lookup_enum_by_nr( int nr ); diff --git a/mesalib/src/mesa/main/errors.c b/mesalib/src/mesa/main/errors.c index 5c6a393e4..0ee3daef3 100644 --- a/mesalib/src/mesa/main/errors.c +++ b/mesalib/src/mesa/main/errors.c @@ -22,9 +22,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/errors.h b/mesalib/src/mesa/main/errors.h index 7d8be5aca..b21a44c98 100644 --- a/mesalib/src/mesa/main/errors.h +++ b/mesalib/src/mesa/main/errors.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -73,6 +74,16 @@ _mesa_gl_debug(struct gl_context *ctx, enum mesa_debug_severity severity, const char *fmtString, ...) PRINTFLIKE(5, 6); +#define _mesa_perf_debug(ctx, sev, ...) do { \ + static GLuint msg_id = 0; \ + if (unlikely(ctx->Const.ContextFlags & GL_CONTEXT_FLAG_DEBUG_BIT)) { \ + _mesa_gl_debug(ctx, &msg_id, \ + MESA_DEBUG_TYPE_PERFORMANCE, \ + sev, \ + __VA_ARGS__); \ + } \ +} while (0) + extern void _mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint *id, const char *msg, int len); diff --git a/mesalib/src/mesa/main/es1_conversion.c b/mesalib/src/mesa/main/es1_conversion.c index cd527dd78..60a60e287 100644 --- a/mesalib/src/mesa/main/es1_conversion.c +++ b/mesalib/src/mesa/main/es1_conversion.c @@ -1,5 +1,4 @@ #include <stdbool.h> -#include "main/mfeatures.h" #include "api_loopback.h" #include "api_exec.h" diff --git a/mesalib/src/mesa/main/eval.c b/mesalib/src/mesa/main/eval.c index b3c284175..349331f00 100644 --- a/mesalib/src/mesa/main/eval.c +++ b/mesalib/src/mesa/main/eval.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -43,7 +44,6 @@ #include "context.h" #include "eval.h" #include "macros.h" -#include "mfeatures.h" #include "mtypes.h" #include "main/dispatch.h" @@ -824,8 +824,7 @@ _mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2, void _mesa_install_eval_vtxfmt(struct _glapi_table *disp, - const GLvertexformat *vfmt, - bool beginend) + const GLvertexformat *vfmt) { SET_EvalCoord1f(disp, vfmt->EvalCoord1f); SET_EvalCoord1fv(disp, vfmt->EvalCoord1fv); @@ -833,13 +832,6 @@ _mesa_install_eval_vtxfmt(struct _glapi_table *disp, SET_EvalCoord2fv(disp, vfmt->EvalCoord2fv); SET_EvalPoint1(disp, vfmt->EvalPoint1); SET_EvalPoint2(disp, vfmt->EvalPoint2); - - /* glEvalMesh1 and glEvalMesh2 are not allowed between glBegin and glEnd. - */ - if (!beginend) { - SET_EvalMesh1(disp, vfmt->EvalMesh1); - SET_EvalMesh2(disp, vfmt->EvalMesh2); - } } diff --git a/mesalib/src/mesa/main/eval.h b/mesalib/src/mesa/main/eval.h index cfde53fd6..33240f00d 100644 --- a/mesalib/src/mesa/main/eval.h +++ b/mesalib/src/mesa/main/eval.h @@ -27,9 +27,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -37,23 +38,10 @@ #define EVAL_H -#include "main/mfeatures.h" #include "main/mtypes.h" #include <stdbool.h> -#define _MESA_INIT_EVAL_VTXFMT(vfmt, impl) \ - do { \ - (vfmt)->EvalCoord1f = impl ## EvalCoord1f; \ - (vfmt)->EvalCoord1fv = impl ## EvalCoord1fv; \ - (vfmt)->EvalCoord2f = impl ## EvalCoord2f; \ - (vfmt)->EvalCoord2fv = impl ## EvalCoord2fv; \ - (vfmt)->EvalPoint1 = impl ## EvalPoint1; \ - (vfmt)->EvalPoint2 = impl ## EvalPoint2; \ - (vfmt)->EvalMesh1 = impl ## EvalMesh1; \ - (vfmt)->EvalMesh2 = impl ## EvalMesh2; \ - } while (0) - extern GLuint _mesa_evaluator_components( GLenum target ); @@ -77,8 +65,7 @@ extern GLfloat *_mesa_copy_map_points2d(GLenum target, extern void _mesa_install_eval_vtxfmt(struct _glapi_table *disp, - const GLvertexformat *vfmt, - bool beginend); + const GLvertexformat *vfmt); extern void _mesa_init_eval( struct gl_context *ctx ); extern void _mesa_free_eval_data( struct gl_context *ctx ); diff --git a/mesalib/src/mesa/main/execmem.c b/mesalib/src/mesa/main/execmem.c index ccd6ab43f..5f319661e 100644 --- a/mesalib/src/mesa/main/execmem.c +++ b/mesalib/src/mesa/main/execmem.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -36,7 +37,7 @@ -#if defined(__linux__) || defined(__OpenBSD__) || defined(_NetBSD__) || defined(__sun) +#if defined(__linux__) || defined(__OpenBSD__) || defined(_NetBSD__) || defined(__sun) || defined(__HAIKU__) /* * Allocate a large block of memory which can hold code then dole it out diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index c7f038b88..39aaad48a 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -35,7 +36,6 @@ #include "context.h" #include "extensions.h" #include "macros.h" -#include "mfeatures.h" #include "mtypes.h" enum { @@ -102,6 +102,7 @@ static const struct extension extension_table[] = { { "GL_ARB_framebuffer_object", o(ARB_framebuffer_object), GL, 2005 }, { "GL_ARB_framebuffer_sRGB", o(EXT_framebuffer_sRGB), GL, 1998 }, { "GL_ARB_get_program_binary", o(ARB_shader_objects), GL, 2010 }, + { "GL_ARB_gpu_shader5", o(ARB_gpu_shader5), GL, 2010 }, { "GL_ARB_half_float_pixel", o(ARB_half_float_pixel), GL, 2003 }, { "GL_ARB_half_float_vertex", o(ARB_half_float_vertex), GL, 2008 }, { "GL_ARB_instanced_arrays", o(ARB_instanced_arrays), GL, 2008 }, @@ -183,6 +184,7 @@ static const struct extension extension_table[] = { { "GL_EXT_fog_coord", o(EXT_fog_coord), GLL, 1999 }, { "GL_EXT_framebuffer_blit", o(EXT_framebuffer_blit), GL, 2005 }, { "GL_EXT_framebuffer_multisample", o(EXT_framebuffer_multisample), GL, 2005 }, + { "GL_EXT_framebuffer_multisample_blit_scaled", o(EXT_framebuffer_multisample_blit_scaled), GL, 2011 }, { "GL_EXT_framebuffer_object", o(EXT_framebuffer_object), GL, 2000 }, { "GL_EXT_framebuffer_sRGB", o(EXT_framebuffer_sRGB), GL, 1998 }, { "GL_EXT_gpu_program_parameters", o(EXT_gpu_program_parameters), GLL, 2006 }, @@ -278,7 +280,7 @@ static const struct extension extension_table[] = { { "GL_OES_texture_cube_map", o(ARB_texture_cube_map), ES1, 2007 }, { "GL_OES_texture_env_crossbar", o(ARB_texture_env_crossbar), ES1, 2005 }, { "GL_OES_texture_mirrored_repeat", o(dummy_true), ES1, 2005 }, - { "GL_OES_texture_npot", o(ARB_texture_non_power_of_two), ES2, 2005 }, + { "GL_OES_texture_npot", o(ARB_texture_non_power_of_two), ES1 | ES2, 2005 }, { "GL_OES_vertex_array_object", o(dummy_true), ES1 | ES2, 2010 }, /* Vendor extensions */ @@ -287,6 +289,7 @@ static const struct extension extension_table[] = { { "GL_AMD_draw_buffers_blend", o(ARB_draw_buffers_blend), GL, 2009 }, { "GL_AMD_seamless_cubemap_per_texture", o(AMD_seamless_cubemap_per_texture), GL, 2009 }, { "GL_AMD_shader_stencil_export", o(ARB_shader_stencil_export), GL, 2009 }, + { "GL_AMD_vertex_shader_layer", o(AMD_vertex_shader_layer), GL, 2012 }, { "GL_APPLE_object_purgeable", o(APPLE_object_purgeable), GL, 2006 }, { "GL_APPLE_packed_pixels", o(dummy_true), GLL, 2002 }, { "GL_APPLE_texture_max_level", o(dummy_true), ES1 | ES2, 2009 }, @@ -398,7 +401,9 @@ _mesa_enable_sw_extensions(struct gl_context *ctx) ctx->Extensions.ARB_texture_env_combine = GL_TRUE; ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE; ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE; - /*ctx->Extensions.ARB_texture_float = GL_TRUE;*/ +#ifdef TEXTURE_FLOAT_ENABLED + ctx->Extensions.ARB_texture_float = GL_TRUE; +#endif ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE; ctx->Extensions.ARB_texture_rg = GL_TRUE; ctx->Extensions.ARB_texture_compression_rgtc = GL_TRUE; diff --git a/mesalib/src/mesa/main/extensions.h b/mesalib/src/mesa/main/extensions.h index 8acbd4b68..6e99116da 100644 --- a/mesalib/src/mesa/main/extensions.h +++ b/mesalib/src/mesa/main/extensions.h @@ -27,9 +27,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -37,7 +38,6 @@ #define _EXTENSIONS_H_ #include "glheader.h" -#include "mfeatures.h" struct gl_context; diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index fc2b2620b..39fa242f7 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -42,7 +43,6 @@ #include "glformats.h" #include "hash.h" #include "macros.h" -#include "mfeatures.h" #include "multisample.h" #include "mtypes.h" #include "renderbuffer.h" @@ -323,12 +323,14 @@ void _mesa_remove_attachment(struct gl_context *ctx, struct gl_renderbuffer_attachment *att) { + struct gl_renderbuffer *rb = att->Renderbuffer; + + /* tell driver that we're done rendering to this texture. */ + if (rb && rb->NeedsFinishRenderTexture) + ctx->Driver.FinishRenderTexture(ctx, rb); + if (att->Type == GL_TEXTURE) { ASSERT(att->Texture); - if (ctx->Driver.FinishRenderTexture) { - /* tell driver that we're done rendering to this texture. */ - ctx->Driver.FinishRenderTexture(ctx, att); - } _mesa_reference_texobj(&att->Texture, NULL); /* unbind */ ASSERT(!att->Texture); } @@ -341,6 +343,57 @@ _mesa_remove_attachment(struct gl_context *ctx, att->Complete = GL_TRUE; } +/** + * Create a renderbuffer which will be set up by the driver to wrap the + * texture image slice. + * + * By using a gl_renderbuffer (like user-allocated renderbuffers), drivers get + * to share most of their framebuffer rendering code between winsys, + * renderbuffer, and texture attachments. + * + * The allocated renderbuffer uses a non-zero Name so that drivers can check + * it for determining vertical orientation, but we use ~0 to make it fairly + * unambiguous with actual user (non-texture) renderbuffers. + */ +void +_mesa_update_texture_renderbuffer(struct gl_context *ctx, + struct gl_framebuffer *fb, + struct gl_renderbuffer_attachment *att) +{ + struct gl_texture_image *texImage; + struct gl_renderbuffer *rb; + + texImage = att->Texture->Image[att->CubeMapFace][att->TextureLevel]; + if (!texImage) + return; + + rb = att->Renderbuffer; + if (!rb) { + rb = ctx->Driver.NewRenderbuffer(ctx, ~0); + if (!rb) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glFramebufferTexture()"); + return; + } + _mesa_reference_renderbuffer(&att->Renderbuffer, rb); + + /* This can't get called on a texture renderbuffer, so set it to NULL + * for clarity compared to user renderbuffers. + */ + rb->AllocStorage = NULL; + + rb->NeedsFinishRenderTexture = ctx->Driver.FinishRenderTexture != NULL; + } + + rb->_BaseFormat = texImage->_BaseFormat; + rb->Format = texImage->TexFormat; + rb->InternalFormat = texImage->InternalFormat; + rb->Width = texImage->Width2; + rb->Height = texImage->Height2; + rb->NumSamples = texImage->NumSamples; + rb->TexImage = texImage; + + ctx->Driver.RenderTexture(ctx, fb, att); +} /** * Bind a texture object to an attachment point. @@ -351,35 +404,35 @@ _mesa_set_texture_attachment(struct gl_context *ctx, struct gl_framebuffer *fb, struct gl_renderbuffer_attachment *att, struct gl_texture_object *texObj, - GLenum texTarget, GLuint level, GLuint zoffset) + GLenum texTarget, GLuint level, GLuint zoffset, + GLboolean layered) { + struct gl_renderbuffer *rb = att->Renderbuffer; + + if (rb && rb->NeedsFinishRenderTexture) + ctx->Driver.FinishRenderTexture(ctx, rb); + if (att->Texture == texObj) { /* re-attaching same texture */ ASSERT(att->Type == GL_TEXTURE); - if (ctx->Driver.FinishRenderTexture) - ctx->Driver.FinishRenderTexture(ctx, att); } else { /* new attachment */ - if (ctx->Driver.FinishRenderTexture && att->Texture) - ctx->Driver.FinishRenderTexture(ctx, att); _mesa_remove_attachment(ctx, att); att->Type = GL_TEXTURE; assert(!att->Texture); _mesa_reference_texobj(&att->Texture, texObj); } + invalidate_framebuffer(fb); /* always update these fields */ att->TextureLevel = level; att->CubeMapFace = _mesa_tex_target_to_face(texTarget); att->Zoffset = zoffset; + att->Layered = layered; att->Complete = GL_FALSE; - if (_mesa_get_attachment_teximage(att)) { - ctx->Driver.RenderTexture(ctx, fb, att); - } - - invalidate_framebuffer(fb); + _mesa_update_texture_renderbuffer(ctx, fb, att); } @@ -775,6 +828,8 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, GLint fixedSampleLocations = -1; GLint i; GLuint j; + bool layer_count_valid = false; + GLuint layer_count = 0, att_layer_count; assert(_mesa_is_user_fbo(fb)); @@ -835,8 +890,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, /* get width, height, format of the renderbuffer/texture */ if (att->Type == GL_TEXTURE) { - const struct gl_texture_image *texImg = - _mesa_get_attachment_teximage(att); + const struct gl_texture_image *texImg = att->Renderbuffer->TexImage; minWidth = MIN2(minWidth, texImg->Width); maxWidth = MAX2(maxWidth, texImg->Width); minHeight = MIN2(minHeight, texImg->Height); @@ -947,8 +1001,26 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, fbo_incomplete("unsupported renderbuffer format", i); return; } + + /* Check that layered rendering is consistent. */ + att_layer_count = att->Layered ? att->Renderbuffer->Depth : 0; + if (!layer_count_valid) { + layer_count = att_layer_count; + layer_count_valid = true; + } else if (layer_count != att_layer_count) { + if (layer_count == 0 || att_layer_count == 0) { + fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS; + fbo_incomplete("framebuffer attachment layer mode is inconsistent", i); + } else { + fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB; + fbo_incomplete("framebuffer attachment layer count is inconsistent", i); + } + return; + } } + fb->Layered = layer_count > 0; + if (_mesa_is_desktop_gl(ctx) && !ctx->Extensions.ARB_ES2_compatibility) { /* Check that all DrawBuffers are present */ for (j = 0; j < ctx->Const.MaxDrawBuffers; j++) { @@ -1790,7 +1862,7 @@ check_begin_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb) for (i = 0; i < BUFFER_COUNT; i++) { struct gl_renderbuffer_attachment *att = fb->Attachment + i; - if (att->Texture && _mesa_get_attachment_teximage(att)) { + if (att->Texture && att->Renderbuffer->TexImage) { ctx->Driver.RenderTexture(ctx, fb, att); } } @@ -1812,8 +1884,9 @@ check_end_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb) GLuint i; for (i = 0; i < BUFFER_COUNT; i++) { struct gl_renderbuffer_attachment *att = fb->Attachment + i; - if (att->Texture && att->Renderbuffer) { - ctx->Driver.FinishRenderTexture(ctx, att); + struct gl_renderbuffer *rb = att->Renderbuffer; + if (rb && rb->NeedsFinishRenderTexture) { + ctx->Driver.FinishRenderTexture(ctx, rb); } } } @@ -2103,7 +2176,7 @@ reuse_framebuffer_texture_attachment(struct gl_framebuffer *fb, static void framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, - GLint level, GLint zoffset) + GLint level, GLint zoffset, GLboolean layered) { struct gl_renderbuffer_attachment *att; struct gl_texture_object *texObj = NULL; @@ -2230,7 +2303,7 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, BUFFER_DEPTH); } else { _mesa_set_texture_attachment(ctx, fb, att, texObj, textarget, - level, zoffset); + level, zoffset, layered); if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { /* Above we created a new renderbuffer and attached it to the * depth attachment point. Now attach it to the stencil attachment @@ -2296,7 +2369,7 @@ _mesa_FramebufferTexture1D(GLenum target, GLenum attachment, } framebuffer_texture(ctx, "1D", target, attachment, textarget, texture, - level, 0); + level, 0, GL_FALSE); } @@ -2347,7 +2420,7 @@ _mesa_FramebufferTexture2D(GLenum target, GLenum attachment, } framebuffer_texture(ctx, "2D", target, attachment, textarget, texture, - level, 0); + level, 0, GL_FALSE); } @@ -2365,7 +2438,7 @@ _mesa_FramebufferTexture3D(GLenum target, GLenum attachment, } framebuffer_texture(ctx, "3D", target, attachment, textarget, texture, - level, zoffset); + level, zoffset, GL_FALSE); } @@ -2376,7 +2449,23 @@ _mesa_FramebufferTextureLayer(GLenum target, GLenum attachment, GET_CURRENT_CONTEXT(ctx); framebuffer_texture(ctx, "Layer", target, attachment, 0, texture, - level, layer); + level, layer, GL_FALSE); +} + + +void GLAPIENTRY +_mesa_FramebufferTexture(GLenum target, GLenum attachment, + GLuint texture, GLint level) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->Version >= 32 || ctx->Extensions.ARB_geometry_shader4) { + framebuffer_texture(ctx, "Layer", target, attachment, 0, texture, + level, 0, GL_TRUE); + } else { + _mesa_error(ctx, GL_INVALID_OPERATION, + "unsupported function (glFramebufferTexture) called"); + } } @@ -2725,7 +2814,7 @@ _mesa_GenerateMipmap(GLenum target) GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, _NEW_BUFFERS); + FLUSH_VERTICES(ctx, 0); switch (target) { case GL_TEXTURE_1D: @@ -2891,6 +2980,20 @@ compatible_resolve_formats(const struct gl_renderbuffer *readRb, return GL_FALSE; } +static GLboolean +is_valid_blit_filter(const struct gl_context *ctx, GLenum filter) +{ + switch (filter) { + case GL_NEAREST: + case GL_LINEAR: + return true; + case GL_SCALED_RESOLVE_FASTEST_EXT: + case GL_SCALED_RESOLVE_NICEST_EXT: + return ctx->Extensions.EXT_framebuffer_multisample_blit_scaled; + default: + return false; + } +} /** * Blit rectangular region, optionally from one framebuffer to another. @@ -2909,7 +3012,7 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, const struct gl_framebuffer *readFb, *drawFb; GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, _NEW_BUFFERS); + FLUSH_VERTICES(ctx, 0); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, @@ -2940,8 +3043,17 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, return; } - if (filter != GL_NEAREST && filter != GL_LINEAR) { - _mesa_error(ctx, GL_INVALID_ENUM, "glBlitFramebufferEXT(filter)"); + if (!is_valid_blit_filter(ctx, filter)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glBlitFramebufferEXT(%s)", + _mesa_lookup_enum_by_nr(filter)); + return; + } + + if ((filter == GL_SCALED_RESOLVE_FASTEST_EXT || + filter == GL_SCALED_RESOLVE_NICEST_EXT) && + (readFb->Visual.samples == 0 || drawFb->Visual.samples > 0)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glBlitFramebufferEXT(%s)", + _mesa_lookup_enum_by_nr(filter)); return; } @@ -3013,10 +3125,10 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, } } } - if (filter == GL_LINEAR) { - /* 3.1 spec, page 199: + if (filter != GL_NEAREST) { + /* From EXT_framebuffer_multisample_blit_scaled specification: * "Calling BlitFramebuffer will result in an INVALID_OPERATION error - * if filter is LINEAR and read buffer contains integer data." + * if filter is not NEAREST and read buffer contains integer data." */ GLenum type = _mesa_get_format_datatype(colorReadRb->Format); if (type == GL_INT || type == GL_UNSIGNED_INT) { @@ -3174,7 +3286,8 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, } /* extra checks for multisample copies... */ - if (readFb->Visual.samples > 0 || drawFb->Visual.samples > 0) { + if ((readFb->Visual.samples > 0 || drawFb->Visual.samples > 0) && + (filter == GL_NEAREST || filter == GL_LINEAR)) { /* src and dest region sizes must be the same */ if (abs(srcX1 - srcX0) != abs(dstX1 - dstX0) || abs(srcY1 - srcY0) != abs(dstY1 - dstY0)) { diff --git a/mesalib/src/mesa/main/fbobject.h b/mesalib/src/mesa/main/fbobject.h index 0358864d7..dfd795a3a 100644 --- a/mesalib/src/mesa/main/fbobject.h +++ b/mesalib/src/mesa/main/fbobject.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -70,25 +71,6 @@ extern struct gl_renderbuffer_attachment * _mesa_get_attachment(struct gl_context *ctx, struct gl_framebuffer *fb, GLenum attachment); - -/** Return the texture image for a renderbuffer attachment */ -static inline struct gl_texture_image * -_mesa_get_attachment_teximage(struct gl_renderbuffer_attachment *att) -{ - assert(att->Type == GL_TEXTURE); - return att->Texture->Image[att->CubeMapFace][att->TextureLevel]; -} - - -/** Return the (const) texture image for a renderbuffer attachment */ -static inline const struct gl_texture_image * -_mesa_get_attachment_teximage_const(const struct gl_renderbuffer_attachment *att) -{ - assert(att->Type == GL_TEXTURE); - return att->Texture->Image[att->CubeMapFace][att->TextureLevel]; -} - - extern void _mesa_remove_attachment(struct gl_context *ctx, struct gl_renderbuffer_attachment *att); @@ -98,13 +80,19 @@ _mesa_set_texture_attachment(struct gl_context *ctx, struct gl_framebuffer *fb, struct gl_renderbuffer_attachment *att, struct gl_texture_object *texObj, - GLenum texTarget, GLuint level, GLuint zoffset); + GLenum texTarget, GLuint level, GLuint zoffset, + GLboolean layered); extern void _mesa_set_renderbuffer_attachment(struct gl_context *ctx, struct gl_renderbuffer_attachment *att, struct gl_renderbuffer *rb); +void +_mesa_update_texture_renderbuffer(struct gl_context *ctx, + struct gl_framebuffer *fb, + struct gl_renderbuffer_attachment *att); + extern void _mesa_framebuffer_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb, @@ -191,6 +179,10 @@ _mesa_FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); extern void GLAPIENTRY +_mesa_FramebufferTexture(GLenum target, GLenum attachment, + GLuint texture, GLint level); + +extern void GLAPIENTRY _mesa_FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); diff --git a/mesalib/src/mesa/main/feedback.c b/mesalib/src/mesa/main/feedback.c index 5d4c6e40d..990d1da6c 100644 --- a/mesalib/src/mesa/main/feedback.c +++ b/mesalib/src/mesa/main/feedback.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** @@ -35,7 +36,6 @@ #include "enums.h" #include "feedback.h" #include "macros.h" -#include "mfeatures.h" #include "mtypes.h" #include "main/dispatch.h" diff --git a/mesalib/src/mesa/main/feedback.h b/mesalib/src/mesa/main/feedback.h index a697dc0d2..48c0efc7d 100644 --- a/mesalib/src/mesa/main/feedback.h +++ b/mesalib/src/mesa/main/feedback.h @@ -18,16 +18,16 @@ * 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 - * BRIAN PAUL 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. + * 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. */ #ifndef FEEDBACK_H #define FEEDBACK_H -#include "main/mfeatures.h" #include "main/mtypes.h" diff --git a/mesalib/src/mesa/main/ff_fragment_shader.cpp b/mesalib/src/mesa/main/ff_fragment_shader.cpp index 01a4542d7..91c425be6 100644 --- a/mesalib/src/mesa/main/ff_fragment_shader.cpp +++ b/mesalib/src/mesa/main/ff_fragment_shader.cpp @@ -1336,7 +1336,10 @@ create_new_program(struct gl_context *ctx, struct state_key *key) validate_ir_tree(p.shader->ir); - while (do_common_optimization(p.shader->ir, false, false, 32)) + const struct gl_shader_compiler_options *options = + &ctx->ShaderCompilerOptions[MESA_SHADER_FRAGMENT]; + + while (do_common_optimization(p.shader->ir, false, false, 32, options)) ; reparent_ir(p.shader->ir, p.shader->ir); diff --git a/mesalib/src/mesa/main/ffvertex_prog.c b/mesalib/src/mesa/main/ffvertex_prog.c index 093bc6651..be6ac0f2a 100644 --- a/mesalib/src/mesa/main/ffvertex_prog.c +++ b/mesalib/src/mesa/main/ffvertex_prog.c @@ -36,7 +36,6 @@ #include "main/glheader.h" #include "main/mtypes.h" #include "main/macros.h" -#include "main/mfeatures.h" #include "main/enums.h" #include "main/ffvertex_prog.h" #include "program/program.h" @@ -608,7 +607,6 @@ static void emit_op3fn(struct tnl_program *p, inst = &p->program->Base.Instructions[nr]; inst->Opcode = (enum prog_opcode) op; - inst->Data = 0; emit_arg( &inst->SrcReg[0], src0 ); emit_arg( &inst->SrcReg[1], src1 ); @@ -700,16 +698,11 @@ static void emit_normalize_vec3( struct tnl_program *p, struct ureg dest, struct ureg src ) { -#if 0 - /* XXX use this when drivers are ready for NRM3 */ - emit_op1(p, OPCODE_NRM3, dest, WRITEMASK_XYZ, src); -#else struct ureg tmp = get_temp(p); emit_op2(p, OPCODE_DP3, tmp, WRITEMASK_X, src, src); emit_op1(p, OPCODE_RSQ, tmp, WRITEMASK_X, tmp); emit_op2(p, OPCODE_MUL, dest, 0, src, swizzle1(tmp, X)); release_temp(p, tmp); -#endif } @@ -1681,7 +1674,7 @@ _mesa_get_fixed_func_vertex_program(struct gl_context *ctx) return NULL; create_new_program( &key, prog, - ctx->mvp_with_dp4, + ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].PreferDP4, ctx->Const.VertexProgram.MaxTemps ); #if 0 diff --git a/mesalib/src/mesa/main/fog.c b/mesalib/src/mesa/main/fog.c index 3c5228ad5..7601651c3 100644 --- a/mesalib/src/mesa/main/fog.c +++ b/mesalib/src/mesa/main/fog.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/fog.h b/mesalib/src/mesa/main/fog.h index 20a75e96b..6bd1cc5ad 100644 --- a/mesalib/src/mesa/main/fog.h +++ b/mesalib/src/mesa/main/fog.h @@ -27,9 +27,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -38,7 +39,6 @@ #include "glheader.h" -#include "mfeatures.h" struct gl_context; diff --git a/mesalib/src/mesa/main/format_pack.c b/mesalib/src/mesa/main/format_pack.c index 1a14b98b7..826fc10a6 100644 --- a/mesalib/src/mesa/main/format_pack.c +++ b/mesalib/src/mesa/main/format_pack.c @@ -16,9 +16,10 @@ * 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 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. + * 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. */ diff --git a/mesalib/src/mesa/main/format_pack.h b/mesalib/src/mesa/main/format_pack.h index 20b2ad8a5..ebd103d03 100644 --- a/mesalib/src/mesa/main/format_pack.h +++ b/mesalib/src/mesa/main/format_pack.h @@ -16,9 +16,10 @@ * 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 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. + * 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. */ diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c index 0933b4e87..0a8b8b183 100644 --- a/mesalib/src/mesa/main/format_unpack.c +++ b/mesalib/src/mesa/main/format_unpack.c @@ -16,9 +16,10 @@ * 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 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. + * 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. */ @@ -610,6 +611,20 @@ unpack_ARGB2101010(const void *src, GLfloat dst[][4], GLuint n) static void +unpack_ARGB2101010_UINT(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLuint *s = (const GLuint *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (GLfloat)((s[i] >> 20) & 0x3ff); + dst[i][GCOMP] = (GLfloat)((s[i] >> 10) & 0x3ff); + dst[i][BCOMP] = (GLfloat)((s[i] >> 0) & 0x3ff); + dst[i][ACOMP] = (GLfloat)((s[i] >> 30) & 0x03); + } +} + + +static void unpack_ABGR2101010_UINT(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = ((const GLuint *) src); @@ -1060,6 +1075,344 @@ unpack_RG_FLOAT16(const void *src, GLfloat dst[][4], GLuint n) } } +static void +unpack_ALPHA_UINT8(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLubyte *s = (const GLubyte *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = 0.0; + dst[i][ACOMP] = (GLfloat) s[i]; + } +} + +static void +unpack_ALPHA_UINT16(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLushort *s = (const GLushort *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = 0.0; + dst[i][ACOMP] = (GLfloat) s[i]; + } +} + +static void +unpack_ALPHA_UINT32(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLuint *s = (const GLuint *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = 0.0; + dst[i][ACOMP] = (GLfloat) s[i]; + } +} + +static void +unpack_ALPHA_INT8(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLbyte *s = (const GLbyte *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = 0.0; + dst[i][ACOMP] = (GLfloat) s[i]; + } +} + +static void +unpack_ALPHA_INT16(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLshort *s = (const GLshort *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = 0.0; + dst[i][ACOMP] = (GLfloat) s[i]; + } +} + +static void +unpack_ALPHA_INT32(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLint *s = (const GLint *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = 0.0; + dst[i][ACOMP] = (GLfloat) s[i]; + } +} + +static void +unpack_INTENSITY_UINT8(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLubyte *s = (const GLubyte *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = + dst[i][ACOMP] = (GLfloat) s[i]; + } +} + +static void +unpack_INTENSITY_UINT16(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLushort *s = (const GLushort *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = + dst[i][ACOMP] = (GLfloat) s[i]; + } +} + +static void +unpack_INTENSITY_UINT32(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLuint *s = (const GLuint *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = + dst[i][ACOMP] = (GLfloat) s[i]; + } +} + +static void +unpack_INTENSITY_INT8(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLbyte *s = (const GLbyte *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = + dst[i][ACOMP] = (GLfloat) s[i]; + } +} + +static void +unpack_INTENSITY_INT16(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLshort *s = (const GLshort *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = + dst[i][ACOMP] = (GLfloat) s[i]; + } +} + +static void +unpack_INTENSITY_INT32(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLint *s = (const GLint *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = + dst[i][ACOMP] = (GLfloat) s[i]; + } +} + +static void +unpack_LUMINANCE_UINT8(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLubyte *s = (const GLubyte *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = dst[i][GCOMP] = dst[i][BCOMP] = (GLfloat) s[i]; + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_LUMINANCE_UINT16(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLushort *s = (const GLushort *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = dst[i][GCOMP] = dst[i][BCOMP] = (GLfloat) s[i]; + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_LUMINANCE_UINT32(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLuint *s = (const GLuint *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = dst[i][GCOMP] = dst[i][BCOMP] = (GLfloat) s[i]; + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_LUMINANCE_INT8(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLbyte *s = (const GLbyte *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = dst[i][GCOMP] = dst[i][BCOMP] = (GLfloat) s[i]; + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_LUMINANCE_INT16(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLshort *s = (const GLshort *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = dst[i][GCOMP] = dst[i][BCOMP] = (GLfloat) s[i]; + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_LUMINANCE_INT32(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLint *s = (const GLint *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = dst[i][GCOMP] = dst[i][BCOMP] = (GLfloat) s[i]; + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_LUMINANCE_ALPHA_UINT8(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLubyte *s = (const GLubyte *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = (GLfloat) s[2*i+0]; + dst[i][ACOMP] = (GLfloat) s[2*i+1]; + } +} + +static void +unpack_LUMINANCE_ALPHA_UINT16(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLushort *s = (const GLushort *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = (GLfloat) s[2*i+0]; + dst[i][ACOMP] = (GLfloat) s[2*i+1]; + } +} + +static void +unpack_LUMINANCE_ALPHA_UINT32(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLuint *s = (const GLuint *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = (GLfloat) s[2*i+0]; + dst[i][ACOMP] = (GLfloat) s[2*i+1]; + } +} + +static void +unpack_LUMINANCE_ALPHA_INT8(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLbyte *s = (const GLbyte *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = (GLfloat) s[2*i+0]; + dst[i][ACOMP] = (GLfloat) s[2*i+1]; + } +} + +static void +unpack_LUMINANCE_ALPHA_INT16(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLshort *s = (const GLshort *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = (GLfloat) s[2*i+0]; + dst[i][ACOMP] = (GLfloat) s[2*i+1]; + } +} + +static void +unpack_LUMINANCE_ALPHA_INT32(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLint *s = (const GLint *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = + dst[i][GCOMP] = + dst[i][BCOMP] = (GLfloat) s[2*i+0]; + dst[i][ACOMP] = (GLfloat) s[2*i+1]; + } +} + +static void +unpack_R_INT8(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLbyte *s = (const GLbyte *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (GLfloat) s[i]; + dst[i][GCOMP] = 0.0; + dst[i][BCOMP] = 0.0; + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_RG_INT8(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLbyte *s = (const GLbyte *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (GLfloat) s[i*2+0]; + dst[i][GCOMP] = (GLfloat) s[i*2+1]; + dst[i][BCOMP] = 0.0; + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_RGB_INT8(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLbyte *s = (const GLbyte *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (GLfloat) s[i*3+0]; + dst[i][GCOMP] = (GLfloat) s[i*3+1]; + dst[i][BCOMP] = (GLfloat) s[i*3+2]; + dst[i][ACOMP] = 1.0; + } +} static void unpack_RGBA_INT8(const void *src, GLfloat dst[][4], GLuint n) @@ -1075,6 +1428,45 @@ unpack_RGBA_INT8(const void *src, GLfloat dst[][4], GLuint n) } static void +unpack_R_INT16(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLshort *s = (const GLshort *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (GLfloat) s[i]; + dst[i][GCOMP] = 0.0; + dst[i][BCOMP] = 0.0; + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_RG_INT16(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLshort *s = (const GLshort *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (GLfloat) s[i*2+0]; + dst[i][GCOMP] = (GLfloat) s[i*2+1]; + dst[i][BCOMP] = 0.0; + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_RGB_INT16(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLshort *s = (const GLshort *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (GLfloat) s[i*3+0]; + dst[i][GCOMP] = (GLfloat) s[i*3+1]; + dst[i][BCOMP] = (GLfloat) s[i*3+2]; + dst[i][ACOMP] = 1.0; + } +} + +static void unpack_RGBA_INT16(const void *src, GLfloat dst[][4], GLuint n) { const GLshort *s = (const GLshort *) src; @@ -1088,6 +1480,46 @@ unpack_RGBA_INT16(const void *src, GLfloat dst[][4], GLuint n) } static void +unpack_R_INT32(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLint *s = (const GLint *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (GLfloat) s[i]; + dst[i][GCOMP] = 0.0; + dst[i][BCOMP] = 0.0; + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_RG_INT32(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLint *s = (const GLint *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (GLfloat) s[i*2+0]; + dst[i][GCOMP] = (GLfloat) s[i*2+1]; + dst[i][BCOMP] = 0.0; + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_RGB_INT32(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLint *s = (const GLint *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (GLfloat) s[i*3+0]; + dst[i][GCOMP] = (GLfloat) s[i*3+1]; + dst[i][BCOMP] = (GLfloat) s[i*3+2]; + dst[i][ACOMP] = 1.0; + } +} + + +static void unpack_RGBA_INT32(const void *src, GLfloat dst[][4], GLuint n) { const GLint *s = (const GLint *) src; @@ -1101,6 +1533,45 @@ unpack_RGBA_INT32(const void *src, GLfloat dst[][4], GLuint n) } static void +unpack_R_UINT8(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLubyte *s = (const GLubyte *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (GLfloat) s[i]; + dst[i][GCOMP] = 0.0; + dst[i][BCOMP] = 0.0; + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_RG_UINT8(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLubyte *s = (const GLubyte *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (GLfloat) s[i*2+0]; + dst[i][GCOMP] = (GLfloat) s[i*2+1]; + dst[i][BCOMP] = 0.0; + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_RGB_UINT8(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLubyte *s = (const GLubyte *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (GLfloat) s[i*3+0]; + dst[i][GCOMP] = (GLfloat) s[i*3+1]; + dst[i][BCOMP] = (GLfloat) s[i*3+2]; + dst[i][ACOMP] = 1.0; + } +} + +static void unpack_RGBA_UINT8(const void *src, GLfloat dst[][4], GLuint n) { const GLubyte *s = (const GLubyte *) src; @@ -1114,6 +1585,45 @@ unpack_RGBA_UINT8(const void *src, GLfloat dst[][4], GLuint n) } static void +unpack_R_UINT16(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLushort *s = (const GLushort *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (GLfloat) s[i]; + dst[i][GCOMP] = 0.0; + dst[i][BCOMP] = 0.0; + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_RG_UINT16(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLushort *s = (const GLushort *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (GLfloat) s[i*2+0]; + dst[i][GCOMP] = (GLfloat) s[i*2+1]; + dst[i][BCOMP] = 0.0; + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_RGB_UINT16(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLushort *s = (const GLushort *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (GLfloat) s[i*3+0]; + dst[i][GCOMP] = (GLfloat) s[i*3+1]; + dst[i][BCOMP] = (GLfloat) s[i*3+2]; + dst[i][ACOMP] = 1.0; + } +} + +static void unpack_RGBA_UINT16(const void *src, GLfloat dst[][4], GLuint n) { const GLushort *s = (const GLushort *) src; @@ -1127,6 +1637,45 @@ unpack_RGBA_UINT16(const void *src, GLfloat dst[][4], GLuint n) } static void +unpack_R_UINT32(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLuint *s = (const GLuint *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (GLfloat) s[i]; + dst[i][GCOMP] = 0.0; + dst[i][BCOMP] = 0.0; + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_RG_UINT32(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLuint *s = (const GLuint *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (GLfloat) s[i*2+0]; + dst[i][GCOMP] = (GLfloat) s[i*2+1]; + dst[i][BCOMP] = 0.0; + dst[i][ACOMP] = 1.0; + } +} + +static void +unpack_RGB_UINT32(const void *src, GLfloat dst[][4], GLuint n) +{ + const GLuint *s = (const GLuint *) src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i][RCOMP] = (GLfloat) s[i*3+0]; + dst[i][GCOMP] = (GLfloat) s[i*3+1]; + dst[i][BCOMP] = (GLfloat) s[i*3+2]; + dst[i][ACOMP] = 1.0; + } +} + +static void unpack_RGBA_UINT32(const void *src, GLfloat dst[][4], GLuint n) { const GLuint *s = (const GLuint *) src; @@ -1770,6 +2319,7 @@ get_unpack_rgba_function(gl_format format) table[MESA_FORMAT_GR1616] = unpack_GR1616; table[MESA_FORMAT_RG1616] = unpack_RG1616; table[MESA_FORMAT_ARGB2101010] = unpack_ARGB2101010; + table[MESA_FORMAT_ARGB2101010_UINT] = unpack_ARGB2101010_UINT; table[MESA_FORMAT_ABGR2101010_UINT] = unpack_ABGR2101010_UINT; table[MESA_FORMAT_Z24_S8] = unpack_Z24_S8; table[MESA_FORMAT_S8_Z24] = unpack_S8_Z24; @@ -1812,11 +2362,57 @@ get_unpack_rgba_function(gl_format format) table[MESA_FORMAT_RG_FLOAT32] = unpack_RG_FLOAT32; table[MESA_FORMAT_RG_FLOAT16] = unpack_RG_FLOAT16; + table[MESA_FORMAT_ALPHA_UINT8] = unpack_ALPHA_UINT8; + table[MESA_FORMAT_ALPHA_UINT16] = unpack_ALPHA_UINT16; + table[MESA_FORMAT_ALPHA_UINT32] = unpack_ALPHA_UINT32; + table[MESA_FORMAT_ALPHA_INT8] = unpack_ALPHA_INT8; + table[MESA_FORMAT_ALPHA_INT16] = unpack_ALPHA_INT16; + table[MESA_FORMAT_ALPHA_INT32] = unpack_ALPHA_INT32; + + table[MESA_FORMAT_INTENSITY_UINT8] = unpack_INTENSITY_UINT8; + table[MESA_FORMAT_INTENSITY_UINT16] = unpack_INTENSITY_UINT16; + table[MESA_FORMAT_INTENSITY_UINT32] = unpack_INTENSITY_UINT32; + table[MESA_FORMAT_INTENSITY_INT8] = unpack_INTENSITY_INT8; + table[MESA_FORMAT_INTENSITY_INT16] = unpack_INTENSITY_INT16; + table[MESA_FORMAT_INTENSITY_INT32] = unpack_INTENSITY_INT32; + + table[MESA_FORMAT_LUMINANCE_UINT8] = unpack_LUMINANCE_UINT8; + table[MESA_FORMAT_LUMINANCE_UINT16] = unpack_LUMINANCE_UINT16; + table[MESA_FORMAT_LUMINANCE_UINT32] = unpack_LUMINANCE_UINT32; + table[MESA_FORMAT_LUMINANCE_INT8] = unpack_LUMINANCE_INT8; + table[MESA_FORMAT_LUMINANCE_INT16] = unpack_LUMINANCE_INT16; + table[MESA_FORMAT_LUMINANCE_INT32] = unpack_LUMINANCE_INT32; + + table[MESA_FORMAT_LUMINANCE_ALPHA_UINT8] = unpack_LUMINANCE_ALPHA_UINT8; + table[MESA_FORMAT_LUMINANCE_ALPHA_UINT16] = unpack_LUMINANCE_ALPHA_UINT16; + table[MESA_FORMAT_LUMINANCE_ALPHA_UINT32] = unpack_LUMINANCE_ALPHA_UINT32; + table[MESA_FORMAT_LUMINANCE_ALPHA_INT8] = unpack_LUMINANCE_ALPHA_INT8; + table[MESA_FORMAT_LUMINANCE_ALPHA_INT16] = unpack_LUMINANCE_ALPHA_INT16; + table[MESA_FORMAT_LUMINANCE_ALPHA_INT32] = unpack_LUMINANCE_ALPHA_INT32; + + table[MESA_FORMAT_R_INT8] = unpack_R_INT8; + table[MESA_FORMAT_RG_INT8] = unpack_RG_INT8; + table[MESA_FORMAT_RGB_INT8] = unpack_RGB_INT8; table[MESA_FORMAT_RGBA_INT8] = unpack_RGBA_INT8; + table[MESA_FORMAT_R_INT16] = unpack_R_INT16; + table[MESA_FORMAT_RG_INT16] = unpack_RG_INT16; + table[MESA_FORMAT_RGB_INT16] = unpack_RGB_INT16; table[MESA_FORMAT_RGBA_INT16] = unpack_RGBA_INT16; + table[MESA_FORMAT_R_INT32] = unpack_R_INT32; + table[MESA_FORMAT_RG_INT32] = unpack_RG_INT32; + table[MESA_FORMAT_RGB_INT32] = unpack_RGB_INT32; table[MESA_FORMAT_RGBA_INT32] = unpack_RGBA_INT32; + table[MESA_FORMAT_R_UINT8] = unpack_R_UINT8; + table[MESA_FORMAT_RG_UINT8] = unpack_RG_UINT8; + table[MESA_FORMAT_RGB_UINT8] = unpack_RGB_UINT8; table[MESA_FORMAT_RGBA_UINT8] = unpack_RGBA_UINT8; + table[MESA_FORMAT_R_UINT16] = unpack_R_UINT16; + table[MESA_FORMAT_RG_UINT16] = unpack_RG_UINT16; + table[MESA_FORMAT_RGB_UINT16] = unpack_RGB_UINT16; table[MESA_FORMAT_RGBA_UINT16] = unpack_RGBA_UINT16; + table[MESA_FORMAT_R_UINT32] = unpack_R_UINT32; + table[MESA_FORMAT_RG_UINT32] = unpack_RG_UINT32; + table[MESA_FORMAT_RGB_UINT32] = unpack_RGB_UINT32; table[MESA_FORMAT_RGBA_UINT32] = unpack_RGBA_UINT32; table[MESA_FORMAT_DUDV8] = unpack_DUDV8; @@ -1852,7 +2448,7 @@ get_unpack_rgba_function(gl_format format) table[MESA_FORMAT_ETC2_SIGNED_RG11_EAC] = unpack_ETC2_SIGNED_RG11_EAC; table[MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1] = unpack_ETC2_RGB8_PUNCHTHROUGH_ALPHA1; - table[MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1] = + table[MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1] = unpack_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1; table[MESA_FORMAT_SIGNED_A8] = unpack_SIGNED_A8; table[MESA_FORMAT_SIGNED_L8] = unpack_SIGNED_L8; diff --git a/mesalib/src/mesa/main/format_unpack.h b/mesalib/src/mesa/main/format_unpack.h index 29c526319..1da03caa8 100644 --- a/mesalib/src/mesa/main/format_unpack.h +++ b/mesalib/src/mesa/main/format_unpack.h @@ -16,9 +16,10 @@ * 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 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. + * 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. */ #ifndef FORMAT_UNPACK_H diff --git a/mesalib/src/mesa/main/formatquery.c b/mesalib/src/mesa/main/formatquery.c index e45dc8680..40eca8711 100644 --- a/mesalib/src/mesa/main/formatquery.c +++ b/mesalib/src/mesa/main/formatquery.c @@ -25,7 +25,6 @@ #include "context.h" #include "glformats.h" #include "macros.h" -#include "mfeatures.h" #include "enums.h" #include "fbobject.h" #include "formatquery.h" diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c index 68ce98430..fee52c1ea 100644 --- a/mesalib/src/mesa/main/formats.c +++ b/mesalib/src/mesa/main/formats.c @@ -18,15 +18,15 @@ * 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 - * BRIAN PAUL 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. + * 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 "imports.h" #include "formats.h" -#include "mfeatures.h" #include "macros.h" #include "glformats.h" diff --git a/mesalib/src/mesa/main/formats.h b/mesalib/src/mesa/main/formats.h index 2961ffa9f..8dd71a086 100644 --- a/mesalib/src/mesa/main/formats.h +++ b/mesalib/src/mesa/main/formats.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* @@ -288,21 +289,21 @@ typedef enum MESA_FORMAT_ARGB2101010_UINT, MESA_FORMAT_ABGR2101010_UINT, - MESA_FORMAT_XRGB4444_UNORM, - MESA_FORMAT_XRGB1555_UNORM, - MESA_FORMAT_XBGR8888_SNORM, - MESA_FORMAT_XBGR8888_SRGB, - MESA_FORMAT_XBGR8888_UINT, - MESA_FORMAT_XBGR8888_SINT, - MESA_FORMAT_XRGB2101010_UNORM, - MESA_FORMAT_XBGR16161616_UNORM, - MESA_FORMAT_XBGR16161616_SNORM, - MESA_FORMAT_XBGR16161616_FLOAT, - MESA_FORMAT_XBGR16161616_UINT, - MESA_FORMAT_XBGR16161616_SINT, - MESA_FORMAT_XBGR32323232_FLOAT, - MESA_FORMAT_XBGR32323232_UINT, - MESA_FORMAT_XBGR32323232_SINT, + MESA_FORMAT_XRGB4444_UNORM, /* xxxx RRRR GGGG BBBB */ + MESA_FORMAT_XRGB1555_UNORM, /* xRRR RRGG GGGB BBBB */ + MESA_FORMAT_XBGR8888_SNORM, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_XBGR8888_SRGB, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_XBGR8888_UINT, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_XBGR8888_SINT, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_XRGB2101010_UNORM, /* xxRR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */ + MESA_FORMAT_XBGR16161616_UNORM,/* ushort[3]=x, [2]=B, [1]=G, [0]=R */ + MESA_FORMAT_XBGR16161616_SNORM,/* ... */ + MESA_FORMAT_XBGR16161616_FLOAT,/* ... */ + MESA_FORMAT_XBGR16161616_UINT, /* ... */ + MESA_FORMAT_XBGR16161616_SINT, /* ... */ + MESA_FORMAT_XBGR32323232_FLOAT,/* float[3]=x, [2]=B, [1]=G, [0]=R */ + MESA_FORMAT_XBGR32323232_UINT, /* ... */ + MESA_FORMAT_XBGR32323232_SINT, /* ... */ MESA_FORMAT_COUNT } gl_format; diff --git a/mesalib/src/mesa/main/framebuffer.c b/mesalib/src/mesa/main/framebuffer.c index 6c6977431..0337b8b08 100644 --- a/mesalib/src/mesa/main/framebuffer.c +++ b/mesalib/src/mesa/main/framebuffer.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -877,18 +878,29 @@ _mesa_dest_buffer_exists(struct gl_context *ctx, GLenum format) GLenum _mesa_get_color_read_format(struct gl_context *ctx) { - const GLenum data_type = _mesa_get_format_datatype( - ctx->ReadBuffer->_ColorReadBuffer->Format); - - switch (ctx->ReadBuffer->_ColorReadBuffer->Format) { - case MESA_FORMAT_ARGB8888: - return GL_BGRA; - case MESA_FORMAT_RGB565: - return GL_BGR; - default: - if (data_type == GL_UNSIGNED_INT || data_type == GL_INT) { + if (!ctx->ReadBuffer || !ctx->ReadBuffer->_ColorReadBuffer) { + /* The spec is unclear how to handle this case, but NVIDIA's + * driver generates GL_INVALID_OPERATION. + */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT: " + "no GL_READ_BUFFER)"); + return GL_NONE; + } + else { + const GLenum format = ctx->ReadBuffer->_ColorReadBuffer->Format; + const GLenum data_type = _mesa_get_format_datatype(format); + + if (format == MESA_FORMAT_ARGB8888) + return GL_BGRA; + else if (format == MESA_FORMAT_RGB565) + return GL_BGR; + + switch (data_type) { + case GL_UNSIGNED_INT: + case GL_INT: return GL_RGBA_INTEGER; - } else { + default: return GL_RGBA; } } @@ -901,26 +913,33 @@ _mesa_get_color_read_format(struct gl_context *ctx) GLenum _mesa_get_color_read_type(struct gl_context *ctx) { - const GLenum data_type = _mesa_get_format_datatype( - ctx->ReadBuffer->_ColorReadBuffer->Format); - - switch (ctx->ReadBuffer->_ColorReadBuffer->Format) { - case MESA_FORMAT_RGB565: - return GL_UNSIGNED_SHORT_5_6_5_REV; - default: - break; + if (!ctx->ReadBuffer || !ctx->ReadBuffer->_ColorReadBuffer) { + /* The spec is unclear how to handle this case, but NVIDIA's + * driver generates GL_INVALID_OPERATION. + */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE: " + "no GL_READ_BUFFER)"); + return GL_NONE; } - - switch (data_type) { - case GL_SIGNED_NORMALIZED: - return GL_BYTE; - case GL_UNSIGNED_INT: - case GL_INT: - case GL_FLOAT: - return data_type; - case GL_UNSIGNED_NORMALIZED: - default: - return GL_UNSIGNED_BYTE; + else { + const GLenum format = ctx->ReadBuffer->_ColorReadBuffer->Format; + const GLenum data_type = _mesa_get_format_datatype(format); + + if (format == MESA_FORMAT_RGB565) + return GL_UNSIGNED_SHORT_5_6_5_REV; + + switch (data_type) { + case GL_SIGNED_NORMALIZED: + return GL_BYTE; + case GL_UNSIGNED_INT: + case GL_INT: + case GL_FLOAT: + return data_type; + case GL_UNSIGNED_NORMALIZED: + default: + return GL_UNSIGNED_BYTE; + } } } @@ -961,8 +980,7 @@ _mesa_print_framebuffer(const struct gl_framebuffer *fb) for (i = 0; i < BUFFER_COUNT; i++) { const struct gl_renderbuffer_attachment *att = &fb->Attachment[i]; if (att->Type == GL_TEXTURE) { - const struct gl_texture_image *texImage = - _mesa_get_attachment_teximage_const(att); + const struct gl_texture_image *texImage = att->Renderbuffer->TexImage; fprintf(stderr, " %2d: Texture %u, level %u, face %u, slice %u, complete %d\n", i, att->Texture->Name, att->TextureLevel, att->CubeMapFace, diff --git a/mesalib/src/mesa/main/framebuffer.h b/mesalib/src/mesa/main/framebuffer.h index 9b94452d6..962f2a4e2 100644 --- a/mesalib/src/mesa/main/framebuffer.h +++ b/mesalib/src/mesa/main/framebuffer.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c index 2ba868c0d..593c75be2 100644 --- a/mesalib/src/mesa/main/get.c +++ b/mesalib/src/mesa/main/get.c @@ -15,9 +15,10 @@ * 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 - * BRIAN PAUL 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. + * 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. * * Author: Kristian Høgsberg <krh@bitplanet.net> */ @@ -30,12 +31,12 @@ #include "extensions.h" #include "get.h" #include "macros.h" -#include "mfeatures.h" #include "mtypes.h" #include "state.h" #include "texcompress.h" #include "framebuffer.h" #include "samplerobj.h" +#include "stencil.h" /* This is a table driven implemetation of the glGet*v() functions. * The basic idea is that most getters just look up an int somewhere @@ -141,6 +142,7 @@ enum value_extra { EXTRA_VALID_CLIP_DISTANCE, EXTRA_FLUSH_CURRENT, EXTRA_GLSL_130, + EXTRA_EXT_UBO_GS4, }; #define NO_EXTRA NULL @@ -226,7 +228,13 @@ union value { * extensions or specific gl versions) or actions (flush current, new * buffers) that we need to do before looking up an enum. We need to * declare them all up front so we can refer to them in the value_desc - * structs below. */ + * structs below. + * + * Each EXTRA_ will be executed. For EXTRA_* enums of extensions and API + * versions, listing multiple ones in an array means an error will be thrown + * only if none of them are available. If you need to check for "AND" + * behavior, you would need to make a custom EXTRA_ enum. + */ static const int extra_new_buffers[] = { EXTRA_NEW_BUFFERS, @@ -281,6 +289,12 @@ static const int extra_EXT_texture_integer[] = { EXTRA_END }; +static const int extra_EXT_texture_integer_and_new_buffers[] = { + EXT(EXT_texture_integer), + EXTRA_NEW_BUFFERS, + EXTRA_END +}; + static const int extra_GLSL_130[] = { EXTRA_GLSL_130, EXTRA_END @@ -300,8 +314,7 @@ static const int extra_ARB_transform_feedback2_api_es3[] = { }; static const int extra_ARB_uniform_buffer_object_and_geometry_shader[] = { - EXT(ARB_uniform_buffer_object), - EXT(ARB_geometry_shader4), + EXTRA_EXT_UBO_GS4, EXTRA_END }; @@ -317,6 +330,12 @@ static const int extra_ARB_ES3_compatibility_api_es3[] = { EXTRA_END }; +static const int extra_EXT_framebuffer_sRGB_and_new_buffers[] = { + EXT(EXT_framebuffer_sRGB), + EXTRA_NEW_BUFFERS, + EXTRA_END +}; + EXTRA_EXT(ARB_texture_cube_map); EXTRA_EXT(MESA_texture_array); EXTRA_EXT2(EXT_secondary_color, ARB_vertex_program); @@ -397,6 +416,13 @@ extra_NV_read_buffer_api_gl[] = { EXTRA_END }; +static const int extra_core_ARB_color_buffer_float_and_new_buffers[] = { + EXTRA_API_GL_CORE, + EXT(ARB_color_buffer_float), + EXTRA_NEW_BUFFERS, + EXTRA_END +}; + /* This is the big table describing all the enums we accept in * glGet*v(). The table is partitioned into six parts: enums * understood by all GL APIs (OpenGL, GLES and GLES2), enums shared @@ -404,8 +430,7 @@ extra_NV_read_buffer_api_gl[] = { * remaining combinations. To look up the enums valid in a given API * we will use a hash table specific to that API. These tables are in * turn generated at build time and included through get_hash.h. - * The different sections are guarded by #if FEATURE_GL etc to make - * sure we only compile in the enums we may need. */ + */ #include "get_hash.h" @@ -651,7 +676,10 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu v->value_enum = ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]; break; case GL_STENCIL_REF: - v->value_int = ctx->Stencil.Ref[ctx->Stencil.ActiveFace]; + v->value_int = _mesa_get_stencil_ref(ctx, ctx->Stencil.ActiveFace); + break; + case GL_STENCIL_BACK_REF: + v->value_int = _mesa_get_stencil_ref(ctx, 1); break; case GL_STENCIL_VALUE_MASK: v->value_int = ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]; @@ -883,58 +911,50 @@ static GLboolean check_extra(struct gl_context *ctx, const char *func, const struct value_desc *d) { const GLuint version = ctx->Version; - int total, enabled; + GLboolean api_check = GL_FALSE; + GLboolean api_found = GL_FALSE; const int *e; - total = 0; - enabled = 0; - for (e = d->extra; *e != EXTRA_END; e++) + for (e = d->extra; *e != EXTRA_END; e++) { switch (*e) { case EXTRA_VERSION_30: - if (version >= 30) { - total++; - enabled++; - } + api_check = GL_TRUE; + if (version >= 30) + api_found = GL_TRUE; break; case EXTRA_VERSION_31: - if (version >= 31) { - total++; - enabled++; - } + api_check = GL_TRUE; + if (version >= 31) + api_found = GL_TRUE; break; case EXTRA_VERSION_32: - if (version >= 32) { - total++; - enabled++; - } + api_check = GL_TRUE; + if (version >= 32) + api_found = GL_TRUE; break; case EXTRA_NEW_FRAG_CLAMP: if (ctx->NewState & (_NEW_BUFFERS | _NEW_FRAG_CLAMP)) _mesa_update_state(ctx); break; case EXTRA_API_ES2: - if (ctx->API == API_OPENGLES2) { - total++; - enabled++; - } + api_check = GL_TRUE; + if (ctx->API == API_OPENGLES2) + api_found = GL_TRUE; break; case EXTRA_API_ES3: - if (_mesa_is_gles3(ctx)) { - total++; - enabled++; - } + api_check = GL_TRUE; + if (_mesa_is_gles3(ctx)) + api_found = GL_TRUE; break; case EXTRA_API_GL: - if (_mesa_is_desktop_gl(ctx)) { - total++; - enabled++; - } + api_check = GL_TRUE; + if (_mesa_is_desktop_gl(ctx)) + api_found = GL_TRUE; break; case EXTRA_API_GL_CORE: - if (ctx->API == API_OPENGL_CORE) { - total++; - enabled++; - } + api_check = GL_TRUE; + if (ctx->API == API_OPENGL_CORE) + api_found = GL_TRUE; break; case EXTRA_NEW_BUFFERS: if (ctx->NewState & _NEW_BUFFERS) @@ -965,21 +985,26 @@ check_extra(struct gl_context *ctx, const char *func, const struct value_desc *d } break; case EXTRA_GLSL_130: - if (ctx->Const.GLSLVersion >= 130) { - total++; - enabled++; - } + api_check = GL_TRUE; + if (ctx->Const.GLSLVersion >= 130) + api_found = GL_TRUE; break; + case EXTRA_EXT_UBO_GS4: + api_check = GL_TRUE; + api_found = (ctx->Extensions.ARB_uniform_buffer_object && + ctx->Extensions.ARB_geometry_shader4); + break; case EXTRA_END: break; default: /* *e is a offset into the extension struct */ - total++; + api_check = GL_TRUE; if (*(GLboolean *) ((char *) &ctx->Extensions + *e)) - enabled++; + api_found = GL_TRUE; break; } + } - if (total > 0 && enabled == 0) { + if (api_check && !api_found) { _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func, _mesa_lookup_enum_by_nr(d->pname)); return GL_FALSE; diff --git a/mesalib/src/mesa/main/get.h b/mesalib/src/mesa/main/get.h index 6b0158f37..f58bb9409 100644 --- a/mesalib/src/mesa/main/get.h +++ b/mesalib/src/mesa/main/get.h @@ -22,9 +22,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/get_hash_generator.py b/mesalib/src/mesa/main/get_hash_generator.py index 04bf9ffe6..96bc49587 100644 --- a/mesalib/src/mesa/main/get_hash_generator.py +++ b/mesalib/src/mesa/main/get_hash_generator.py @@ -179,54 +179,34 @@ def generate_hash_tables(enum_list, enabled_apis, param_descriptors): return params, merge_tables(sorted_tables) -def opt_to_apis(feature): - _map = {"ES1": "GLES", "ES2": "GLES2", "GL": "GL"} - if feature not in _map: - return None - - apis = set([_map[feature]]) - if "GL" in apis: - apis.add("GL_CORE") - if "GLES2" in apis: - apis.add("GLES3") - - return apis def show_usage(): sys.stderr.write( """Usage: %s [OPTIONS] -f <file> specify GL API XML file - -a [GL|ES1|ES2] specify APIs to generate hash tables for """ % (program)) exit(1) if __name__ == '__main__': try: - (opts, args) = getopt.getopt(sys.argv[1:], "f:a:") + (opts, args) = getopt.getopt(sys.argv[1:], "f:") except Exception,e: show_usage() if len(args) != 0: show_usage() - enabled_apis = set([]) api_desc_file = "" for opt_name, opt_val in opts: if opt_name == "-f": api_desc_file = opt_val - if opt_name == "-a": - apis = opt_to_apis(opt_val.upper()) - if not apis: - die("invalid API %s\n" % opt_val) - - enabled_apis |= apis if not api_desc_file: die("missing descriptor file (-f)\n") - if len(enabled_apis) == 0: - die("need at least a single enabled API\n") + # generate the code for all APIs + enabled_apis = set(["GLES", "GLES2", "GLES3", "GL", "GL_CORE"]) try: api_desc = gl_XML.parse_GL_API(api_desc_file) diff --git a/mesalib/src/mesa/main/get_hash_params.py b/mesalib/src/mesa/main/get_hash_params.py index 4ef23247b..ef1ab02e1 100644 --- a/mesalib/src/mesa/main/get_hash_params.py +++ b/mesalib/src/mesa/main/get_hash_params.py @@ -8,7 +8,7 @@ descriptor=[ [ "COLOR_WRITEMASK", "LOC_CUSTOM, TYPE_INT_4, 0, NO_EXTRA" ], [ "CULL_FACE", "CONTEXT_BOOL(Polygon.CullFlag), NO_EXTRA" ], [ "CULL_FACE_MODE", "CONTEXT_ENUM(Polygon.CullFaceMode), NO_EXTRA" ], - [ "DEPTH_BITS", "BUFFER_INT(Visual.depthBits), NO_EXTRA" ], + [ "DEPTH_BITS", "BUFFER_INT(Visual.depthBits), extra_new_buffers" ], [ "DEPTH_CLEAR_VALUE", "CONTEXT_FIELD(Depth.Clear, TYPE_DOUBLEN), NO_EXTRA" ], [ "DEPTH_FUNC", "CONTEXT_ENUM(Depth.Func), NO_EXTRA" ], [ "DEPTH_RANGE", "CONTEXT_FIELD(Viewport.Near, TYPE_FLOATN_2), NO_EXTRA" ], @@ -31,7 +31,7 @@ descriptor=[ [ "RED_BITS", "BUFFER_INT(Visual.redBits), extra_new_buffers" ], [ "SCISSOR_BOX", "LOC_CUSTOM, TYPE_INT_4, 0, NO_EXTRA" ], [ "SCISSOR_TEST", "CONTEXT_BOOL(Scissor.Enabled), NO_EXTRA" ], - [ "STENCIL_BITS", "BUFFER_INT(Visual.stencilBits), NO_EXTRA" ], + [ "STENCIL_BITS", "BUFFER_INT(Visual.stencilBits), extra_new_buffers" ], [ "STENCIL_CLEAR_VALUE", "CONTEXT_INT(Stencil.Clear), NO_EXTRA" ], [ "STENCIL_FAIL", "LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA" ], [ "STENCIL_FUNC", "LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA" ], @@ -80,8 +80,8 @@ descriptor=[ [ "SAMPLE_COVERAGE_ARB", "CONTEXT_BOOL(Multisample.SampleCoverage), NO_EXTRA" ], [ "SAMPLE_COVERAGE_VALUE_ARB", "CONTEXT_FLOAT(Multisample.SampleCoverageValue), NO_EXTRA" ], [ "SAMPLE_COVERAGE_INVERT_ARB", "CONTEXT_BOOL(Multisample.SampleCoverageInvert), NO_EXTRA" ], - [ "SAMPLE_BUFFERS_ARB", "BUFFER_INT(Visual.sampleBuffers), NO_EXTRA" ], - [ "SAMPLES_ARB", "BUFFER_INT(Visual.samples), NO_EXTRA" ], + [ "SAMPLE_BUFFERS_ARB", "BUFFER_INT(Visual.sampleBuffers), extra_new_buffers" ], + [ "SAMPLES_ARB", "BUFFER_INT(Visual.samples), extra_new_buffers" ], # GL_SGIS_generate_mipmap [ "GENERATE_MIPMAP_HINT_SGIS", "CONTEXT_ENUM(Hint.GenerateMipmap), NO_EXTRA" ], @@ -273,8 +273,8 @@ descriptor=[ # GL_ARB_fragment_program # == GL_MAX_TEXTURE_IMAGE_UNITS_NV - [ "MAX_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.MaxTextureImageUnits), extra_ARB_fragment_program" ], - [ "MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.MaxVertexTextureImageUnits), extra_ARB_vertex_shader" ], + [ "MAX_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.FragmentProgram.MaxTextureImageUnits), extra_ARB_fragment_program" ], + [ "MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.VertexProgram.MaxTextureImageUnits), extra_ARB_vertex_shader" ], [ "MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.MaxCombinedTextureImageUnits), extra_ARB_vertex_shader" ], # GL_ARB_shader_objects @@ -286,7 +286,7 @@ descriptor=[ [ "STENCIL_BACK_FUNC", "CONTEXT_ENUM(Stencil.Function[1]), NO_EXTRA" ], [ "STENCIL_BACK_VALUE_MASK", "CONTEXT_INT(Stencil.ValueMask[1]), NO_EXTRA" ], [ "STENCIL_BACK_WRITEMASK", "CONTEXT_INT(Stencil.WriteMask[1]), NO_EXTRA" ], - [ "STENCIL_BACK_REF", "CONTEXT_INT(Stencil.Ref[1]), NO_EXTRA" ], + [ "STENCIL_BACK_REF", "LOC_CUSTOM, TYPE_INT, NO_OFFSET, NO_EXTRA" ], [ "STENCIL_BACK_FAIL", "CONTEXT_ENUM(Stencil.FailFunc[1]), NO_EXTRA" ], [ "STENCIL_BACK_PASS_DEPTH_FAIL", "CONTEXT_ENUM(Stencil.ZFailFunc[1]), NO_EXTRA" ], [ "STENCIL_BACK_PASS_DEPTH_PASS", "CONTEXT_ENUM(Stencil.ZPassFunc[1]), NO_EXTRA" ], @@ -630,22 +630,22 @@ descriptor=[ [ "TEXTURE_CUBE_MAP_SEAMLESS", "CONTEXT_BOOL(Texture.CubeMapSeamless), extra_ARB_seamless_cube_map" ], # GL_EXT_texture_integer - [ "RGBA_INTEGER_MODE_EXT", "BUFFER_BOOL(_IntegerColor), extra_EXT_texture_integer" ], + [ "RGBA_INTEGER_MODE_EXT", "BUFFER_BOOL(_IntegerColor), extra_EXT_texture_integer_and_new_buffers" ], # GL_ARB_transform_feedback3 [ "MAX_TRANSFORM_FEEDBACK_BUFFERS", "CONTEXT_INT(Const.MaxTransformFeedbackBuffers), extra_ARB_transform_feedback3" ], [ "MAX_VERTEX_STREAMS", "CONTEXT_INT(Const.MaxVertexStreams), extra_ARB_transform_feedback3" ], # GL_ARB_geometry_shader4 - [ "MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.MaxGeometryTextureImageUnits), extra_ARB_geometry_shader4" ], + [ "MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.GeometryProgram.MaxTextureImageUnits), extra_ARB_geometry_shader4" ], [ "MAX_GEOMETRY_OUTPUT_VERTICES_ARB", "CONTEXT_INT(Const.MaxGeometryOutputVertices), extra_ARB_geometry_shader4" ], [ "MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB", "CONTEXT_INT(Const.MaxGeometryTotalOutputComponents), extra_ARB_geometry_shader4" ], [ "MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB", "CONTEXT_INT(Const.GeometryProgram.MaxUniformComponents), extra_ARB_geometry_shader4" ], - [ "MAX_GEOMETRY_VARYING_COMPONENTS_ARB", "CONTEXT_INT(Const.MaxGeometryVaryingComponents), extra_ARB_geometry_shader4" ], - [ "MAX_VERTEX_VARYING_COMPONENTS_ARB", "CONTEXT_INT(Const.MaxVertexVaryingComponents), extra_ARB_geometry_shader4" ], + [ "MAX_GEOMETRY_VARYING_COMPONENTS_ARB", "CONTEXT_INT(Const.MaxVaryingComponents), extra_ARB_geometry_shader4" ], + [ "MAX_VERTEX_VARYING_COMPONENTS_ARB", "CONTEXT_INT(Const.MaxVaryingComponents), extra_ARB_geometry_shader4" ], # GL_ARB_color_buffer_float - [ "RGBA_FLOAT_MODE_ARB", "BUFFER_FIELD(Visual.floatMode, TYPE_BOOLEAN), 0" ], + [ "RGBA_FLOAT_MODE_ARB", "BUFFER_FIELD(Visual.floatMode, TYPE_BOOLEAN), extra_core_ARB_color_buffer_float_and_new_buffers" ], # GL_EXT_gpu_shader4 / GLSL 1.30 [ "MIN_PROGRAM_TEXEL_OFFSET", "CONTEXT_INT(Const.MinProgramTexelOffset), extra_GLSL_130" ], @@ -676,7 +676,7 @@ descriptor=[ # GL3.0 / GL_EXT_framebuffer_sRGB [ "FRAMEBUFFER_SRGB_EXT", "CONTEXT_BOOL(Color.sRGBEnabled), extra_EXT_framebuffer_sRGB" ], - [ "FRAMEBUFFER_SRGB_CAPABLE_EXT", "BUFFER_INT(Visual.sRGBCapable), extra_EXT_framebuffer_sRGB" ], + [ "FRAMEBUFFER_SRGB_CAPABLE_EXT", "BUFFER_INT(Visual.sRGBCapable), extra_EXT_framebuffer_sRGB_and_new_buffers" ], # GL 3.1 # NOTE: different enum values for GL_PRIMITIVE_RESTART_NV diff --git a/mesalib/src/mesa/main/getstring.c b/mesalib/src/mesa/main/getstring.c index 5280b4dd3..52985f148 100644 --- a/mesalib/src/mesa/main/getstring.c +++ b/mesalib/src/mesa/main/getstring.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -29,7 +30,6 @@ #include "get.h" #include "enums.h" #include "extensions.h" -#include "mfeatures.h" #include "mtypes.h" diff --git a/mesalib/src/mesa/main/glformats.c b/mesalib/src/mesa/main/glformats.c index c1e16587a..dfee6f196 100644 --- a/mesalib/src/mesa/main/glformats.c +++ b/mesalib/src/mesa/main/glformats.c @@ -18,9 +18,10 @@ * 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 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. + * 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. */ diff --git a/mesalib/src/mesa/main/glformats.h b/mesalib/src/mesa/main/glformats.h index cdd2b9427..af1089931 100644 --- a/mesalib/src/mesa/main/glformats.h +++ b/mesalib/src/mesa/main/glformats.h @@ -18,9 +18,10 @@ * 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 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. + * 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. */ #ifndef GLFORMATS_H diff --git a/mesalib/src/mesa/main/glheader.h b/mesalib/src/mesa/main/glheader.h index e93ca30e7..fd6985118 100644 --- a/mesalib/src/mesa/main/glheader.h +++ b/mesalib/src/mesa/main/glheader.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/hash.c b/mesalib/src/mesa/main/hash.c index 8c763e20a..e38158c75 100644 --- a/mesalib/src/mesa/main/hash.c +++ b/mesalib/src/mesa/main/hash.c @@ -29,9 +29,10 @@ * 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 - * BRIAN PAUL 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. + * 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 "glheader.h" @@ -114,9 +115,9 @@ _mesa_NewHashTable(void) { struct _mesa_HashTable *table = CALLOC_STRUCT(_mesa_HashTable); - table->ht = _mesa_hash_table_create(NULL, uint_key_compare); - _mesa_hash_table_set_deleted_key(table->ht, uint_key(DELETED_KEY_VALUE)); if (table) { + table->ht = _mesa_hash_table_create(NULL, uint_key_compare); + _mesa_hash_table_set_deleted_key(table->ht, uint_key(DELETED_KEY_VALUE)); _glthread_INIT_MUTEX(table->Mutex); _glthread_INIT_MUTEX(table->WalkMutex); } diff --git a/mesalib/src/mesa/main/hash.h b/mesalib/src/mesa/main/hash.h index cdaa7669a..a3171df6b 100644 --- a/mesalib/src/mesa/main/hash.h +++ b/mesalib/src/mesa/main/hash.h @@ -22,9 +22,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/hint.c b/mesalib/src/mesa/main/hint.c index c2560192a..ed0394bc8 100644 --- a/mesalib/src/mesa/main/hint.c +++ b/mesalib/src/mesa/main/hint.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/hint.h b/mesalib/src/mesa/main/hint.h index ca9659d58..f702fbf51 100644 --- a/mesalib/src/mesa/main/hint.h +++ b/mesalib/src/mesa/main/hint.h @@ -27,9 +27,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -37,7 +38,6 @@ #define HINT_H #include "glheader.h" -#include "mfeatures.h" struct gl_context; diff --git a/mesalib/src/mesa/main/histogram.c b/mesalib/src/mesa/main/histogram.c index fe454bcfb..88440ad71 100644 --- a/mesalib/src/mesa/main/histogram.c +++ b/mesalib/src/mesa/main/histogram.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -28,7 +29,6 @@ #include "colormac.h" #include "histogram.h" #include "macros.h" -#include "mfeatures.h" #include "main/dispatch.h" diff --git a/mesalib/src/mesa/main/histogram.h b/mesalib/src/mesa/main/histogram.h index 06781e732..a1ec5185b 100644 --- a/mesalib/src/mesa/main/histogram.h +++ b/mesalib/src/mesa/main/histogram.h @@ -27,9 +27,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -37,7 +38,6 @@ #define HISTOGRAM_H #include "compiler.h" -#include "mfeatures.h" struct _glapi_table; diff --git a/mesalib/src/mesa/main/image.c b/mesalib/src/mesa/main/image.c index 52804bd8b..42fec10e1 100644 --- a/mesalib/src/mesa/main/image.c +++ b/mesalib/src/mesa/main/image.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -36,7 +37,6 @@ #include "image.h" #include "imports.h" #include "macros.h" -#include "mfeatures.h" #include "mtypes.h" diff --git a/mesalib/src/mesa/main/image.h b/mesalib/src/mesa/main/image.h index 7e92790b7..5515be630 100644 --- a/mesalib/src/mesa/main/image.h +++ b/mesalib/src/mesa/main/image.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/imports.c b/mesalib/src/mesa/main/imports.c index e6f754254..ba30d8e84 100644 --- a/mesalib/src/mesa/main/imports.c +++ b/mesalib/src/mesa/main/imports.c @@ -37,9 +37,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/imports.h b/mesalib/src/mesa/main/imports.h index c4110ef10..1678f71b2 100644 --- a/mesalib/src/mesa/main/imports.h +++ b/mesalib/src/mesa/main/imports.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/light.c b/mesalib/src/mesa/main/light.c index c694bebe6..a3a576efd 100644 --- a/mesalib/src/mesa/main/light.c +++ b/mesalib/src/mesa/main/light.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -474,10 +475,6 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params ) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); ctx->Light.Model.TwoSide = newbool; - if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) - ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE; - else - ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE; break; case GL_LIGHT_MODEL_COLOR_CONTROL: if (ctx->API != API_OPENGL_COMPAT) diff --git a/mesalib/src/mesa/main/light.h b/mesalib/src/mesa/main/light.h index e25dbf226..2247a7494 100644 --- a/mesalib/src/mesa/main/light.h +++ b/mesalib/src/mesa/main/light.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -29,7 +30,6 @@ #include "glheader.h" -#include "mfeatures.h" struct gl_context; struct gl_light; diff --git a/mesalib/src/mesa/main/lines.c b/mesalib/src/mesa/main/lines.c index a01219c42..30eb21880 100644 --- a/mesalib/src/mesa/main/lines.c +++ b/mesalib/src/mesa/main/lines.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/lines.h b/mesalib/src/mesa/main/lines.h index 8e8b3f8d6..a6a610e71 100644 --- a/mesalib/src/mesa/main/lines.h +++ b/mesalib/src/mesa/main/lines.h @@ -22,9 +22,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/macros.h b/mesalib/src/mesa/main/macros.h index f6d38fb64..ac2467209 100644 --- a/mesalib/src/mesa/main/macros.h +++ b/mesalib/src/mesa/main/macros.h @@ -22,9 +22,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -656,6 +657,12 @@ INTERP_4F(GLfloat t, GLfloat dst[4], const GLfloat out[4], const GLfloat in[4]) #define MIN3( A, B, C ) ((A) < (B) ? MIN2(A, C) : MIN2(B, C)) #define MAX3( A, B, C ) ((A) > (B) ? MAX2(A, C) : MAX2(B, C)) +static inline unsigned +minify(unsigned value, unsigned levels) +{ + return MAX2(1, value >> levels); +} + /** * Align a value up to an alignment value * diff --git a/mesalib/src/mesa/main/matrix.c b/mesalib/src/mesa/main/matrix.c index f2fd56787..0ba7e9357 100644 --- a/mesalib/src/mesa/main/matrix.c +++ b/mesalib/src/mesa/main/matrix.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -40,7 +41,6 @@ #include "context.h" #include "enums.h" #include "macros.h" -#include "mfeatures.h" #include "matrix.h" #include "mtypes.h" #include "math/m_matrix.h" diff --git a/mesalib/src/mesa/main/matrix.h b/mesalib/src/mesa/main/matrix.h index 185a5c04b..74e7d6183 100644 --- a/mesalib/src/mesa/main/matrix.h +++ b/mesalib/src/mesa/main/matrix.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/mfeatures.h b/mesalib/src/mesa/main/mfeatures.h deleted file mode 100644 index 55e9cf9c4..000000000 --- a/mesalib/src/mesa/main/mfeatures.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * 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 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 - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -/** - * \file mfeatures.h - * Flags to enable/disable specific parts of the API. - */ - -#ifndef FEATURES_H -#define FEATURES_H - -#ifndef FEATURE_ES1 -#define FEATURE_ES1 0 -#endif -#ifndef FEATURE_ES2 -#define FEATURE_ES2 0 -#endif - -#define FEATURE_ES (FEATURE_ES1 || FEATURE_ES2) - -#ifndef FEATURE_GL -#define FEATURE_GL !FEATURE_ES -#endif - -#if defined(IN_DRI_DRIVER) || (FEATURE_GL + FEATURE_ES1 + FEATURE_ES2 > 1) -#define FEATURE_remap_table 1 -#else -#define FEATURE_remap_table 0 -#endif - -#endif /* FEATURES_H */ diff --git a/mesalib/src/mesa/main/mipmap.c b/mesalib/src/mesa/main/mipmap.c index a2f3767a3..e9741f3e0 100644 --- a/mesalib/src/mesa/main/mipmap.c +++ b/mesalib/src/mesa/main/mipmap.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/mipmap.h b/mesalib/src/mesa/main/mipmap.h index 072794cb6..6e26d5ba0 100644 --- a/mesalib/src/mesa/main/mipmap.h +++ b/mesalib/src/mesa/main/mipmap.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index 008f68bda..186f8a03b 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** @@ -36,7 +37,6 @@ #include "main/glheader.h" #include "main/config.h" -#include "main/mfeatures.h" #include "glapi/glapi.h" #include "math/m_matrix.h" /* GLmatrix */ #include "main/simple_list.h" /* struct simple_node */ @@ -85,9 +85,9 @@ struct set_entry; /** Extra draw modes beyond GL_POINTS, GL_TRIANGLE_FAN, etc */ -#define PRIM_OUTSIDE_BEGIN_END (GL_POLYGON+1) -#define PRIM_INSIDE_UNKNOWN_PRIM (GL_POLYGON+2) -#define PRIM_UNKNOWN (GL_POLYGON+3) +#define PRIM_MAX GL_TRIANGLE_STRIP_ADJACENCY +#define PRIM_OUTSIDE_BEGIN_END (PRIM_MAX + 1) +#define PRIM_UNKNOWN (PRIM_MAX + 2) @@ -231,7 +231,7 @@ typedef enum VARYING_SLOT_CLIP_DIST0, VARYING_SLOT_CLIP_DIST1, VARYING_SLOT_PRIMITIVE_ID, /* Does not appear in VS */ - VARYING_SLOT_LAYER, /* Appears only as GS output */ + VARYING_SLOT_LAYER, /* Appears as VS or GS output */ VARYING_SLOT_FACE, /* FS only */ VARYING_SLOT_PNTC, /* FS only */ VARYING_SLOT_VAR0, /* First generic varying slot */ @@ -1502,9 +1502,6 @@ struct gl_array_object /** Mask of VERT_BIT_* values indicating which arrays are enabled */ GLbitfield64 _Enabled; - /** Mask of VERT_BIT_* values indicating changed/dirty arrays */ - GLbitfield64 NewArrays; - /** * Min of all enabled arrays' _MaxElement. When arrays reside inside VBOs * we can determine the max legal (in bounds) glDrawElements array index. @@ -1537,15 +1534,13 @@ struct gl_array_attrib * \name Primitive restart controls * * Primitive restart is enabled if either \c PrimitiveRestart or - * \c PrimitiveRestart is set. If \c PrimitiveRestart is set, then - * \c RestartIndex is used as the cut vertex. Otherwise ~0 is used. + * \c PrimitiveRestartFixedIndex is set. */ /*@{*/ GLboolean PrimitiveRestart; GLboolean PrimitiveRestartFixedIndex; GLboolean _PrimitiveRestart; GLuint RestartIndex; - GLuint _RestartIndex; /*@}*/ /* GL_ARB_vertex_buffer_object */ @@ -1829,7 +1824,8 @@ enum glsl_interp_qualifier INTERP_QUALIFIER_NONE = 0, INTERP_QUALIFIER_SMOOTH, INTERP_QUALIFIER_FLAT, - INTERP_QUALIFIER_NOPERSPECTIVE + INTERP_QUALIFIER_NOPERSPECTIVE, + INTERP_QUALIFIER_COUNT /**< Number of interpolation qualifiers */ }; @@ -2134,6 +2130,17 @@ struct gl_shader /*@}*/ /** + * Map from sampler unit to texture unit (set by glUniform1i()) + * + * A sampler unit is associated with each sampler uniform by the linker. + * The sampler unit associated with each uniform is stored in the + * \c gl_uniform_storage::sampler field. + */ + GLubyte SamplerUnits[MAX_SAMPLERS]; + /** Which texture target is being sampled (TEXTURE_1D/2D/3D/etc_INDEX) */ + gl_texture_index SamplerTargets[MAX_SAMPLERS]; + + /** * Number of uniform components used by this shader. * * This field is only set post-linking. @@ -2337,17 +2344,6 @@ struct gl_shader_program */ struct string_to_uint_map *UniformHash; - /** - * Map from sampler unit to texture unit (set by glUniform1i()) - * - * A sampler unit is associated with each sampler uniform by the linker. - * The sampler unit associated with each uniform is stored in the - * \c gl_uniform_storage::sampler field. - */ - GLubyte SamplerUnits[MAX_SAMPLERS]; - /** Which texture target is being sampled (TEXTURE_1D/2D/3D/etc_INDEX) */ - gl_texture_index SamplerTargets[MAX_SAMPLERS]; - GLboolean LinkStatus; /**< GL_LINK_STATUS */ GLboolean Validated; GLboolean _Used; /**< Ever used for drawing? */ @@ -2435,6 +2431,12 @@ struct gl_shader_compiler_options GLuint MaxIfDepth; /**< Maximum nested IF blocks */ GLuint MaxUnrollIterations; + /** + * Prefer DP4 instructions (rather than MUL/MAD) for matrix * vector + * operations, such as position transformation. + */ + GLboolean PreferDP4; + struct gl_sl_pragmas DefaultPragmas; /**< Default #pragma settings */ }; @@ -2565,13 +2567,31 @@ struct gl_renderbuffer GLuint Name; GLint RefCount; GLuint Width, Height; + GLuint Depth; GLboolean Purgeable; /**< Is the buffer purgeable under memory pressure? */ GLboolean AttachedAnytime; /**< TRUE if it was attached to a framebuffer */ + /** + * True for renderbuffers that wrap textures, giving the driver a chance to + * flush render caches through the FinishRenderTexture hook. + * + * Drivers may also set this on renderbuffers other than those generated by + * glFramebufferTexture(), though it means FinishRenderTexture() would be + * called without a rb->TexImage. + */ + GLboolean NeedsFinishRenderTexture; GLubyte NumSamples; GLenum InternalFormat; /**< The user-specified format */ GLenum _BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_DEPTH_COMPONENT or GL_STENCIL_INDEX. */ gl_format Format; /**< The actual renderbuffer memory format */ + /** + * Pointer to the texture image if this renderbuffer wraps a texture, + * otherwise NULL. + * + * Note that the reference on the gl_texture_object containing this + * TexImage is held by the gl_renderbuffer_attachment. + */ + struct gl_texture_image *TexImage; /** Delete this renderbuffer */ void (*Delete)(struct gl_context *ctx, struct gl_renderbuffer *rb); @@ -2608,6 +2628,7 @@ struct gl_renderbuffer_attachment GLuint CubeMapFace; /**< 0 .. 5, for cube map textures. */ GLuint Zoffset; /**< Slice for 3D textures, or layer for both 1D * and 2D array textures */ + GLboolean Layered; }; @@ -2680,6 +2701,8 @@ struct gl_framebuffer struct gl_renderbuffer *_ColorDrawBuffers[MAX_DRAW_BUFFERS]; struct gl_renderbuffer *_ColorReadBuffer; + GLboolean Layered; + /** Delete this framebuffer */ void (*Delete)(struct gl_framebuffer *fb); }; @@ -2730,6 +2753,7 @@ struct gl_program_constants /* GL_ARB_uniform_buffer_object */ GLuint MaxUniformBlocks; GLuint MaxCombinedUniformComponents; + GLuint MaxTextureImageUnits; }; @@ -2746,11 +2770,8 @@ struct gl_constants GLuint MaxArrayTextureLayers; /**< Max layers in array textures */ GLuint MaxTextureRectSize; /**< Max rectangle texture size, in pixes */ GLuint MaxTextureCoordUnits; - GLuint MaxTextureImageUnits; - GLuint MaxVertexTextureImageUnits; GLuint MaxCombinedTextureImageUnits; - GLuint MaxGeometryTextureImageUnits; - GLuint MaxTextureUnits; /**< = MIN(CoordUnits, ImageUnits) */ + GLuint MaxTextureUnits; /**< = MIN(CoordUnits, FragmentProgram.ImageUnits) */ GLfloat MaxTextureMaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */ GLfloat MaxTextureLodBias; /**< GL_EXT_texture_lod_bias */ GLuint MaxTextureBufferSize; /**< GL_ARB_texture_buffer_object */ @@ -2768,8 +2789,6 @@ struct gl_constants GLfloat MinLineWidthAA, MaxLineWidthAA; /**< antialiased */ GLfloat LineWidthGranularity; - GLuint MaxColorTableSize; - GLuint MaxClipPlanes; GLuint MaxLights; GLfloat MaxShininess; /**< GL_NV_light_max_exponent */ @@ -2800,10 +2819,9 @@ struct gl_constants GLuint MaxRenderbufferSize; /**< GL_EXT_framebuffer_object */ GLuint MaxSamples; /**< GL_ARB_framebuffer_object */ - /** Number of varying vectors between vertex and fragment shaders */ + /** Number of varying vectors between any two shader stages. */ GLuint MaxVarying; - GLuint MaxVertexVaryingComponents; /**< Between vert and geom shader */ - GLuint MaxGeometryVaryingComponents; /**< Between geom and frag shader */ + GLuint MaxVaryingComponents; /** @{ * GL_ARB_uniform_buffer_object @@ -2965,6 +2983,7 @@ struct gl_extensions GLboolean ARB_framebuffer_object; GLboolean ARB_explicit_attrib_location; GLboolean ARB_geometry_shader4; + GLboolean ARB_gpu_shader5; GLboolean ARB_half_float_pixel; GLboolean ARB_half_float_vertex; GLboolean ARB_instanced_arrays; @@ -3019,6 +3038,7 @@ struct gl_extensions GLboolean EXT_fog_coord; GLboolean EXT_framebuffer_blit; GLboolean EXT_framebuffer_multisample; + GLboolean EXT_framebuffer_multisample_blit_scaled; GLboolean EXT_framebuffer_object; GLboolean EXT_framebuffer_sRGB; GLboolean EXT_gpu_program_parameters; @@ -3051,6 +3071,7 @@ struct gl_extensions GLboolean OES_standard_derivatives; /* vendor extensions */ GLboolean AMD_seamless_cubemap_per_texture; + GLboolean AMD_vertex_shader_layer; GLboolean APPLE_object_purgeable; GLboolean ATI_envmap_bumpmap; GLboolean ATI_texture_compression_3dc; @@ -3137,7 +3158,7 @@ struct gl_matrix_stack #define _NEW_TEXTURE (1 << 16) /**< gl_context::Texture */ #define _NEW_TRANSFORM (1 << 17) /**< gl_context::Transform */ #define _NEW_VIEWPORT (1 << 18) /**< gl_context::Viewport */ -#define _NEW_PACKUNPACK (1 << 19) /**< gl_context::Pack, Unpack */ +/* gap, re-use for core Mesa state only; use ctx->DriverFlags otherwise */ #define _NEW_ARRAY (1 << 20) /**< gl_context::Array */ #define _NEW_RENDERMODE (1 << 21) /**< gl_context::RenderMode, etc */ #define _NEW_BUFFERS (1 << 22) /**< gl_context::Visual, DrawBuffer, */ @@ -3148,34 +3169,9 @@ struct gl_matrix_stack #define _NEW_PROGRAM_CONSTANTS (1 << 27) #define _NEW_BUFFER_OBJECT (1 << 28) #define _NEW_FRAG_CLAMP (1 << 29) -#define _NEW_TRANSFORM_FEEDBACK (1 << 30) /**< gl_context::TransformFeedback */ +/* gap, re-use for core Mesa state only; use ctx->DriverFlags otherwise */ #define _NEW_VARYING_VP_INPUTS (1 << 31) /**< gl_context::varying_vp_inputs */ #define _NEW_ALL ~0 - -/** - * We use _NEW_TRANSFORM for GL_RASTERIZER_DISCARD. This #define is for - * clarity. - */ -#define _NEW_RASTERIZER_DISCARD _NEW_TRANSFORM -/*@}*/ - - -/** - * \name A bunch of flags that we think might be useful to drivers. - * - * Set in the __struct gl_contextRec::_TriangleCaps bitfield. - */ -/*@{*/ -#define DD_SEPARATE_SPECULAR (1 << 0) -#define DD_TRI_LIGHT_TWOSIDE (1 << 1) -#define DD_TRI_UNFILLED (1 << 2) -#define DD_TRI_SMOOTH (1 << 3) -#define DD_TRI_STIPPLE (1 << 4) -#define DD_TRI_OFFSET (1 << 5) -#define DD_LINE_SMOOTH (1 << 6) -#define DD_LINE_STIPPLE (1 << 7) -#define DD_POINT_SMOOTH (1 << 8) -#define DD_POINT_ATTEN (1 << 9) /*@}*/ @@ -3352,7 +3348,20 @@ typedef enum */ struct gl_driver_flags { - GLbitfield NewArray; /**< Vertex array state */ + /** gl_context::Array::_DrawArrays (vertex array state) */ + GLbitfield NewArray; + + /** gl_context::TransformFeedback::CurrentObject */ + GLbitfield NewTransformFeedback; + + /** gl_context::RasterDiscard */ + GLbitfield NewRasterizerDiscard; + + /** + * gl_context::UniformBufferBindings + * gl_shader_program::UniformBlocks + */ + GLbitfield NewUniformBuffer; }; struct gl_uniform_buffer_binding @@ -3534,7 +3543,8 @@ struct gl_context * associated with uniform blocks by glUniformBlockBinding()'s state in the * shader program. */ - struct gl_uniform_buffer_binding *UniformBufferBindings; + struct gl_uniform_buffer_binding + UniformBufferBindings[MAX_COMBINED_UNIFORM_BUFFERS]; /*@}*/ @@ -3568,11 +3578,6 @@ struct gl_context GLbitfield64 varying_vp_inputs; /**< mask of VERT_BIT_* flags */ /** \name Derived state */ - /*@{*/ - /** Bitwise-or of DD_* flags. Note that this bitfield may be used before - * state validation so they need to always be current. - */ - GLbitfield _TriangleCaps; GLbitfield _ImageTransferState;/**< bitwise-or of IMAGE_*_BIT flags */ GLfloat _EyeZDir[3]; GLfloat _ModelViewInvScale; @@ -3593,12 +3598,6 @@ struct gl_context GLboolean TextureFormatSupported[MESA_FORMAT_COUNT]; - /** - * Use dp4 (rather than mul/mad) instructions for position - * transformation? - */ - GLboolean mvp_with_dp4; - GLboolean RasterDiscard; /**< GL_RASTERIZER_DISCARD */ /** diff --git a/mesalib/src/mesa/main/multisample.c b/mesalib/src/mesa/main/multisample.c index b0f45d933..02d6ca453 100644 --- a/mesalib/src/mesa/main/multisample.c +++ b/mesalib/src/mesa/main/multisample.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -30,6 +31,7 @@ #include "main/mtypes.h" #include "main/fbobject.h" #include "main/glformats.h" +#include "main/state.h" /** @@ -73,6 +75,10 @@ _mesa_GetMultisamplefv(GLenum pname, GLuint index, GLfloat * val) { GET_CURRENT_CONTEXT(ctx); + if (ctx->NewState & _NEW_BUFFERS) { + _mesa_update_state(ctx); + } + switch (pname) { case GL_SAMPLE_POSITION: { if (index >= ctx->DrawBuffer->Visual.samples) { diff --git a/mesalib/src/mesa/main/multisample.h b/mesalib/src/mesa/main/multisample.h index f2f01de5c..d6995d8fb 100644 --- a/mesalib/src/mesa/main/multisample.h +++ b/mesalib/src/mesa/main/multisample.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/pack.h b/mesalib/src/mesa/main/pack.h index 2fbdf9115..ad357bae1 100644 --- a/mesalib/src/mesa/main/pack.h +++ b/mesalib/src/mesa/main/pack.h @@ -17,9 +17,10 @@ * 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 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. + * 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. */ diff --git a/mesalib/src/mesa/main/pbo.c b/mesalib/src/mesa/main/pbo.c index 0dc4c04eb..400cec3f0 100644 --- a/mesalib/src/mesa/main/pbo.c +++ b/mesalib/src/mesa/main/pbo.c @@ -17,9 +17,10 @@ * 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 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. + * 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. */ diff --git a/mesalib/src/mesa/main/pbo.h b/mesalib/src/mesa/main/pbo.h index 9eba33514..9851ef1a1 100644 --- a/mesalib/src/mesa/main/pbo.h +++ b/mesalib/src/mesa/main/pbo.h @@ -17,9 +17,10 @@ * 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 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. + * 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. */ diff --git a/mesalib/src/mesa/main/pixel.c b/mesalib/src/mesa/main/pixel.c index e9f75a7df..0552de666 100644 --- a/mesalib/src/mesa/main/pixel.c +++ b/mesalib/src/mesa/main/pixel.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -33,7 +34,6 @@ #include "colormac.h" #include "context.h" #include "macros.h" -#include "mfeatures.h" #include "pixel.h" #include "pbo.h" #include "mtypes.h" diff --git a/mesalib/src/mesa/main/pixel.h b/mesalib/src/mesa/main/pixel.h index 433208cb6..88fc0cf99 100644 --- a/mesalib/src/mesa/main/pixel.h +++ b/mesalib/src/mesa/main/pixel.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -35,7 +36,6 @@ #include "compiler.h" #include "glheader.h" -#include "mfeatures.h" struct _glapi_table; struct gl_context; diff --git a/mesalib/src/mesa/main/pixelstore.c b/mesalib/src/mesa/main/pixelstore.c index 01068e8ea..cf871dc5c 100644 --- a/mesalib/src/mesa/main/pixelstore.c +++ b/mesalib/src/mesa/main/pixelstore.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** @@ -32,7 +33,6 @@ #include "bufferobj.h" #include "context.h" #include "pixelstore.h" -#include "mfeatures.h" #include "mtypes.h" @@ -48,7 +48,6 @@ _mesa_PixelStorei( GLenum pname, GLint param ) goto invalid_enum_error; if (param == (GLint)ctx->Pack.SwapBytes) return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Pack.SwapBytes = param ? GL_TRUE : GL_FALSE; break; case GL_PACK_LSB_FIRST: @@ -56,7 +55,6 @@ _mesa_PixelStorei( GLenum pname, GLint param ) goto invalid_enum_error; if (param == (GLint)ctx->Pack.LsbFirst) return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Pack.LsbFirst = param ? GL_TRUE : GL_FALSE; break; case GL_PACK_ROW_LENGTH: @@ -68,7 +66,6 @@ _mesa_PixelStorei( GLenum pname, GLint param ) } if (ctx->Pack.RowLength == param) return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Pack.RowLength = param; break; case GL_PACK_IMAGE_HEIGHT: @@ -80,7 +77,6 @@ _mesa_PixelStorei( GLenum pname, GLint param ) } if (ctx->Pack.ImageHeight == param) return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Pack.ImageHeight = param; break; case GL_PACK_SKIP_PIXELS: @@ -92,7 +88,6 @@ _mesa_PixelStorei( GLenum pname, GLint param ) } if (ctx->Pack.SkipPixels == param) return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Pack.SkipPixels = param; break; case GL_PACK_SKIP_ROWS: @@ -104,7 +99,6 @@ _mesa_PixelStorei( GLenum pname, GLint param ) } if (ctx->Pack.SkipRows == param) return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Pack.SkipRows = param; break; case GL_PACK_SKIP_IMAGES: @@ -116,7 +110,6 @@ _mesa_PixelStorei( GLenum pname, GLint param ) } if (ctx->Pack.SkipImages == param) return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Pack.SkipImages = param; break; case GL_PACK_ALIGNMENT: @@ -126,7 +119,6 @@ _mesa_PixelStorei( GLenum pname, GLint param ) } if (ctx->Pack.Alignment == param) return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Pack.Alignment = param; break; case GL_PACK_INVERT_MESA: @@ -138,7 +130,6 @@ _mesa_PixelStorei( GLenum pname, GLint param ) } if (ctx->Pack.Invert == param) return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Pack.Invert = param; break; @@ -149,7 +140,6 @@ _mesa_PixelStorei( GLenum pname, GLint param ) return; if ((GLint)ctx->Unpack.SwapBytes == param) return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Unpack.SwapBytes = param ? GL_TRUE : GL_FALSE; break; case GL_UNPACK_LSB_FIRST: @@ -159,7 +149,6 @@ _mesa_PixelStorei( GLenum pname, GLint param ) return; if ((GLint)ctx->Unpack.LsbFirst == param) return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Unpack.LsbFirst = param ? GL_TRUE : GL_FALSE; break; case GL_UNPACK_ROW_LENGTH: @@ -171,7 +160,6 @@ _mesa_PixelStorei( GLenum pname, GLint param ) } if (ctx->Unpack.RowLength == param) return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Unpack.RowLength = param; break; case GL_UNPACK_IMAGE_HEIGHT: @@ -184,7 +172,6 @@ _mesa_PixelStorei( GLenum pname, GLint param ) if (ctx->Unpack.ImageHeight == param) return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Unpack.ImageHeight = param; break; case GL_UNPACK_SKIP_PIXELS: @@ -196,7 +183,6 @@ _mesa_PixelStorei( GLenum pname, GLint param ) } if (ctx->Unpack.SkipPixels == param) return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Unpack.SkipPixels = param; break; case GL_UNPACK_SKIP_ROWS: @@ -208,7 +194,6 @@ _mesa_PixelStorei( GLenum pname, GLint param ) } if (ctx->Unpack.SkipRows == param) return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Unpack.SkipRows = param; break; case GL_UNPACK_SKIP_IMAGES: @@ -220,7 +205,6 @@ _mesa_PixelStorei( GLenum pname, GLint param ) } if (ctx->Unpack.SkipImages == param) return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Unpack.SkipImages = param; break; case GL_UNPACK_ALIGNMENT: @@ -230,7 +214,6 @@ _mesa_PixelStorei( GLenum pname, GLint param ) } if (ctx->Unpack.Alignment == param) return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Unpack.Alignment = param; break; default: diff --git a/mesalib/src/mesa/main/pixelstore.h b/mesalib/src/mesa/main/pixelstore.h index eb5081974..1ffc8f8b8 100644 --- a/mesalib/src/mesa/main/pixelstore.h +++ b/mesalib/src/mesa/main/pixelstore.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** diff --git a/mesalib/src/mesa/main/pixeltransfer.c b/mesalib/src/mesa/main/pixeltransfer.c index fa355eb4a..8bbeeb853 100644 --- a/mesalib/src/mesa/main/pixeltransfer.c +++ b/mesalib/src/mesa/main/pixeltransfer.c @@ -17,9 +17,10 @@ * 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 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. + * 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. */ diff --git a/mesalib/src/mesa/main/pixeltransfer.h b/mesalib/src/mesa/main/pixeltransfer.h index 3cd7ebe77..b0a301f26 100644 --- a/mesalib/src/mesa/main/pixeltransfer.h +++ b/mesalib/src/mesa/main/pixeltransfer.h @@ -17,9 +17,10 @@ * 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 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. + * 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. */ diff --git a/mesalib/src/mesa/main/points.c b/mesalib/src/mesa/main/points.c index c925d4cfd..71b1a4166 100644 --- a/mesalib/src/mesa/main/points.c +++ b/mesalib/src/mesa/main/points.c @@ -22,9 +22,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -122,11 +123,6 @@ _mesa_PointParameterfv( GLenum pname, const GLfloat *params) ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0 || ctx->Point.Params[1] != 0.0 || ctx->Point.Params[2] != 0.0); - - if (ctx->Point._Attenuated) - ctx->_TriangleCaps |= DD_POINT_ATTEN; - else - ctx->_TriangleCaps &= ~DD_POINT_ATTEN; break; case GL_POINT_SIZE_MIN_EXT: if (params[0] < 0.0F) { diff --git a/mesalib/src/mesa/main/points.h b/mesalib/src/mesa/main/points.h index 306a8a572..797f83158 100644 --- a/mesalib/src/mesa/main/points.h +++ b/mesalib/src/mesa/main/points.h @@ -22,9 +22,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/polygon.c b/mesalib/src/mesa/main/polygon.c index cdef01a2f..0ded7434c 100644 --- a/mesalib/src/mesa/main/polygon.c +++ b/mesalib/src/mesa/main/polygon.c @@ -22,9 +22,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -172,11 +173,6 @@ _mesa_PolygonMode( GLenum face, GLenum mode ) return; } - if (ctx->Polygon.FrontMode == GL_FILL && ctx->Polygon.BackMode == GL_FILL) - ctx->_TriangleCaps &= ~DD_TRI_UNFILLED; - else - ctx->_TriangleCaps |= DD_TRI_UNFILLED; - if (ctx->Driver.PolygonMode) ctx->Driver.PolygonMode(ctx, face, mode); } diff --git a/mesalib/src/mesa/main/polygon.h b/mesalib/src/mesa/main/polygon.h index 35f222f26..651c3356c 100644 --- a/mesalib/src/mesa/main/polygon.h +++ b/mesalib/src/mesa/main/polygon.h @@ -22,9 +22,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/querymatrix.h b/mesalib/src/mesa/main/querymatrix.h index 187b5f486..e08d843a9 100644 --- a/mesalib/src/mesa/main/querymatrix.h +++ b/mesalib/src/mesa/main/querymatrix.h @@ -25,7 +25,6 @@ #define QUERYMATRIX_H -#include "mfeatures.h" #include "mtypes.h" diff --git a/mesalib/src/mesa/main/queryobj.c b/mesalib/src/mesa/main/queryobj.c index f0db740fd..0d6fe39d4 100644 --- a/mesalib/src/mesa/main/queryobj.c +++ b/mesalib/src/mesa/main/queryobj.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -29,7 +30,6 @@ #include "hash.h" #include "imports.h" #include "queryobj.h" -#include "mfeatures.h" #include "mtypes.h" #include "main/dispatch.h" @@ -76,7 +76,7 @@ _mesa_new_query_object(struct gl_context *ctx, GLuint id) static void _mesa_begin_query(struct gl_context *ctx, struct gl_query_object *q) { - /* no-op */ + ctx->NewState |= _NEW_DEPTH; /* for swrast */ } @@ -87,6 +87,7 @@ _mesa_begin_query(struct gl_context *ctx, struct gl_query_object *q) static void _mesa_end_query(struct gl_context *ctx, struct gl_query_object *q) { + ctx->NewState |= _NEW_DEPTH; /* for swrast */ q->Ready = GL_TRUE; } @@ -315,7 +316,7 @@ _mesa_BeginQueryIndexed(GLenum target, GLuint index, GLuint id) if (!query_error_check_index(ctx, target, index)) return; - FLUSH_VERTICES(ctx, _NEW_DEPTH); + FLUSH_VERTICES(ctx, 0); bindpt = get_query_binding_point(ctx, target); if (!bindpt) { @@ -392,7 +393,7 @@ _mesa_EndQueryIndexed(GLenum target, GLuint index) if (!query_error_check_index(ctx, target, index)) return; - FLUSH_VERTICES(ctx, _NEW_DEPTH); + FLUSH_VERTICES(ctx, 0); bindpt = get_query_binding_point(ctx, target); if (!bindpt) { diff --git a/mesalib/src/mesa/main/queryobj.h b/mesalib/src/mesa/main/queryobj.h index 0616c943e..5b9ff5820 100644 --- a/mesalib/src/mesa/main/queryobj.h +++ b/mesalib/src/mesa/main/queryobj.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -27,7 +28,6 @@ #define QUERYOBJ_H -#include "main/mfeatures.h" #include "main/mtypes.h" #include "main/hash.h" diff --git a/mesalib/src/mesa/main/rastpos.c b/mesalib/src/mesa/main/rastpos.c index 5a030be44..e578c6cc8 100644 --- a/mesalib/src/mesa/main/rastpos.c +++ b/mesalib/src/mesa/main/rastpos.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -32,7 +33,6 @@ #include "context.h" #include "feedback.h" #include "macros.h" -#include "mfeatures.h" #include "mtypes.h" #include "rastpos.h" #include "state.h" diff --git a/mesalib/src/mesa/main/rastpos.h b/mesalib/src/mesa/main/rastpos.h index bbd32abd3..45968f304 100644 --- a/mesalib/src/mesa/main/rastpos.h +++ b/mesalib/src/mesa/main/rastpos.h @@ -22,9 +22,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -33,7 +34,6 @@ #include "compiler.h" -#include "mfeatures.h" struct _glapi_table; struct gl_context; diff --git a/mesalib/src/mesa/main/readpix.c b/mesalib/src/mesa/main/readpix.c index 0dee38063..85952d671 100644 --- a/mesalib/src/mesa/main/readpix.c +++ b/mesalib/src/mesa/main/readpix.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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 "glheader.h" diff --git a/mesalib/src/mesa/main/readpix.h b/mesalib/src/mesa/main/readpix.h index 7491c22ff..9e2d58ae9 100644 --- a/mesalib/src/mesa/main/readpix.h +++ b/mesalib/src/mesa/main/readpix.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/remap.c b/mesalib/src/mesa/main/remap.c index a09870561..44ec96498 100644 --- a/mesalib/src/mesa/main/remap.c +++ b/mesalib/src/mesa/main/remap.c @@ -36,10 +36,6 @@ * a dynamic entry, or the corresponding static entry, in glapi. */ -#include "mfeatures.h" - -#if FEATURE_remap_table - #include "remap.h" #include "imports.h" #include "glapi/glapi.h" @@ -223,6 +219,3 @@ _mesa_init_remap_table(void) driDispatchRemapTable_size, MESA_remap_table_functions); } - - -#endif /* FEATURE_remap_table */ diff --git a/mesalib/src/mesa/main/remap.h b/mesalib/src/mesa/main/remap.h index fa3172487..bfef6ac4e 100644 --- a/mesalib/src/mesa/main/remap.h +++ b/mesalib/src/mesa/main/remap.h @@ -29,7 +29,6 @@ #include "main/compiler.h" -#include "main/mfeatures.h" struct gl_function_pool_remap { int pool_index; @@ -42,8 +41,6 @@ struct gl_function_remap { }; -#if FEATURE_remap_table - extern int driDispatchRemapTable[]; @@ -62,37 +59,5 @@ _mesa_map_static_functions(void); extern void _mesa_init_remap_table(void); -#else /* FEATURE_remap_table */ - -static inline const char * -_mesa_get_function_spec(int func_index) -{ - return NULL; -} - -static inline int -_mesa_map_function_spec(const char *spec) -{ - return -1; -} - -static inline void -_mesa_map_function_array(const struct gl_function_remap *func_array) -{ -} - -static inline void -_mesa_map_static_functions(void) -{ -} - - -static inline void -_mesa_init_remap_table(void) -{ -} - -#endif /* FEATURE_remap_table */ - #endif /* REMAP_H */ diff --git a/mesalib/src/mesa/main/renderbuffer.c b/mesalib/src/mesa/main/renderbuffer.c index b42616226..c82b5cd85 100644 --- a/mesalib/src/mesa/main/renderbuffer.c +++ b/mesalib/src/mesa/main/renderbuffer.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -52,6 +53,7 @@ _mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name) rb->Width = 0; rb->Height = 0; + rb->Depth = 0; rb->InternalFormat = GL_RGBA; rb->Format = MESA_FORMAT_NONE; } diff --git a/mesalib/src/mesa/main/renderbuffer.h b/mesalib/src/mesa/main/renderbuffer.h index c450b33cb..e3e56d29e 100644 --- a/mesalib/src/mesa/main/renderbuffer.h +++ b/mesalib/src/mesa/main/renderbuffer.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/samplerobj.c b/mesalib/src/mesa/main/samplerobj.c index 5cff32936..91b17ab5e 100644 --- a/mesalib/src/mesa/main/samplerobj.c +++ b/mesalib/src/mesa/main/samplerobj.c @@ -16,9 +16,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -35,7 +36,6 @@ #include "main/enums.h" #include "main/hash.h" #include "main/macros.h" -#include "main/mfeatures.h" #include "main/mtypes.h" #include "main/samplerobj.h" diff --git a/mesalib/src/mesa/main/samplerobj.h b/mesalib/src/mesa/main/samplerobj.h index 69e389949..c72b1cd8d 100644 --- a/mesalib/src/mesa/main/samplerobj.h +++ b/mesalib/src/mesa/main/samplerobj.h @@ -16,9 +16,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/scissor.c b/mesalib/src/mesa/main/scissor.c index 0c2a91f5c..538ed595e 100644 --- a/mesalib/src/mesa/main/scissor.c +++ b/mesalib/src/mesa/main/scissor.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/scissor.h b/mesalib/src/mesa/main/scissor.h index da9385e2b..2ac0c88da 100644 --- a/mesalib/src/mesa/main/scissor.h +++ b/mesalib/src/mesa/main/scissor.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c index 2c307e79c..8cb02760b 100644 --- a/mesalib/src/mesa/main/shaderapi.c +++ b/mesalib/src/mesa/main/shaderapi.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** @@ -41,7 +42,6 @@ #include "main/dispatch.h" #include "main/enums.h" #include "main/hash.h" -#include "main/mfeatures.h" #include "main/mtypes.h" #include "main/shaderapi.h" #include "main/shaderobj.h" @@ -1453,8 +1453,10 @@ _mesa_ValidateProgram(GLhandleARB program) validate_program(ctx, program); } -#ifdef FEATURE_ES2 +/** + * For OpenGL ES 2.0, GL_ARB_ES2_compatibility + */ void GLAPIENTRY _mesa_GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) @@ -1507,6 +1509,9 @@ _mesa_GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, } +/** + * For OpenGL ES 2.0, GL_ARB_ES2_compatibility + */ void GLAPIENTRY _mesa_ReleaseShaderCompiler(void) { @@ -1514,6 +1519,9 @@ _mesa_ReleaseShaderCompiler(void) } +/** + * For OpenGL ES 2.0, GL_ARB_ES2_compatibility + */ void GLAPIENTRY _mesa_ShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length) @@ -1527,7 +1535,6 @@ _mesa_ShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, _mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__); } -#endif /* FEATURE_ES2 */ void GLAPIENTRY _mesa_GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, diff --git a/mesalib/src/mesa/main/shaderapi.h b/mesalib/src/mesa/main/shaderapi.h index 342b58905..1cd4ffcea 100644 --- a/mesalib/src/mesa/main/shaderapi.h +++ b/mesalib/src/mesa/main/shaderapi.h @@ -17,9 +17,10 @@ * 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 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. + * 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. */ diff --git a/mesalib/src/mesa/main/shaderobj.c b/mesalib/src/mesa/main/shaderobj.c index 59daff5bf..a60d8f38a 100644 --- a/mesalib/src/mesa/main/shaderobj.c +++ b/mesalib/src/mesa/main/shaderobj.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** @@ -32,7 +33,6 @@ #include "main/glheader.h" #include "main/context.h" #include "main/hash.h" -#include "main/mfeatures.h" #include "main/mtypes.h" #include "main/shaderobj.h" #include "main/uniforms.h" diff --git a/mesalib/src/mesa/main/shaderobj.h b/mesalib/src/mesa/main/shaderobj.h index 5470b51d7..a0dac5ec9 100644 --- a/mesalib/src/mesa/main/shaderobj.h +++ b/mesalib/src/mesa/main/shaderobj.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/shared.c b/mesalib/src/mesa/main/shared.c index 408125998..9f5624def 100644 --- a/mesalib/src/mesa/main/shared.c +++ b/mesalib/src/mesa/main/shared.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** @@ -28,7 +29,6 @@ */ #include "imports.h" -#include "mfeatures.h" #include "mtypes.h" #include "hash.h" #include "hash_table.h" diff --git a/mesalib/src/mesa/main/shared.h b/mesalib/src/mesa/main/shared.h index 3fe4578cf..3bec08765 100644 --- a/mesalib/src/mesa/main/shared.h +++ b/mesalib/src/mesa/main/shared.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ #ifndef SHARED_H diff --git a/mesalib/src/mesa/main/simple_list.h b/mesalib/src/mesa/main/simple_list.h index 9417108a0..0ade52d71 100644 --- a/mesalib/src/mesa/main/simple_list.h +++ b/mesalib/src/mesa/main/simple_list.h @@ -28,9 +28,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/state.c b/mesalib/src/mesa/main/state.c index 251c1aea9..1b927ca65 100644 --- a/mesalib/src/mesa/main/state.c +++ b/mesalib/src/mesa/main/state.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -54,16 +55,6 @@ #include "blend.h" -static void -update_separate_specular(struct gl_context *ctx) -{ - if (_mesa_need_secondary_color(ctx)) - ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR; - else - ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR; -} - - /** * Update the following fields: * ctx->VertexProgram._Enabled @@ -324,82 +315,6 @@ update_twoside(struct gl_context *ctx) } -/* - * Check polygon state and set DD_TRI_OFFSET - * in ctx->_TriangleCaps if needed. - */ -static void -update_polygon(struct gl_context *ctx) -{ - ctx->_TriangleCaps &= ~DD_TRI_OFFSET; - - if ( ctx->Polygon.OffsetPoint - || ctx->Polygon.OffsetLine - || ctx->Polygon.OffsetFill) - ctx->_TriangleCaps |= DD_TRI_OFFSET; -} - - -/** - * Update the ctx->_TriangleCaps bitfield. - * XXX that bitfield should really go away someday! - * This function must be called after other update_*() functions since - * there are dependencies on some other derived values. - */ -#if 0 -static void -update_tricaps(struct gl_context *ctx, GLbitfield new_state) -{ - ctx->_TriangleCaps = 0; - - /* - * Points - */ - if (1/*new_state & _NEW_POINT*/) { - if (ctx->Point.SmoothFlag) - ctx->_TriangleCaps |= DD_POINT_SMOOTH; - if (ctx->Point._Attenuated) - ctx->_TriangleCaps |= DD_POINT_ATTEN; - } - - /* - * Lines - */ - if (1/*new_state & _NEW_LINE*/) { - if (ctx->Line.SmoothFlag) - ctx->_TriangleCaps |= DD_LINE_SMOOTH; - if (ctx->Line.StippleFlag) - ctx->_TriangleCaps |= DD_LINE_STIPPLE; - } - - /* - * Polygons - */ - if (1/*new_state & _NEW_POLYGON*/) { - if (ctx->Polygon.SmoothFlag) - ctx->_TriangleCaps |= DD_TRI_SMOOTH; - if (ctx->Polygon.StippleFlag) - ctx->_TriangleCaps |= DD_TRI_STIPPLE; - if (ctx->Polygon.FrontMode != GL_FILL - || ctx->Polygon.BackMode != GL_FILL) - ctx->_TriangleCaps |= DD_TRI_UNFILLED; - if (ctx->Polygon.OffsetPoint || - ctx->Polygon.OffsetLine || - ctx->Polygon.OffsetFill) - ctx->_TriangleCaps |= DD_TRI_OFFSET; - } - - /* - * Lighting and shading - */ - if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) - ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE; - if (_mesa_need_secondary_color(ctx)) - ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR; -} -#endif - - /** * Compute derived GL state. * If __struct gl_contextRec::NewState is non-zero then this function \b must @@ -458,9 +373,6 @@ _mesa_update_state_locked( struct gl_context *ctx ) if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT)) _mesa_update_draw_buffer_bounds( ctx ); - if (new_state & _NEW_POLYGON) - update_polygon( ctx ); - if (new_state & _NEW_LIGHT) _mesa_update_lighting( ctx ); @@ -473,21 +385,12 @@ _mesa_update_state_locked( struct gl_context *ctx ) if (new_state & _NEW_PIXEL) _mesa_update_pixel( ctx, new_state ); - if (new_state & _MESA_NEW_SEPARATE_SPECULAR) - update_separate_specular( ctx ); - if (new_state & (_NEW_BUFFERS | _NEW_VIEWPORT)) update_viewport_matrix(ctx); if (new_state & (_NEW_MULTISAMPLE | _NEW_BUFFERS)) update_multisample( ctx ); -#if 0 - if (new_state & (_NEW_POINT | _NEW_LINE | _NEW_POLYGON | _NEW_LIGHT - | _NEW_STENCIL | _MESA_NEW_SEPARATE_SPECULAR)) - update_tricaps( ctx, new_state ); -#endif - /* ctx->_NeedEyeCoords is now up to date. * * If the truth value of this variable has changed, update for the @@ -508,8 +411,10 @@ _mesa_update_state_locked( struct gl_context *ctx ) new_prog_state |= update_program( ctx ); } - if (new_state & (_NEW_ARRAY | _NEW_PROGRAM | _NEW_BUFFER_OBJECT)) + if (ctx->Const.CheckArrayBounds && + new_state & (_NEW_ARRAY | _NEW_PROGRAM | _NEW_BUFFER_OBJECT)) { _mesa_update_array_object_max_element(ctx, ctx->Array.ArrayObj); + } out: new_prog_state |= update_program_constants(ctx); @@ -526,7 +431,6 @@ _mesa_update_state_locked( struct gl_context *ctx ) new_state = ctx->NewState | new_prog_state; ctx->NewState = 0; ctx->Driver.UpdateState(ctx, new_state); - ctx->Array.ArrayObj->NewArrays = 0x0; } diff --git a/mesalib/src/mesa/main/state.h b/mesalib/src/mesa/main/state.h index 7b3121b4e..bc2406b4d 100644 --- a/mesalib/src/mesa/main/state.h +++ b/mesalib/src/mesa/main/state.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/stencil.c b/mesalib/src/mesa/main/stencil.c index 330841731..505703a3d 100644 --- a/mesalib/src/mesa/main/stencil.c +++ b/mesalib/src/mesa/main/stencil.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -109,10 +110,6 @@ _mesa_ClearStencil( GLint s ) { GET_CURRENT_CONTEXT(ctx); - if (ctx->Stencil.Clear == (GLuint) s) - return; - - FLUSH_VERTICES(ctx, _NEW_STENCIL); ctx->Stencil.Clear = (GLuint) s; } @@ -135,7 +132,6 @@ void GLAPIENTRY _mesa_StencilFuncSeparateATI( GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask ) { GET_CURRENT_CONTEXT(ctx); - const GLint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1; if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glStencilFuncSeparateATI()\n"); @@ -151,8 +147,6 @@ _mesa_StencilFuncSeparateATI( GLenum frontfunc, GLenum backfunc, GLint ref, GLui return; } - ref = CLAMP( ref, 0, stencilMax ); - /* set both front and back state */ if (ctx->Stencil.Function[0] == frontfunc && ctx->Stencil.Function[1] == backfunc && @@ -192,7 +186,6 @@ void GLAPIENTRY _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask ) { GET_CURRENT_CONTEXT(ctx); - const GLint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1; const GLint face = ctx->Stencil.ActiveFace; if (MESA_VERBOSE & VERBOSE_API) @@ -203,8 +196,6 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask ) return; } - ref = CLAMP( ref, 0, stencilMax ); - if (face != 0) { if (ctx->Stencil.Function[face] == func && ctx->Stencil.ValueMask[face] == mask && @@ -390,7 +381,6 @@ _mesa_ActiveStencilFaceEXT(GLenum face) } if (face == GL_FRONT || face == GL_BACK) { - FLUSH_VERTICES(ctx, _NEW_STENCIL); ctx->Stencil.ActiveFace = (face == GL_FRONT) ? 0 : 2; } else { @@ -467,7 +457,6 @@ void GLAPIENTRY _mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) { GET_CURRENT_CONTEXT(ctx); - const GLint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1; if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glStencilFuncSeparate()\n"); @@ -481,8 +470,6 @@ _mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) return; } - ref = CLAMP(ref, 0, stencilMax); - FLUSH_VERTICES(ctx, _NEW_STENCIL); if (face != GL_BACK) { diff --git a/mesalib/src/mesa/main/stencil.h b/mesalib/src/mesa/main/stencil.h index b772bfd6e..f2f7d37c6 100644 --- a/mesalib/src/mesa/main/stencil.h +++ b/mesalib/src/mesa/main/stencil.h @@ -22,9 +22,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -78,4 +79,18 @@ _mesa_update_stencil(struct gl_context *ctx); extern void _mesa_init_stencil( struct gl_context * ctx ); +/* From the GL 4.3 spec, 17.3.5: + * "Stencil comparison operations and queries of <ref> clamp its value + * to the range [0, 2^s-1], where <s> is the number of bits in the + * stencil buffer attached to the draw framebuffer." + */ + +static inline GLint +_mesa_get_stencil_ref(struct gl_context const *ctx, int face) +{ + GLint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1; + GLint ref = ctx->Stencil.Ref[face]; + return CLAMP(ref, 0, stencilMax); +} + #endif diff --git a/mesalib/src/mesa/main/syncobj.c b/mesalib/src/mesa/main/syncobj.c index 020fa1d7a..c8d25cdf1 100644 --- a/mesalib/src/mesa/main/syncobj.c +++ b/mesalib/src/mesa/main/syncobj.c @@ -60,7 +60,6 @@ #include "imports.h" #include "context.h" #include "macros.h" -#include "mfeatures.h" #include "get.h" #include "dispatch.h" #include "mtypes.h" diff --git a/mesalib/src/mesa/main/syncobj.h b/mesalib/src/mesa/main/syncobj.h index 6b4367466..faa3f558d 100644 --- a/mesalib/src/mesa/main/syncobj.h +++ b/mesalib/src/mesa/main/syncobj.h @@ -32,7 +32,6 @@ #define SYNCOBJ_H #include "glheader.h" -#include "mfeatures.h" struct _glapi_table; struct dd_function_table; diff --git a/mesalib/src/mesa/main/texcompress.c b/mesalib/src/mesa/main/texcompress.c index 734294e45..2391868a4 100644 --- a/mesalib/src/mesa/main/texcompress.c +++ b/mesalib/src/mesa/main/texcompress.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -35,7 +36,6 @@ #include "colormac.h" #include "context.h" #include "formats.h" -#include "mfeatures.h" #include "mtypes.h" #include "context.h" #include "texcompress.h" @@ -588,7 +588,7 @@ _mesa_decompress_image(gl_format format, GLuint width, GLuint height, for (j = 0; j < height; j++) { for (i = 0; i < width; i++) { - fetch(src, NULL, stride, i, j, 0, dest); + fetch(src, stride, i, j, dest); dest += 4; } } diff --git a/mesalib/src/mesa/main/texcompress.h b/mesalib/src/mesa/main/texcompress.h index b45e7cf1b..c27fc26c9 100644 --- a/mesalib/src/mesa/main/texcompress.h +++ b/mesalib/src/mesa/main/texcompress.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ #ifndef TEXCOMPRESS_H @@ -27,7 +28,6 @@ #include "formats.h" #include "glheader.h" -#include "mfeatures.h" struct gl_context; @@ -51,9 +51,8 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img, /** A function to fetch one texel from a compressed texture */ typedef void (*compressed_fetch_func)(const GLubyte *map, - const GLuint imageOffsets[], GLint rowStride, - GLint i, GLint j, GLint k, + GLint i, GLint j, GLfloat *texel); extern compressed_fetch_func diff --git a/mesalib/src/mesa/main/texcompress_cpal.c b/mesalib/src/mesa/main/texcompress_cpal.c index 75389a437..2838a6a4e 100644 --- a/mesalib/src/mesa/main/texcompress_cpal.c +++ b/mesalib/src/mesa/main/texcompress_cpal.c @@ -16,9 +16,10 @@ * 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 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. + * 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. */ /** @@ -33,7 +34,6 @@ #include "glheader.h" #include "compiler.h" /* for ASSERT */ #include "context.h" -#include "mfeatures.h" #include "mtypes.h" #include "imports.h" #include "pixelstore.h" diff --git a/mesalib/src/mesa/main/texcompress_cpal.h b/mesalib/src/mesa/main/texcompress_cpal.h index 7d28fd866..8a8eac292 100644 --- a/mesalib/src/mesa/main/texcompress_cpal.h +++ b/mesalib/src/mesa/main/texcompress_cpal.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/texcompress_etc.c b/mesalib/src/mesa/main/texcompress_etc.c index 7ad4ddeb6..a06d29f19 100644 --- a/mesalib/src/mesa/main/texcompress_etc.c +++ b/mesalib/src/mesa/main/texcompress_etc.c @@ -38,7 +38,6 @@ */ #include <stdbool.h> -#include "mfeatures.h" #include "texcompress.h" #include "texcompress_etc.h" #include "texstore.h" @@ -1223,8 +1222,8 @@ _mesa_unpack_etc2_format(uint8_t *dst_row, static void -fetch_etc1_rgb8(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, +fetch_etc1_rgb8(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { struct etc1_block block; @@ -1244,9 +1243,8 @@ fetch_etc1_rgb8(const GLubyte *map, const GLuint imageOffsets[], static void -fetch_etc2_rgb8(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_etc2_rgb8(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { struct etc2_block block; uint8_t dst[3]; @@ -1266,9 +1264,8 @@ fetch_etc2_rgb8(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_etc2_srgb8(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_etc2_srgb8(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { struct etc2_block block; uint8_t dst[3]; @@ -1288,9 +1285,8 @@ fetch_etc2_srgb8(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_etc2_rgba8_eac(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_etc2_rgba8_eac(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { struct etc2_block block; uint8_t dst[4]; @@ -1308,9 +1304,8 @@ fetch_etc2_rgba8_eac(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_etc2_srgb8_alpha8_eac(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_etc2_srgb8_alpha8_eac(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { struct etc2_block block; uint8_t dst[4]; @@ -1328,9 +1323,8 @@ fetch_etc2_srgb8_alpha8_eac(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_etc2_r11_eac(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_etc2_r11_eac(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { struct etc2_block block; GLushort dst; @@ -1348,9 +1342,8 @@ fetch_etc2_r11_eac(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_etc2_rg11_eac(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_etc2_rg11_eac(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { struct etc2_block block; GLushort dst[2]; @@ -1373,9 +1366,8 @@ fetch_etc2_rg11_eac(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_etc2_signed_r11_eac(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_etc2_signed_r11_eac(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { struct etc2_block block; GLushort dst; @@ -1393,9 +1385,8 @@ fetch_etc2_signed_r11_eac(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_etc2_signed_rg11_eac(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_etc2_signed_rg11_eac(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { struct etc2_block block; GLushort dst[2]; @@ -1419,8 +1410,7 @@ fetch_etc2_signed_rg11_eac(const GLubyte *map, const GLuint imageOffsets[], static void fetch_etc2_rgb8_punchthrough_alpha1(const GLubyte *map, - const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { struct etc2_block block; @@ -1441,10 +1431,8 @@ fetch_etc2_rgb8_punchthrough_alpha1(const GLubyte *map, static void fetch_etc2_srgb8_punchthrough_alpha1(const GLubyte *map, - const GLuint imageOffsets[], GLint rowStride, - GLint i, GLint j, GLint k, - GLfloat *texel) + GLint i, GLint j, GLfloat *texel) { struct etc2_block block; uint8_t dst[4]; diff --git a/mesalib/src/mesa/main/texcompress_etc.h b/mesalib/src/mesa/main/texcompress_etc.h index 503d0388a..9da0fb337 100644 --- a/mesalib/src/mesa/main/texcompress_etc.h +++ b/mesalib/src/mesa/main/texcompress_etc.h @@ -26,7 +26,6 @@ #include <inttypes.h> #include "glheader.h" -#include "mfeatures.h" #include "texcompress.h" #include "texstore.h" diff --git a/mesalib/src/mesa/main/texcompress_fxt1.c b/mesalib/src/mesa/main/texcompress_fxt1.c index f7254f92e..93bd19a9a 100644 --- a/mesalib/src/mesa/main/texcompress_fxt1.c +++ b/mesalib/src/mesa/main/texcompress_fxt1.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -34,7 +35,6 @@ #include "colormac.h" #include "image.h" #include "macros.h" -#include "mfeatures.h" #include "mipmap.h" #include "texcompress.h" #include "texcompress_fxt1.h" @@ -1616,8 +1616,8 @@ fxt1_decode_1 (const void *texture, GLint stride, /* in pixels */ static void -fetch_rgb_fxt1(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) +fetch_rgb_fxt1(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { GLubyte rgba[4]; fxt1_decode_1(map, rowStride, i, j, rgba); @@ -1629,8 +1629,8 @@ fetch_rgb_fxt1(const GLubyte *map, const GLuint imageOffsets[], static void -fetch_rgba_fxt1(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) +fetch_rgba_fxt1(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { GLubyte rgba[4]; fxt1_decode_1(map, rowStride, i, j, rgba); diff --git a/mesalib/src/mesa/main/texcompress_fxt1.h b/mesalib/src/mesa/main/texcompress_fxt1.h index 5949df90f..3a00de5ac 100644 --- a/mesalib/src/mesa/main/texcompress_fxt1.h +++ b/mesalib/src/mesa/main/texcompress_fxt1.h @@ -17,16 +17,16 @@ * 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 - * BRIAN PAUL 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. + * 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. */ #ifndef TEXCOMPRESS_FXT1_H #define TEXCOMPRESS_FXT1_H #include "glheader.h" -#include "mfeatures.h" #include "texstore.h" diff --git a/mesalib/src/mesa/main/texcompress_rgtc.c b/mesalib/src/mesa/main/texcompress_rgtc.c index 1f8de25ec..7afd8ffa7 100644 --- a/mesalib/src/mesa/main/texcompress_rgtc.c +++ b/mesalib/src/mesa/main/texcompress_rgtc.c @@ -38,7 +38,6 @@ #include "colormac.h" #include "image.h" #include "macros.h" -#include "mfeatures.h" #include "mipmap.h" #include "texcompress.h" #include "texcompress_rgtc.h" @@ -319,12 +318,11 @@ _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS) static void -fetch_red_rgtc1(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) +fetch_red_rgtc1(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { GLubyte red; - GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0; - unsigned_fetch_texel_rgtc(rowStride, map + sliceOffset, i, j, &red, 1); + unsigned_fetch_texel_rgtc(rowStride, map, i, j, &red, 1); texel[RCOMP] = UBYTE_TO_FLOAT(red); texel[GCOMP] = 0.0; texel[BCOMP] = 0.0; @@ -332,12 +330,11 @@ fetch_red_rgtc1(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_l_latc1(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) +fetch_l_latc1(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { GLubyte red; - GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0; - unsigned_fetch_texel_rgtc(rowStride, map + sliceOffset, i, j, &red, 1); + unsigned_fetch_texel_rgtc(rowStride, map, i, j, &red, 1); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = UBYTE_TO_FLOAT(red); @@ -345,13 +342,11 @@ fetch_l_latc1(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_signed_red_rgtc1(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_signed_red_rgtc1(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { GLbyte red; - GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0; - signed_fetch_texel_rgtc(rowStride, (const GLbyte *) map + sliceOffset, + signed_fetch_texel_rgtc(rowStride, (const GLbyte *) map, i, j, &red, 1); texel[RCOMP] = BYTE_TO_FLOAT_TEX(red); texel[GCOMP] = 0.0; @@ -360,13 +355,11 @@ fetch_signed_red_rgtc1(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_signed_l_latc1(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_signed_l_latc1(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { GLbyte red; - GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0; - signed_fetch_texel_rgtc(rowStride, (GLbyte *) map + sliceOffset, + signed_fetch_texel_rgtc(rowStride, (GLbyte *) map, i, j, &red, 1); texel[RCOMP] = texel[GCOMP] = @@ -375,17 +368,15 @@ fetch_signed_l_latc1(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_rg_rgtc2(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_rg_rgtc2(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { GLubyte red, green; - GLuint sliceOffset = k ? imageOffsets[k] : 0; unsigned_fetch_texel_rgtc(rowStride, - map + sliceOffset, + map, i, j, &red, 2); unsigned_fetch_texel_rgtc(rowStride, - map + sliceOffset + 8, + map + 8, i, j, &green, 2); texel[RCOMP] = UBYTE_TO_FLOAT(red); texel[GCOMP] = UBYTE_TO_FLOAT(green); @@ -394,17 +385,15 @@ fetch_rg_rgtc2(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_la_latc2(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_la_latc2(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { GLubyte red, green; - GLuint sliceOffset = k ? imageOffsets[k] : 0; unsigned_fetch_texel_rgtc(rowStride, - map + sliceOffset, + map, i, j, &red, 2); unsigned_fetch_texel_rgtc(rowStride, - map + sliceOffset + 8, + map + 8, i, j, &green, 2); texel[RCOMP] = texel[GCOMP] = @@ -414,17 +403,15 @@ fetch_la_latc2(const GLubyte *map, const GLuint imageOffsets[], static void -fetch_signed_rg_rgtc2(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_signed_rg_rgtc2(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { GLbyte red, green; - GLuint sliceOffset = k ? imageOffsets[k] : 0; signed_fetch_texel_rgtc(rowStride, - (GLbyte *) map + sliceOffset, + (GLbyte *) map, i, j, &red, 2); signed_fetch_texel_rgtc(rowStride, - (GLbyte *) map + sliceOffset + 8, + (GLbyte *) map + 8, i, j, &green, 2); texel[RCOMP] = BYTE_TO_FLOAT_TEX(red); texel[GCOMP] = BYTE_TO_FLOAT_TEX(green); @@ -434,17 +421,15 @@ fetch_signed_rg_rgtc2(const GLubyte *map, const GLuint imageOffsets[], static void -fetch_signed_la_latc2(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, - GLfloat *texel) +fetch_signed_la_latc2(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { GLbyte red, green; - GLuint sliceOffset = k ? imageOffsets[k] : 0; signed_fetch_texel_rgtc(rowStride, - (GLbyte *) map + sliceOffset, + (GLbyte *) map, i, j, &red, 2); signed_fetch_texel_rgtc(rowStride, - (GLbyte *) map + sliceOffset + 8, + (GLbyte *) map + 8, i, j, &green, 2); texel[RCOMP] = texel[GCOMP] = diff --git a/mesalib/src/mesa/main/texcompress_rgtc.h b/mesalib/src/mesa/main/texcompress_rgtc.h index 9e1cce438..98638f022 100644 --- a/mesalib/src/mesa/main/texcompress_rgtc.h +++ b/mesalib/src/mesa/main/texcompress_rgtc.h @@ -25,7 +25,6 @@ #define TEXCOMPRESS_RGTC_H #include "glheader.h" -#include "mfeatures.h" #include "texstore.h" diff --git a/mesalib/src/mesa/main/texcompress_s3tc.c b/mesalib/src/mesa/main/texcompress_s3tc.c index 4a81ad803..41ea33613 100644 --- a/mesalib/src/mesa/main/texcompress_s3tc.c +++ b/mesalib/src/mesa/main/texcompress_s3tc.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -39,7 +40,6 @@ #include "dlopen.h" #include "image.h" #include "macros.h" -#include "mfeatures.h" #include "mtypes.h" #include "texcompress.h" #include "texcompress_s3tc.h" @@ -345,13 +345,12 @@ problem(const char *func) static void -fetch_rgb_dxt1(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) +fetch_rgb_dxt1(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { if (fetch_ext_rgb_dxt1) { - GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0; GLubyte tex[4]; - fetch_ext_rgb_dxt1(rowStride, map + sliceOffset, i, j, tex); + fetch_ext_rgb_dxt1(rowStride, map, i, j, tex); texel[RCOMP] = UBYTE_TO_FLOAT(tex[RCOMP]); texel[GCOMP] = UBYTE_TO_FLOAT(tex[GCOMP]); texel[BCOMP] = UBYTE_TO_FLOAT(tex[BCOMP]); @@ -363,13 +362,12 @@ fetch_rgb_dxt1(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_rgba_dxt1(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) +fetch_rgba_dxt1(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { if (fetch_ext_rgba_dxt1) { - GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0; GLubyte tex[4]; - fetch_ext_rgba_dxt1(rowStride, map + sliceOffset, i, j, tex); + fetch_ext_rgba_dxt1(rowStride, map, i, j, tex); texel[RCOMP] = UBYTE_TO_FLOAT(tex[RCOMP]); texel[GCOMP] = UBYTE_TO_FLOAT(tex[GCOMP]); texel[BCOMP] = UBYTE_TO_FLOAT(tex[BCOMP]); @@ -381,13 +379,12 @@ fetch_rgba_dxt1(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_rgba_dxt3(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) +fetch_rgba_dxt3(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { if (fetch_ext_rgba_dxt3) { - GLuint sliceOffset = k ? imageOffsets[k] : 0; GLubyte tex[4]; - fetch_ext_rgba_dxt3(rowStride, map + sliceOffset, i, j, tex); + fetch_ext_rgba_dxt3(rowStride, map, i, j, tex); texel[RCOMP] = UBYTE_TO_FLOAT(tex[RCOMP]); texel[GCOMP] = UBYTE_TO_FLOAT(tex[GCOMP]); texel[BCOMP] = UBYTE_TO_FLOAT(tex[BCOMP]); @@ -399,13 +396,12 @@ fetch_rgba_dxt3(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_rgba_dxt5(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) +fetch_rgba_dxt5(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { if (fetch_ext_rgba_dxt5) { - GLuint sliceOffset = k ? imageOffsets[k] : 0; GLubyte tex[4]; - fetch_ext_rgba_dxt5(rowStride, map + sliceOffset, i, j, tex); + fetch_ext_rgba_dxt5(rowStride, map, i, j, tex); texel[RCOMP] = UBYTE_TO_FLOAT(tex[RCOMP]); texel[GCOMP] = UBYTE_TO_FLOAT(tex[GCOMP]); texel[BCOMP] = UBYTE_TO_FLOAT(tex[BCOMP]); @@ -418,13 +414,12 @@ fetch_rgba_dxt5(const GLubyte *map, const GLuint imageOffsets[], static void -fetch_srgb_dxt1(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) +fetch_srgb_dxt1(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { if (fetch_ext_rgb_dxt1) { - GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0; GLubyte tex[4]; - fetch_ext_rgb_dxt1(rowStride, map + sliceOffset, i, j, tex); + fetch_ext_rgb_dxt1(rowStride, map, i, j, tex); texel[RCOMP] = _mesa_nonlinear_to_linear(tex[RCOMP]); texel[GCOMP] = _mesa_nonlinear_to_linear(tex[GCOMP]); texel[BCOMP] = _mesa_nonlinear_to_linear(tex[BCOMP]); @@ -436,13 +431,12 @@ fetch_srgb_dxt1(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_srgba_dxt1(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) +fetch_srgba_dxt1(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { if (fetch_ext_rgba_dxt1) { - GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0; GLubyte tex[4]; - fetch_ext_rgba_dxt1(rowStride, map + sliceOffset, i, j, tex); + fetch_ext_rgba_dxt1(rowStride, map, i, j, tex); texel[RCOMP] = _mesa_nonlinear_to_linear(tex[RCOMP]); texel[GCOMP] = _mesa_nonlinear_to_linear(tex[GCOMP]); texel[BCOMP] = _mesa_nonlinear_to_linear(tex[BCOMP]); @@ -454,13 +448,12 @@ fetch_srgba_dxt1(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_srgba_dxt3(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) +fetch_srgba_dxt3(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { if (fetch_ext_rgba_dxt3) { - GLuint sliceOffset = k ? imageOffsets[k] : 0; GLubyte tex[4]; - fetch_ext_rgba_dxt3(rowStride, map + sliceOffset, i, j, tex); + fetch_ext_rgba_dxt3(rowStride, map, i, j, tex); texel[RCOMP] = _mesa_nonlinear_to_linear(tex[RCOMP]); texel[GCOMP] = _mesa_nonlinear_to_linear(tex[GCOMP]); texel[BCOMP] = _mesa_nonlinear_to_linear(tex[BCOMP]); @@ -472,13 +465,12 @@ fetch_srgba_dxt3(const GLubyte *map, const GLuint imageOffsets[], } static void -fetch_srgba_dxt5(const GLubyte *map, const GLuint imageOffsets[], - GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) +fetch_srgba_dxt5(const GLubyte *map, + GLint rowStride, GLint i, GLint j, GLfloat *texel) { if (fetch_ext_rgba_dxt5) { - GLuint sliceOffset = k ? imageOffsets[k] : 0; GLubyte tex[4]; - fetch_ext_rgba_dxt5(rowStride, map + sliceOffset, i, j, tex); + fetch_ext_rgba_dxt5(rowStride, map, i, j, tex); texel[RCOMP] = _mesa_nonlinear_to_linear(tex[RCOMP]); texel[GCOMP] = _mesa_nonlinear_to_linear(tex[GCOMP]); texel[BCOMP] = _mesa_nonlinear_to_linear(tex[BCOMP]); diff --git a/mesalib/src/mesa/main/texcompress_s3tc.h b/mesalib/src/mesa/main/texcompress_s3tc.h index d9ef68992..fbc04c234 100644 --- a/mesalib/src/mesa/main/texcompress_s3tc.h +++ b/mesalib/src/mesa/main/texcompress_s3tc.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ #ifndef TEXCOMPRESS_S3TC_H @@ -27,7 +28,6 @@ #include "compiler.h" #include "glheader.h" -#include "mfeatures.h" #include "texstore.h" #include "texcompress.h" diff --git a/mesalib/src/mesa/main/texenv.c b/mesalib/src/mesa/main/texenv.c index 2979e6706..84731ddda 100644 --- a/mesalib/src/mesa/main/texenv.c +++ b/mesalib/src/mesa/main/texenv.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** @@ -879,7 +880,7 @@ _mesa_GetTexBumpParameterivATI( GLenum pname, GLint *param ) } else if (pname == GL_BUMP_NUM_TEX_UNITS_ATI) { GLint count = 0; - for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) { + for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; i++) { if (ctx->Const.SupportedBumpUnits & (1 << i)) { count++; } @@ -887,7 +888,7 @@ _mesa_GetTexBumpParameterivATI( GLenum pname, GLint *param ) *param = count; } else if (pname == GL_BUMP_TEX_UNITS_ATI) { - for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) { + for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; i++) { if (ctx->Const.SupportedBumpUnits & (1 << i)) { *param++ = i + GL_TEXTURE0; } @@ -928,7 +929,7 @@ _mesa_GetTexBumpParameterfvATI( GLenum pname, GLfloat *param ) } else if (pname == GL_BUMP_NUM_TEX_UNITS_ATI) { GLint count = 0; - for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) { + for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; i++) { if (ctx->Const.SupportedBumpUnits & (1 << i)) { count++; } @@ -936,7 +937,7 @@ _mesa_GetTexBumpParameterfvATI( GLenum pname, GLfloat *param ) *param = (GLfloat) count; } else if (pname == GL_BUMP_TEX_UNITS_ATI) { - for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) { + for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; i++) { if (ctx->Const.SupportedBumpUnits & (1 << i)) { *param++ = (GLfloat) (i + GL_TEXTURE0); } diff --git a/mesalib/src/mesa/main/texenv.h b/mesalib/src/mesa/main/texenv.h index 1e9c5faed..5f71e276d 100644 --- a/mesalib/src/mesa/main/texenv.h +++ b/mesalib/src/mesa/main/texenv.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/texenvprogram.h b/mesalib/src/mesa/main/texenvprogram.h index 3d9cb8546..aff404be0 100644 --- a/mesalib/src/mesa/main/texenvprogram.h +++ b/mesalib/src/mesa/main/texenvprogram.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c index 6f22a4f5f..495a2048d 100644 --- a/mesalib/src/mesa/main/texformat.c +++ b/mesalib/src/mesa/main/texformat.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -35,7 +36,6 @@ #include "context.h" #include "enums.h" -#include "mfeatures.h" #include "mtypes.h" #include "texcompress.h" #include "texformat.h" @@ -50,250 +50,229 @@ * internalFormat parameters passed to glTexImage(). * * \param ctx the GL context. + * \param target a texture target (GL_TEXTURE_x) * \param internalFormat user's prefered internal texture format. * \param format incoming image pixel format. * \param type incoming image data type. * - * \return a pointer to a gl_texture_format object which describes the - * choosen texture format, or NULL on failure. - * - * This is called via dd_function_table::ChooseTextureFormat. Hardware drivers - * will typically override this function with a specialized version. + * \return the closest gl_format for the given format/type arguments + * + * This is called via dd_function_table::ChooseTextureFormat. Hardware + * drivers may override this function with a specialized version. */ gl_format _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, GLint internalFormat, GLenum format, GLenum type) { (void) format; - (void) type; switch (internalFormat) { - /* shallow RGBA formats */ - case 4: - case GL_RGBA: - if (type == GL_UNSIGNED_SHORT_4_4_4_4_REV) { - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444); - } else if (type == GL_UNSIGNED_SHORT_1_5_5_5_REV) { - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB1555); - } else if (type == GL_UNSIGNED_INT_2_10_10_10_REV) { - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB2101010); - } - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); - break; - - case GL_RGBA8: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); - break; - case GL_RGB5_A1: - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB1555); - break; - case GL_RGBA2: - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444_REV); /* just to test another format*/ - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444); - break; - case GL_RGBA4: - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444); - break; - - /* deep RGBA formats */ - case GL_RGB10_A2: - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB2101010); - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); - break; - case GL_RGBA12: - case GL_RGBA16: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); - break; - - /* shallow RGB formats */ - case 3: - case GL_RGB: - if (type == GL_UNSIGNED_INT_2_10_10_10_REV) { - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB2101010); - } - /* fallthrough */ - case GL_RGB8: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888); - RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); - break; - case GL_R3_G3_B2: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB332); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565_REV); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888); - RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); - break; - case GL_RGB4: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565_REV); /* just to test another format */ - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565); - break; - case GL_RGB5: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565); - break; - - /* deep RGB formats */ - case GL_RGB10: - case GL_RGB12: - case GL_RGB16: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16); - RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); - break; - - /* Alpha formats */ - case GL_ALPHA: - case GL_ALPHA4: - case GL_ALPHA8: - RETURN_IF_SUPPORTED(MESA_FORMAT_A8); - break; - - case GL_ALPHA12: - case GL_ALPHA16: - RETURN_IF_SUPPORTED(MESA_FORMAT_A16); - RETURN_IF_SUPPORTED(MESA_FORMAT_A8); - break; - - /* Luminance formats */ - case 1: - case GL_LUMINANCE: - case GL_LUMINANCE4: - case GL_LUMINANCE8: - RETURN_IF_SUPPORTED(MESA_FORMAT_L8); - break; - - case GL_LUMINANCE12: - case GL_LUMINANCE16: - RETURN_IF_SUPPORTED(MESA_FORMAT_L16); - RETURN_IF_SUPPORTED(MESA_FORMAT_L8); - break; + /* shallow RGBA formats */ + case 4: + case GL_RGBA: + if (type == GL_UNSIGNED_SHORT_4_4_4_4_REV) { + RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444); + } else if (type == GL_UNSIGNED_SHORT_1_5_5_5_REV) { + RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB1555); + } else if (type == GL_UNSIGNED_INT_2_10_10_10_REV) { + RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB2101010); + } + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); + break; + + case GL_RGBA8: + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); + break; + case GL_RGB5_A1: + RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB1555); + break; + case GL_RGBA2: + RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444_REV); /* just to test another format*/ + RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444); + break; + case GL_RGBA4: + RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444); + break; + + /* deep RGBA formats */ + case GL_RGB10_A2: + RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB2101010); + RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); + break; + case GL_RGBA12: + case GL_RGBA16: + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); + break; + + /* shallow RGB formats */ + case 3: + case GL_RGB: + if (type == GL_UNSIGNED_INT_2_10_10_10_REV) { + RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB2101010); + } + /* fallthrough */ + case GL_RGB8: + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888); + RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); + break; + case GL_R3_G3_B2: + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB332); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565_REV); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888); + RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); + break; + case GL_RGB4: + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565_REV); /* just to test another format */ + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565); + break; + case GL_RGB5: + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565); + break; + + /* deep RGB formats */ + case GL_RGB10: + case GL_RGB12: + case GL_RGB16: + RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR16161616_UNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16); + RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); + break; + + /* Alpha formats */ + case GL_ALPHA: + case GL_ALPHA4: + case GL_ALPHA8: + RETURN_IF_SUPPORTED(MESA_FORMAT_A8); + break; + + case GL_ALPHA12: + case GL_ALPHA16: + RETURN_IF_SUPPORTED(MESA_FORMAT_A16); + RETURN_IF_SUPPORTED(MESA_FORMAT_A8); + break; + + /* Luminance formats */ + case 1: + case GL_LUMINANCE: + case GL_LUMINANCE4: + case GL_LUMINANCE8: + RETURN_IF_SUPPORTED(MESA_FORMAT_L8); + break; + + case GL_LUMINANCE12: + case GL_LUMINANCE16: + RETURN_IF_SUPPORTED(MESA_FORMAT_L16); + RETURN_IF_SUPPORTED(MESA_FORMAT_L8); + break; /* Luminance/Alpha formats */ - case GL_LUMINANCE4_ALPHA4: - RETURN_IF_SUPPORTED(MESA_FORMAT_AL44); - RETURN_IF_SUPPORTED(MESA_FORMAT_AL88); - break; - - case 2: - case GL_LUMINANCE_ALPHA: - case GL_LUMINANCE6_ALPHA2: - case GL_LUMINANCE8_ALPHA8: - RETURN_IF_SUPPORTED(MESA_FORMAT_AL88); - break; - - case GL_LUMINANCE12_ALPHA4: - case GL_LUMINANCE12_ALPHA12: - case GL_LUMINANCE16_ALPHA16: - RETURN_IF_SUPPORTED(MESA_FORMAT_AL1616); - RETURN_IF_SUPPORTED(MESA_FORMAT_AL88); - break; - - case GL_INTENSITY: - case GL_INTENSITY4: - case GL_INTENSITY8: - RETURN_IF_SUPPORTED(MESA_FORMAT_I8); - break; - - case GL_INTENSITY12: - case GL_INTENSITY16: - RETURN_IF_SUPPORTED(MESA_FORMAT_I16); - RETURN_IF_SUPPORTED(MESA_FORMAT_I8); - break; - - default: - ; /* fallthrough */ - } - - if (ctx->Extensions.ARB_depth_texture) { - switch (internalFormat) { - case GL_DEPTH_COMPONENT: - case GL_DEPTH_COMPONENT24: - case GL_DEPTH_COMPONENT32: - RETURN_IF_SUPPORTED(MESA_FORMAT_Z32); - RETURN_IF_SUPPORTED(MESA_FORMAT_X8_Z24); - RETURN_IF_SUPPORTED(MESA_FORMAT_S8_Z24); - break; - case GL_DEPTH_COMPONENT16: - RETURN_IF_SUPPORTED(MESA_FORMAT_Z16); - RETURN_IF_SUPPORTED(MESA_FORMAT_X8_Z24); - RETURN_IF_SUPPORTED(MESA_FORMAT_S8_Z24); - default: - ; /* fallthrough */ + case GL_LUMINANCE4_ALPHA4: + RETURN_IF_SUPPORTED(MESA_FORMAT_AL44); + RETURN_IF_SUPPORTED(MESA_FORMAT_AL88); + break; + + case 2: + case GL_LUMINANCE_ALPHA: + case GL_LUMINANCE6_ALPHA2: + case GL_LUMINANCE8_ALPHA8: + RETURN_IF_SUPPORTED(MESA_FORMAT_AL88); + break; + + case GL_LUMINANCE12_ALPHA4: + case GL_LUMINANCE12_ALPHA12: + case GL_LUMINANCE16_ALPHA16: + RETURN_IF_SUPPORTED(MESA_FORMAT_AL1616); + RETURN_IF_SUPPORTED(MESA_FORMAT_AL88); + break; + + case GL_INTENSITY: + case GL_INTENSITY4: + case GL_INTENSITY8: + RETURN_IF_SUPPORTED(MESA_FORMAT_I8); + break; + + case GL_INTENSITY12: + case GL_INTENSITY16: + RETURN_IF_SUPPORTED(MESA_FORMAT_I16); + RETURN_IF_SUPPORTED(MESA_FORMAT_I8); + break; + + case GL_DEPTH_COMPONENT: + case GL_DEPTH_COMPONENT24: + case GL_DEPTH_COMPONENT32: + RETURN_IF_SUPPORTED(MESA_FORMAT_Z32); + RETURN_IF_SUPPORTED(MESA_FORMAT_X8_Z24); + RETURN_IF_SUPPORTED(MESA_FORMAT_S8_Z24); + break; + case GL_DEPTH_COMPONENT16: + RETURN_IF_SUPPORTED(MESA_FORMAT_Z16); + RETURN_IF_SUPPORTED(MESA_FORMAT_X8_Z24); + RETURN_IF_SUPPORTED(MESA_FORMAT_S8_Z24); + break; + + case GL_COMPRESSED_ALPHA_ARB: + RETURN_IF_SUPPORTED(MESA_FORMAT_A8); + break; + case GL_COMPRESSED_LUMINANCE_ARB: + RETURN_IF_SUPPORTED(MESA_FORMAT_L8); + break; + case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: + RETURN_IF_SUPPORTED(MESA_FORMAT_AL88); + break; + case GL_COMPRESSED_INTENSITY_ARB: + RETURN_IF_SUPPORTED(MESA_FORMAT_I8); + break; + case GL_COMPRESSED_RGB_ARB: + /* We don't use texture compression for 1D and 1D array textures. + * For 1D textures, compressions doesn't buy us much. + * For 1D ARRAY textures, there's complicated issues with updating + * sub-regions on non-block boundaries with glCopyTexSubImage, among + * other issues. FWIW, the GL_EXT_texture_array extension prohibits + * 1D ARRAY textures in S3TC format. + */ + if (target != GL_TEXTURE_1D && target != GL_TEXTURE_1D_ARRAY) { + if (ctx->Extensions.EXT_texture_compression_s3tc || + ctx->Extensions.ANGLE_texture_compression_dxt) + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1); + if (ctx->Extensions.TDFX_texture_compression_FXT1) + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FXT1); } - } - - switch (internalFormat) { - case GL_COMPRESSED_ALPHA_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_A8); - break; - case GL_COMPRESSED_LUMINANCE_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_L8); - break; - case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_AL88); - break; - case GL_COMPRESSED_INTENSITY_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_I8); - break; - case GL_COMPRESSED_RGB_ARB: - /* We don't use texture compression for 1D and 1D array textures. - * For 1D textures, compressions doesn't buy us much. - * For 1D ARRAY textures, there's complicated issues with updating - * sub-regions on non-block boundaries with glCopyTexSubImage, among - * other issues. FWIW, the GL_EXT_texture_array extension prohibits - * 1D ARRAY textures in S3TC format. - */ - if (target != GL_TEXTURE_1D && target != GL_TEXTURE_1D_ARRAY) { - if (ctx->Extensions.EXT_texture_compression_s3tc || - ctx->Extensions.ANGLE_texture_compression_dxt) - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1); - if (ctx->Extensions.TDFX_texture_compression_FXT1) - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FXT1); - } - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888); - RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); - break; - case GL_COMPRESSED_RGBA_ARB: - /* We don't use texture compression for 1D and 1D array textures. */ - if (target != GL_TEXTURE_1D && target != GL_TEXTURE_1D_ARRAY) { - if (ctx->Extensions.EXT_texture_compression_s3tc || - ctx->Extensions.ANGLE_texture_compression_dxt) - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT3); /* Not rgba_dxt1, see spec */ - if (ctx->Extensions.TDFX_texture_compression_FXT1) - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FXT1); - } - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); - break; - default: - ; /* fallthrough */ - } - - if (ctx->Extensions.ARB_ES2_compatibility) { - switch (internalFormat) { - case GL_RGB565: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565); - break; - default: - ; /* fallthrough */ + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888); + RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); + break; + case GL_COMPRESSED_RGBA_ARB: + /* We don't use texture compression for 1D and 1D array textures. */ + if (target != GL_TEXTURE_1D && target != GL_TEXTURE_1D_ARRAY) { + if (ctx->Extensions.EXT_texture_compression_s3tc || + ctx->Extensions.ANGLE_texture_compression_dxt) + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT3); /* Not rgba_dxt1, see spec */ + if (ctx->Extensions.TDFX_texture_compression_FXT1) + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FXT1); } - } + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); + break; - if (ctx->Extensions.MESA_ycbcr_texture) { - if (internalFormat == GL_YCBCR_MESA) { - if (type == GL_UNSIGNED_SHORT_8_8_MESA) - RETURN_IF_SUPPORTED(MESA_FORMAT_YCBCR); - else - RETURN_IF_SUPPORTED(MESA_FORMAT_YCBCR_REV); - } - } + case GL_RGB565: + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565); + break; + + case GL_YCBCR_MESA: + if (type == GL_UNSIGNED_SHORT_8_8_MESA) + RETURN_IF_SUPPORTED(MESA_FORMAT_YCBCR); + else + RETURN_IF_SUPPORTED(MESA_FORMAT_YCBCR_REV); + break; /* For non-generic compressed format we assert two things: * @@ -303,7 +282,6 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, * 2. The driver only enables the extension if it supports all of the * formats that are part of that extension. */ - switch (internalFormat) { case GL_COMPRESSED_RGB_FXT1_3DFX: return MESA_FORMAT_RGB_FXT1; case GL_COMPRESSED_RGBA_FXT1_3DFX: @@ -368,560 +346,474 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, return MESA_FORMAT_SRGBA_DXT3; case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: return MESA_FORMAT_SRGBA_DXT5; - default: - ; /* fallthrough */ - } - - if (ctx->Extensions.ARB_texture_float) { - switch (internalFormat) { - case GL_ALPHA16F_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); - break; - case GL_ALPHA32F_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); - break; - case GL_LUMINANCE16F_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); - break; - case GL_LUMINANCE32F_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); - break; - case GL_LUMINANCE_ALPHA16F_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); - break; - case GL_LUMINANCE_ALPHA32F_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); - break; - case GL_INTENSITY16F_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); - break; - case GL_INTENSITY32F_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); - break; - case GL_RGB16F_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); - break; - case GL_RGB32F_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); - break; - case GL_RGBA16F_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); - break; - case GL_RGBA32F_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); - break; - default: - ; /* fallthrough */ - } - } - - if (ctx->Extensions.EXT_texture_shared_exponent) { - switch (internalFormat) { - case GL_RGB9_E5: - ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_RGB9_E5_FLOAT]); - return MESA_FORMAT_RGB9_E5_FLOAT; - default: - ; /* fallthrough */ - } - } - - if (ctx->Extensions.EXT_packed_float) { - switch (internalFormat) { - case GL_R11F_G11F_B10F: - ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_R11_G11_B10_FLOAT]); - return MESA_FORMAT_R11_G11_B10_FLOAT; - default: - ; /* fallthrough */ - } - } - - if (ctx->Extensions.EXT_packed_depth_stencil) { - switch (internalFormat) { - case GL_DEPTH_STENCIL_EXT: - case GL_DEPTH24_STENCIL8_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_Z24_S8); - RETURN_IF_SUPPORTED(MESA_FORMAT_S8_Z24); - break; - default: - ; /* fallthrough */ - } - } - - if (ctx->Extensions.ARB_depth_buffer_float) { - switch (internalFormat) { - case GL_DEPTH_COMPONENT32F: - ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_Z32_FLOAT]); - return MESA_FORMAT_Z32_FLOAT; - case GL_DEPTH32F_STENCIL8: - ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_Z32_FLOAT_X24S8]); - return MESA_FORMAT_Z32_FLOAT_X24S8; - default: - ; /* fallthrough */ - } - } - if (ctx->Extensions.ATI_envmap_bumpmap) { - switch (internalFormat) { - case GL_DUDV_ATI: - case GL_DU8DV8_ATI: - RETURN_IF_SUPPORTED(MESA_FORMAT_DUDV8); - break; - default: - ; /* fallthrough */ - } - } - - if (ctx->Extensions.EXT_texture_snorm) { - switch (internalFormat) { - case GL_RED_SNORM: - case GL_R8_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_R8); - break; - case GL_RG_SNORM: - case GL_RG8_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RG88_REV); - break; - case GL_RGB_SNORM: - case GL_RGB8_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBX8888); - /* FALLTHROUGH */ - case GL_RGBA_SNORM: - case GL_RGBA8_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); - break; - case GL_ALPHA_SNORM: - case GL_ALPHA8_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_A8); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); - break; - case GL_LUMINANCE_SNORM: - case GL_LUMINANCE8_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_L8); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBX8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); - break; - case GL_LUMINANCE_ALPHA_SNORM: - case GL_LUMINANCE8_ALPHA8_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_AL88); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); - break; - case GL_INTENSITY_SNORM: - case GL_INTENSITY8_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_I8); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); - break; - case GL_R16_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_R16); - break; - case GL_RG16_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_GR1616); - break; - case GL_RGB16_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGB_16); - /* FALLTHROUGH */ - case GL_RGBA16_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA_16); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); - break; - case GL_ALPHA16_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_A16); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA_16); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); - break; - case GL_LUMINANCE16_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_L16); - /* FALLTHROUGH */ - case GL_LUMINANCE16_ALPHA16_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_AL1616); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA_16); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); - break; - case GL_INTENSITY16_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_I16); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA_16); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); - break; - default: - ; /* fall-through */ - } - } - - if (ctx->Extensions.EXT_texture_sRGB) { - switch (internalFormat) { - case GL_SRGB_EXT: - case GL_SRGB8_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB8); - RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); - break; - case GL_SRGB_ALPHA_EXT: - case GL_SRGB8_ALPHA8_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA8); - RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); - break; - case GL_SLUMINANCE_EXT: - case GL_SLUMINANCE8_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_SL8); - RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); - break; - case GL_SLUMINANCE_ALPHA_EXT: - case GL_SLUMINANCE8_ALPHA8_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_SLA8); - RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); - break; - case GL_COMPRESSED_SLUMINANCE_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_SL8); - RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); - break; - case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_SLA8); - RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); - break; - case GL_COMPRESSED_SRGB_EXT: - if (ctx->Extensions.EXT_texture_compression_s3tc) - RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB_DXT1); - RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB8); - RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); - break; - case GL_COMPRESSED_SRGB_ALPHA_EXT: - if (ctx->Extensions.EXT_texture_compression_s3tc) - RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT3); /* Not srgba_dxt1, see spec */ - RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA8); - RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); - break; - default: - ; /* fallthrough */ - } - } - - if (ctx->Extensions.EXT_texture_integer) { - switch (internalFormat) { - case GL_ALPHA8UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_UINT8); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8); - break; - case GL_ALPHA16UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_UINT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16); - break; - case GL_ALPHA32UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_UINT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32); - break; - case GL_ALPHA8I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_INT8); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8); - break; - case GL_ALPHA16I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_INT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16); - break; - case GL_ALPHA32I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_INT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32); - break; - case GL_LUMINANCE8UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_UINT8); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8); - break; - case GL_LUMINANCE16UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_UINT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16); - break; - case GL_LUMINANCE32UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_UINT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32); - break; - case GL_LUMINANCE8I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_INT8); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8); - break; - case GL_LUMINANCE16I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_INT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16); - break; - case GL_LUMINANCE32I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_INT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32); - break; - case GL_LUMINANCE_ALPHA8UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_UINT8); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8); - break; - case GL_LUMINANCE_ALPHA16UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_UINT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16); - break; - case GL_LUMINANCE_ALPHA32UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_UINT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32); - break; - case GL_LUMINANCE_ALPHA8I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_INT8); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8); - break; - case GL_LUMINANCE_ALPHA16I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_INT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16); - break; - case GL_LUMINANCE_ALPHA32I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_INT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32); - break; - case GL_INTENSITY8UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_UINT8); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8); - break; - case GL_INTENSITY16UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_UINT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16); - break; - case GL_INTENSITY32UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_UINT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32); - break; - case GL_INTENSITY8I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_INT8); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8); - break; - case GL_INTENSITY16I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_INT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16); - break; - case GL_INTENSITY32I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_INT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32); - break; - } - } - - if (ctx->Version >= 30 || - ctx->Extensions.EXT_texture_integer) { - switch (internalFormat) { - case GL_RGB8UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_UINT8); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8); - break; - case GL_RGB16UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_UINT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16); - break; - case GL_RGB32UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_UINT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32); - break; - case GL_RGB8I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_INT8); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8); - break; - case GL_RGB16I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_INT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16); - break; - case GL_RGB32I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_INT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32); - break; - case GL_RGBA8UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8); - break; - case GL_RGBA16UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16); - break; - case GL_RGBA32UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32); - break; - case GL_RGBA8I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8); - break; - case GL_RGBA16I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16); - break; - case GL_RGBA32I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32); - break; - } - } - - if (ctx->Extensions.ARB_texture_rg) { - switch (internalFormat) { - case GL_R8: - case GL_RED: - RETURN_IF_SUPPORTED(MESA_FORMAT_R8); - break; - - case GL_COMPRESSED_RED: - if (target != GL_TEXTURE_1D && target != GL_TEXTURE_1D_ARRAY) - RETURN_IF_SUPPORTED(MESA_FORMAT_RED_RGTC1); - RETURN_IF_SUPPORTED(MESA_FORMAT_R8); - break; - - case GL_R16: - RETURN_IF_SUPPORTED(MESA_FORMAT_R16); - break; - - case GL_RG: - case GL_RG8: - RETURN_IF_SUPPORTED(MESA_FORMAT_GR88); - break; - - case GL_COMPRESSED_RG: - if (target != GL_TEXTURE_1D && target != GL_TEXTURE_1D_ARRAY) - RETURN_IF_SUPPORTED(MESA_FORMAT_RG_RGTC2); - RETURN_IF_SUPPORTED(MESA_FORMAT_GR88); - break; - - case GL_RG16: - RETURN_IF_SUPPORTED(MESA_FORMAT_GR1616); - break; - - default: - ; /* fallthrough */ - } - } - - if (ctx->Extensions.ARB_texture_rg && ctx->Extensions.ARB_texture_float) { - switch (internalFormat) { - case GL_R16F: - RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); - break; - case GL_R32F: - RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); - break; - case GL_RG16F: - RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); - break; - case GL_RG32F: - RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); - break; - - default: - ; /* fallthrough */ - } - } - - if (ctx->Version >= 30 || - (ctx->Extensions.ARB_texture_rg && - ctx->Extensions.EXT_texture_integer)) { - switch (internalFormat) { - case GL_R8UI: - RETURN_IF_SUPPORTED(MESA_FORMAT_R_UINT8); - break; - case GL_RG8UI: - RETURN_IF_SUPPORTED(MESA_FORMAT_RG_UINT8); - break; - case GL_R16UI: - RETURN_IF_SUPPORTED(MESA_FORMAT_R_UINT16); - break; - case GL_RG16UI: - RETURN_IF_SUPPORTED(MESA_FORMAT_RG_UINT16); - break; - case GL_R32UI: - RETURN_IF_SUPPORTED(MESA_FORMAT_R_UINT32); - break; - case GL_RG32UI: - RETURN_IF_SUPPORTED(MESA_FORMAT_RG_UINT32); - break; - case GL_R8I: - RETURN_IF_SUPPORTED(MESA_FORMAT_R_INT8); - break; - case GL_RG8I: - RETURN_IF_SUPPORTED(MESA_FORMAT_RG_INT8); - break; - case GL_R16I: - RETURN_IF_SUPPORTED(MESA_FORMAT_R_INT16); - break; - case GL_RG16I: - RETURN_IF_SUPPORTED(MESA_FORMAT_RG_INT16); - break; - case GL_R32I: - RETURN_IF_SUPPORTED(MESA_FORMAT_R_INT32); - break; - case GL_RG32I: - RETURN_IF_SUPPORTED(MESA_FORMAT_RG_INT32); - break; - default: - break; - } - } - - if (ctx->Extensions.ARB_texture_rgb10_a2ui) { - switch (internalFormat) { - case GL_RGB10_A2UI: - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB2101010_UINT); - RETURN_IF_SUPPORTED(MESA_FORMAT_ABGR2101010_UINT); - break; - default: - break; - } - } - /* GL_BGRA can be an internal format *only* in OpenGL ES (1.x or 2.0). - */ - if (_mesa_is_gles(ctx)) { - switch (internalFormat) { - case GL_BGRA: - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); - break; - - default: - ; /* fallthrough */ - } + case GL_ALPHA16F_ARB: + RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + break; + case GL_ALPHA32F_ARB: + RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); + break; + case GL_LUMINANCE16F_ARB: + RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + break; + case GL_LUMINANCE32F_ARB: + RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); + break; + case GL_LUMINANCE_ALPHA16F_ARB: + RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + break; + case GL_LUMINANCE_ALPHA32F_ARB: + RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); + break; + case GL_INTENSITY16F_ARB: + RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + break; + case GL_INTENSITY32F_ARB: + RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); + break; + case GL_RGB16F_ARB: + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR16161616_FLOAT); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + break; + case GL_RGB32F_ARB: + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR32323232_FLOAT); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); + break; + case GL_RGBA16F_ARB: + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + break; + case GL_RGBA32F_ARB: + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); + break; + + case GL_RGB9_E5: + /* GL_EXT_texture_shared_exponent -- just one format to support */ + ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_RGB9_E5_FLOAT]); + return MESA_FORMAT_RGB9_E5_FLOAT; + + case GL_R11F_G11F_B10F: + /* GL_EXT_texture_packed_float -- just one format to support */ + ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_R11_G11_B10_FLOAT]); + return MESA_FORMAT_R11_G11_B10_FLOAT; + + case GL_DEPTH_STENCIL_EXT: + case GL_DEPTH24_STENCIL8_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_Z24_S8); + RETURN_IF_SUPPORTED(MESA_FORMAT_S8_Z24); + break; + + case GL_DEPTH_COMPONENT32F: + ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_Z32_FLOAT]); + return MESA_FORMAT_Z32_FLOAT; + case GL_DEPTH32F_STENCIL8: + ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_Z32_FLOAT_X24S8]); + return MESA_FORMAT_Z32_FLOAT_X24S8; + + case GL_DUDV_ATI: + case GL_DU8DV8_ATI: + RETURN_IF_SUPPORTED(MESA_FORMAT_DUDV8); + break; + + case GL_RED_SNORM: + case GL_R8_SNORM: + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_R8); + break; + case GL_RG_SNORM: + case GL_RG8_SNORM: + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RG88_REV); + break; + case GL_RGB_SNORM: + case GL_RGB8_SNORM: + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBX8888); + /* FALLTHROUGH */ + case GL_RGBA_SNORM: + case GL_RGBA8_SNORM: + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); + break; + case GL_ALPHA_SNORM: + case GL_ALPHA8_SNORM: + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_A8); + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); + break; + case GL_LUMINANCE_SNORM: + case GL_LUMINANCE8_SNORM: + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_L8); + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBX8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); + break; + case GL_LUMINANCE_ALPHA_SNORM: + case GL_LUMINANCE8_ALPHA8_SNORM: + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_AL88); + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); + break; + case GL_INTENSITY_SNORM: + case GL_INTENSITY8_SNORM: + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_I8); + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); + break; + case GL_R16_SNORM: + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_R16); + break; + case GL_RG16_SNORM: + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_GR1616); + break; + case GL_RGB16_SNORM: + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGB_16); + RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR16161616_SNORM); + /* FALLTHROUGH */ + case GL_RGBA16_SNORM: + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA_16); + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); + break; + case GL_ALPHA16_SNORM: + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_A16); + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA_16); + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); + break; + case GL_LUMINANCE16_SNORM: + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_L16); + /* FALLTHROUGH */ + case GL_LUMINANCE16_ALPHA16_SNORM: + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_AL1616); + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA_16); + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); + break; + case GL_INTENSITY16_SNORM: + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_I16); + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA_16); + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); + break; + + case GL_SRGB_EXT: + case GL_SRGB8_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB8); + RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); + break; + case GL_SRGB_ALPHA_EXT: + case GL_SRGB8_ALPHA8_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA8); + RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); + break; + case GL_SLUMINANCE_EXT: + case GL_SLUMINANCE8_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_SL8); + RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); + break; + case GL_SLUMINANCE_ALPHA_EXT: + case GL_SLUMINANCE8_ALPHA8_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_SLA8); + RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); + break; + case GL_COMPRESSED_SLUMINANCE_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_SL8); + RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); + break; + case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_SLA8); + RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); + break; + case GL_COMPRESSED_SRGB_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB_DXT1); + RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB8); + RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); + break; + case GL_COMPRESSED_SRGB_ALPHA_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT3); /* Not srgba_dxt1, see spec */ + RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA8); + RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); + break; + + case GL_ALPHA8UI_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_UINT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8); + break; + case GL_ALPHA16UI_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_UINT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16); + break; + case GL_ALPHA32UI_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_UINT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32); + break; + case GL_ALPHA8I_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_INT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8); + break; + case GL_ALPHA16I_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_INT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16); + break; + case GL_ALPHA32I_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_INT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32); + break; + case GL_LUMINANCE8UI_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_UINT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8); + break; + case GL_LUMINANCE16UI_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_UINT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16); + break; + case GL_LUMINANCE32UI_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_UINT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32); + break; + case GL_LUMINANCE8I_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_INT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8); + break; + case GL_LUMINANCE16I_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_INT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16); + break; + case GL_LUMINANCE32I_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_INT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32); + break; + case GL_LUMINANCE_ALPHA8UI_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_UINT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8); + break; + case GL_LUMINANCE_ALPHA16UI_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_UINT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16); + break; + case GL_LUMINANCE_ALPHA32UI_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_UINT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32); + break; + case GL_LUMINANCE_ALPHA8I_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_INT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8); + break; + case GL_LUMINANCE_ALPHA16I_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_INT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16); + break; + case GL_LUMINANCE_ALPHA32I_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_INT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32); + break; + case GL_INTENSITY8UI_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_UINT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8); + break; + case GL_INTENSITY16UI_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_UINT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16); + break; + case GL_INTENSITY32UI_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_UINT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32); + break; + case GL_INTENSITY8I_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_INT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8); + break; + case GL_INTENSITY16I_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_INT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16); + break; + case GL_INTENSITY32I_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_INT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32); + break; + + case GL_RGB8UI_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_UINT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR8888_UINT); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8); + break; + case GL_RGB16UI_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_UINT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR16161616_UINT); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16); + break; + case GL_RGB32UI_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_UINT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR32323232_UINT); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32); + break; + case GL_RGB8I_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_INT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR8888_SINT); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8); + break; + case GL_RGB16I_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_INT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR16161616_SINT); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16); + break; + case GL_RGB32I_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_INT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR32323232_SINT); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32); + break; + case GL_RGBA8UI_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8); + break; + case GL_RGBA16UI_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16); + break; + case GL_RGBA32UI_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32); + break; + case GL_RGBA8I_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8); + break; + case GL_RGBA16I_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16); + break; + case GL_RGBA32I_EXT: + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32); + break; + + case GL_R8: + case GL_RED: + RETURN_IF_SUPPORTED(MESA_FORMAT_R8); + break; + + case GL_COMPRESSED_RED: + if (target != GL_TEXTURE_1D && target != GL_TEXTURE_1D_ARRAY) + RETURN_IF_SUPPORTED(MESA_FORMAT_RED_RGTC1); + RETURN_IF_SUPPORTED(MESA_FORMAT_R8); + break; + + case GL_R16: + RETURN_IF_SUPPORTED(MESA_FORMAT_R16); + break; + + case GL_RG: + case GL_RG8: + RETURN_IF_SUPPORTED(MESA_FORMAT_GR88); + break; + + case GL_COMPRESSED_RG: + if (target != GL_TEXTURE_1D && target != GL_TEXTURE_1D_ARRAY) + RETURN_IF_SUPPORTED(MESA_FORMAT_RG_RGTC2); + RETURN_IF_SUPPORTED(MESA_FORMAT_GR88); + break; + + case GL_RG16: + RETURN_IF_SUPPORTED(MESA_FORMAT_GR1616); + break; + + case GL_R16F: + RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + break; + case GL_R32F: + RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); + break; + case GL_RG16F: + RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + break; + case GL_RG32F: + RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); + break; + + case GL_R8UI: + RETURN_IF_SUPPORTED(MESA_FORMAT_R_UINT8); + break; + case GL_RG8UI: + RETURN_IF_SUPPORTED(MESA_FORMAT_RG_UINT8); + break; + case GL_R16UI: + RETURN_IF_SUPPORTED(MESA_FORMAT_R_UINT16); + break; + case GL_RG16UI: + RETURN_IF_SUPPORTED(MESA_FORMAT_RG_UINT16); + break; + case GL_R32UI: + RETURN_IF_SUPPORTED(MESA_FORMAT_R_UINT32); + break; + case GL_RG32UI: + RETURN_IF_SUPPORTED(MESA_FORMAT_RG_UINT32); + break; + case GL_R8I: + RETURN_IF_SUPPORTED(MESA_FORMAT_R_INT8); + break; + case GL_RG8I: + RETURN_IF_SUPPORTED(MESA_FORMAT_RG_INT8); + break; + case GL_R16I: + RETURN_IF_SUPPORTED(MESA_FORMAT_R_INT16); + break; + case GL_RG16I: + RETURN_IF_SUPPORTED(MESA_FORMAT_RG_INT16); + break; + case GL_R32I: + RETURN_IF_SUPPORTED(MESA_FORMAT_R_INT32); + break; + case GL_RG32I: + RETURN_IF_SUPPORTED(MESA_FORMAT_RG_INT32); + break; + + case GL_RGB10_A2UI: + RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB2101010_UINT); + RETURN_IF_SUPPORTED(MESA_FORMAT_ABGR2101010_UINT); + break; + + case GL_BGRA: + RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); + break; } _mesa_problem(ctx, "unexpected format %s in _mesa_choose_tex_format()", @@ -929,3 +821,16 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, return MESA_FORMAT_NONE; } +GLboolean +_mesa_tex_target_is_array(GLenum target) +{ + switch (target) { + case GL_TEXTURE_1D_ARRAY_EXT: + case GL_TEXTURE_2D_ARRAY_EXT: + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: + case GL_TEXTURE_CUBE_MAP_ARRAY: + return GL_TRUE; + default: + return GL_FALSE; + } +} diff --git a/mesalib/src/mesa/main/texformat.h b/mesalib/src/mesa/main/texformat.h index 71af9ca22..d6ff54173 100644 --- a/mesalib/src/mesa/main/texformat.h +++ b/mesalib/src/mesa/main/texformat.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ #ifndef TEXFORMAT_H @@ -35,5 +36,7 @@ extern gl_format _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, GLint internalFormat, GLenum format, GLenum type); +extern GLboolean +_mesa_tex_target_is_array(GLenum target); #endif diff --git a/mesalib/src/mesa/main/texgen.c b/mesalib/src/mesa/main/texgen.c index e45cfe176..81ad224a0 100644 --- a/mesalib/src/mesa/main/texgen.c +++ b/mesalib/src/mesa/main/texgen.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** @@ -34,7 +35,6 @@ #include "main/context.h" #include "main/enums.h" #include "main/macros.h" -#include "main/mfeatures.h" #include "main/texgen.h" #include "main/texstate.h" #include "math/m_matrix.h" diff --git a/mesalib/src/mesa/main/texgen.h b/mesalib/src/mesa/main/texgen.h index 97563a0f0..3292258dc 100644 --- a/mesalib/src/mesa/main/texgen.h +++ b/mesalib/src/mesa/main/texgen.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -29,7 +30,6 @@ #include "compiler.h" #include "glheader.h" -#include "mfeatures.h" struct _glapi_table; diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c index 74b09ef2c..70319c52b 100644 --- a/mesalib/src/mesa/main/texgetimage.c +++ b/mesalib/src/mesa/main/texgetimage.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -37,7 +38,6 @@ #include "format_unpack.h" #include "glformats.h" #include "image.h" -#include "mfeatures.h" #include "mtypes.h" #include "pack.h" #include "pbo.h" diff --git a/mesalib/src/mesa/main/texgetimage.h b/mesalib/src/mesa/main/texgetimage.h index c9277fc91..32c33fed4 100644 --- a/mesalib/src/mesa/main/texgetimage.h +++ b/mesalib/src/mesa/main/texgetimage.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index 784b389a7..9aaa63f13 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -39,7 +40,6 @@ #include "image.h" #include "imports.h" #include "macros.h" -#include "mfeatures.h" #include "multisample.h" #include "state.h" #include "texcompress.h" @@ -180,7 +180,7 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat ) default: ; /* fallthrough */ } - + if (ctx->Extensions.TDFX_texture_compression_FXT1) { switch (internalFormat) { case GL_COMPRESSED_RGB_FXT1_3DFX: @@ -315,15 +315,17 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat ) case GL_SRGB_EXT: case GL_SRGB8_EXT: case GL_COMPRESSED_SRGB_EXT: - case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: return GL_RGB; + case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: + return ctx->Extensions.EXT_texture_compression_s3tc ? GL_RGB : -1; case GL_SRGB_ALPHA_EXT: case GL_SRGB8_ALPHA8_EXT: case GL_COMPRESSED_SRGB_ALPHA_EXT: + return GL_RGBA; case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: - return GL_RGBA; + return ctx->Extensions.EXT_texture_compression_s3tc ? GL_RGBA : -1; case GL_SLUMINANCE_ALPHA_EXT: case GL_SLUMINANCE8_ALPHA8_EXT: case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT: @@ -613,7 +615,7 @@ set_tex_image(struct gl_texture_object *tObj, /** * Allocate a texture image structure. - * + * * Called via ctx->Driver.NewTextureImage() unless overriden by a device * driver. * @@ -868,7 +870,7 @@ _mesa_get_tex_image(struct gl_context *ctx, struct gl_texture_object *texObj, if (!texObj) return NULL; - + texImage = _mesa_select_tex_image(ctx, texObj, target, level); if (!texImage) { texImage = ctx->Driver.NewTextureImage(ctx); @@ -974,7 +976,7 @@ get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level) * * \param ctx GL context. * \param target texture target. - * + * * \return the maximum number of allowed mipmap levels for the given * texture target, or zero if passed a bad target. * @@ -1536,13 +1538,13 @@ error_check_subtexture_dimensions(struct gl_context *ctx, } /* check xoffset and width */ - if (xoffset < -destImage->Border) { + if (xoffset < - (GLint) destImage->Border) { _mesa_error(ctx, GL_INVALID_VALUE, "%s%dD(xoffset)", function, dims); return GL_TRUE; } - if (xoffset + subWidth > destImage->Width) { + if (xoffset + subWidth > (GLint) destImage->Width) { _mesa_error(ctx, GL_INVALID_VALUE, "%s%dD(xoffset+width)", function, dims); return GL_TRUE; @@ -1556,7 +1558,7 @@ error_check_subtexture_dimensions(struct gl_context *ctx, function, dims); return GL_TRUE; } - if (yoffset + subHeight > destImage->Height) { + if (yoffset + subHeight > (GLint) destImage->Height) { _mesa_error(ctx, GL_INVALID_VALUE, "%s%dD(yoffset+height)", function, dims); return GL_TRUE; @@ -1594,18 +1596,24 @@ error_check_subtexture_dimensions(struct gl_context *ctx, return GL_TRUE; } - /* size must be multiple of bw by bh or equal to whole texture size */ - if ((subWidth % bw != 0) && subWidth != destImage->Width) { + /* The size must be a multiple of bw x bh, or we must be using a + * offset+size that exactly hits the edge of the image. This + * is important for small mipmap levels (1x1, 2x1, etc) and for + * NPOT textures. + */ + if ((subWidth % bw != 0) && + (xoffset + subWidth != (GLint) destImage->Width)) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s%dD(width = %d)", function, dims, subWidth); return GL_TRUE; } - if ((subHeight % bh != 0) && subHeight != destImage->Height) { + if ((subHeight % bh != 0) && + (yoffset + subHeight != (GLint) destImage->Height)) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s%dD(height = %d)", function, dims, subHeight); return GL_TRUE; - } + } } return GL_FALSE; @@ -1705,7 +1713,7 @@ target_can_be_compressed(const struct gl_context *ctx, GLenum target, return ctx->Extensions.ARB_texture_cube_map_array; default: return GL_FALSE; - } + } } @@ -1867,7 +1875,7 @@ compressed_tex_size(GLsizei width, GLsizei height, GLsizei depth, /** * Test the glTexImage[123]D() parameters for errors. - * + * * \param ctx GL context. * \param dimensions texture image dimensions (must be 1, 2 or 3). * \param target texture target given by the user (already validated). @@ -1879,7 +1887,7 @@ compressed_tex_size(GLsizei width, GLsizei height, GLsizei depth, * \param height image height given by the user. * \param depth image depth given by the user. * \param border image border given by the user. - * + * * \return GL_TRUE if a error is found, GL_FALSE otherwise * * Verifies each of the parameters against the constants specified in @@ -1949,12 +1957,12 @@ texture_error_check( struct gl_context *ctx, internalFormat); } else { if (format != internalFormat) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glTexImage%dD(format = %s, internalFormat = %s)", - dimensions, - _mesa_lookup_enum_by_nr(format), - _mesa_lookup_enum_by_nr(internalFormat)); - return GL_TRUE; + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTexImage%dD(format = %s, internalFormat = %s)", + dimensions, + _mesa_lookup_enum_by_nr(format), + _mesa_lookup_enum_by_nr(internalFormat)); + return GL_TRUE; } err = _mesa_es_error_check_format_and_type(format, type, dimensions); @@ -2258,7 +2266,7 @@ error: /** * Test glTexSubImage[123]D() parameters for errors. - * + * * \param ctx GL context. * \param dimensions texture image dimensions (must be 1, 2 or 3). * \param target texture target given by the user (already validated) @@ -2271,7 +2279,7 @@ error: * \param width image width given by the user. * \param height image height given by the user. * \param depth image depth given by the user. - * + * * \return GL_TRUE if an error was detected, or GL_FALSE if no errors. * * Verifies each of the parameters against the constants specified in @@ -2376,7 +2384,7 @@ texsubimage_error_check(struct gl_context *ctx, GLuint dimensions, /** * Test glCopyTexImage[12]D() parameters for errors. - * + * * \param ctx GL context. * \param dimensions texture image dimensions (must be 1, 2 or 3). * \param target texture target given by the user. @@ -2385,9 +2393,9 @@ texsubimage_error_check(struct gl_context *ctx, GLuint dimensions, * \param width image width given by the user. * \param height image height given by the user. * \param border texture border. - * + * * \return GL_TRUE if an error was detected, or GL_FALSE if no errors. - * + * * Verifies each of the parameters against the constants specified in * __struct gl_contextRec::Const and the supported extensions, and according * to the OpenGL specification. @@ -2407,7 +2415,7 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions, _mesa_error(ctx, GL_INVALID_ENUM, "glCopyTexImage%uD(target=%s)", dimensions, _mesa_lookup_enum_by_nr(target)); return GL_TRUE; - } + } /* level check */ if (level < 0 || level >= _mesa_max_texture_levels(ctx, target)) { @@ -2753,9 +2761,8 @@ check_rtt_cb(GLuint key, void *data, void *userData) att->Texture == texObj && att->TextureLevel == level && att->CubeMapFace == face) { - ASSERT(_mesa_get_attachment_teximage(att)); - /* Tell driver about the new renderbuffer texture */ - ctx->Driver.RenderTexture(ctx, ctx->DrawBuffer, att); + _mesa_update_texture_renderbuffer(ctx, ctx->DrawBuffer, att); + ASSERT(att->Renderbuffer->TexImage); /* Mark fb status as indeterminate to force re-validation */ fb->_Status = 0; } @@ -2920,6 +2927,7 @@ _mesa_choose_texture_format(struct gl_context *ctx, return f; } + /** * Adjust pixel unpack params and image dimensions to strip off the * one-pixel texture border. @@ -2957,7 +2965,9 @@ strip_texture_border(GLenum target, *height = *height - 2; /* reduce the height by two border pixels */ } - if (*depth >= 3 && target != GL_TEXTURE_2D_ARRAY && target != GL_TEXTURE_CUBE_MAP_ARRAY) { + if (*depth >= 3 && + target != GL_TEXTURE_2D_ARRAY && + target != GL_TEXTURE_CUBE_MAP_ARRAY) { unpackNew->SkipImages++; /* skip the border */ *depth = *depth - 2; /* reduce the depth by two border pixels */ } @@ -3309,7 +3319,7 @@ texsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level, _mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage%uD(target=%s)", dims, _mesa_lookup_enum_by_nr(target)); return; - } + } if (ctx->NewState & _NEW_PIXEL) _mesa_update_state(ctx); @@ -3694,7 +3704,7 @@ compressed_subtexture_error_check(struct gl_context *ctx, GLint dims, targetOK = GL_FALSE; break; } - + if (!targetOK) { _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage%uD(target)", dims); @@ -4027,6 +4037,7 @@ get_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat) } } + static gl_format validate_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat) { @@ -4098,6 +4109,7 @@ texbufferrange(struct gl_context *ctx, GLenum target, GLenum internalFormat, _mesa_unlock_texture(ctx, texObj); } + /** GL_ARB_texture_buffer_object */ void GLAPIENTRY _mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer) @@ -4124,6 +4136,7 @@ _mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer) texbufferrange(ctx, target, internalFormat, bufObj, 0, buffer ? -1 : 0); } + /** GL_ARB_texture_buffer_range */ void GLAPIENTRY _mesa_TexBufferRange(GLenum target, GLenum internalFormat, GLuint buffer, @@ -4164,6 +4177,7 @@ _mesa_TexBufferRange(GLenum target, GLenum internalFormat, GLuint buffer, texbufferrange(ctx, target, internalFormat, bufObj, offset, size); } + static GLboolean is_renderable_texture_format(struct gl_context *ctx, GLenum internalformat) { @@ -4174,6 +4188,7 @@ is_renderable_texture_format(struct gl_context *ctx, GLenum internalformat) return baseFormat != 0 && baseFormat != GL_STENCIL_INDEX; } + /** GL_ARB_texture_multisample */ static GLboolean check_multisample_target(GLuint dims, GLenum target) @@ -4192,6 +4207,7 @@ check_multisample_target(GLuint dims, GLenum target) } } + static void teximagemultisample(GLuint dims, GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, @@ -4309,7 +4325,6 @@ teximagemultisample(GLuint dims, GLenum target, GLsizei samples, texImage->FixedSampleLocations = fixedsamplelocations; if (width > 0 && height > 0 && depth > 0) { - if (!ctx->Driver.AllocTextureStorage(ctx, texObj, 1, width, height, depth)) { /* tidy up the texture image state. strictly speaking, @@ -4326,15 +4341,18 @@ teximagemultisample(GLuint dims, GLenum target, GLsizei samples, } } + void GLAPIENTRY _mesa_TexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations) { teximagemultisample(2, target, samples, internalformat, - width, height, 1, fixedsamplelocations, GL_FALSE, "glTexImage2DMultisample"); + width, height, 1, fixedsamplelocations, GL_FALSE, + "glTexImage2DMultisample"); } + void GLAPIENTRY _mesa_TexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, @@ -4342,7 +4360,8 @@ _mesa_TexImage3DMultisample(GLenum target, GLsizei samples, GLboolean fixedsamplelocations) { teximagemultisample(3, target, samples, internalformat, - width, height, depth, fixedsamplelocations, GL_FALSE, "glTexImage3DMultisample"); + width, height, depth, fixedsamplelocations, GL_FALSE, + "glTexImage3DMultisample"); } @@ -4352,9 +4371,11 @@ _mesa_TexStorage2DMultisample(GLenum target, GLsizei samples, GLsizei height, GLboolean fixedsamplelocations) { teximagemultisample(2, target, samples, internalformat, - width, height, 1, fixedsamplelocations, GL_TRUE, "glTexStorage2DMultisample"); + width, height, 1, fixedsamplelocations, GL_TRUE, + "glTexStorage2DMultisample"); } + void GLAPIENTRY _mesa_TexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, @@ -4362,5 +4383,6 @@ _mesa_TexStorage3DMultisample(GLenum target, GLsizei samples, GLboolean fixedsamplelocations) { teximagemultisample(3, target, samples, internalformat, - width, height, depth, fixedsamplelocations, GL_TRUE, "glTexStorage3DMultisample"); + width, height, depth, fixedsamplelocations, GL_TRUE, + "glTexStorage3DMultisample"); } diff --git a/mesalib/src/mesa/main/teximage.h b/mesalib/src/mesa/main/teximage.h index bb295c7a7..a0d71c9f8 100644 --- a/mesalib/src/mesa/main/teximage.h +++ b/mesalib/src/mesa/main/teximage.h @@ -22,9 +22,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c index 66377c8c0..27c040301 100644 --- a/mesalib/src/mesa/main/texobj.c +++ b/mesalib/src/mesa/main/texobj.c @@ -22,13 +22,13 @@ * 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 - * BRIAN PAUL 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. + * 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 "mfeatures.h" #include "bufferobj.h" #include "colortab.h" #include "context.h" diff --git a/mesalib/src/mesa/main/texobj.h b/mesalib/src/mesa/main/texobj.h index f86b4ebcd..622defa71 100644 --- a/mesalib/src/mesa/main/texobj.h +++ b/mesalib/src/mesa/main/texobj.h @@ -22,9 +22,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c index f60eb204e..b5a1e58e2 100644 --- a/mesalib/src/mesa/main/texparam.c +++ b/mesalib/src/mesa/main/texparam.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** @@ -38,7 +39,6 @@ #include "main/formats.h" #include "main/glformats.h" #include "main/macros.h" -#include "main/mfeatures.h" #include "main/mtypes.h" #include "main/state.h" #include "main/texcompress.h" diff --git a/mesalib/src/mesa/main/texparam.h b/mesalib/src/mesa/main/texparam.h index 19b4116c0..32cefad22 100644 --- a/mesalib/src/mesa/main/texparam.h +++ b/mesalib/src/mesa/main/texparam.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/texstate.c b/mesalib/src/mesa/main/texstate.c index d44cd7cf9..afc9337ff 100644 --- a/mesalib/src/mesa/main/texstate.c +++ b/mesalib/src/mesa/main/texstate.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** @@ -29,7 +30,6 @@ */ #include "glheader.h" -#include "mfeatures.h" #include "bufferobj.h" #include "colormac.h" #include "colortab.h" diff --git a/mesalib/src/mesa/main/texstate.h b/mesalib/src/mesa/main/texstate.h index 7abf9101e..5c7fa8a31 100644 --- a/mesalib/src/mesa/main/texstate.h +++ b/mesalib/src/mesa/main/texstate.h @@ -22,9 +22,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/texstorage.c b/mesalib/src/mesa/main/texstorage.c index 6309b5716..0a53726fe 100644 --- a/mesalib/src/mesa/main/texstorage.c +++ b/mesalib/src/mesa/main/texstorage.c @@ -16,9 +16,10 @@ * 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 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. + * 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. */ @@ -34,7 +35,6 @@ #include "enums.h" #include "imports.h" #include "macros.h" -#include "mfeatures.h" #include "teximage.h" #include "texobj.h" #include "texstorage.h" @@ -245,6 +245,36 @@ _mesa_is_legal_tex_storage_format(struct gl_context *ctx, GLenum internalformat) } } +/** + * Default ctx->Driver.AllocTextureStorage() handler. + * + * The driver can override this with a more specific implementation if it + * desires, but this can be used to get the texture images allocated using the + * usual texture image handling code. The immutability of + * GL_ARB_texture_storage texture layouts is handled by texObj->Immutable + * checks at glTexImage* time. + */ +GLboolean +_mesa_alloc_texture_storage(struct gl_context *ctx, + struct gl_texture_object *texObj, + GLsizei levels, GLsizei width, + GLsizei height, GLsizei depth) +{ + const int numFaces = _mesa_num_tex_faces(texObj->Target); + int face; + int level; + + for (face = 0; face < numFaces; face++) { + for (level = 0; level < levels; level++) { + struct gl_texture_image *const texImage = texObj->Image[face][level]; + if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage)) + return GL_FALSE; + } + } + + return GL_TRUE; +} + /** * Do error checking for calls to glTexStorage1/2/3D(). diff --git a/mesalib/src/mesa/main/texstorage.h b/mesalib/src/mesa/main/texstorage.h index 9f172e1ca..ec4f71374 100644 --- a/mesalib/src/mesa/main/texstorage.h +++ b/mesalib/src/mesa/main/texstorage.h @@ -16,9 +16,10 @@ * 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 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. + * 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. */ @@ -60,5 +61,10 @@ _mesa_TextureStorage3DEXT(GLuint texture, GLenum target, GLsizei levels, extern GLboolean _mesa_is_legal_tex_storage_format(struct gl_context *ctx, GLenum internalformat); +extern GLboolean +_mesa_alloc_texture_storage(struct gl_context *ctx, + struct gl_texture_object *texObj, + GLsizei levels, GLsizei width, + GLsizei height, GLsizei depth); #endif /* TEXSTORAGE_H */ diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c index 0e13d8903..daa024c80 100644 --- a/mesalib/src/mesa/main/texstore.c +++ b/mesalib/src/mesa/main/texstore.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* @@ -58,7 +59,6 @@ #include "image.h" #include "macros.h" #include "mipmap.h" -#include "mfeatures.h" #include "mtypes.h" #include "pack.h" #include "pbo.h" diff --git a/mesalib/src/mesa/main/texstore.h b/mesalib/src/mesa/main/texstore.h index 75f24bd45..f3d4a7d05 100644 --- a/mesalib/src/mesa/main/texstore.h +++ b/mesalib/src/mesa/main/texstore.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/transformfeedback.c b/mesalib/src/mesa/main/transformfeedback.c index fd4718d87..03f188300 100644 --- a/mesalib/src/mesa/main/transformfeedback.c +++ b/mesalib/src/mesa/main/transformfeedback.c @@ -16,9 +16,10 @@ * 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 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. + * 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. */ @@ -35,7 +36,6 @@ #include "context.h" #include "hash.h" #include "macros.h" -#include "mfeatures.h" #include "mtypes.h" #include "transformfeedback.h" #include "shaderapi.h" @@ -385,7 +385,9 @@ _mesa_BeginTransformFeedback(GLenum mode) } } - FLUSH_VERTICES(ctx, _NEW_TRANSFORM_FEEDBACK); + FLUSH_VERTICES(ctx, 0); + ctx->NewDriverState |= ctx->DriverFlags.NewTransformFeedback; + obj->Active = GL_TRUE; ctx->TransformFeedback.Mode = mode; @@ -422,7 +424,9 @@ _mesa_EndTransformFeedback(void) return; } - FLUSH_VERTICES(ctx, _NEW_TRANSFORM_FEEDBACK); + FLUSH_VERTICES(ctx, 0); + ctx->NewDriverState |= ctx->DriverFlags.NewTransformFeedback; + ctx->TransformFeedback.CurrentObject->Active = GL_FALSE; ctx->TransformFeedback.CurrentObject->Paused = GL_FALSE; ctx->TransformFeedback.CurrentObject->EndedAnytime = GL_TRUE; @@ -443,7 +447,7 @@ bind_buffer_range(struct gl_context *ctx, GLuint index, struct gl_transform_feedback_object *obj = ctx->TransformFeedback.CurrentObject; - /* Note: no need to FLUSH_VERTICES or flag _NEW_TRANSFORM_FEEDBACK, because + /* Note: no need to FLUSH_VERTICES or flag NewTransformFeedback, because * transform feedback buffers can't be changed while transform feedback is * active. */ @@ -687,7 +691,7 @@ _mesa_TransformFeedbackVaryings(GLuint program, GLsizei count, shProg->TransformFeedback.BufferMode = bufferMode; - /* No need to set _NEW_TRANSFORM_FEEDBACK (or invoke FLUSH_VERTICES) since + /* No need to invoke FLUSH_VERTICES or flag NewTransformFeedback since * the varyings won't be used until shader link time. */ } @@ -898,7 +902,9 @@ _mesa_PauseTransformFeedback(void) return; } - FLUSH_VERTICES(ctx, _NEW_TRANSFORM_FEEDBACK); + FLUSH_VERTICES(ctx, 0); + ctx->NewDriverState |= ctx->DriverFlags.NewTransformFeedback; + obj->Paused = GL_TRUE; assert(ctx->Driver.PauseTransformFeedback); @@ -924,7 +930,9 @@ _mesa_ResumeTransformFeedback(void) return; } - FLUSH_VERTICES(ctx, _NEW_TRANSFORM_FEEDBACK); + FLUSH_VERTICES(ctx, 0); + ctx->NewDriverState |= ctx->DriverFlags.NewTransformFeedback; + obj->Paused = GL_FALSE; assert(ctx->Driver.ResumeTransformFeedback); diff --git a/mesalib/src/mesa/main/transformfeedback.h b/mesalib/src/mesa/main/transformfeedback.h index c128746b3..f6dc2a7b3 100644 --- a/mesalib/src/mesa/main/transformfeedback.h +++ b/mesalib/src/mesa/main/transformfeedback.h @@ -16,9 +16,10 @@ * 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 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. + * 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. */ @@ -28,7 +29,6 @@ #include <stdbool.h> #include "compiler.h" #include "glheader.h" -#include "mfeatures.h" #include "mtypes.h" struct _glapi_table; diff --git a/mesalib/src/mesa/main/uniform_query.cpp b/mesalib/src/mesa/main/uniform_query.cpp index b8335fe6b..ec3104936 100644 --- a/mesalib/src/mesa/main/uniform_query.cpp +++ b/mesalib/src/mesa/main/uniform_query.cpp @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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 <stdlib.h> @@ -777,24 +778,24 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg, if (uni->type->is_sampler()) { int i; - for (i = 0; i < count; i++) { - shProg->SamplerUnits[uni->sampler + offset + i] = - ((unsigned *) values)[i]; - } - bool flushed = false; for (i = 0; i < MESA_SHADER_TYPES; i++) { struct gl_shader *const sh = shProg->_LinkedShaders[i]; + int j; - /* If the shader stage doesn't use any samplers, don't bother - * checking if any samplers have changed. + /* If the shader stage doesn't use the sampler uniform, skip this. */ - if (sh == NULL || sh->active_samplers == 0) + if (sh == NULL || !uni->sampler[i].active) continue; + for (j = 0; j < count; j++) { + sh->SamplerUnits[uni->sampler[i].index + offset + j] = + ((unsigned *) values)[j]; + } + struct gl_program *const prog = sh->Program; - assert(sizeof(prog->SamplerUnits) == sizeof(shProg->SamplerUnits)); + assert(sizeof(prog->SamplerUnits) == sizeof(sh->SamplerUnits)); /* Determine if any of the samplers used by this shader stage have * been modified. @@ -802,7 +803,7 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg, bool changed = false; for (unsigned j = 0; j < Elements(prog->SamplerUnits); j++) { if ((sh->active_samplers & (1U << j)) != 0 - && (prog->SamplerUnits[j] != shProg->SamplerUnits[j])) { + && (prog->SamplerUnits[j] != sh->SamplerUnits[j])) { changed = true; break; } @@ -815,8 +816,8 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg, } memcpy(prog->SamplerUnits, - shProg->SamplerUnits, - sizeof(shProg->SamplerUnits)); + sh->SamplerUnits, + sizeof(sh->SamplerUnits)); _mesa_update_shader_textures_used(shProg, prog); if (ctx->Driver.SamplerUniformChange) diff --git a/mesalib/src/mesa/main/uniforms.c b/mesalib/src/mesa/main/uniforms.c index d902407a0..6d79df683 100644 --- a/mesalib/src/mesa/main/uniforms.c +++ b/mesalib/src/mesa/main/uniforms.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** @@ -44,6 +45,7 @@ #include "main/enums.h" #include "ir_uniform.h" #include "glsl_types.h" +#include "program/program.h" /** * Update the vertex/fragment program's TexturesUsed array. @@ -65,14 +67,18 @@ _mesa_update_shader_textures_used(struct gl_shader_program *shProg, struct gl_program *prog) { GLuint s; + struct gl_shader *shader = + shProg->_LinkedShaders[_mesa_program_target_to_index(prog->Target)]; - memcpy(prog->SamplerUnits, shProg->SamplerUnits, sizeof(prog->SamplerUnits)); + assert(shader); + + memcpy(prog->SamplerUnits, shader->SamplerUnits, sizeof(prog->SamplerUnits)); memset(prog->TexturesUsed, 0, sizeof(prog->TexturesUsed)); for (s = 0; s < MAX_SAMPLERS; s++) { if (prog->SamplersUsed & (1 << s)) { - GLuint unit = shProg->SamplerUnits[s]; - GLuint tgt = shProg->SamplerTargets[s]; + GLuint unit = shader->SamplerUnits[s]; + GLuint tgt = shader->SamplerTargets[s]; assert(unit < Elements(prog->TexturesUsed)); assert(tgt < NUM_TEXTURE_TARGETS); prog->TexturesUsed[unit] |= (1 << tgt); @@ -630,7 +636,9 @@ _mesa_UniformBlockBinding(GLuint program, uniformBlockBinding) { int i; - FLUSH_VERTICES(ctx, _NEW_BUFFER_OBJECT); + FLUSH_VERTICES(ctx, 0); + ctx->NewDriverState |= ctx->DriverFlags.NewUniformBuffer; + shProg->UniformBlocks[uniformBlockIndex].Binding = uniformBlockBinding; for (i = 0; i < MESA_SHADER_TYPES; i++) { diff --git a/mesalib/src/mesa/main/uniforms.h b/mesalib/src/mesa/main/uniforms.h index a12ad9b36..5ebd5e49a 100644 --- a/mesalib/src/mesa/main/uniforms.h +++ b/mesalib/src/mesa/main/uniforms.h @@ -16,9 +16,10 @@ * 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 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. + * 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. */ diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c index 213b845c9..db0945e30 100644 --- a/mesalib/src/mesa/main/varray.c +++ b/mesalib/src/mesa/main/varray.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -33,7 +34,6 @@ #include "hash.h" #include "image.h" #include "macros.h" -#include "mfeatures.h" #include "mtypes.h" #include "varray.h" #include "arrayobj.h" @@ -269,7 +269,6 @@ update_array(struct gl_context *ctx, ctx->Array.ArrayBufferObj); ctx->NewState |= _NEW_ARRAY; - ctx->Array.ArrayObj->NewArrays |= VERT_BIT(attrib); } @@ -521,7 +520,6 @@ _mesa_EnableVertexAttribArray(GLuint index) FLUSH_VERTICES(ctx, _NEW_ARRAY); arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_TRUE; arrayObj->_Enabled |= VERT_BIT_GENERIC(index); - arrayObj->NewArrays |= VERT_BIT_GENERIC(index); } } @@ -547,7 +545,6 @@ _mesa_DisableVertexAttribArray(GLuint index) FLUSH_VERTICES(ctx, _NEW_ARRAY); arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_FALSE; arrayObj->_Enabled &= ~VERT_BIT_GENERIC(index); - arrayObj->NewArrays |= VERT_BIT_GENERIC(index); } } @@ -1112,10 +1109,9 @@ _mesa_PrimitiveRestartIndex(GLuint index) return; } - ctx->Array.RestartIndex = index; - if (ctx->Array.PrimitiveRestart && ctx->Array._RestartIndex != index) { + if (ctx->Array.RestartIndex != index) { FLUSH_VERTICES(ctx, _NEW_TRANSFORM); - ctx->Array._RestartIndex = index; + ctx->Array.RestartIndex = index; } } @@ -1148,11 +1144,34 @@ _mesa_VertexAttribDivisor(GLuint index, GLuint divisor) if (array->InstanceDivisor != divisor) { FLUSH_VERTICES(ctx, _NEW_ARRAY); array->InstanceDivisor = divisor; - ctx->Array.ArrayObj->NewArrays |= VERT_BIT(VERT_ATTRIB_GENERIC(index)); } } +unsigned +_mesa_primitive_restart_index(const struct gl_context *ctx, GLenum ib_type) +{ + /* From the OpenGL 4.3 core specification, page 302: + * "If both PRIMITIVE_RESTART and PRIMITIVE_RESTART_FIXED_INDEX are + * enabled, the index value determined by PRIMITIVE_RESTART_FIXED_INDEX + * is used." + */ + if (ctx->Array.PrimitiveRestartFixedIndex) { + switch (ib_type) { + case GL_UNSIGNED_BYTE: + return 0xff; + case GL_UNSIGNED_SHORT: + return 0xffff; + case GL_UNSIGNED_INT: + return 0xffffffff; + default: + assert(!"_mesa_primitive_restart_index: Invalid index buffer type."); + } + } + + return ctx->Array.RestartIndex; +} + /** * Copy one client vertex array to another. diff --git a/mesalib/src/mesa/main/varray.h b/mesalib/src/mesa/main/varray.h index 904fa1bea..a178bc13c 100644 --- a/mesalib/src/mesa/main/varray.h +++ b/mesalib/src/mesa/main/varray.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -29,7 +30,6 @@ #include "glheader.h" -#include "mfeatures.h" struct gl_client_array; struct gl_context; @@ -248,6 +248,8 @@ _mesa_PrimitiveRestartIndex(GLuint index); extern void GLAPIENTRY _mesa_VertexAttribDivisor(GLuint index, GLuint divisor); +extern unsigned +_mesa_primitive_restart_index(const struct gl_context *ctx, GLenum ib_type); extern void _mesa_copy_client_array(struct gl_context *ctx, diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c index ecca446c1..cdd5ed316 100644 --- a/mesalib/src/mesa/main/version.c +++ b/mesalib/src/mesa/main/version.c @@ -16,9 +16,10 @@ * 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 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. + * 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. */ @@ -259,7 +260,7 @@ compute_version(struct gl_context *ctx) ctx->Extensions.EXT_texture_snorm && ctx->Extensions.NV_primitive_restart && ctx->Extensions.NV_texture_rectangle && - ctx->Const.MaxVertexTextureImageUnits >= 16); + ctx->Const.VertexProgram.MaxTextureImageUnits >= 16); const GLboolean ver_3_2 = (ver_3_1 && ctx->Const.GLSLVersion >= 150 && ctx->Extensions.ARB_depth_clamp && diff --git a/mesalib/src/mesa/main/version.h b/mesalib/src/mesa/main/version.h index b4f8d8590..19d321d9a 100644 --- a/mesalib/src/mesa/main/version.h +++ b/mesalib/src/mesa/main/version.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/viewport.c b/mesalib/src/mesa/main/viewport.c index 92f04cdf1..c4d7f1e07 100644 --- a/mesalib/src/mesa/main/viewport.c +++ b/mesalib/src/mesa/main/viewport.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/viewport.h b/mesalib/src/mesa/main/viewport.h index db4507bea..77d8cbbfd 100644 --- a/mesalib/src/mesa/main/viewport.h +++ b/mesalib/src/mesa/main/viewport.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/main/vtxfmt.c b/mesalib/src/mesa/main/vtxfmt.c index 8669c4007..8864b8cf5 100644 --- a/mesalib/src/mesa/main/vtxfmt.c +++ b/mesalib/src/mesa/main/vtxfmt.c @@ -17,20 +17,19 @@ * 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 - * BRIAN PAUL 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. + * 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: - * Keith Whitwell <keith@tungstengraphics.com> - * Gareth Hughes + * Keith Whitwell <keith@tungstengraphics.com> Gareth Hughes */ #include "glheader.h" #include "api_arrayelt.h" #include "context.h" #include "imports.h" -#include "mfeatures.h" #include "mtypes.h" #include "vtxfmt.h" #include "eval.h" @@ -40,12 +39,12 @@ /** - * Use the per-vertex functions found in <vfmt> to initialize the given - * API dispatch table. + * Copy the functions found in the GLvertexformat object into the + * dispatch table. */ static void install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab, - const GLvertexformat *vfmt, bool beginend) + const GLvertexformat *vfmt) { assert(ctx->Version > 0); @@ -62,7 +61,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab, } if (ctx->API == API_OPENGL_COMPAT) { - _mesa_install_eval_vtxfmt(tab, vfmt, beginend); + _mesa_install_eval_vtxfmt(tab, vfmt); } if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) { @@ -111,40 +110,6 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab, SET_Begin(tab, vfmt->Begin); SET_End(tab, vfmt->End); SET_PrimitiveRestartNV(tab, vfmt->PrimitiveRestartNV); - - SET_Rectf(tab, vfmt->Rectf); - } - - SET_DrawArrays(tab, vfmt->DrawArrays); - SET_DrawElements(tab, vfmt->DrawElements); - if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) { - SET_DrawRangeElements(tab, vfmt->DrawRangeElements); - } - - SET_MultiDrawElementsEXT(tab, vfmt->MultiDrawElementsEXT); - - if (_mesa_is_desktop_gl(ctx)) { - SET_DrawElementsBaseVertex(tab, vfmt->DrawElementsBaseVertex); - SET_DrawRangeElementsBaseVertex(tab, vfmt->DrawRangeElementsBaseVertex); - SET_MultiDrawElementsBaseVertex(tab, vfmt->MultiDrawElementsBaseVertex); - SET_DrawArraysInstancedBaseInstance(tab, vfmt->DrawArraysInstancedBaseInstance); - SET_DrawElementsInstancedBaseInstance(tab, vfmt->DrawElementsInstancedBaseInstance); - SET_DrawElementsInstancedBaseVertex(tab, vfmt->DrawElementsInstancedBaseVertex); - SET_DrawElementsInstancedBaseVertexBaseInstance(tab, vfmt->DrawElementsInstancedBaseVertexBaseInstance); - } - - if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) { - SET_DrawArraysInstancedARB(tab, vfmt->DrawArraysInstanced); - SET_DrawElementsInstancedARB(tab, vfmt->DrawElementsInstanced); - } - - if (_mesa_is_desktop_gl(ctx)) { - SET_DrawTransformFeedback(tab, vfmt->DrawTransformFeedback); - SET_DrawTransformFeedbackStream(tab, vfmt->DrawTransformFeedbackStream); - SET_DrawTransformFeedbackInstanced(tab, - vfmt->DrawTransformFeedbackInstanced); - SET_DrawTransformFeedbackStreamInstanced(tab, - vfmt->DrawTransformFeedbackStreamInstanced); } /* Originally for GL_NV_vertex_program, this is also used by dlist.c */ @@ -251,9 +216,9 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab, void _mesa_install_exec_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt) { - install_vtxfmt(ctx, ctx->Exec, vfmt, false); + install_vtxfmt(ctx, ctx->Exec, vfmt); if (ctx->BeginEnd) - install_vtxfmt(ctx, ctx->BeginEnd, vfmt, true); + install_vtxfmt(ctx, ctx->BeginEnd, vfmt); } @@ -265,7 +230,7 @@ void _mesa_install_save_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt) { if (_mesa_is_desktop_gl(ctx)) - install_vtxfmt(ctx, ctx->Save, vfmt, false); + install_vtxfmt(ctx, ctx->Save, vfmt); } diff --git a/mesalib/src/mesa/main/vtxfmt.h b/mesalib/src/mesa/main/vtxfmt.h index 16ffb6ffd..4301c4277 100644 --- a/mesalib/src/mesa/main/vtxfmt.h +++ b/mesalib/src/mesa/main/vtxfmt.h @@ -24,9 +24,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -34,7 +35,6 @@ #define _VTXFMT_H_ #include "compiler.h" -#include "mfeatures.h" #include "mtypes.h" extern void _mesa_install_exec_vtxfmt( struct gl_context *ctx, const GLvertexformat *vfmt ); diff --git a/mesalib/src/mesa/math/m_clip_tmp.h b/mesalib/src/mesa/math/m_clip_tmp.h index 2e3096405..c6b8bd83d 100644 --- a/mesalib/src/mesa/math/m_clip_tmp.h +++ b/mesalib/src/mesa/math/m_clip_tmp.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/math/m_copy_tmp.h b/mesalib/src/mesa/math/m_copy_tmp.h index 07ab1f7b2..98fbd0730 100644 --- a/mesalib/src/mesa/math/m_copy_tmp.h +++ b/mesalib/src/mesa/math/m_copy_tmp.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/math/m_debug.h b/mesalib/src/mesa/math/m_debug.h index 6476b6de2..a1e8cee9d 100644 --- a/mesalib/src/mesa/math/m_debug.h +++ b/mesalib/src/mesa/math/m_debug.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Gareth Hughes diff --git a/mesalib/src/mesa/math/m_debug_clip.c b/mesalib/src/mesa/math/m_debug_clip.c index bbad6ef02..08b9eff06 100644 --- a/mesalib/src/mesa/math/m_debug_clip.c +++ b/mesalib/src/mesa/math/m_debug_clip.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Gareth Hughes diff --git a/mesalib/src/mesa/math/m_debug_norm.c b/mesalib/src/mesa/math/m_debug_norm.c index 00efa336d..588cd90a3 100644 --- a/mesalib/src/mesa/math/m_debug_norm.c +++ b/mesalib/src/mesa/math/m_debug_norm.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Gareth Hughes diff --git a/mesalib/src/mesa/math/m_debug_util.h b/mesalib/src/mesa/math/m_debug_util.h index ed11c849e..f356588ae 100644 --- a/mesalib/src/mesa/math/m_debug_util.h +++ b/mesalib/src/mesa/math/m_debug_util.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Gareth Hughes diff --git a/mesalib/src/mesa/math/m_debug_xform.c b/mesalib/src/mesa/math/m_debug_xform.c index 2cceaa2f8..cea382da6 100644 --- a/mesalib/src/mesa/math/m_debug_xform.c +++ b/mesalib/src/mesa/math/m_debug_xform.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/math/m_dotprod_tmp.h b/mesalib/src/mesa/math/m_dotprod_tmp.h index 03e65af6c..6f530cfc4 100644 --- a/mesalib/src/mesa/math/m_dotprod_tmp.h +++ b/mesalib/src/mesa/math/m_dotprod_tmp.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/math/m_eval.c b/mesalib/src/mesa/math/m_eval.c index d324673c5..7e8a81d13 100644 --- a/mesalib/src/mesa/math/m_eval.c +++ b/mesalib/src/mesa/math/m_eval.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/math/m_eval.h b/mesalib/src/mesa/math/m_eval.h index d73ecaafb..cc1d1894c 100644 --- a/mesalib/src/mesa/math/m_eval.h +++ b/mesalib/src/mesa/math/m_eval.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ #ifndef _M_EVAL_H diff --git a/mesalib/src/mesa/math/m_matrix.c b/mesalib/src/mesa/math/m_matrix.c index bcd2cae4a..4f64bd226 100644 --- a/mesalib/src/mesa/math/m_matrix.c +++ b/mesalib/src/mesa/math/m_matrix.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/math/m_matrix.h b/mesalib/src/mesa/math/m_matrix.h index 9f4ea2586..fabe15a94 100644 --- a/mesalib/src/mesa/math/m_matrix.h +++ b/mesalib/src/mesa/math/m_matrix.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/math/m_norm_tmp.h b/mesalib/src/mesa/math/m_norm_tmp.h index a20cb0501..24839e2b5 100644 --- a/mesalib/src/mesa/math/m_norm_tmp.h +++ b/mesalib/src/mesa/math/m_norm_tmp.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/math/m_trans_tmp.h b/mesalib/src/mesa/math/m_trans_tmp.h index 76ed83209..867384b78 100644 --- a/mesalib/src/mesa/math/m_trans_tmp.h +++ b/mesalib/src/mesa/math/m_trans_tmp.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** diff --git a/mesalib/src/mesa/math/m_translate.c b/mesalib/src/mesa/math/m_translate.c index 1da4de372..40c817463 100644 --- a/mesalib/src/mesa/math/m_translate.c +++ b/mesalib/src/mesa/math/m_translate.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** diff --git a/mesalib/src/mesa/math/m_translate.h b/mesalib/src/mesa/math/m_translate.h index 8fec6f14b..eeb947f29 100644 --- a/mesalib/src/mesa/math/m_translate.h +++ b/mesalib/src/mesa/math/m_translate.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/math/m_vector.c b/mesalib/src/mesa/math/m_vector.c index 4bded31e0..0d38117e9 100644 --- a/mesalib/src/mesa/math/m_vector.c +++ b/mesalib/src/mesa/math/m_vector.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/math/m_vector.h b/mesalib/src/mesa/math/m_vector.h index 71281d575..143a30282 100644 --- a/mesalib/src/mesa/math/m_vector.h +++ b/mesalib/src/mesa/math/m_vector.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/math/m_xform.c b/mesalib/src/mesa/math/m_xform.c index 61ad3c753..f8c0993d4 100644 --- a/mesalib/src/mesa/math/m_xform.c +++ b/mesalib/src/mesa/math/m_xform.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/math/m_xform.h b/mesalib/src/mesa/math/m_xform.h index 280248883..7cec7f0ad 100644 --- a/mesalib/src/mesa/math/m_xform.h +++ b/mesalib/src/mesa/math/m_xform.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/math/m_xform_tmp.h b/mesalib/src/mesa/math/m_xform_tmp.h index e93837725..1f984887d 100644 --- a/mesalib/src/mesa/math/m_xform_tmp.h +++ b/mesalib/src/mesa/math/m_xform_tmp.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/program/Android.mk b/mesalib/src/mesa/program/Android.mk index 51362e0eb..3f974ea27 100644 --- a/mesalib/src/mesa/program/Android.mk +++ b/mesalib/src/mesa/program/Android.mk @@ -38,7 +38,7 @@ endef # Import the following variables: # PROGRAM_FILES -include $(MESA_TOP)/src/mesa/sources.mak +include $(MESA_TOP)/src/mesa/Makefile.sources include $(CLEAR_VARS) @@ -49,7 +49,7 @@ intermediates := $(call local-intermediates-dir) MESA_ENABLED_APIS := ES1 ES2 -# TODO(chadv): In sources.mak, move these vars to a different list so we can +# TODO(chadv): In Makefile.sources, move these vars to a different list so we can # remove this kludge. generated_sources_basenames := \ lex.yy.c \ diff --git a/mesalib/src/mesa/program/Makefile.am b/mesalib/src/mesa/program/Makefile.am index 1b8204658..ab565e251 100644 --- a/mesalib/src/mesa/program/Makefile.am +++ b/mesalib/src/mesa/program/Makefile.am @@ -19,9 +19,9 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -include ../sources.mak +include ../Makefile.sources -AM_CPPFLAGS = $(API_DEFINES) $(DEFINES) $(INCLUDE_DIRS) +AM_CPPFLAGS = $(DEFINES) $(INCLUDE_DIRS) AM_CFLAGS = $(VISIBILITY_CFLAGS) AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS) libdricore_program_la_CFLAGS = $(NOVISIBILITY_CFLAGS) diff --git a/mesalib/src/mesa/program/arbprogparse.c b/mesalib/src/mesa/program/arbprogparse.c index 527bb936e..0ec87e356 100644 --- a/mesalib/src/mesa/program/arbprogparse.c +++ b/mesalib/src/mesa/program/arbprogparse.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ #define DEBUG_PARSING 0 diff --git a/mesalib/src/mesa/program/arbprogparse.h b/mesalib/src/mesa/program/arbprogparse.h index 4c0c30072..04d304bc0 100644 --- a/mesalib/src/mesa/program/arbprogparse.h +++ b/mesalib/src/mesa/program/arbprogparse.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp index 14cf5baa7..a5b6699c2 100644 --- a/mesalib/src/mesa/program/ir_to_mesa.cpp +++ b/mesalib/src/mesa/program/ir_to_mesa.cpp @@ -1444,6 +1444,10 @@ ir_to_mesa_visitor::visit(ir_expression *ir) case ir_unop_unpack_half_2x16_split_x: case ir_unop_unpack_half_2x16_split_y: case ir_binop_pack_half_2x16_split: + case ir_unop_bitfield_reverse: + case ir_unop_bit_count: + case ir_unop_find_msb: + case ir_unop_find_lsb: assert(!"not supported"); break; case ir_binop_min: @@ -1485,6 +1489,15 @@ ir_to_mesa_visitor::visit(ir_expression *ir) emit(ir, OPCODE_LRP, result_dst, op[2], op[1], op[0]); break; + case ir_binop_vector_extract: + case ir_binop_bfm: + case ir_triop_bfi: + case ir_triop_bitfield_extract: + case ir_triop_vector_insert: + case ir_quadop_bitfield_insert: + assert(!"not supported"); + break; + case ir_quadop_vector: /* This operation should have already been handled. */ @@ -2391,8 +2404,10 @@ print_program(struct prog_instruction *mesa_instructions, class add_uniform_to_shader : public program_resource_visitor { public: add_uniform_to_shader(struct gl_shader_program *shader_program, - struct gl_program_parameter_list *params) - : shader_program(shader_program), params(params), idx(-1) + struct gl_program_parameter_list *params, + gl_shader_type shader_type) + : shader_program(shader_program), params(params), idx(-1), + shader_type(shader_type) { /* empty */ } @@ -2412,6 +2427,7 @@ private: struct gl_shader_program *shader_program; struct gl_program_parameter_list *params; int idx; + gl_shader_type shader_type; }; void @@ -2458,8 +2474,11 @@ add_uniform_to_shader::visit_field(const glsl_type *type, const char *name, struct gl_uniform_storage *storage = &this->shader_program->UniformStorage[location]; + assert(storage->sampler[shader_type].active); + for (unsigned int j = 0; j < size / 4; j++) - params->ParameterValues[index + j][0].f = storage->sampler + j; + params->ParameterValues[index + j][0].f = + storage->sampler[shader_type].index + j; } } @@ -2485,7 +2504,8 @@ _mesa_generate_parameters_list_for_uniforms(struct gl_shader_program struct gl_program_parameter_list *params) { - add_uniform_to_shader add(shader_program, params); + add_uniform_to_shader add(shader_program, params, + _mesa_shader_type_to_index(sh->Type)); foreach_list(node, sh->ir) { ir_variable *var = ((ir_instruction *) node)->as_variable(); @@ -2757,6 +2777,8 @@ ir_to_mesa_visitor::copy_propagate(void) /* If this is a copy, add it to the ACP. */ if (inst->op == OPCODE_MOV && inst->dst.file == PROGRAM_TEMPORARY && + !(inst->dst.file == inst->src[0].file && + inst->dst.index == inst->src[0].index) && !inst->dst.reladdr && !inst->saturate && !inst->src[0].reladdr && @@ -3012,7 +3034,8 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress; progress = do_common_optimization(ir, true, true, - options->MaxUnrollIterations) + options->MaxUnrollIterations, + options) || progress; progress = lower_quadop_vector(ir, true) || progress; @@ -3039,6 +3062,7 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) || progress; progress = do_vec_index_to_cond_assign(ir) || progress; + progress = lower_vector_insert(ir, true) || progress; } while (progress); validate_ir_tree(ir); @@ -3118,11 +3142,13 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader) if (!state->error && !shader->ir->is_empty()) { validate_ir_tree(shader->ir); + struct gl_shader_compiler_options *options = + &ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(shader->Type)]; /* Do some optimization at compile time to reduce shader IR size * and reduce later work if the same shader is linked multiple times */ - while (do_common_optimization(shader->ir, false, false, 32)) + while (do_common_optimization(shader->ir, false, false, 32, options)) ; validate_ir_tree(shader->ir); diff --git a/mesalib/src/mesa/program/prog_execute.c b/mesalib/src/mesa/program/prog_execute.c index d205cdbbe..548077d39 100644 --- a/mesalib/src/mesa/program/prog_execute.c +++ b/mesalib/src/mesa/program/prog_execute.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** @@ -240,37 +241,6 @@ fetch_vector4(const struct prog_src_register *source, /** - * Fetch a 4-element uint vector from the given source register. - * Apply swizzling but not negation/abs. - */ -static void -fetch_vector4ui(const struct prog_src_register *source, - const struct gl_program_machine *machine, GLuint result[4]) -{ - const GLuint *src = (GLuint *) get_src_register_pointer(source, machine); - ASSERT(src); - - if (source->Swizzle == SWIZZLE_NOOP) { - /* no swizzling */ - COPY_4V(result, src); - } - else { - ASSERT(GET_SWZ(source->Swizzle, 0) <= 3); - ASSERT(GET_SWZ(source->Swizzle, 1) <= 3); - ASSERT(GET_SWZ(source->Swizzle, 2) <= 3); - ASSERT(GET_SWZ(source->Swizzle, 3) <= 3); - result[0] = src[GET_SWZ(source->Swizzle, 0)]; - result[1] = src[GET_SWZ(source->Swizzle, 1)]; - result[2] = src[GET_SWZ(source->Swizzle, 2)]; - result[3] = src[GET_SWZ(source->Swizzle, 3)]; - } - - /* Note: no Negate or Abs here */ -} - - - -/** * Fetch the derivative with respect to X or Y for the given register. * XXX this currently only works for fragment program input attribs. */ @@ -666,18 +636,6 @@ _mesa_execute_program(struct gl_context * ctx, } } break; - case OPCODE_AND: /* bitwise AND */ - { - GLuint a[4], b[4], result[4]; - fetch_vector4ui(&inst->SrcReg[0], machine, a); - fetch_vector4ui(&inst->SrcReg[1], machine, b); - result[0] = a[0] & b[0]; - result[1] = a[1] & b[1]; - result[2] = a[2] & b[2]; - result[3] = a[3] & b[3]; - store_vector4ui(inst, machine, result); - } - break; case OPCODE_ARL: { GLfloat t[4]; @@ -790,20 +748,6 @@ _mesa_execute_program(struct gl_context * ctx, } } break; - case OPCODE_DP2A: - { - GLfloat a[4], b[4], c, result[4]; - fetch_vector4(&inst->SrcReg[0], machine, a); - fetch_vector4(&inst->SrcReg[1], machine, b); - fetch_vector1(&inst->SrcReg[1], machine, &c); - result[0] = result[1] = result[2] = result[3] = DOT2(a, b) + c; - store_vector4(inst, machine, result); - if (DEBUG_PROG) { - printf("DP2A %g = (%g %g) . (%g %g) + %g\n", - result[0], a[0], a[1], b[0], b[1], c); - } - } - break; case OPCODE_DP3: { GLfloat a[4], b[4], result[4]; @@ -1193,59 +1137,6 @@ _mesa_execute_program(struct gl_context * ctx, break; case OPCODE_NOP: break; - case OPCODE_NOT: /* bitwise NOT */ - { - GLuint a[4], result[4]; - fetch_vector4ui(&inst->SrcReg[0], machine, a); - result[0] = ~a[0]; - result[1] = ~a[1]; - result[2] = ~a[2]; - result[3] = ~a[3]; - store_vector4ui(inst, machine, result); - } - break; - case OPCODE_NRM3: /* 3-component normalization */ - { - GLfloat a[4], result[4]; - GLfloat tmp; - fetch_vector4(&inst->SrcReg[0], machine, a); - tmp = a[0] * a[0] + a[1] * a[1] + a[2] * a[2]; - if (tmp != 0.0F) - tmp = INV_SQRTF(tmp); - result[0] = tmp * a[0]; - result[1] = tmp * a[1]; - result[2] = tmp * a[2]; - result[3] = 0.0; /* undefined, but prevent valgrind warnings */ - store_vector4(inst, machine, result); - } - break; - case OPCODE_NRM4: /* 4-component normalization */ - { - GLfloat a[4], result[4]; - GLfloat tmp; - fetch_vector4(&inst->SrcReg[0], machine, a); - tmp = a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]; - if (tmp != 0.0F) - tmp = INV_SQRTF(tmp); - result[0] = tmp * a[0]; - result[1] = tmp * a[1]; - result[2] = tmp * a[2]; - result[3] = tmp * a[3]; - store_vector4(inst, machine, result); - } - break; - case OPCODE_OR: /* bitwise OR */ - { - GLuint a[4], b[4], result[4]; - fetch_vector4ui(&inst->SrcReg[0], machine, a); - fetch_vector4ui(&inst->SrcReg[1], machine, b); - result[0] = a[0] | b[0]; - result[1] = a[1] | b[1]; - result[2] = a[2] | b[2]; - result[3] = a[3] | b[3]; - store_vector4ui(inst, machine, result); - } - break; case OPCODE_PK2H: /* pack two 16-bit floats in one 32-bit float */ { GLfloat a[4]; @@ -1747,18 +1638,6 @@ _mesa_execute_program(struct gl_context * ctx, store_vector4(inst, machine, result); } break; - case OPCODE_XOR: /* bitwise XOR */ - { - GLuint a[4], b[4], result[4]; - fetch_vector4ui(&inst->SrcReg[0], machine, a); - fetch_vector4ui(&inst->SrcReg[1], machine, b); - result[0] = a[0] ^ b[0]; - result[1] = a[1] ^ b[1]; - result[2] = a[2] ^ b[2]; - result[3] = a[3] ^ b[3]; - store_vector4ui(inst, machine, result); - } - break; case OPCODE_XPD: /* cross product */ { GLfloat a[4], b[4], result[4]; @@ -1789,19 +1668,6 @@ _mesa_execute_program(struct gl_context * ctx, store_vector4(inst, machine, result); } break; - case OPCODE_PRINT: - { - if (inst->SrcReg[0].File != PROGRAM_UNDEFINED) { - GLfloat a[4]; - fetch_vector4(&inst->SrcReg[0], machine, a); - printf("%s%g, %g, %g, %g\n", (const char *) inst->Data, - a[0], a[1], a[2], a[3]); - } - else { - printf("%s\n", (const char *) inst->Data); - } - } - break; case OPCODE_END: return GL_TRUE; default: diff --git a/mesalib/src/mesa/program/prog_execute.h b/mesalib/src/mesa/program/prog_execute.h index 1ae302c32..346b7b6b3 100644 --- a/mesalib/src/mesa/program/prog_execute.h +++ b/mesalib/src/mesa/program/prog_execute.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ #ifndef PROG_EXECUTE_H diff --git a/mesalib/src/mesa/program/prog_instruction.c b/mesalib/src/mesa/program/prog_instruction.c index ab93932ef..4329e6544 100644 --- a/mesalib/src/mesa/program/prog_instruction.c +++ b/mesalib/src/mesa/program/prog_instruction.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -127,7 +128,6 @@ _mesa_free_instructions(struct prog_instruction *inst, GLuint count) { GLuint i; for (i = 0; i < count; i++) { - free(inst[i].Data); free((char *)inst[i].Comment); } free(inst); @@ -153,7 +153,6 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = { { OPCODE_NOP, "NOP", 0, 0 }, { OPCODE_ABS, "ABS", 1, 1 }, { OPCODE_ADD, "ADD", 2, 1 }, - { OPCODE_AND, "AND", 2, 1 }, { OPCODE_ARL, "ARL", 1, 1 }, { OPCODE_BGNLOOP,"BGNLOOP", 0, 0 }, { OPCODE_BGNSUB, "BGNSUB", 0, 0 }, @@ -165,7 +164,6 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = { { OPCODE_DDX, "DDX", 1, 1 }, { OPCODE_DDY, "DDY", 1, 1 }, { OPCODE_DP2, "DP2", 2, 1 }, - { OPCODE_DP2A, "DP2A", 3, 1 }, { OPCODE_DP3, "DP3", 2, 1 }, { OPCODE_DP4, "DP4", 2, 1 }, { OPCODE_DPH, "DPH", 2, 1 }, @@ -195,16 +193,11 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = { { OPCODE_NOISE2, "NOISE2", 1, 1 }, { OPCODE_NOISE3, "NOISE3", 1, 1 }, { OPCODE_NOISE4, "NOISE4", 1, 1 }, - { OPCODE_NOT, "NOT", 1, 1 }, - { OPCODE_NRM3, "NRM3", 1, 1 }, - { OPCODE_NRM4, "NRM4", 1, 1 }, - { OPCODE_OR, "OR", 2, 1 }, { OPCODE_PK2H, "PK2H", 1, 1 }, { OPCODE_PK2US, "PK2US", 1, 1 }, { OPCODE_PK4B, "PK4B", 1, 1 }, { OPCODE_PK4UB, "PK4UB", 1, 1 }, { OPCODE_POW, "POW", 2, 1 }, - { OPCODE_PRINT, "PRINT", 1, 0 }, { OPCODE_RCP, "RCP", 1, 1 }, { OPCODE_RET, "RET", 0, 0 }, { OPCODE_RFL, "RFL", 1, 1 }, @@ -234,7 +227,6 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = { { OPCODE_UP4B, "UP4B", 1, 1 }, { OPCODE_UP4UB, "UP4UB", 1, 1 }, { OPCODE_X2D, "X2D", 3, 1 }, - { OPCODE_XOR, "XOR", 2, 1 }, { OPCODE_XPD, "XPD", 2, 1 } }; diff --git a/mesalib/src/mesa/program/prog_instruction.h b/mesalib/src/mesa/program/prog_instruction.h index a7bba75f1..160b1d079 100644 --- a/mesalib/src/mesa/program/prog_instruction.h +++ b/mesalib/src/mesa/program/prog_instruction.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -147,7 +148,6 @@ typedef enum prog_opcode { OPCODE_NOP = 0, /* X */ OPCODE_ABS, /* X X 1.1 X */ OPCODE_ADD, /* X X X X X */ - OPCODE_AND, /* */ OPCODE_ARL, /* X X X */ OPCODE_BGNLOOP, /* opt */ OPCODE_BGNSUB, /* opt */ @@ -159,7 +159,6 @@ typedef enum prog_opcode { OPCODE_DDX, /* X X */ OPCODE_DDY, /* X X */ OPCODE_DP2, /* 2 X */ - OPCODE_DP2A, /* 2 */ OPCODE_DP3, /* X X X X X */ OPCODE_DP4, /* X X X X X */ OPCODE_DPH, /* X X 1.1 */ @@ -189,16 +188,11 @@ typedef enum prog_opcode { OPCODE_NOISE2, /* X */ OPCODE_NOISE3, /* X */ OPCODE_NOISE4, /* X */ - OPCODE_NOT, /* */ - OPCODE_NRM3, /* */ - OPCODE_NRM4, /* */ - OPCODE_OR, /* */ OPCODE_PK2H, /* X */ OPCODE_PK2US, /* X */ OPCODE_PK4B, /* X */ OPCODE_PK4UB, /* X */ OPCODE_POW, /* X X X X */ - OPCODE_PRINT, /* X X */ OPCODE_RCP, /* X X X X X */ OPCODE_RET, /* 2 2 opt */ OPCODE_RFL, /* X */ @@ -228,7 +222,6 @@ typedef enum prog_opcode { OPCODE_UP4B, /* X */ OPCODE_UP4UB, /* X */ OPCODE_X2D, /* X */ - OPCODE_XOR, /* */ OPCODE_XPD, /* X X */ MAX_OPCODE } gl_inst_opcode; @@ -389,9 +382,6 @@ struct prog_instruction /** for debugging purposes */ const char *Comment; - /** Arbitrary data. Used for OPCODE_PRINT and some drivers */ - void *Data; - /** for driver use (try to remove someday) */ GLint Aux; }; diff --git a/mesalib/src/mesa/program/prog_noise.c b/mesalib/src/mesa/program/prog_noise.c index 75cd8c659..63590c60c 100644 --- a/mesalib/src/mesa/program/prog_noise.c +++ b/mesalib/src/mesa/program/prog_noise.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/program/prog_noise.h b/mesalib/src/mesa/program/prog_noise.h index dd7986efc..9828343a6 100644 --- a/mesalib/src/mesa/program/prog_noise.h +++ b/mesalib/src/mesa/program/prog_noise.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ #ifndef PROG_NOISE diff --git a/mesalib/src/mesa/program/prog_opt_constant_fold.c b/mesalib/src/mesa/program/prog_opt_constant_fold.c index e2418b554..3811c0d8a 100644 --- a/mesalib/src/mesa/program/prog_opt_constant_fold.c +++ b/mesalib/src/mesa/program/prog_opt_constant_fold.c @@ -204,10 +204,6 @@ _mesa_constant_fold(struct gl_program *prog) get_value(prog, &inst->SrcReg[0], a); get_value(prog, &inst->SrcReg[1], b); - /* It seems like a loop could be used here, but we cleverly put - * DP2A between DP2 and DP3. Subtracting DP2 (or similar) from - * the opcode results in various failures of the loop control. - */ result = (a[0] * b[0]) + (a[1] * b[1]); if (inst->Opcode >= OPCODE_DP3) diff --git a/mesalib/src/mesa/program/prog_parameter.c b/mesalib/src/mesa/program/prog_parameter.c index 8713d57b5..0b134f7da 100644 --- a/mesalib/src/mesa/program/prog_parameter.c +++ b/mesalib/src/mesa/program/prog_parameter.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** diff --git a/mesalib/src/mesa/program/prog_parameter.h b/mesalib/src/mesa/program/prog_parameter.h index 7b6b4b80e..bb2aa973b 100644 --- a/mesalib/src/mesa/program/prog_parameter.h +++ b/mesalib/src/mesa/program/prog_parameter.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** diff --git a/mesalib/src/mesa/program/prog_print.c b/mesalib/src/mesa/program/prog_print.c index c73f10df5..c8351e3b5 100644 --- a/mesalib/src/mesa/program/prog_print.c +++ b/mesalib/src/mesa/program/prog_print.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** @@ -663,20 +664,6 @@ _mesa_fprint_instruction_opt(FILE *f, } switch (inst->Opcode) { - case OPCODE_PRINT: - fprintf(f, "PRINT '%s'", (char *) inst->Data); - if (inst->SrcReg[0].File != PROGRAM_UNDEFINED) { - fprintf(f, ", "); - fprintf(f, "%s[%d]%s", - _mesa_register_file_name((gl_register_file) inst->SrcReg[0].File), - inst->SrcReg[0].Index, - _mesa_swizzle_string(inst->SrcReg[0].Swizzle, - inst->SrcReg[0].Negate, GL_FALSE)); - } - if (inst->Comment) - fprintf(f, " # %s", inst->Comment); - fprint_comment(f, inst); - break; case OPCODE_SWZ: fprintf(f, "SWZ"); if (inst->SaturateMode == SATURATE_ZERO_ONE) diff --git a/mesalib/src/mesa/program/prog_print.h b/mesalib/src/mesa/program/prog_print.h index 3e400eb46..82195cbbc 100644 --- a/mesalib/src/mesa/program/prog_print.h +++ b/mesalib/src/mesa/program/prog_print.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/program/prog_statevars.c b/mesalib/src/mesa/program/prog_statevars.c index 09d2a568a..19a948237 100644 --- a/mesalib/src/mesa/program/prog_statevars.c +++ b/mesalib/src/mesa/program/prog_statevars.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** diff --git a/mesalib/src/mesa/program/prog_statevars.h b/mesalib/src/mesa/program/prog_statevars.h index af2c89792..e26ded9e0 100644 --- a/mesalib/src/mesa/program/prog_statevars.h +++ b/mesalib/src/mesa/program/prog_statevars.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ #ifndef PROG_STATEVARS_H diff --git a/mesalib/src/mesa/program/program.c b/mesalib/src/mesa/program/program.c index 2ef969ff7..37bb7b7eb 100644 --- a/mesalib/src/mesa/program/program.c +++ b/mesalib/src/mesa/program/program.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** @@ -32,7 +33,6 @@ #include "main/glheader.h" #include "main/context.h" #include "main/hash.h" -#include "main/mfeatures.h" #include "program.h" #include "prog_cache.h" #include "prog_parameter.h" diff --git a/mesalib/src/mesa/program/program.h b/mesalib/src/mesa/program/program.h index c5650c519..8f88b3913 100644 --- a/mesalib/src/mesa/program/program.h +++ b/mesalib/src/mesa/program/program.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** diff --git a/mesalib/src/mesa/program/program_parse.y b/mesalib/src/mesa/program/program_parse.y index 81d85f9fb..cbf3fe6ca 100644 --- a/mesalib/src/mesa/program/program_parse.y +++ b/mesalib/src/mesa/program/program_parse.y @@ -709,6 +709,7 @@ extSwizSel: INTEGER } $$.swz = ($1 == 0) ? SWIZZLE_ZERO : SWIZZLE_ONE; + $$.negate = 0; /* 0 and 1 are valid for both RGBA swizzle names and XYZW * swizzle names. @@ -728,6 +729,10 @@ extSwizSel: INTEGER s = $1[0]; free($1); + $$.rgba_valid = 0; + $$.xyzw_valid = 0; + $$.negate = 0; + switch (s) { case 'x': $$.swz = SWIZZLE_X; @@ -2709,7 +2714,7 @@ _mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *st ? & ctx->Const.VertexProgram : & ctx->Const.FragmentProgram; - state->MaxTextureImageUnits = ctx->Const.MaxTextureImageUnits; + state->MaxTextureImageUnits = ctx->Const.FragmentProgram.MaxTextureImageUnits; state->MaxTextureCoordUnits = ctx->Const.MaxTextureCoordUnits; state->MaxTextureUnits = ctx->Const.MaxTextureUnits; state->MaxClipPlanes = ctx->Const.MaxClipPlanes; diff --git a/mesalib/src/mesa/program/program_parse_extra.c b/mesalib/src/mesa/program/program_parse_extra.c index 4d928483e..e8e1912eb 100644 --- a/mesalib/src/mesa/program/program_parse_extra.c +++ b/mesalib/src/mesa/program/program_parse_extra.c @@ -194,15 +194,21 @@ _mesa_ARBfp_parse_option(struct asm_parser_state *state, const char *option) } else if (strncmp(option, "precision_hint_", 15) == 0) { option += 15; - if (state->option.PrecisionHint == OPTION_NONE) { - if (strcmp(option, "nicest") == 0) { - state->option.PrecisionHint = OPTION_NICEST; - return 1; - } else if (strcmp(option, "fastest") == 0) { - state->option.PrecisionHint = OPTION_FASTEST; - return 1; - } - } + /* The ARB_fragment_program spec, 3.11.4.5.2 says: + * + * "Only one precision control option may be specified by any given + * fragment program. A fragment program that specifies both the + * "ARB_precision_hint_fastest" and "ARB_precision_hint_nicest" + * program options will fail to load. + */ + + if (strcmp(option, "nicest") == 0 && state->option.PrecisionHint != OPTION_FASTEST) { + state->option.PrecisionHint = OPTION_NICEST; + return 1; + } else if (strcmp(option, "fastest") == 0 && state->option.PrecisionHint != OPTION_NICEST) { + state->option.PrecisionHint = OPTION_FASTEST; + return 1; + } return 0; } else if (strcmp(option, "draw_buffers") == 0) { diff --git a/mesalib/src/mesa/program/programopt.c b/mesalib/src/mesa/program/programopt.c index d40ffd543..6a62e1f58 100644 --- a/mesalib/src/mesa/program/programopt.c +++ b/mesalib/src/mesa/program/programopt.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** @@ -218,7 +219,7 @@ _mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_vertex_program *vpro void _mesa_insert_mvp_code(struct gl_context *ctx, struct gl_vertex_program *vprog) { - if (ctx->mvp_with_dp4) + if (ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].PreferDP4) _mesa_insert_mvp_dp4_code( ctx, vprog ); else _mesa_insert_mvp_mad_code( ctx, vprog ); diff --git a/mesalib/src/mesa/program/programopt.h b/mesalib/src/mesa/program/programopt.h index b9205823c..3a274417f 100644 --- a/mesalib/src/mesa/program/programopt.h +++ b/mesalib/src/mesa/program/programopt.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/program/register_allocate.c b/mesalib/src/mesa/program/register_allocate.c index 2c826fc66..16739fd39 100644 --- a/mesalib/src/mesa/program/register_allocate.c +++ b/mesalib/src/mesa/program/register_allocate.c @@ -355,7 +355,7 @@ ra_alloc_interference_graph(struct ra_regs *regs, unsigned int count) g->stack = rzalloc_array(g, unsigned int, count); for (i = 0; i < count; i++) { - int bitset_count = ALIGN(count, BITSET_WORDBITS) / BITSET_WORDBITS; + int bitset_count = BITSET_WORDS(count); g->nodes[i].adjacency = rzalloc_array(g, BITSET_WORD, bitset_count); g->nodes[i].adjacency_list_size = 4; @@ -437,7 +437,7 @@ ra_simplify(struct ra_graph *g) } for (i = 0; i < g->count; i++) { - if (!g->nodes[i].in_stack) + if (!g->nodes[i].in_stack && g->nodes[i].reg == -1) return GL_FALSE; } @@ -586,7 +586,7 @@ int ra_get_best_spill_node(struct ra_graph *g) { unsigned int best_node = -1; - unsigned int best_benefit = 0.0; + float best_benefit = 0.0; unsigned int n; for (n = 0; n < g->count; n++) { diff --git a/mesalib/src/mesa/program/sampler.cpp b/mesalib/src/mesa/program/sampler.cpp index e3641aaa9..9b9412730 100644 --- a/mesalib/src/mesa/program/sampler.cpp +++ b/mesalib/src/mesa/program/sampler.cpp @@ -34,6 +34,7 @@ extern "C" { #include "main/compiler.h" #include "main/mtypes.h" #include "program/prog_parameter.h" +#include "program/program.h" } class get_sampler_name : public ir_hierarchical_visitor @@ -102,14 +103,16 @@ public: ir_dereference *last; }; -extern "C" { -int + +extern "C" int _mesa_get_sampler_uniform_value(class ir_dereference *sampler, struct gl_shader_program *shader_program, const struct gl_program *prog) { get_sampler_name getname(sampler, shader_program); + GLuint shader = _mesa_program_target_to_index(prog->Target); + sampler->accept(&getname); unsigned location; @@ -119,6 +122,15 @@ _mesa_get_sampler_uniform_value(class ir_dereference *sampler, return 0; } - return shader_program->UniformStorage[location].sampler + getname.offset; -} + if (!shader_program->UniformStorage[location].sampler[shader].active) { + assert(0 && "cannot return a sampler"); + linker_error(shader_program, + "cannot return a sampler named %s, because it is not " + "used in this shader stage. This is a driver bug.\n", + getname.name); + return 0; + } + + return shader_program->UniformStorage[location].sampler[shader].index + + getname.offset; } diff --git a/mesalib/src/mesa/state_tracker/st_atom.c b/mesalib/src/mesa/state_tracker/st_atom.c index 32bcc266a..1abaf8f3e 100644 --- a/mesalib/src/mesa/state_tracker/st_atom.c +++ b/mesalib/src/mesa/state_tracker/st_atom.c @@ -55,10 +55,10 @@ static const struct st_tracked_state *atoms[] = &st_update_viewport, &st_update_scissor, &st_update_blend, - &st_update_sampler, &st_update_vertex_texture, &st_update_fragment_texture, &st_update_geometry_texture, + &st_update_sampler, /* depends on update_*_texture for swizzle */ &st_update_framebuffer, &st_update_msaa, &st_update_vs_constants, @@ -160,11 +160,7 @@ void st_validate_state( struct st_context *st ) check_attrib_edgeflag(st); - /* The bitmap cache is immune to pixel unpack changes. - * Note that GLUT makes several calls to glPixelStore for each - * bitmap char it draws so this is an important check. - */ - if (state->mesa & ~_NEW_PACKUNPACK) + if (state->mesa) st_flush_bitmap_cache(st); check_program_state( st ); diff --git a/mesalib/src/mesa/state_tracker/st_atom_array.c b/mesalib/src/mesa/state_tracker/st_atom_array.c index 2437245bd..87a0a17f1 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_array.c +++ b/mesalib/src/mesa/state_tracker/st_atom_array.c @@ -589,7 +589,7 @@ static void update_array(struct st_context *st) const struct st_tracked_state st_update_array = { "st_update_array", /* name */ { /* dirty */ - _NEW_BUFFER_OBJECT, /* mesa */ + 0, /* mesa */ ST_NEW_VERTEX_ARRAYS | ST_NEW_VERTEX_PROGRAM, /* st */ }, update_array /* update */ diff --git a/mesalib/src/mesa/state_tracker/st_atom_constbuf.c b/mesalib/src/mesa/state_tracker/st_atom_constbuf.c index 56ba96fe3..27a910b5f 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_constbuf.c +++ b/mesalib/src/mesa/state_tracker/st_atom_constbuf.c @@ -194,12 +194,25 @@ static void st_bind_ubos(struct st_context *st, binding = &st->ctx->UniformBufferBindings[shader->UniformBlocks[i].Binding]; st_obj = st_buffer_object(binding->BufferObject); - pipe_resource_reference(&cb.buffer, st_obj->buffer); - cb.buffer_size = st_obj->buffer->width0 - binding->Offset; + cb.buffer = st_obj->buffer; + + if (cb.buffer) { + cb.buffer_offset = binding->Offset; + cb.buffer_size = cb.buffer->width0 - binding->Offset; + + /* AutomaticSize is FALSE if the buffer was set with BindBufferRange. + * Take the minimum just to be sure. + */ + if (!binding->AutomaticSize) + cb.buffer_size = MIN2(cb.buffer_size, binding->Size); + } + else { + cb.buffer_offset = 0; + cb.buffer_size = 0; + } cso_set_constant_buffer(st->cso_context, shader_type, 1 + i, &cb); - pipe_resource_reference(&cb.buffer, NULL); } } @@ -216,8 +229,8 @@ static void bind_vs_ubos(struct st_context *st) const struct st_tracked_state st_bind_vs_ubos = { "st_bind_vs_ubos", { - (_NEW_PROGRAM | _NEW_BUFFER_OBJECT), - ST_NEW_VERTEX_PROGRAM, + 0, + ST_NEW_VERTEX_PROGRAM | ST_NEW_UNIFORM_BUFFER, }, bind_vs_ubos }; @@ -230,14 +243,13 @@ static void bind_fs_ubos(struct st_context *st) return; st_bind_ubos(st, prog->_LinkedShaders[MESA_SHADER_FRAGMENT], PIPE_SHADER_FRAGMENT); - } const struct st_tracked_state st_bind_fs_ubos = { "st_bind_fs_ubos", { - (_NEW_PROGRAM | _NEW_BUFFER_OBJECT), - ST_NEW_FRAGMENT_PROGRAM, + 0, + ST_NEW_FRAGMENT_PROGRAM | ST_NEW_UNIFORM_BUFFER, }, bind_fs_ubos }; diff --git a/mesalib/src/mesa/state_tracker/st_atom_depth.c b/mesalib/src/mesa/state_tracker/st_atom_depth.c index c76a6d8c6..18a56a2e4 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_depth.c +++ b/mesalib/src/mesa/state_tracker/st_atom_depth.c @@ -41,6 +41,9 @@ #include "pipe/p_defines.h" #include "cso_cache/cso_context.h" +#include "main/core.h" +#include "main/stencil.h" + /** * Convert an OpenGL compare mode to a pipe tokens. @@ -116,7 +119,7 @@ update_depth_stencil_alpha(struct st_context *st) dsa->stencil[0].zpass_op = gl_stencil_op_to_pipe(ctx->Stencil.ZPassFunc[0]); dsa->stencil[0].valuemask = ctx->Stencil.ValueMask[0] & 0xff; dsa->stencil[0].writemask = ctx->Stencil.WriteMask[0] & 0xff; - sr.ref_value[0] = ctx->Stencil.Ref[0] & 0xff; + sr.ref_value[0] = _mesa_get_stencil_ref(ctx, 0); if (ctx->Stencil._TestTwoSide) { const GLuint back = ctx->Stencil._BackFace; @@ -127,7 +130,7 @@ update_depth_stencil_alpha(struct st_context *st) dsa->stencil[1].zpass_op = gl_stencil_op_to_pipe(ctx->Stencil.ZPassFunc[back]); dsa->stencil[1].valuemask = ctx->Stencil.ValueMask[back] & 0xff; dsa->stencil[1].writemask = ctx->Stencil.WriteMask[back] & 0xff; - sr.ref_value[1] = ctx->Stencil.Ref[back] & 0xff; + sr.ref_value[1] = _mesa_get_stencil_ref(ctx, back); } else { /* This should be unnecessary. Drivers must not expect this to @@ -153,7 +156,7 @@ update_depth_stencil_alpha(struct st_context *st) const struct st_tracked_state st_update_depth_stencil_alpha = { "st_update_depth_stencil", /* name */ { /* dirty */ - (_NEW_DEPTH|_NEW_STENCIL|_NEW_COLOR), /* mesa */ + (_NEW_DEPTH|_NEW_STENCIL|_NEW_COLOR|_NEW_BUFFERS),/* mesa */ 0, /* st */ }, update_depth_stencil_alpha /* update */ diff --git a/mesalib/src/mesa/state_tracker/st_atom_framebuffer.c b/mesalib/src/mesa/state_tracker/st_atom_framebuffer.c index 3df8691f4..c752640f4 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_framebuffer.c +++ b/mesalib/src/mesa/state_tracker/st_atom_framebuffer.c @@ -59,6 +59,7 @@ update_renderbuffer_surface(struct st_context *st, enum pipe_format format = st->ctx->Color.sRGBEnabled ? resource->format : util_format_linear(resource->format); if (!strb->surface || + strb->surface->texture->nr_samples != strb->Base.NumSamples || strb->surface->format != format || strb->surface->texture != resource || strb->surface->width != rtt_width || diff --git a/mesalib/src/mesa/state_tracker/st_atom_msaa.c b/mesalib/src/mesa/state_tracker/st_atom_msaa.c index 9baa4fcf2..fb760460c 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_msaa.c +++ b/mesalib/src/mesa/state_tracker/st_atom_msaa.c @@ -62,7 +62,8 @@ static void update_sample_mask( struct st_context *st ) if (st->ctx->Multisample.SampleCoverageInvert) sample_mask = ~sample_mask; } - /* TODO merge with app-supplied sample mask */ + if (st->ctx->Multisample.SampleMask) + sample_mask &= st->ctx->Multisample.SampleMaskValue; } /* mask off unused bits or don't care? */ diff --git a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c index 62464b475..f4d0cab42 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c @@ -228,9 +228,12 @@ static void update_raster_state( struct st_context *st ) /* _NEW_FRAG_CLAMP */ raster->clamp_fragment_color = !st->clamp_frag_color_in_shader && ctx->Color._ClampFragmentColor; - raster->gl_rasterization_rules = 1; - /* _NEW_RASTERIZER_DISCARD */ + raster->half_pixel_center = 1; + if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) + raster->bottom_edge_rule = 1; + + /* ST_NEW_RASTERIZER */ raster->rasterizer_discard = ctx->RasterDiscard; /* _NEW_TRANSFORM */ @@ -252,9 +255,9 @@ const struct st_tracked_state st_update_rasterizer = { _NEW_PROGRAM | _NEW_SCISSOR | _NEW_FRAG_CLAMP | - _NEW_RASTERIZER_DISCARD | _NEW_TRANSFORM), /* mesa state dependencies*/ - ST_NEW_VERTEX_PROGRAM, /* state tracker dependencies */ + (ST_NEW_VERTEX_PROGRAM | + ST_NEW_RASTERIZER), /* state tracker dependencies */ }, update_raster_state /* update function */ }; diff --git a/mesalib/src/mesa/state_tracker/st_atom_sampler.c b/mesalib/src/mesa/state_tracker/st_atom_sampler.c index 3eba5b13c..302e12981 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_sampler.c +++ b/mesalib/src/mesa/state_tracker/st_atom_sampler.c @@ -48,6 +48,8 @@ #include "cso_cache/cso_context.h" +#include "util/u_format.h" + /** * Convert GLenum texcoord wrap tokens to pipe tokens. @@ -172,8 +174,10 @@ convert_sampler(struct st_context *st, msamp->BorderColor.ui[1] || msamp->BorderColor.ui[2] || msamp->BorderColor.ui[3]) { + struct st_texture_object *stobj = st_texture_object(texobj); struct gl_texture_image *teximg; GLboolean is_integer = GL_FALSE; + union pipe_color_union border_color; teximg = texobj->Image[0][texobj->BaseLevel]; @@ -181,9 +185,26 @@ convert_sampler(struct st_context *st, is_integer = _mesa_is_enum_format_integer(teximg->InternalFormat); } - st_translate_color(&msamp->BorderColor, - &sampler->border_color, - teximg ? teximg->_BaseFormat : GL_RGBA, is_integer); + if (st->apply_texture_swizzle_to_border_color && stobj->sampler_view) { + const unsigned char swz[4] = + { + stobj->sampler_view->swizzle_r, + stobj->sampler_view->swizzle_g, + stobj->sampler_view->swizzle_b, + stobj->sampler_view->swizzle_a, + }; + + st_translate_color(&msamp->BorderColor, + &border_color, + teximg ? teximg->_BaseFormat : GL_RGBA, is_integer); + + util_format_apply_color_swizzle(&sampler->border_color, + &border_color, swz, is_integer); + } else { + st_translate_color(&msamp->BorderColor, + &sampler->border_color, + teximg ? teximg->_BaseFormat : GL_RGBA, is_integer); + } } sampler->max_anisotropy = (msamp->MaxAnisotropy == 1.0 ? @@ -258,14 +279,14 @@ update_samplers(struct st_context *st) update_shader_samplers(st, PIPE_SHADER_FRAGMENT, &ctx->FragmentProgram._Current->Base, - ctx->Const.MaxTextureImageUnits, + ctx->Const.FragmentProgram.MaxTextureImageUnits, st->state.samplers[PIPE_SHADER_FRAGMENT], &st->state.num_samplers[PIPE_SHADER_FRAGMENT]); update_shader_samplers(st, PIPE_SHADER_VERTEX, &ctx->VertexProgram._Current->Base, - ctx->Const.MaxVertexTextureImageUnits, + ctx->Const.VertexProgram.MaxTextureImageUnits, st->state.samplers[PIPE_SHADER_VERTEX], &st->state.num_samplers[PIPE_SHADER_VERTEX]); @@ -273,7 +294,7 @@ update_samplers(struct st_context *st) update_shader_samplers(st, PIPE_SHADER_GEOMETRY, &ctx->GeometryProgram._Current->Base, - ctx->Const.MaxGeometryTextureImageUnits, + ctx->Const.GeometryProgram.MaxTextureImageUnits, st->state.samplers[PIPE_SHADER_GEOMETRY], &st->state.num_samplers[PIPE_SHADER_GEOMETRY]); } diff --git a/mesalib/src/mesa/state_tracker/st_atom_scissor.c b/mesalib/src/mesa/state_tracker/st_atom_scissor.c index eb1387778..19c2cd2fb 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_scissor.c +++ b/mesalib/src/mesa/state_tracker/st_atom_scissor.c @@ -86,7 +86,7 @@ update_scissor( struct st_context *st ) if (memcmp(&scissor, &st->state.scissor, sizeof(scissor)) != 0) { /* state has changed */ st->state.scissor = scissor; /* struct copy */ - st->pipe->set_scissor_state(st->pipe, &scissor); /* activate */ + st->pipe->set_scissor_states(st->pipe, 0, 1, &scissor); /* activate */ } } diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c index fc2d69013..d79e04cf4 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_texture.c +++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c @@ -239,7 +239,8 @@ update_single_texture(struct st_context *st, st_mesa_format_to_pipe_format(stObj->base._BufferObjectFormat); } else { - view_format = stObj->pt->format; + view_format = + stObj->surface_based ? stObj->surface_format : stObj->pt->format; /* If sRGB decoding is off, use the linear format */ if (samp->sRGBDecode == GL_SKIP_DECODE_EXT) { @@ -325,11 +326,11 @@ update_vertex_textures(struct st_context *st) { const struct gl_context *ctx = st->ctx; - if (ctx->Const.MaxVertexTextureImageUnits > 0) { + if (ctx->Const.VertexProgram.MaxTextureImageUnits > 0) { update_textures(st, PIPE_SHADER_VERTEX, &ctx->VertexProgram._Current->Base, - ctx->Const.MaxVertexTextureImageUnits, + ctx->Const.VertexProgram.MaxTextureImageUnits, st->state.sampler_views[PIPE_SHADER_VERTEX], &st->state.num_sampler_views[PIPE_SHADER_VERTEX]); } @@ -344,7 +345,7 @@ update_fragment_textures(struct st_context *st) update_textures(st, PIPE_SHADER_FRAGMENT, &ctx->FragmentProgram._Current->Base, - ctx->Const.MaxTextureImageUnits, + ctx->Const.FragmentProgram.MaxTextureImageUnits, st->state.sampler_views[PIPE_SHADER_FRAGMENT], &st->state.num_sampler_views[PIPE_SHADER_FRAGMENT]); } @@ -359,7 +360,7 @@ update_geometry_textures(struct st_context *st) update_textures(st, PIPE_SHADER_GEOMETRY, &ctx->GeometryProgram._Current->Base, - ctx->Const.MaxTextureImageUnits, + ctx->Const.FragmentProgram.MaxTextureImageUnits, st->state.sampler_views[PIPE_SHADER_GEOMETRY], &st->state.num_sampler_views[PIPE_SHADER_GEOMETRY]); } diff --git a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c index b3ca40501..e96f4b36e 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c +++ b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c @@ -34,7 +34,6 @@ #include "main/image.h" #include "main/bufferobj.h" #include "main/macros.h" -#include "main/mfeatures.h" #include "main/pbo.h" #include "program/program.h" #include "program/prog_print.h" @@ -299,7 +298,7 @@ make_bitmap_texture(struct gl_context *ctx, GLsizei width, GLsizei height, * Create texture to hold bitmap pattern. */ pt = st_texture_create(st, st->internal_target, st->bitmap.tex_format, - 0, width, height, 1, 1, + 0, width, height, 1, 1, 0, PIPE_BIND_SAMPLER_VIEW); if (!pt) { _mesa_unmap_pbo_source(ctx, unpack); @@ -567,7 +566,7 @@ reset_cache(struct st_context *st) cache->texture = st_texture_create(st, PIPE_TEXTURE_2D, st->bitmap.tex_format, 0, BITMAP_CACHE_WIDTH, BITMAP_CACHE_HEIGHT, - 1, 1, + 1, 1, 0, PIPE_BIND_SAMPLER_VIEW); } @@ -826,7 +825,8 @@ st_init_bitmap(struct st_context *st) /* init baseline rasterizer state once */ memset(&st->bitmap.rasterizer, 0, sizeof(st->bitmap.rasterizer)); - st->bitmap.rasterizer.gl_rasterization_rules = 1; + st->bitmap.rasterizer.half_pixel_center = 1; + st->bitmap.rasterizer.bottom_edge_rule = 1; st->bitmap.rasterizer.depth_clip = 1; /* find a usable texture format */ diff --git a/mesalib/src/mesa/state_tracker/st_cb_bitmap.h b/mesalib/src/mesa/state_tracker/st_cb_bitmap.h index d1c18058b..cc9f5f574 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_bitmap.h +++ b/mesalib/src/mesa/state_tracker/st_cb_bitmap.h @@ -31,7 +31,6 @@ #include "main/compiler.h" -#include "main/mfeatures.h" struct dd_function_table; struct st_context; diff --git a/mesalib/src/mesa/state_tracker/st_cb_blit.c b/mesalib/src/mesa/state_tracker/st_cb_blit.c index 50cab4294..a236a08e9 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_blit.c +++ b/mesalib/src/mesa/state_tracker/st_cb_blit.c @@ -33,7 +33,6 @@ #include "main/imports.h" #include "main/image.h" #include "main/macros.h" -#include "main/mfeatures.h" #include "st_context.h" #include "st_texture.h" diff --git a/mesalib/src/mesa/state_tracker/st_cb_blit.h b/mesalib/src/mesa/state_tracker/st_cb_blit.h index 159c6ca8d..9e94e4439 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_blit.h +++ b/mesalib/src/mesa/state_tracker/st_cb_blit.h @@ -30,7 +30,6 @@ #include "main/compiler.h" -#include "main/mfeatures.h" struct dd_function_table; struct st_context; diff --git a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c index 8ff32c842..2e5e253a4 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -182,6 +182,21 @@ st_bufferobj_data(struct gl_context *ctx, struct st_buffer_object *st_obj = st_buffer_object(obj); unsigned bind, pipe_usage; + if (size && data && st_obj->buffer && + st_obj->Base.Size == size && st_obj->Base.Usage == usage) { + /* Just discard the old contents and write new data. + * This should be the same as creating a new buffer, but we avoid + * a lot of validation in Mesa. + */ + struct pipe_box box; + + u_box_1d(0, size, &box); + pipe->transfer_inline_write(pipe, st_obj->buffer, 0, + PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE, + &box, data, 0, 0); + return GL_TRUE; + } + st_obj->Base.Size = size; st_obj->Base.Usage = usage; @@ -247,9 +262,11 @@ st_bufferobj_data(struct gl_context *ctx, if (data) pipe_buffer_write(pipe, st_obj->buffer, 0, size, data); - return GL_TRUE; } + /* BufferData may change an array or uniform buffer, need to update it */ + st->dirty.st |= ST_NEW_VERTEX_ARRAYS | ST_NEW_UNIFORM_BUFFER; + return GL_TRUE; } diff --git a/mesalib/src/mesa/state_tracker/st_cb_clear.c b/mesalib/src/mesa/state_tracker/st_cb_clear.c index a5aa8f496..566f4a76e 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_clear.c +++ b/mesalib/src/mesa/state_tracker/st_cb_clear.c @@ -67,7 +67,8 @@ st_init_clear(struct st_context *st) { memset(&st->clear, 0, sizeof(st->clear)); - st->clear.raster.gl_rasterization_rules = 1; + st->clear.raster.half_pixel_center = 1; + st->clear.raster.bottom_edge_rule = 1; st->clear.raster.depth_clip = 1; } diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c index f5a1e27f7..68359e803 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c @@ -35,7 +35,6 @@ #include "main/bufferobj.h" #include "main/format_pack.h" #include "main/macros.h" -#include "main/mfeatures.h" #include "main/mtypes.h" #include "main/pack.h" #include "main/pbo.h" @@ -466,7 +465,7 @@ alloc_texture(struct st_context *st, GLsizei width, GLsizei height, struct pipe_resource *pt; pt = st_texture_create(st, st->internal_target, texFormat, 0, - width, height, 1, 1, PIPE_BIND_SAMPLER_VIEW); + width, height, 1, 1, 0, PIPE_BIND_SAMPLER_VIEW); return pt; } @@ -711,7 +710,8 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, memset(&rasterizer, 0, sizeof(rasterizer)); rasterizer.clamp_fragment_color = !st->clamp_frag_color_in_shader && ctx->Color._ClampFragmentColor; - rasterizer.gl_rasterization_rules = 1; + rasterizer.half_pixel_center = 1; + rasterizer.bottom_edge_rule = 1; rasterizer.depth_clip = !ctx->Transform.DepthClamp; rasterizer.scissor = ctx->Scissor.Enabled; cso_set_rasterizer(cso, &rasterizer); diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.h b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.h index 6209dcade..6cd6a4ed6 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.h +++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.h @@ -31,7 +31,6 @@ #include "main/compiler.h" -#include "main/mfeatures.h" struct dd_function_table; struct st_context; diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawtex.c b/mesalib/src/mesa/state_tracker/st_cb_drawtex.c index c4efce02f..2cc200e0c 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawtex.c +++ b/mesalib/src/mesa/state_tracker/st_cb_drawtex.c @@ -15,7 +15,6 @@ #include "main/imports.h" #include "main/image.h" #include "main/macros.h" -#include "main/mfeatures.h" #include "program/program.h" #include "program/prog_print.h" diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawtex.h b/mesalib/src/mesa/state_tracker/st_cb_drawtex.h index ccb615e98..9794ccc15 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawtex.h +++ b/mesalib/src/mesa/state_tracker/st_cb_drawtex.h @@ -11,7 +11,6 @@ #include "main/compiler.h" -#include "main/mfeatures.h" struct dd_function_table; struct st_context; diff --git a/mesalib/src/mesa/state_tracker/st_cb_eglimage.c b/mesalib/src/mesa/state_tracker/st_cb_eglimage.c index 8c78e5ef4..a396b9e97 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_eglimage.c +++ b/mesalib/src/mesa/state_tracker/st_cb_eglimage.c @@ -26,7 +26,6 @@ * Chia-I Wu <olv@lunarg.com> */ -#include "main/mfeatures.h" #include "main/texobj.h" #include "main/teximage.h" #include "util/u_inlines.h" @@ -132,6 +131,7 @@ st_bind_surface(struct gl_context *ctx, GLenum target, stObj->width0 = ps->width; stObj->height0 = ps->height; stObj->depth0 = 1; + stObj->surface_format = ps->format; _mesa_dirty_texobj(ctx, texObj, GL_TRUE); } diff --git a/mesalib/src/mesa/state_tracker/st_cb_eglimage.h b/mesalib/src/mesa/state_tracker/st_cb_eglimage.h index 1750b9147..c6ddec6ae 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_eglimage.h +++ b/mesalib/src/mesa/state_tracker/st_cb_eglimage.h @@ -30,7 +30,6 @@ #define ST_CB_EGLIMAGE_H #include "main/compiler.h" -#include "main/mfeatures.h" struct dd_function_table; diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c index 4452e523b..826722be8 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c +++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c @@ -38,7 +38,6 @@ #include "main/fbobject.h" #include "main/framebuffer.h" #include "main/macros.h" -#include "main/mfeatures.h" #include "main/renderbuffer.h" #include "pipe/p_context.h" @@ -391,11 +390,10 @@ st_render_texture(struct gl_context *ctx, { struct st_context *st = st_context(ctx); struct pipe_context *pipe = st->pipe; - struct st_renderbuffer *strb; - struct gl_renderbuffer *rb; + struct gl_renderbuffer *rb = att->Renderbuffer; + struct st_renderbuffer *strb = st_renderbuffer(rb); struct pipe_resource *pt; struct st_texture_object *stObj; - const struct gl_texture_image *texImage; struct pipe_surface surf_tmpl; if (!st_finalize_texture(ctx, pipe, att->Texture)) @@ -404,27 +402,6 @@ st_render_texture(struct gl_context *ctx, pt = st_get_texobj_resource(att->Texture); assert(pt); - /* get pointer to texture image we're rendeing to */ - texImage = _mesa_get_attachment_teximage(att); - - /* create new renderbuffer which wraps the texture image. - * Use the texture's name as the renderbuffer's name so that we have - * something that's non-zero (to determine vertical orientation) and - * possibly helpful for debugging. - */ - rb = st_new_renderbuffer(ctx, att->Texture->Name); - if (!rb) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glFramebufferTexture()"); - return; - } - - _mesa_reference_renderbuffer(&att->Renderbuffer, rb); - assert(rb->RefCount == 1); - rb->AllocStorage = NULL; /* should not get called */ - strb = st_renderbuffer(rb); - - assert(strb->Base.RefCount > 0); - /* get the texture for the texture object */ stObj = st_texture_object(att->Texture); @@ -434,11 +411,6 @@ st_render_texture(struct gl_context *ctx, strb->rtt_face = att->CubeMapFace; strb->rtt_slice = att->Zoffset; - rb->Width = texImage->Width2; - rb->Height = texImage->Height2; - rb->_BaseFormat = texImage->_BaseFormat; - rb->InternalFormat = texImage->InternalFormat; - pipe_resource_reference( &strb->texture, pt ); pipe_surface_release(pipe, &strb->surface); @@ -477,10 +449,9 @@ st_render_texture(struct gl_context *ctx, * Called via ctx->Driver.FinishRenderTexture. */ static void -st_finish_render_texture(struct gl_context *ctx, - struct gl_renderbuffer_attachment *att) +st_finish_render_texture(struct gl_context *ctx, struct gl_renderbuffer *rb) { - struct st_renderbuffer *strb = st_renderbuffer(att->Renderbuffer); + struct st_renderbuffer *strb = st_renderbuffer(rb); if (!strb) return; @@ -527,7 +498,7 @@ st_validate_attachment(struct gl_context *ctx, return GL_FALSE; format = stObj->pt->format; - texFormat = _mesa_get_attachment_teximage_const(att)->TexFormat; + texFormat = att->Renderbuffer->TexImage->TexFormat; /* If the encoding is sRGB and sRGB rendering cannot be enabled, * check for linear format support instead. diff --git a/mesalib/src/mesa/state_tracker/st_cb_feedback.c b/mesalib/src/mesa/state_tracker/st_cb_feedback.c index 7a8fde465..d2e4346b7 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_feedback.c +++ b/mesalib/src/mesa/state_tracker/st_cb_feedback.c @@ -40,7 +40,6 @@ #include "main/imports.h" #include "main/context.h" #include "main/feedback.h" -#include "main/mfeatures.h" #include "vbo/vbo.h" diff --git a/mesalib/src/mesa/state_tracker/st_cb_feedback.h b/mesalib/src/mesa/state_tracker/st_cb_feedback.h index 0163631e3..6350da4e4 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_feedback.h +++ b/mesalib/src/mesa/state_tracker/st_cb_feedback.h @@ -31,7 +31,6 @@ #include "main/compiler.h" -#include "main/mfeatures.h" struct dd_function_table; diff --git a/mesalib/src/mesa/state_tracker/st_cb_flush.c b/mesalib/src/mesa/state_tracker/st_cb_flush.c index b11004718..f428e0af9 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_flush.c +++ b/mesalib/src/mesa/state_tracker/st_cb_flush.c @@ -77,7 +77,7 @@ display_front_buffer(struct st_context *st) void st_flush(struct st_context *st, struct pipe_fence_handle **fence, - enum pipe_flush_flags flags) + unsigned flags) { FLUSH_VERTICES(st->ctx, 0); FLUSH_CURRENT(st->ctx, 0); diff --git a/mesalib/src/mesa/state_tracker/st_cb_flush.h b/mesalib/src/mesa/state_tracker/st_cb_flush.h index 003e2a2a9..cb5c62e87 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_flush.h +++ b/mesalib/src/mesa/state_tracker/st_cb_flush.h @@ -42,7 +42,7 @@ st_init_flush_functions(struct dd_function_table *functions); extern void st_flush(struct st_context *st, struct pipe_fence_handle **fence, - enum pipe_flush_flags flags); + unsigned flags); extern void st_finish(struct st_context *st); diff --git a/mesalib/src/mesa/state_tracker/st_cb_msaa.c b/mesalib/src/mesa/state_tracker/st_cb_msaa.c new file mode 100644 index 000000000..bbf2b2c5c --- /dev/null +++ b/mesalib/src/mesa/state_tracker/st_cb_msaa.c @@ -0,0 +1,59 @@ +/************************************************************************** + * + * Copyright 2013 Red Hat + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#include "main/bufferobj.h" +#include "main/imports.h" + +#include "state_tracker/st_cb_msaa.h" +#include "state_tracker/st_context.h" +#include "state_tracker/st_atom.h" +#include "state_tracker/st_cb_fbo.h" + +#include "pipe/p_context.h" + + +static void +st_GetSamplePosition(struct gl_context *ctx, + struct gl_framebuffer *fb, + GLuint index, + GLfloat *outValue) +{ + struct st_context *st = st_context(ctx); + + st_validate_state(st); + + if (st->pipe->get_sample_position) + st->pipe->get_sample_position(st->pipe, (unsigned) fb->Visual.samples, + index, outValue); +} + + +void +st_init_msaa_functions(struct dd_function_table *functions) +{ + functions->GetSamplePosition = st_GetSamplePosition; +} diff --git a/mesalib/src/mesa/state_tracker/st_cb_msaa.h b/mesalib/src/mesa/state_tracker/st_cb_msaa.h new file mode 100644 index 000000000..ba4c06f6b --- /dev/null +++ b/mesalib/src/mesa/state_tracker/st_cb_msaa.h @@ -0,0 +1,39 @@ +/************************************************************************** + * + * Copyright 2013 Red Hat + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#ifndef ST_CB_MSAA_H +#define ST_CB_MSAA_H + +#include "main/glheader.h" + +struct dd_function_table; + +extern void +st_init_msaa_functions(struct dd_function_table *functions); + +#endif diff --git a/mesalib/src/mesa/state_tracker/st_cb_queryobj.c b/mesalib/src/mesa/state_tracker/st_cb_queryobj.c index 6a35c1b69..24ce6351d 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_queryobj.c +++ b/mesalib/src/mesa/state_tracker/st_cb_queryobj.c @@ -35,7 +35,6 @@ #include "main/imports.h" #include "main/context.h" -#include "main/mfeatures.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" diff --git a/mesalib/src/mesa/state_tracker/st_cb_queryobj.h b/mesalib/src/mesa/state_tracker/st_cb_queryobj.h index d5b107532..e069b095c 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_queryobj.h +++ b/mesalib/src/mesa/state_tracker/st_cb_queryobj.h @@ -29,7 +29,6 @@ #define ST_CB_QUERYOBJ_H -#include "main/mfeatures.h" #include "main/mtypes.h" /** diff --git a/mesalib/src/mesa/state_tracker/st_cb_rasterpos.c b/mesalib/src/mesa/state_tracker/st_cb_rasterpos.c index 4731f2648..26a55909d 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_rasterpos.c +++ b/mesalib/src/mesa/state_tracker/st_cb_rasterpos.c @@ -38,7 +38,6 @@ #include "main/imports.h" #include "main/macros.h" -#include "main/mfeatures.h" #include "main/feedback.h" #include "st_context.h" diff --git a/mesalib/src/mesa/state_tracker/st_cb_rasterpos.h b/mesalib/src/mesa/state_tracker/st_cb_rasterpos.h index bfd3e4138..99796f610 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_rasterpos.h +++ b/mesalib/src/mesa/state_tracker/st_cb_rasterpos.h @@ -30,7 +30,6 @@ #include "main/compiler.h" -#include "main/mfeatures.h" struct dd_function_table; diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c index 0cd0d77af..56dbe85c0 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_texture.c +++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c @@ -25,7 +25,6 @@ * **************************************************************************/ -#include "main/mfeatures.h" #include "main/bufferobj.h" #include "main/enums.h" #include "main/fbobject.h" @@ -78,6 +77,8 @@ gl_target_to_pipe(GLenum target) case GL_TEXTURE_2D: case GL_PROXY_TEXTURE_2D: case GL_TEXTURE_EXTERNAL_OES: + case GL_TEXTURE_2D_MULTISAMPLE: + case GL_PROXY_TEXTURE_2D_MULTISAMPLE: return PIPE_TEXTURE_2D; case GL_TEXTURE_RECTANGLE_NV: case GL_PROXY_TEXTURE_RECTANGLE_NV: @@ -99,6 +100,8 @@ gl_target_to_pipe(GLenum target) return PIPE_TEXTURE_1D_ARRAY; case GL_TEXTURE_2D_ARRAY_EXT: case GL_PROXY_TEXTURE_2D_ARRAY_EXT: + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: + case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY: return PIPE_TEXTURE_2D_ARRAY; case GL_TEXTURE_BUFFER: return PIPE_BUFFER; @@ -408,7 +411,7 @@ guess_and_alloc_texture(struct st_context *st, ptWidth, ptHeight, ptDepth, - ptLayers, + ptLayers, 0, bindings); stObj->lastLevel = lastLevel; @@ -496,7 +499,7 @@ st_AllocTextureImageBuffer(struct gl_context *ctx, ptWidth, ptHeight, ptDepth, - ptLayers, + ptLayers, 0, bindings); return stImage->pt != NULL; } @@ -1492,7 +1495,7 @@ st_finalize_texture(struct gl_context *ctx, GLuint face; struct st_texture_image *firstImage; enum pipe_format firstImageFormat; - GLuint ptWidth, ptHeight, ptDepth, ptLayers; + GLuint ptWidth, ptHeight, ptDepth, ptLayers, ptNumSamples; if (_mesa_is_texture_complete(tObj, &tObj->Sampler)) { /* The texture is complete and we know exactly how many mipmap levels @@ -1537,6 +1540,11 @@ st_finalize_texture(struct gl_context *ctx, pipe_sampler_view_release(st->pipe, &stObj->sampler_view); } + /* If this texture comes from a window system, there is nothing else to do. */ + if (stObj->surface_based) { + return GL_TRUE; + } + /* Find gallium format for the Mesa texture */ firstImageFormat = st_mesa_format_to_pipe_format(firstImage->base.TexFormat); @@ -1556,6 +1564,7 @@ st_finalize_texture(struct gl_context *ctx, /* convert GL dims to Gallium dims */ st_gl_texture_dims_to_pipe_dims(stObj->base.Target, width, height, depth, &ptWidth, &ptHeight, &ptDepth, &ptLayers); + ptNumSamples = firstImage->base.NumSamples; } /* If we already have a gallium texture, check that it matches the texture @@ -1563,11 +1572,12 @@ st_finalize_texture(struct gl_context *ctx, */ if (stObj->pt) { if (stObj->pt->target != gl_target_to_pipe(stObj->base.Target) || - !st_sampler_compat_formats(stObj->pt->format, firstImageFormat) || + stObj->pt->format != firstImageFormat || stObj->pt->last_level < stObj->lastLevel || stObj->pt->width0 != ptWidth || stObj->pt->height0 != ptHeight || stObj->pt->depth0 != ptDepth || + stObj->pt->nr_samples != ptNumSamples || stObj->pt->array_size != ptLayers) { /* The gallium texture does not match the Mesa texture so delete the @@ -1591,7 +1601,7 @@ st_finalize_texture(struct gl_context *ctx, ptWidth, ptHeight, ptDepth, - ptLayers, + ptLayers, ptNumSamples, bindings); if (!stObj->pt) { @@ -1637,11 +1647,14 @@ st_AllocTextureStorage(struct gl_context *ctx, GLsizei height, GLsizei depth) { const GLuint numFaces = _mesa_num_tex_faces(texObj->Target); + struct gl_texture_image *texImage = texObj->Image[0][0]; struct st_context *st = st_context(ctx); struct st_texture_object *stObj = st_texture_object(texObj); + struct pipe_screen *screen = st->pipe->screen; GLuint ptWidth, ptHeight, ptDepth, ptLayers, bindings; enum pipe_format fmt; GLint level; + int num_samples = texImage->NumSamples; assert(levels > 0); @@ -1651,10 +1664,30 @@ st_AllocTextureStorage(struct gl_context *ctx, stObj->depth0 = depth; stObj->lastLevel = levels - 1; - fmt = st_mesa_format_to_pipe_format(texObj->Image[0][0]->TexFormat); + fmt = st_mesa_format_to_pipe_format(texImage->TexFormat); bindings = default_bindings(st, fmt); + /* Raise the sample count if the requested one is unsupported. */ + if (num_samples > 1) { + boolean found = FALSE; + + for (; num_samples <= ctx->Const.MaxSamples; num_samples++) { + if (screen->is_format_supported(screen, fmt, PIPE_TEXTURE_2D, + num_samples, + PIPE_BIND_SAMPLER_VIEW)) { + /* Update the sample count in gl_texture_image as well. */ + texImage->NumSamples = num_samples; + found = TRUE; + break; + } + } + + if (!found) { + return GL_FALSE; + } + } + st_gl_texture_dims_to_pipe_dims(texObj->Target, width, height, depth, &ptWidth, &ptHeight, &ptDepth, &ptLayers); @@ -1662,11 +1695,11 @@ st_AllocTextureStorage(struct gl_context *ctx, stObj->pt = st_texture_create(st, gl_target_to_pipe(texObj->Target), fmt, - levels, + levels - 1, ptWidth, ptHeight, ptDepth, - ptLayers, + ptLayers, num_samples, bindings); if (!stObj->pt) return GL_FALSE; diff --git a/mesalib/src/mesa/state_tracker/st_cb_xformfb.c b/mesalib/src/mesa/state_tracker/st_cb_xformfb.c index 3e52c9988..e1a7a88a1 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_xformfb.c +++ b/mesalib/src/mesa/state_tracker/st_cb_xformfb.c @@ -36,7 +36,6 @@ #include "main/bufferobj.h" #include "main/context.h" -#include "main/mfeatures.h" #include "main/transformfeedback.h" #include "st_cb_bufferobjects.h" diff --git a/mesalib/src/mesa/state_tracker/st_cb_xformfb.h b/mesalib/src/mesa/state_tracker/st_cb_xformfb.h index 5c82fed18..998c41825 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_xformfb.h +++ b/mesalib/src/mesa/state_tracker/st_cb_xformfb.h @@ -30,7 +30,6 @@ #include "main/compiler.h" -#include "main/mfeatures.h" struct dd_function_table; struct gl_transform_feedback_object; diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c index cc87f2bb3..7d18c2521 100644 --- a/mesalib/src/mesa/state_tracker/st_context.c +++ b/mesalib/src/mesa/state_tracker/st_context.c @@ -49,6 +49,7 @@ #include "st_cb_eglimage.h" #include "st_cb_fbo.h" #include "st_cb_feedback.h" +#include "st_cb_msaa.h" #include "st_cb_program.h" #include "st_cb_queryobj.h" #include "st_cb_readpixels.h" @@ -187,6 +188,10 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe, st->needs_texcoord_semantic = screen->get_param(screen, PIPE_CAP_TGSI_TEXCOORD); + st->apply_texture_swizzle_to_border_color = + !!(screen->get_param(screen, PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK) & + (PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 | + PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_R600)); /* GL limits and extensions */ st_init_limits(st); @@ -203,6 +208,8 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe, static void st_init_driver_flags(struct gl_driver_flags *f) { f->NewArray = ST_NEW_VERTEX_ARRAYS; + f->NewRasterizerDiscard = ST_NEW_RASTERIZER; + f->NewUniformBuffer = ST_NEW_UNIFORM_BUFFER; } struct st_context *st_create_context(gl_api api, struct pipe_context *pipe, @@ -233,7 +240,7 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe, * driver prefers DP4 or MUL/MAD for vertex transformation. */ if (debug_get_option_mesa_mvp_dp4()) - _mesa_set_mvp_with_dp4( ctx, GL_TRUE ); + ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].PreferDP4 = GL_TRUE; return st_create_context_priv(ctx, pipe, options); } @@ -340,6 +347,7 @@ void st_init_driver_functions(struct dd_function_table *functions) st_init_fbo_functions(functions); st_init_feedback_functions(functions); + st_init_msaa_functions(functions); st_init_program_functions(functions); st_init_query_functions(functions); st_init_cond_render_functions(functions); diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h index 8786a036f..ab89b4947 100644 --- a/mesalib/src/mesa/state_tracker/st_context.h +++ b/mesalib/src/mesa/state_tracker/st_context.h @@ -50,6 +50,8 @@ struct u_upload_mgr; #define ST_NEW_EDGEFLAGS_DATA (1 << 4) #define ST_NEW_GEOMETRY_PROGRAM (1 << 5) #define ST_NEW_VERTEX_ARRAYS (1 << 6) +#define ST_NEW_RASTERIZER (1 << 7) +#define ST_NEW_UNIFORM_BUFFER (1 << 8) struct st_state_flags { @@ -87,6 +89,7 @@ struct st_context boolean prefer_blit_based_texture_transfer; boolean needs_texcoord_semantic; + boolean apply_texture_swizzle_to_border_color; /* On old libGL's for linux we need to invalidate the drawables * on glViewpport calls, this is set via a option. diff --git a/mesalib/src/mesa/state_tracker/st_draw.c b/mesalib/src/mesa/state_tracker/st_draw.c index bff8d9b31..a440ae2a8 100644 --- a/mesalib/src/mesa/state_tracker/st_draw.c +++ b/mesalib/src/mesa/state_tracker/st_draw.c @@ -40,7 +40,6 @@ #include "main/image.h" #include "main/bufferobj.h" #include "main/macros.h" -#include "main/mfeatures.h" #include "vbo/vbo.h" @@ -231,7 +230,7 @@ st_draw_vbo(struct gl_context *ctx, nr_prims); if (!setup_index_buffer(st, ib, &ibuffer)) { - /* out of memory */ + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBegin/DrawElements/DrawArray"); return; } @@ -245,7 +244,7 @@ st_draw_vbo(struct gl_context *ctx, * so we only set these fields for indexed drawing: */ info.primitive_restart = ctx->Array._PrimitiveRestart; - info.restart_index = ctx->Array._RestartIndex; + info.restart_index = ctx->Array.RestartIndex; } else { /* Transform feedback drawing is always non-indexed. */ diff --git a/mesalib/src/mesa/state_tracker/st_draw_feedback.c b/mesalib/src/mesa/state_tracker/st_draw_feedback.c index ae87fb28d..b19d913e5 100644 --- a/mesalib/src/mesa/state_tracker/st_draw_feedback.c +++ b/mesalib/src/mesa/state_tracker/st_draw_feedback.c @@ -28,7 +28,6 @@ #include "main/imports.h" #include "main/image.h" #include "main/macros.h" -#include "main/mfeatures.h" #include "vbo/vbo.h" @@ -134,7 +133,7 @@ st_feedback_draw_vbo(struct gl_context *ctx, * code sends state updates to the pipe, not to our private draw module. */ assert(draw); - draw_set_viewport_state(draw, &st->state.viewport); + draw_set_viewport_states(draw, 0, 1, &st->state.viewport); draw_set_clip_state(draw, &st->state.clip); draw_set_rasterizer_state(draw, &st->state.rasterizer, NULL); draw_bind_vertex_shader(draw, st->vp_variant->draw_shader); @@ -176,7 +175,8 @@ st_feedback_draw_vbo(struct gl_context *ctx, map = pipe_buffer_map(pipe, vbuffers[attr].buffer, PIPE_TRANSFER_READ, &vb_transfer[attr]); - draw_set_mapped_vertex_buffer(draw, attr, map); + draw_set_mapped_vertex_buffer(draw, attr, map, + vbuffers[attr].buffer->width0); } else { vbuffers[attr].buffer = NULL; @@ -184,7 +184,8 @@ st_feedback_draw_vbo(struct gl_context *ctx, vbuffers[attr].buffer_offset = 0; velements[attr].src_offset = 0; - draw_set_mapped_vertex_buffer(draw, attr, vbuffers[attr].user_buffer); + draw_set_mapped_vertex_buffer(draw, attr, vbuffers[attr].user_buffer, + ~0); } /* common-case setup */ @@ -232,7 +233,7 @@ st_feedback_draw_vbo(struct gl_context *ctx, draw_set_indexes(draw, (ubyte *) mapped_indices + ibuffer.offset, - ibuffer.index_size); + ibuffer.index_size, ~0); } /* set the constant buffer */ @@ -251,7 +252,7 @@ st_feedback_draw_vbo(struct gl_context *ctx, * unmap vertex/index buffers */ if (ib) { - draw_set_indexes(draw, NULL, 0); + draw_set_indexes(draw, NULL, 0, 0); if (ib_transfer) pipe_buffer_unmap(pipe, ib_transfer); pipe_resource_reference(&ibuffer.buffer, NULL); @@ -261,7 +262,7 @@ st_feedback_draw_vbo(struct gl_context *ctx, for (attr = 0; attr < vp->num_inputs; attr++) { if (vb_transfer[attr]) pipe_buffer_unmap(pipe, vb_transfer[attr]); - draw_set_mapped_vertex_buffer(draw, attr, NULL); + draw_set_mapped_vertex_buffer(draw, attr, NULL, 0); pipe_resource_reference(&vbuffers[attr].buffer, NULL); } draw_set_vertex_buffers(draw, 0, vp->num_inputs, NULL); diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index 2d8b9efec..46acc8763 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -29,7 +29,6 @@ #include "main/imports.h" #include "main/context.h" #include "main/macros.h" -#include "main/mfeatures.h" #include "main/version.h" #include "pipe/p_context.h" @@ -38,9 +37,9 @@ #include "st_context.h" #include "st_extensions.h" +#include "st_format.h" - -static int _min(int a, int b) +static unsigned _min(unsigned a, unsigned b) { return (a < b) ? a : b; } @@ -71,7 +70,6 @@ void st_init_limits(struct st_context *st) struct gl_constants *c = &st->ctx->Const; gl_shader_type sh; boolean can_ubo = TRUE; - int max_const_buffers; c->MaxTextureLevels = _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS), @@ -91,25 +89,10 @@ void st_init_limits(struct st_context *st) c->MaxArrayTextureLayers = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS); - c->MaxTextureImageUnits - = _min(screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT, - PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS), - MAX_TEXTURE_IMAGE_UNITS); - - c->MaxVertexTextureImageUnits - = _min(screen->get_shader_param(screen, PIPE_SHADER_VERTEX, - PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS), - MAX_VERTEX_TEXTURE_IMAGE_UNITS); - c->MaxCombinedTextureImageUnits = _min(screen->get_param(screen, PIPE_CAP_MAX_COMBINED_SAMPLERS), MAX_COMBINED_TEXTURE_IMAGE_UNITS); - c->MaxTextureCoordUnits - = _min(c->MaxTextureImageUnits, MAX_TEXTURE_COORD_UNITS); - - c->MaxTextureUnits = _min(c->MaxTextureImageUnits, c->MaxTextureCoordUnits); - /* Define max viewport size and max renderbuffer size in terms of * max texture size (note: max tex RECT size = max tex 2D size). * If this isn't true for some hardware we'll need new PIPE_CAP_ queries. @@ -118,9 +101,9 @@ void st_init_limits(struct st_context *st) c->MaxViewportHeight = c->MaxRenderbufferSize = c->MaxTextureRectSize; - c->MaxDrawBuffers - = _clamp(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS), - 1, MAX_DRAW_BUFFERS); + c->MaxDrawBuffers = c->MaxColorAttachments = + _clamp(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS), + 1, MAX_DRAW_BUFFERS); c->MaxDualSourceDrawBuffers = _clamp(screen->get_param(screen, PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS), @@ -156,13 +139,16 @@ void st_init_limits(struct st_context *st) c->MaxTextureLodBias = screen->get_paramf(screen, PIPE_CAPF_MAX_TEXTURE_LOD_BIAS); - c->MaxDrawBuffers - = CLAMP(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS), - 1, MAX_DRAW_BUFFERS); - c->QuadsFollowProvokingVertexConvention = screen->get_param( screen, PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION); + c->MaxUniformBlockSize = + screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT, + PIPE_SHADER_CAP_MAX_CONSTS) * 16; + if (c->MaxUniformBlockSize < 16384) { + can_ubo = FALSE; + } + for (sh = 0; sh < MESA_SHADER_TYPES; ++sh) { struct gl_shader_compiler_options *options = &st->ctx->ShaderCompilerOptions[sh]; @@ -183,17 +169,39 @@ void st_init_limits(struct st_context *st) continue; } - pc->MaxNativeInstructions = screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_INSTRUCTIONS); - pc->MaxNativeAluInstructions = screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS); - pc->MaxNativeTexInstructions = screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS); - pc->MaxNativeTexIndirections = screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS); - pc->MaxNativeAttribs = screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_INPUTS); - pc->MaxNativeTemps = screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_TEMPS); - pc->MaxNativeAddressRegs = screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_ADDRS); - pc->MaxNativeParameters = screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_CONSTS); - pc->MaxUniformComponents = 4 * MIN2(pc->MaxNativeParameters, MAX_UNIFORMS); - /* raise MaxParameters if native support is higher */ - pc->MaxParameters = MAX2(pc->MaxParameters, pc->MaxNativeParameters); + pc->MaxTextureImageUnits = + _min(screen->get_shader_param(screen, sh, + PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS), + MAX_TEXTURE_IMAGE_UNITS); + + pc->MaxInstructions = pc->MaxNativeInstructions = + screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_INSTRUCTIONS); + pc->MaxAluInstructions = pc->MaxNativeAluInstructions = + screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS); + pc->MaxTexInstructions = pc->MaxNativeTexInstructions = + screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS); + pc->MaxTexIndirections = pc->MaxNativeTexIndirections = + screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS); + pc->MaxAttribs = pc->MaxNativeAttribs = + screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_INPUTS); + pc->MaxTemps = pc->MaxNativeTemps = + screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_TEMPS); + pc->MaxAddressRegs = pc->MaxNativeAddressRegs = + screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_ADDRS); + pc->MaxParameters = pc->MaxNativeParameters = + screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_CONSTS); + + pc->MaxUniformComponents = 4 * MIN2(pc->MaxNativeParameters, MAX_UNIFORMS); + + pc->MaxUniformBlocks = + screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_CONST_BUFFERS); + if (pc->MaxUniformBlocks) + pc->MaxUniformBlocks -= 1; /* The first one is for ordinary uniforms. */ + pc->MaxUniformBlocks = _min(pc->MaxUniformBlocks, MAX_UNIFORM_BUFFERS); + + pc->MaxCombinedUniformComponents = (pc->MaxUniformComponents + + c->MaxUniformBlockSize / 4 * + pc->MaxUniformBlocks); /* Gallium doesn't really care about local vs. env parameters so use the * same limits. @@ -220,15 +228,9 @@ void st_init_limits(struct st_context *st) options->EmitNoIndirectUniform = !screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_INDIRECT_CONST_ADDR); - if (pc->MaxNativeInstructions) { - if (options->EmitNoIndirectUniform) + if (pc->MaxNativeInstructions && + (options->EmitNoIndirectUniform || pc->MaxUniformBlocks < 12)) { can_ubo = FALSE; - - max_const_buffers = screen->get_shader_param(screen, sh, - PIPE_SHADER_CAP_MAX_CONST_BUFFERS); - /* we need 13 buffers - 1 constant, 12 UBO */ - if (max_const_buffers < 13) - can_ubo = FALSE; } if (options->EmitNoLoops) @@ -238,11 +240,20 @@ void st_init_limits(struct st_context *st) options->LowerClipDistance = true; } + /* This depends on program constants. */ + c->MaxTextureCoordUnits + = _min(c->FragmentProgram.MaxTextureImageUnits, MAX_TEXTURE_COORD_UNITS); + + c->MaxTextureUnits = _min(c->FragmentProgram.MaxTextureImageUnits, c->MaxTextureCoordUnits); + + c->VertexProgram.MaxAttribs = MIN2(c->VertexProgram.MaxAttribs, 16); + /* PIPE_SHADER_CAP_MAX_INPUTS for the FS specifies the maximum number * of inputs. It's always 2 colors + N generic inputs. */ c->MaxVarying = screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_MAX_INPUTS); c->MaxVarying = MIN2(c->MaxVarying, MAX_VARYING); + c->MaxVaryingComponents = c->MaxVarying * 4; c->MinProgramTexelOffset = screen->get_param(screen, PIPE_CAP_MIN_TEXEL_OFFSET); c->MaxProgramTexelOffset = screen->get_param(screen, PIPE_CAP_MAX_TEXEL_OFFSET); @@ -267,8 +278,13 @@ void st_init_limits(struct st_context *st) if (can_ubo) { st->ctx->Extensions.ARB_uniform_buffer_object = GL_TRUE; - st->ctx->Const.UniformBufferOffsetAlignment = + c->UniformBufferOffsetAlignment = screen->get_param(screen, PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT); + c->MaxCombinedUniformBlocks = c->MaxUniformBufferBindings = + c->VertexProgram.MaxUniformBlocks + + c->GeometryProgram.MaxUniformBlocks + + c->FragmentProgram.MaxUniformBlocks; + assert(c->MaxCombinedUniformBlocks <= MAX_COMBINED_UNIFORM_BUFFERS); } } @@ -398,7 +414,8 @@ void st_init_extensions(struct st_context *st) { o(MESA_texture_array), PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS }, { o(OES_standard_derivatives), PIPE_CAP_SM3 }, - { o(ARB_texture_cube_map_array), PIPE_CAP_CUBE_MAP_ARRAY } + { o(ARB_texture_cube_map_array), PIPE_CAP_CUBE_MAP_ARRAY }, + { o(ARB_texture_multisample), PIPE_CAP_TEXTURE_MULTISAMPLE } }; /* Required: render target and sampler support */ @@ -658,10 +675,33 @@ void st_init_extensions(struct st_context *st) /* Maximum sample count. */ for (i = 16; i > 0; --i) { - if (screen->is_format_supported(screen, PIPE_FORMAT_B8G8R8A8_UNORM, - PIPE_TEXTURE_2D, i, - PIPE_BIND_RENDER_TARGET)) { + enum pipe_format pformat = st_choose_format(st, GL_RGBA, + GL_NONE, GL_NONE, + PIPE_TEXTURE_2D, i, + PIPE_BIND_RENDER_TARGET, FALSE); + if (pformat != PIPE_FORMAT_NONE) { ctx->Const.MaxSamples = i; + ctx->Const.MaxColorTextureSamples = i; + break; + } + } + for (i = ctx->Const.MaxSamples; i > 0; --i) { + enum pipe_format pformat = st_choose_format(st, GL_DEPTH_STENCIL, + GL_NONE, GL_NONE, + PIPE_TEXTURE_2D, i, + PIPE_BIND_DEPTH_STENCIL, FALSE); + if (pformat != PIPE_FORMAT_NONE) { + ctx->Const.MaxDepthTextureSamples = i; + break; + } + } + for (i = ctx->Const.MaxSamples; i > 0; --i) { + enum pipe_format pformat = st_choose_format(st, GL_RGBA_INTEGER, + GL_NONE, GL_NONE, + PIPE_TEXTURE_2D, i, + PIPE_BIND_RENDER_TARGET, FALSE); + if (pformat != PIPE_FORMAT_NONE) { + ctx->Const.MaxIntegerSamples = i; break; } } @@ -689,7 +729,10 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.ARB_transform_feedback_instanced = GL_TRUE; } if (st->options.force_glsl_extensions_warn) - ctx->Const.ForceGLSLExtensionsWarn = 1; + ctx->Const.ForceGLSLExtensionsWarn = 1; + + if (st->options.disable_glsl_line_continuations) + ctx->Const.DisableGLSLLineContinuations = 1; ctx->Const.MinMapBufferAlignment = screen->get_param(screen, PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT); @@ -699,6 +742,9 @@ void st_init_extensions(struct st_context *st) if (screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OBJECTS)) { ctx->Extensions.ARB_texture_buffer_object = GL_TRUE; + ctx->Const.MaxTextureBufferSize = + _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE), + (1u << 31) - 1); ctx->Const.TextureBufferOffsetAlignment = screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT); diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c index a15706a03..56f3a4a48 100644 --- a/mesalib/src/mesa/state_tracker/st_format.c +++ b/mesalib/src/mesa/state_tracker/st_format.c @@ -38,7 +38,6 @@ #include "main/texstore.h" #include "main/image.h" #include "main/macros.h" -#include "main/mfeatures.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" @@ -1801,41 +1800,6 @@ st_QuerySamplesForFormat(struct gl_context *ctx, GLenum target, } -GLboolean -st_sampler_compat_formats(enum pipe_format format1, enum pipe_format format2) -{ - if (format1 == format2) - return GL_TRUE; - - if (format1 == PIPE_FORMAT_B8G8R8A8_UNORM && - format2 == PIPE_FORMAT_B8G8R8X8_UNORM) - return GL_TRUE; - - if (format1 == PIPE_FORMAT_B8G8R8X8_UNORM && - format2 == PIPE_FORMAT_B8G8R8A8_UNORM) - return GL_TRUE; - - if (format1 == PIPE_FORMAT_A8B8G8R8_UNORM && - format2 == PIPE_FORMAT_X8B8G8R8_UNORM) - return GL_TRUE; - - if (format1 == PIPE_FORMAT_X8B8G8R8_UNORM && - format2 == PIPE_FORMAT_A8B8G8R8_UNORM) - return GL_TRUE; - - if (format1 == PIPE_FORMAT_A8R8G8B8_UNORM && - format2 == PIPE_FORMAT_X8R8G8B8_UNORM) - return GL_TRUE; - - if (format1 == PIPE_FORMAT_X8R8G8B8_UNORM && - format2 == PIPE_FORMAT_A8R8G8B8_UNORM) - return GL_TRUE; - - return GL_FALSE; -} - - - /** * This is used for translating texture border color and the clear * color. For example, the clear color is interpreted according to diff --git a/mesalib/src/mesa/state_tracker/st_format.h b/mesalib/src/mesa/state_tracker/st_format.h index 0a1c18d92..6e97dcb96 100644 --- a/mesalib/src/mesa/state_tracker/st_format.h +++ b/mesalib/src/mesa/state_tracker/st_format.h @@ -70,10 +70,6 @@ size_t st_QuerySamplesForFormat(struct gl_context *ctx, GLenum target, GLenum internalFormat, int samples[16]); -/* can we use a sampler view to translate these formats - only used to make TFP so far */ -extern GLboolean -st_sampler_compat_formats(enum pipe_format format1, enum pipe_format format2); extern void diff --git a/mesalib/src/mesa/state_tracker/st_gen_mipmap.c b/mesalib/src/mesa/state_tracker/st_gen_mipmap.c index 8ce2e06a2..e5512af2a 100644 --- a/mesalib/src/mesa/state_tracker/st_gen_mipmap.c +++ b/mesalib/src/mesa/state_tracker/st_gen_mipmap.c @@ -172,6 +172,7 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target, oldTex->height0, oldTex->depth0, oldTex->array_size, + 0, oldTex->bind); /* This will copy the old texture's base image into the new texture 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 338c652cb..f8176eb77 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -1945,8 +1945,6 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir) if (ir->type->base_type == GLSL_TYPE_BOOL) { emit(ir, TGSI_OPCODE_USNE, result_dst, cbuf, st_src_reg_for_int(0)); - result_src.negate = 1; - emit(ir, TGSI_OPCODE_UCMP, result_dst, result_src, st_src_reg_for_int(~0), st_src_reg_for_int(0)); } else { emit(ir, TGSI_OPCODE_MOV, result_dst, cbuf); } @@ -1969,7 +1967,17 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir) case ir_unop_unpack_snorm_4x8: case ir_unop_unpack_unorm_4x8: case ir_binop_pack_half_2x16_split: + case ir_unop_bitfield_reverse: + case ir_unop_bit_count: + case ir_unop_find_msb: + case ir_unop_find_lsb: + case ir_binop_bfm: + case ir_triop_bfi: + case ir_triop_bitfield_extract: + case ir_quadop_bitfield_insert: case ir_quadop_vector: + case ir_binop_vector_extract: + case ir_triop_vector_insert: /* This operation is not supported, or should have already been handled. */ assert(!"Invalid ir opcode in glsl_to_tgsi_visitor::visit()"); @@ -2388,8 +2396,8 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir) if (native_integers) { /* This is necessary because TGSI's CMP instruction expects the * condition to be a float, and we store booleans as integers. - * If TGSI had a UCMP instruction or similar, this extra - * instruction would not be necessary. + * TODO: really want to avoid i2f path and use UCMP. Requires + * changes to process_move_condition though too. */ condition_temp = get_temp(glsl_type::vec4_type); condition.negate = 0; @@ -2683,7 +2691,7 @@ glsl_to_tgsi_visitor::visit(ir_call *ir) void glsl_to_tgsi_visitor::visit(ir_texture *ir) { - st_src_reg result_src, coord, cube_sc, lod_info, projector, dx, dy, offset; + st_src_reg result_src, coord, cube_sc, lod_info, projector, dx, dy, offset, sample_index; st_dst_reg result_dst, coord_dst, cube_sc_dst; glsl_to_tgsi_instruction *inst = NULL; unsigned opcode = TGSI_OPCODE_NOP; @@ -2706,6 +2714,7 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) */ coord = get_temp(glsl_type::vec4_type); coord_dst = st_dst_reg(coord); + coord_dst.writemask = (1 << ir->coordinate->type->vector_elements) - 1; emit(ir, TGSI_OPCODE_MOV, coord_dst, this->result); } @@ -2772,7 +2781,9 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) } break; case ir_txf_ms: - assert(!"Unexpected ir_txf_ms opcode"); + opcode = TGSI_OPCODE_TXF; + ir->lod_info.sample_index->accept(this); + sample_index = this->result; break; case ir_lod: assert(!"Unexpected ir_lod opcode"); @@ -2859,7 +2870,11 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) } } - if (opcode == TGSI_OPCODE_TXL || opcode == TGSI_OPCODE_TXB || + if (ir->op == ir_txf_ms) { + coord_dst.writemask = WRITEMASK_W; + emit(ir, TGSI_OPCODE_MOV, coord_dst, sample_index); + coord_dst.writemask = WRITEMASK_XYZW; + } else if (opcode == TGSI_OPCODE_TXL || opcode == TGSI_OPCODE_TXB || opcode == TGSI_OPCODE_TXF) { /* TGSI stores LOD or LOD bias in the last channel of the coords. */ coord_dst.writemask = WRITEMASK_W; @@ -2921,6 +2936,10 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) case GLSL_SAMPLER_DIM_EXTERNAL: inst->tex_target = TEXTURE_EXTERNAL_INDEX; break; + case GLSL_SAMPLER_DIM_MS: + inst->tex_target = (sampler_type->sampler_array) + ? TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX : TEXTURE_2D_MULTISAMPLE_INDEX; + break; default: assert(!"Should not get here."); } @@ -2967,12 +2986,15 @@ glsl_to_tgsi_visitor::visit(ir_discard *ir) void glsl_to_tgsi_visitor::visit(ir_if *ir) { + unsigned if_opcode; glsl_to_tgsi_instruction *if_inst; ir->condition->accept(this); assert(this->result.file != PROGRAM_UNDEFINED); - if_inst = emit(ir->condition, TGSI_OPCODE_IF, undef_dst, this->result); + if_opcode = native_integers ? TGSI_OPCODE_UIF : TGSI_OPCODE_IF; + + if_inst = emit(ir->condition, if_opcode, undef_dst, this->result); this->instructions.push_tail(if_inst); @@ -3451,6 +3473,7 @@ glsl_to_tgsi_visitor::copy_propagate(void) break; case TGSI_OPCODE_IF: + case TGSI_OPCODE_UIF: ++level; break; @@ -3529,6 +3552,8 @@ glsl_to_tgsi_visitor::copy_propagate(void) /* If this is a copy, add it to the ACP. */ if (inst->op == TGSI_OPCODE_MOV && inst->dst.file == PROGRAM_TEMPORARY && + !(inst->dst.file == inst->src[0].file && + inst->dst.index == inst->src[0].index) && !inst->dst.reladdr && !inst->saturate && !inst->src[0].reladdr && @@ -3653,6 +3678,7 @@ glsl_to_tgsi_visitor::eliminate_dead_code_advanced(void) break; case TGSI_OPCODE_IF: + case TGSI_OPCODE_UIF: ++level; /* fallthrough to default case to mark the condition as read */ @@ -4378,6 +4404,7 @@ compile_tgsi_instruction(struct st_translate *t, case TGSI_OPCODE_ELSE: case TGSI_OPCODE_ENDLOOP: case TGSI_OPCODE_IF: + case TGSI_OPCODE_UIF: assert(num_dst == 0); ureg_label_insn(ureg, inst->op, @@ -4903,7 +4930,7 @@ st_translate_program( assert(i == program->num_immediates); /* texture samplers */ - for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) { + for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; i++) { if (program->samplers_used & (1 << i)) { t->samplers[i] = ureg_DECL_sampler(ureg, i); } @@ -5216,6 +5243,7 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) lower_ubo_reference(prog->_LinkedShaders[i], ir); do_vec_index_to_cond_assign(ir); + lower_vector_insert(ir, true); lower_quadop_vector(ir, false); lower_noise(ir); if (options->MaxIfDepth == 0) { @@ -5228,7 +5256,7 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress; progress = do_common_optimization(ir, true, true, - options->MaxUnrollIterations) + options->MaxUnrollIterations, options) || progress; progress = lower_if_to_cond_assign(ir, options->MaxIfDepth) || progress; diff --git a/mesalib/src/mesa/state_tracker/st_manager.c b/mesalib/src/mesa/state_tracker/st_manager.c index 03e086a72..9e537f3c4 100644 --- a/mesalib/src/mesa/state_tracker/st_manager.c +++ b/mesalib/src/mesa/state_tracker/st_manager.c @@ -28,7 +28,6 @@ #include "main/mtypes.h" #include "main/context.h" -#include "main/mfeatures.h" #include "main/texobj.h" #include "main/teximage.h" #include "main/texstate.h" @@ -454,7 +453,7 @@ st_context_flush(struct st_context_iface *stctxi, unsigned flags, struct pipe_fence_handle **fence) { struct st_context *st = (struct st_context *) stctxi; - enum pipe_flush_flags pipe_flags = 0; + unsigned pipe_flags = 0; if (flags & ST_FLUSH_END_OF_FRAME) { pipe_flags |= PIPE_FLUSH_END_OF_FRAME; @@ -468,7 +467,7 @@ st_context_flush(struct st_context_iface *stctxi, unsigned flags, static boolean st_context_teximage(struct st_context_iface *stctxi, enum st_texture_type tex_type, - int level, enum pipe_format internal_format, + int level, enum pipe_format pipe_format, struct pipe_resource *tex, boolean mipmap) { struct st_context *st = (struct st_context *) stctxi; @@ -512,29 +511,13 @@ st_context_teximage(struct st_context_iface *stctxi, texImage = _mesa_get_tex_image(ctx, texObj, target, level); stImage = st_texture_image(texImage); if (tex) { - gl_format texFormat; - - /* - * XXX When internal_format and tex->format differ, st_finalize_texture - * needs to allocate a new texture with internal_format and copy the - * texture here into the new one. It will result in surface_copy being - * called on surfaces whose formats differ. - * - * To avoid that, internal_format is (wrongly) ignored here. A sane fix - * is to use a sampler view. - */ - if (!st_sampler_compat_formats(tex->format, internal_format)) - internal_format = tex->format; - - if (util_format_get_component_bits(internal_format, - UTIL_FORMAT_COLORSPACE_RGB, 3) > 0) + gl_format texFormat = st_pipe_format_to_mesa_format(pipe_format); + + if (util_format_has_alpha(tex->format)) internalFormat = GL_RGBA; else internalFormat = GL_RGB; - texFormat = st_ChooseTextureFormat(ctx, target, internalFormat, - GL_BGRA, GL_UNSIGNED_BYTE); - _mesa_init_teximage_fields(ctx, texImage, tex->width0, tex->height0, 1, 0, internalFormat, texFormat); @@ -563,6 +546,7 @@ st_context_teximage(struct st_context_iface *stctxi, stObj->width0 = width; stObj->height0 = height; stObj->depth0 = depth; + stObj->surface_format = pipe_format; _mesa_dirty_texobj(ctx, texObj, GL_TRUE); _mesa_unlock_texture(ctx, texObj); @@ -884,16 +868,10 @@ st_manager_add_color_renderbuffer(struct st_context *st, static const struct st_api st_gl_api = { "Mesa " PACKAGE_VERSION, ST_API_OPENGL, -#if FEATURE_GL ST_PROFILE_DEFAULT_MASK | ST_PROFILE_OPENGL_CORE_MASK | -#endif -#if FEATURE_ES1 ST_PROFILE_OPENGL_ES1_MASK | -#endif -#if FEATURE_ES2 ST_PROFILE_OPENGL_ES2_MASK | -#endif 0, ST_API_FEATURE_MS_VISUALS_MASK, st_api_destroy, diff --git a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c index 3831a0a79..dd9f4fc53 100644 --- a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -269,6 +269,8 @@ st_translate_texture_target( GLuint textarget, } switch( textarget ) { + case TEXTURE_2D_MULTISAMPLE_INDEX: return TGSI_TEXTURE_2D_MSAA; + case TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX: return TGSI_TEXTURE_2D_ARRAY_MSAA; case TEXTURE_BUFFER_INDEX: return TGSI_TEXTURE_BUFFER; case TEXTURE_1D_INDEX: return TGSI_TEXTURE_1D; case TEXTURE_2D_INDEX: return TGSI_TEXTURE_2D; @@ -554,8 +556,6 @@ translate_opcode( unsigned op ) return TGSI_OPCODE_DDY; case OPCODE_DP2: return TGSI_OPCODE_DP2; - case OPCODE_DP2A: - return TGSI_OPCODE_DP2A; case OPCODE_DP3: return TGSI_OPCODE_DP3; case OPCODE_DP4: @@ -608,10 +608,6 @@ translate_opcode( unsigned op ) return TGSI_OPCODE_MUL; case OPCODE_NOP: return TGSI_OPCODE_NOP; - case OPCODE_NRM3: - return TGSI_OPCODE_NRM; - case OPCODE_NRM4: - return TGSI_OPCODE_NRM4; case OPCODE_POW: return TGSI_OPCODE_POW; case OPCODE_RCP: @@ -663,6 +659,7 @@ translate_opcode( unsigned op ) static void compile_instruction( + struct gl_context *ctx, struct st_translate *t, const struct prog_instruction *inst, boolean clamp_dst_color_output) @@ -695,7 +692,6 @@ compile_instruction( case OPCODE_CAL: case OPCODE_ELSE: case OPCODE_ENDLOOP: - case OPCODE_IF: debug_assert(num_dst == 0); ureg_label_insn( ureg, translate_opcode( inst->Opcode ), @@ -703,6 +699,14 @@ compile_instruction( get_label( t, inst->BranchTarget )); return; + case OPCODE_IF: + debug_assert(num_dst == 0); + ureg_label_insn( ureg, + ctx->Const.NativeIntegers ? TGSI_OPCODE_UIF : TGSI_OPCODE_IF, + src, num_src, + get_label( t, inst->BranchTarget )); + return; + case OPCODE_TEX: case OPCODE_TXB: case OPCODE_TXD: @@ -1217,7 +1221,7 @@ st_translate_mesa_program( } /* texture samplers */ - for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) { + for (i = 0; i < ctx->Const.FragmentProgram.MaxTextureImageUnits; i++) { if (program->SamplersUsed & (1 << i)) { t->samplers[i] = ureg_DECL_sampler( ureg, i ); } @@ -1227,7 +1231,7 @@ st_translate_mesa_program( */ for (i = 0; i < program->NumInstructions; i++) { set_insn_start( t, ureg_get_instruction_number( ureg )); - compile_instruction( t, &program->Instructions[i], clamp_color ); + compile_instruction( ctx, t, &program->Instructions[i], clamp_color ); } /* Fix up all emitted labels: diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c index 7a38da84f..60cc37cf8 100644 --- a/mesalib/src/mesa/state_tracker/st_program.c +++ b/mesalib/src/mesa/state_tracker/st_program.c @@ -33,7 +33,6 @@ #include "main/imports.h" #include "main/hash.h" -#include "main/mfeatures.h" #include "main/mtypes.h" #include "program/prog_parameter.h" #include "program/prog_print.h" diff --git a/mesalib/src/mesa/state_tracker/st_texture.c b/mesalib/src/mesa/state_tracker/st_texture.c index ed3709848..9a271826e 100644 --- a/mesalib/src/mesa/state_tracker/st_texture.c +++ b/mesalib/src/mesa/state_tracker/st_texture.c @@ -60,6 +60,7 @@ st_texture_create(struct st_context *st, GLuint height0, GLuint depth0, GLuint layers, + GLuint nr_samples, GLuint bind ) { struct pipe_resource pt, *newtex; @@ -90,6 +91,7 @@ st_texture_create(struct st_context *st, pt.usage = PIPE_USAGE_DEFAULT; pt.bind = bind; pt.flags = 0; + pt.nr_samples = nr_samples; newtex = screen->resource_create(screen, &pt); @@ -138,6 +140,8 @@ st_gl_texture_dims_to_pipe_dims(GLenum texture, case GL_TEXTURE_RECTANGLE: case GL_PROXY_TEXTURE_RECTANGLE: case GL_TEXTURE_EXTERNAL_OES: + case GL_PROXY_TEXTURE_2D_MULTISAMPLE: + case GL_TEXTURE_2D_MULTISAMPLE: assert(depthIn == 1); *widthOut = widthIn; *heightOut = heightIn; @@ -159,7 +163,9 @@ st_gl_texture_dims_to_pipe_dims(GLenum texture, *layersOut = 6; break; case GL_TEXTURE_2D_ARRAY: + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: case GL_PROXY_TEXTURE_2D_ARRAY: + case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY: *widthOut = widthIn; *heightOut = heightIn; *depthOut = 1; @@ -402,7 +408,7 @@ st_create_color_map_texture(struct gl_context *ctx) /* create texture for color map/table */ pt = st_texture_create(st, PIPE_TEXTURE_2D, format, 0, - texSize, texSize, 1, 1, PIPE_BIND_SAMPLER_VIEW); + texSize, texSize, 1, 1, 0, PIPE_BIND_SAMPLER_VIEW); return pt; } diff --git a/mesalib/src/mesa/state_tracker/st_texture.h b/mesalib/src/mesa/state_tracker/st_texture.h index 8a701009a..c15aeaea6 100644 --- a/mesalib/src/mesa/state_tracker/st_texture.h +++ b/mesalib/src/mesa/state_tracker/st_texture.h @@ -87,10 +87,16 @@ struct st_texture_object */ struct pipe_sampler_view *sampler_view; - /* True if there is/was a surface bound to this texture object. It helps - * track whether the texture object is surface based or not. + /* True if this texture comes from the window system. Such a texture + * cannot be reallocated and the format can only be changed with a sampler + * view or a surface. */ GLboolean surface_based; + + /* If surface_based is true, this format should be used for all sampler + * views and surfaces instead of pt->format. + */ + enum pipe_format surface_format; }; @@ -153,6 +159,7 @@ st_texture_create(struct st_context *st, GLuint height0, GLuint depth0, GLuint layers, + GLuint nr_samples, GLuint tex_usage ); diff --git a/mesalib/src/mesa/swrast/s_aaline.c b/mesalib/src/mesa/swrast/s_aaline.c index dcc9e3a5c..6729c53fc 100644 --- a/mesalib/src/mesa/swrast/s_aaline.c +++ b/mesalib/src/mesa/swrast/s_aaline.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_aaline.h b/mesalib/src/mesa/swrast/s_aaline.h index 74d5518e1..8ff1d7da3 100644 --- a/mesalib/src/mesa/swrast/s_aaline.h +++ b/mesalib/src/mesa/swrast/s_aaline.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_aalinetemp.h b/mesalib/src/mesa/swrast/s_aalinetemp.h index 75e28f417..26efaa3e2 100644 --- a/mesalib/src/mesa/swrast/s_aalinetemp.h +++ b/mesalib/src/mesa/swrast/s_aalinetemp.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_aatriangle.c b/mesalib/src/mesa/swrast/s_aatriangle.c index b59177fa7..02d49b9bd 100644 --- a/mesalib/src/mesa/swrast/s_aatriangle.c +++ b/mesalib/src/mesa/swrast/s_aatriangle.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_aatriangle.h b/mesalib/src/mesa/swrast/s_aatriangle.h index e40efb198..b5df414d9 100644 --- a/mesalib/src/mesa/swrast/s_aatriangle.h +++ b/mesalib/src/mesa/swrast/s_aatriangle.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_aatritemp.h b/mesalib/src/mesa/swrast/s_aatritemp.h index 4581248fd..a400364d3 100644 --- a/mesalib/src/mesa/swrast/s_aatritemp.h +++ b/mesalib/src/mesa/swrast/s_aatritemp.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_alpha.c b/mesalib/src/mesa/swrast/s_alpha.c index 1ceda531c..3f12552fd 100644 --- a/mesalib/src/mesa/swrast/s_alpha.c +++ b/mesalib/src/mesa/swrast/s_alpha.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** diff --git a/mesalib/src/mesa/swrast/s_alpha.h b/mesalib/src/mesa/swrast/s_alpha.h index fca209a44..6c8728daa 100644 --- a/mesalib/src/mesa/swrast/s_alpha.h +++ b/mesalib/src/mesa/swrast/s_alpha.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_bitmap.c b/mesalib/src/mesa/swrast/s_bitmap.c index 3a2792913..6d397da86 100644 --- a/mesalib/src/mesa/swrast/s_bitmap.c +++ b/mesalib/src/mesa/swrast/s_bitmap.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** diff --git a/mesalib/src/mesa/swrast/s_blend.c b/mesalib/src/mesa/swrast/s_blend.c index 54fffbb45..4423d5b17 100644 --- a/mesalib/src/mesa/swrast/s_blend.c +++ b/mesalib/src/mesa/swrast/s_blend.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_blend.h b/mesalib/src/mesa/swrast/s_blend.h index 69cd89e7a..32f921352 100644 --- a/mesalib/src/mesa/swrast/s_blend.h +++ b/mesalib/src/mesa/swrast/s_blend.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_blit.c b/mesalib/src/mesa/swrast/s_blit.c index 051354dc8..0c8cfe551 100644 --- a/mesalib/src/mesa/swrast/s_blit.c +++ b/mesalib/src/mesa/swrast/s_blit.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -188,6 +189,12 @@ blit_nearest(struct gl_context *ctx, return; } + /* allocate the src/dst row buffers */ + srcBuffer = malloc(MAX_PIXEL_BYTES * srcWidth); + dstBuffer = malloc(MAX_PIXEL_BYTES * dstWidth); + if (!srcBuffer || !dstBuffer) + goto fail_no_memory; + /* Blit to all the draw buffers */ for (i = 0; i < numDrawBuffers; i++) { if (buffer == GL_COLOR_BUFFER_BIT) { @@ -229,7 +236,7 @@ blit_nearest(struct gl_context *ctx, default: _mesa_problem(ctx, "unexpected pixel size (%d) in blit_nearest", pixelSize); - return; + goto fail; } if ((readRb == drawRb) || @@ -248,8 +255,7 @@ blit_nearest(struct gl_context *ctx, GL_MAP_READ_BIT | GL_MAP_WRITE_BIT, &map, &rowStride); if (!map) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFramebuffer"); - return; + goto fail_no_memory; } srcMap = map + srcYpos * rowStride + srcXpos * formatSize; @@ -276,8 +282,7 @@ blit_nearest(struct gl_context *ctx, srcWidth, srcHeight, GL_MAP_READ_BIT, &srcMap, &srcRowStride); if (!srcMap) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFramebuffer"); - return; + goto fail_no_memory; } ctx->Driver.MapRenderbuffer(ctx, drawRb, dstXpos, dstYpos, @@ -285,24 +290,10 @@ blit_nearest(struct gl_context *ctx, GL_MAP_WRITE_BIT, &dstMap, &dstRowStride); if (!dstMap) { ctx->Driver.UnmapRenderbuffer(ctx, readRb); - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFramebuffer"); - return; + goto fail_no_memory; } } - /* allocate the src/dst row buffers */ - srcBuffer = malloc(pixelSize * srcWidth); - if (!srcBuffer) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT"); - return; - } - dstBuffer = malloc(pixelSize * dstWidth); - if (!dstBuffer) { - free(srcBuffer); - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT"); - return; - } - for (dstRow = 0; dstRow < dstHeight; dstRow++) { GLfloat srcRowF = (dstRow + 0.5F) / dstHeight * srcHeight - 0.5F; GLint srcRow = IROUND(srcRowF); @@ -369,14 +360,21 @@ blit_nearest(struct gl_context *ctx, } } - free(srcBuffer); - free(dstBuffer); - ctx->Driver.UnmapRenderbuffer(ctx, readRb); if (drawRb != readRb) { ctx->Driver.UnmapRenderbuffer(ctx, drawRb); } } + +fail: + free(srcBuffer); + free(dstBuffer); + return; + +fail_no_memory: + free(srcBuffer); + free(dstBuffer); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBuffer"); } @@ -564,22 +562,10 @@ blit_linear(struct gl_context *ctx, * Keep two adjacent src rows around for bilinear sampling. */ srcBuffer0 = malloc(pixelSize * srcWidth); - if (!srcBuffer0) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT"); - return; - } srcBuffer1 = malloc(pixelSize * srcWidth); - if (!srcBuffer1) { - free(srcBuffer0); - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT"); - return; - } dstBuffer = malloc(pixelSize * dstWidth); - if (!dstBuffer) { - free(srcBuffer0); - free(srcBuffer1); - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT"); - return; + if (!srcBuffer0 || !srcBuffer1 || !dstBuffer) { + goto fail_no_memory; } for (i = 0; i < drawFb->_NumColorDrawBuffers; i++) { @@ -610,11 +596,7 @@ blit_linear(struct gl_context *ctx, GL_MAP_READ_BIT | GL_MAP_WRITE_BIT, &srcMap, &srcRowStride); if (!srcMap) { - free(srcBuffer0); - free(srcBuffer1); - free(dstBuffer); - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFramebuffer"); - return; + goto fail_no_memory; } dstMap = srcMap; @@ -629,22 +611,14 @@ blit_linear(struct gl_context *ctx, 0, 0, readRb->Width, readRb->Height, GL_MAP_READ_BIT, &srcMap, &srcRowStride); if (!srcMap) { - free(srcBuffer0); - free(srcBuffer1); - free(dstBuffer); - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFramebuffer"); - return; + goto fail_no_memory; } ctx->Driver.MapRenderbuffer(ctx, drawRb, 0, 0, drawRb->Width, drawRb->Height, GL_MAP_WRITE_BIT, &dstMap, &dstRowStride); if (!dstMap) { ctx->Driver.UnmapRenderbuffer(ctx, readRb); - free(srcBuffer0); - free(srcBuffer1); - free(dstBuffer); - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFramebuffer"); - return; + goto fail_no_memory; } } @@ -734,15 +708,22 @@ blit_linear(struct gl_context *ctx, } } - free(srcBuffer0); - free(srcBuffer1); - free(dstBuffer); - ctx->Driver.UnmapRenderbuffer(ctx, readRb); if (drawRb != readRb) { ctx->Driver.UnmapRenderbuffer(ctx, drawRb); } } + + free(srcBuffer0); + free(srcBuffer1); + free(dstBuffer); + return; + +fail_no_memory: + free(srcBuffer0); + free(srcBuffer1); + free(dstBuffer); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFramebuffer"); } diff --git a/mesalib/src/mesa/swrast/s_chan.h b/mesalib/src/mesa/swrast/s_chan.h index 1db7fae4d..38daf6575 100644 --- a/mesalib/src/mesa/swrast/s_chan.h +++ b/mesalib/src/mesa/swrast/s_chan.h @@ -16,9 +16,10 @@ * 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 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. + * 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. */ /** diff --git a/mesalib/src/mesa/swrast/s_clear.c b/mesalib/src/mesa/swrast/s_clear.c index d942e6e63..58b36e8a2 100644 --- a/mesalib/src/mesa/swrast/s_clear.c +++ b/mesalib/src/mesa/swrast/s_clear.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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 "main/glheader.h" diff --git a/mesalib/src/mesa/swrast/s_context.c b/mesalib/src/mesa/swrast/s_context.c index 11e906436..70bbb83dc 100644 --- a/mesalib/src/mesa/swrast/s_context.c +++ b/mesalib/src/mesa/swrast/s_context.c @@ -17,13 +17,13 @@ * 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 - * BRIAN PAUL 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. + * 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: - * Keith Whitwell <keith@tungstengraphics.com> - * Brian Paul + * Keith Whitwell <keith@tungstengraphics.com> Brian Paul */ #include "main/imports.h" @@ -459,7 +459,7 @@ _swrast_invalidate_state( struct gl_context *ctx, GLbitfield new_state ) swrast->BlendFunc = _swrast_validate_blend_func; if (new_state & _SWRAST_NEW_TEXTURE_SAMPLE_FUNC) - for (i = 0 ; i < ctx->Const.MaxTextureImageUnits ; i++) + for (i = 0 ; i < ARRAY_SIZE(swrast->TextureSample); i++) swrast->TextureSample[i] = NULL; } @@ -473,7 +473,7 @@ _swrast_update_texture_samplers(struct gl_context *ctx) if (!swrast) return; /* pipe hack */ - for (u = 0; u < ctx->Const.MaxTextureImageUnits; u++) { + for (u = 0; u < ARRAY_SIZE(swrast->TextureSample); u++) { struct gl_texture_object *tObj = ctx->Texture.Unit[u]._Current; /* Note: If tObj is NULL, the sample function will be a simple * function that just returns opaque black (0,0,0,1). @@ -766,7 +766,7 @@ _swrast_CreateContext( struct gl_context *ctx ) swrast->Driver.SpanRenderStart = _swrast_span_render_start; swrast->Driver.SpanRenderFinish = _swrast_span_render_finish; - for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) + for (i = 0; i < ARRAY_SIZE(swrast->TextureSample); i++) swrast->TextureSample[i] = NULL; /* SpanArrays is global and shared by all SWspan instances. However, when diff --git a/mesalib/src/mesa/swrast/s_context.h b/mesalib/src/mesa/swrast/s_context.h index 2f7a2b531..9520185b2 100644 --- a/mesalib/src/mesa/swrast/s_context.h +++ b/mesalib/src/mesa/swrast/s_context.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -137,11 +138,24 @@ struct swrast_texture_image /** used for mipmap LOD computation */ GLfloat WidthScale, HeightScale, DepthScale; - /** These fields only valid when texture memory is mapped */ - GLint RowStride; /**< Padded width in units of texels */ - GLuint *ImageOffsets; /**< if 3D texture: array [Depth] of offsets to - each 2D slice in 'Data', in texels */ - GLubyte *Map; /**< Pointer to mapped image memory */ + /** + * Byte stride between rows in ImageSlices. + * + * For compressed textures, this is the byte stride between one row of + * blocks and the next row of blocks. + * + * Only valid while one of the ImageSlices is mapped, and must be the same + * between all slices. + */ + GLint RowStride; + /** + * When a texture image is mapped for swrast, this array contains pointers + * to the beginning of each slice. + * + * For swrast-allocated textures, these pointers will always stay + * initialized to point within Buffer. + */ + void **ImageSlices; /** Malloc'd texture memory */ GLubyte *Buffer; @@ -299,7 +313,7 @@ typedef struct /** Internal hooks, kept up to date by the same mechanism as above. */ blend_func BlendFunc; - texture_sample_func TextureSample[MAX_TEXTURE_IMAGE_UNITS]; + texture_sample_func TextureSample[MAX_COMBINED_TEXTURE_IMAGE_UNITS]; /** Buffer for saving the sampled texture colors. * Needed for GL_ARB_texture_env_crossbar implementation. @@ -379,6 +393,9 @@ _swrast_map_textures(struct gl_context *ctx); extern void _swrast_unmap_textures(struct gl_context *ctx); +extern unsigned int +_swrast_teximage_slice_height(struct gl_texture_image *texImage); + extern void _swrast_map_texture(struct gl_context *ctx, struct gl_texture_object *texObj); diff --git a/mesalib/src/mesa/swrast/s_copypix.c b/mesalib/src/mesa/swrast/s_copypix.c index 1d8926179..57bdce0d2 100644 --- a/mesalib/src/mesa/swrast/s_copypix.c +++ b/mesalib/src/mesa/swrast/s_copypix.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_depth.c b/mesalib/src/mesa/swrast/s_depth.c index 969b75f07..4d2a6bd36 100644 --- a/mesalib/src/mesa/swrast/s_depth.c +++ b/mesalib/src/mesa/swrast/s_depth.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_depth.h b/mesalib/src/mesa/swrast/s_depth.h index 25a7a0bbf..987c7af2b 100644 --- a/mesalib/src/mesa/swrast/s_depth.h +++ b/mesalib/src/mesa/swrast/s_depth.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_drawpix.c b/mesalib/src/mesa/swrast/s_drawpix.c index 3d23f912f..41b50ab71 100644 --- a/mesalib/src/mesa/swrast/s_drawpix.c +++ b/mesalib/src/mesa/swrast/s_drawpix.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_feedback.c b/mesalib/src/mesa/swrast/s_feedback.c index 00467e54f..67d84753e 100644 --- a/mesalib/src/mesa/swrast/s_feedback.c +++ b/mesalib/src/mesa/swrast/s_feedback.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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 "main/glheader.h" diff --git a/mesalib/src/mesa/swrast/s_feedback.h b/mesalib/src/mesa/swrast/s_feedback.h index 6bfd49735..62b9a38d6 100644 --- a/mesalib/src/mesa/swrast/s_feedback.h +++ b/mesalib/src/mesa/swrast/s_feedback.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_fog.c b/mesalib/src/mesa/swrast/s_fog.c index 57a6a8e61..1a2ef1d50 100644 --- a/mesalib/src/mesa/swrast/s_fog.c +++ b/mesalib/src/mesa/swrast/s_fog.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_fog.h b/mesalib/src/mesa/swrast/s_fog.h index 9f93b7050..d4d31e4f5 100644 --- a/mesalib/src/mesa/swrast/s_fog.h +++ b/mesalib/src/mesa/swrast/s_fog.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_fragprog.c b/mesalib/src/mesa/swrast/s_fragprog.c index 1ce2ee452..e7e1b8582 100644 --- a/mesalib/src/mesa/swrast/s_fragprog.c +++ b/mesalib/src/mesa/swrast/s_fragprog.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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 "main/glheader.h" diff --git a/mesalib/src/mesa/swrast/s_fragprog.h b/mesalib/src/mesa/swrast/s_fragprog.h index ac1f5ff4c..0522c6c7f 100644 --- a/mesalib/src/mesa/swrast/s_fragprog.h +++ b/mesalib/src/mesa/swrast/s_fragprog.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_lines.c b/mesalib/src/mesa/swrast/s_lines.c index 7364dd965..72c41369b 100644 --- a/mesalib/src/mesa/swrast/s_lines.c +++ b/mesalib/src/mesa/swrast/s_lines.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_lines.h b/mesalib/src/mesa/swrast/s_lines.h index a4c98a855..3d4453eb8 100644 --- a/mesalib/src/mesa/swrast/s_lines.h +++ b/mesalib/src/mesa/swrast/s_lines.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_linetemp.h b/mesalib/src/mesa/swrast/s_linetemp.h index 8feb8b120..f3ce6d95e 100644 --- a/mesalib/src/mesa/swrast/s_linetemp.h +++ b/mesalib/src/mesa/swrast/s_linetemp.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_logic.c b/mesalib/src/mesa/swrast/s_logic.c index 93388d720..a111f6337 100644 --- a/mesalib/src/mesa/swrast/s_logic.c +++ b/mesalib/src/mesa/swrast/s_logic.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_logic.h b/mesalib/src/mesa/swrast/s_logic.h index 0a3adfca5..b5e11fbf8 100644 --- a/mesalib/src/mesa/swrast/s_logic.h +++ b/mesalib/src/mesa/swrast/s_logic.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_masking.c b/mesalib/src/mesa/swrast/s_masking.c index 8f5344650..d9d06b45b 100644 --- a/mesalib/src/mesa/swrast/s_masking.c +++ b/mesalib/src/mesa/swrast/s_masking.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_masking.h b/mesalib/src/mesa/swrast/s_masking.h index 5124509a0..0aa0755d1 100644 --- a/mesalib/src/mesa/swrast/s_masking.h +++ b/mesalib/src/mesa/swrast/s_masking.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_points.c b/mesalib/src/mesa/swrast/s_points.c index 80693be8e..7483a7716 100644 --- a/mesalib/src/mesa/swrast/s_points.c +++ b/mesalib/src/mesa/swrast/s_points.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_points.h b/mesalib/src/mesa/swrast/s_points.h index 0b6550e80..e356f063b 100644 --- a/mesalib/src/mesa/swrast/s_points.h +++ b/mesalib/src/mesa/swrast/s_points.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_renderbuffer.c b/mesalib/src/mesa/swrast/s_renderbuffer.c index 282b2c482..54b645e78 100644 --- a/mesalib/src/mesa/swrast/s_renderbuffer.c +++ b/mesalib/src/mesa/swrast/s_renderbuffer.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_renderbuffer.h b/mesalib/src/mesa/swrast/s_renderbuffer.h index 266ebd934..45c57fffd 100644 --- a/mesalib/src/mesa/swrast/s_renderbuffer.h +++ b/mesalib/src/mesa/swrast/s_renderbuffer.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_span.c b/mesalib/src/mesa/swrast/s_span.c index 7bb3b1f2b..cb755f9eb 100644 --- a/mesalib/src/mesa/swrast/s_span.c +++ b/mesalib/src/mesa/swrast/s_span.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_span.h b/mesalib/src/mesa/swrast/s_span.h index 6f710c533..0a5a6dc6c 100644 --- a/mesalib/src/mesa/swrast/s_span.h +++ b/mesalib/src/mesa/swrast/s_span.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_stencil.c b/mesalib/src/mesa/swrast/s_stencil.c index 3423737ee..a63a773cf 100644 --- a/mesalib/src/mesa/swrast/s_stencil.c +++ b/mesalib/src/mesa/swrast/s_stencil.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -28,6 +29,8 @@ #include "main/imports.h" #include "main/format_pack.h" #include "main/format_unpack.h" +#include "main/core.h" +#include "main/stencil.h" #include "s_context.h" #include "s_depth.h" @@ -128,7 +131,7 @@ apply_stencil_op(const struct gl_context *ctx, GLenum oper, GLuint face, GLuint n, GLubyte stencil[], const GLubyte mask[], GLint stride) { - const GLubyte ref = ctx->Stencil.Ref[face]; + const GLubyte ref = _mesa_get_stencil_ref(ctx, face); const GLubyte wrtmask = ctx->Stencil.WriteMask[face]; const GLubyte invmask = (GLubyte) (~wrtmask); GLuint i, j; @@ -215,7 +218,7 @@ do_stencil_test(struct gl_context *ctx, GLuint face, GLuint n, GLboolean allfail = GL_FALSE; GLuint i, j; const GLuint valueMask = ctx->Stencil.ValueMask[face]; - const GLubyte ref = (GLubyte) (ctx->Stencil.Ref[face] & valueMask); + const GLubyte ref = (GLubyte) (_mesa_get_stencil_ref(ctx, face) & valueMask); GLubyte s; /* diff --git a/mesalib/src/mesa/swrast/s_stencil.h b/mesalib/src/mesa/swrast/s_stencil.h index 113649a37..c92f0af3e 100644 --- a/mesalib/src/mesa/swrast/s_stencil.h +++ b/mesalib/src/mesa/swrast/s_stencil.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_texcombine.c b/mesalib/src/mesa/swrast/s_texcombine.c index c24807cb7..df3a74a06 100644 --- a/mesalib/src/mesa/swrast/s_texcombine.c +++ b/mesalib/src/mesa/swrast/s_texcombine.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -611,7 +612,7 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span ) * thread. */ swrast->TexelBuffer = - malloc(ctx->Const.MaxTextureImageUnits * maxThreads * + malloc(ctx->Const.FragmentProgram.MaxTextureImageUnits * maxThreads * SWRAST_MAX_WIDTH * 4 * sizeof(GLfloat)); if (!swrast->TexelBuffer) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "texture_combine"); diff --git a/mesalib/src/mesa/swrast/s_texcombine.h b/mesalib/src/mesa/swrast/s_texcombine.h index 11049d86b..dd9151de2 100644 --- a/mesalib/src/mesa/swrast/s_texcombine.h +++ b/mesalib/src/mesa/swrast/s_texcombine.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_texfetch.c b/mesalib/src/mesa/swrast/s_texfetch.c index 5e1a9f783..f6c269d8b 100644 --- a/mesalib/src/mesa/swrast/s_texfetch.c +++ b/mesalib/src/mesa/swrast/s_texfetch.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -97,10 +98,17 @@ static void fetch_compressed(const struct swrast_texture_image *swImage, GLint i, GLint j, GLint k, GLfloat *texel) { - swImage->FetchCompressedTexel(swImage->Map, - swImage->ImageOffsets, - swImage->RowStride, - i, j, k, texel); + /* The FetchCompressedTexel function takes an integer pixel rowstride, + * while the image's rowstride is bytes per row of blocks. + */ + GLuint bw, bh; + GLuint texelBytes = _mesa_get_format_bytes(swImage->Base.TexFormat); + _mesa_get_format_block_size(swImage->Base.TexFormat, &bw, &bh); + assert(swImage->RowStride * bw % texelBytes == 0); + + swImage->FetchCompressedTexel(swImage->ImageSlices[k], + swImage->RowStride * bw / texelBytes, + i, j, texel); } diff --git a/mesalib/src/mesa/swrast/s_texfetch.h b/mesalib/src/mesa/swrast/s_texfetch.h index 4e4397e13..dd37b066c 100644 --- a/mesalib/src/mesa/swrast/s_texfetch.h +++ b/mesalib/src/mesa/swrast/s_texfetch.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_texfetch_tmp.h b/mesalib/src/mesa/swrast/s_texfetch_tmp.h index 2de1f1a97..44fa8170b 100644 --- a/mesalib/src/mesa/swrast/s_texfetch_tmp.h +++ b/mesalib/src/mesa/swrast/s_texfetch_tmp.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -43,23 +44,24 @@ #if DIM == 1 #define TEXEL_ADDR( type, image, i, j, k, size ) \ - ((void) (j), (void) (k), ((type *)(image)->Map + (i) * (size))) + ((void) (j), (void) (k), ((type *)(image)->ImageSlices[0] + (i) * (size))) #define FETCH(x) fetch_texel_1d_##x #elif DIM == 2 #define TEXEL_ADDR( type, image, i, j, k, size ) \ - ((void) (k), \ - ((type *)(image)->Map + ((image)->RowStride * (j) + (i)) * (size))) + ((void) (k), \ + ((type *)((GLubyte *) (image)->ImageSlices[0] + (image)->RowStride * (j)) + \ + (i) * (size))) #define FETCH(x) fetch_texel_2d_##x #elif DIM == 3 #define TEXEL_ADDR( type, image, i, j, k, size ) \ - ((type *)(image)->Map + ((image)->ImageOffsets[k] \ - + (image)->RowStride * (j) + (i)) * (size)) + ((type *)((GLubyte *) (image)->ImageSlices[k] + \ + (image)->RowStride * (j)) + (i) * (size)) #define FETCH(x) fetch_texel_3d_##x diff --git a/mesalib/src/mesa/swrast/s_texfilter.c b/mesalib/src/mesa/swrast/s_texfilter.c index ae3ffe5f4..fba8e6cba 100644 --- a/mesalib/src/mesa/swrast/s_texfilter.c +++ b/mesalib/src/mesa/swrast/s_texfilter.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -1435,7 +1436,7 @@ opt_sample_rgb_2d(struct gl_context *ctx, GLint i = IFLOOR(texcoords[k][0] * width) & colMask; GLint j = IFLOOR(texcoords[k][1] * height) & rowMask; GLint pos = (j << shift) | i; - GLubyte *texel = swImg->Map + 3 * pos; + GLubyte *texel = (GLubyte *) swImg->ImageSlices[0] + 3 * pos; rgba[k][RCOMP] = UBYTE_TO_FLOAT(texel[2]); rgba[k][GCOMP] = UBYTE_TO_FLOAT(texel[1]); rgba[k][BCOMP] = UBYTE_TO_FLOAT(texel[0]); @@ -1480,7 +1481,7 @@ opt_sample_rgba_2d(struct gl_context *ctx, const GLint col = IFLOOR(texcoords[i][0] * width) & colMask; const GLint row = IFLOOR(texcoords[i][1] * height) & rowMask; const GLint pos = (row << shift) | col; - const GLuint texel = *((GLuint *) swImg->Map + pos); + const GLuint texel = *((GLuint *) swImg->ImageSlices[0] + pos); rgba[i][RCOMP] = UBYTE_TO_FLOAT( (texel >> 24) ); rgba[i][GCOMP] = UBYTE_TO_FLOAT( (texel >> 16) & 0xff ); rgba[i][BCOMP] = UBYTE_TO_FLOAT( (texel >> 8) & 0xff ); @@ -1504,7 +1505,9 @@ sample_lambda_2d(struct gl_context *ctx, const GLboolean repeatNoBorderPOT = (samp->WrapS == GL_REPEAT) && (samp->WrapT == GL_REPEAT) - && (tImg->Border == 0 && (tImg->Width == swImg->RowStride)) + && (tImg->Border == 0) + && (_mesa_format_row_stride(tImg->TexFormat, tImg->Width) == + swImg->RowStride) && swImg->_IsPowerOfTwo; ASSERT(lambda != NULL); diff --git a/mesalib/src/mesa/swrast/s_texfilter.h b/mesalib/src/mesa/swrast/s_texfilter.h index 58b57365c..7bfa045a7 100644 --- a/mesalib/src/mesa/swrast/s_texfilter.h +++ b/mesalib/src/mesa/swrast/s_texfilter.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_texrender.c b/mesalib/src/mesa/swrast/s_texrender.c index 7b25a7b7d..751d7767b 100644 --- a/mesalib/src/mesa/swrast/s_texrender.c +++ b/mesalib/src/mesa/swrast/s_texrender.c @@ -22,37 +22,6 @@ delete_texture_wrapper(struct gl_context *ctx, struct gl_renderbuffer *rb) free(rb); } - -/** - * This function creates a renderbuffer object which wraps a texture image. - * The new renderbuffer is plugged into the given attachment point. - * This allows rendering into the texture as if it were a renderbuffer. - */ -static void -wrap_texture(struct gl_context *ctx, struct gl_renderbuffer_attachment *att) -{ - struct gl_renderbuffer *rb; - const GLuint name = 0; - - ASSERT(att->Type == GL_TEXTURE); - ASSERT(att->Renderbuffer == NULL); - - rb = ctx->Driver.NewRenderbuffer(ctx, name); - if (!rb) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "wrap_texture"); - return; - } - - /* init base gl_renderbuffer fields */ - _mesa_init_renderbuffer(rb, name); - /* plug in our texture_renderbuffer-specific functions */ - rb->Delete = delete_texture_wrapper; - rb->AllocStorage = NULL; /* illegal! */ - - /* update attachment point */ - _mesa_reference_renderbuffer(&att->Renderbuffer, rb); -} - /** * Update the renderbuffer wrapper for rendering to a texture. * For example, update the width, height of the RB based on the texture size, @@ -69,7 +38,7 @@ update_wrapper(struct gl_context *ctx, struct gl_renderbuffer_attachment *att) (void) ctx; - swImage = swrast_texture_image(_mesa_get_attachment_teximage(att)); + swImage = swrast_texture_image(rb->TexImage); assert(swImage); format = swImage->Base.TexFormat; @@ -81,25 +50,10 @@ update_wrapper(struct gl_context *ctx, struct gl_renderbuffer_attachment *att) zOffset = att->Zoffset; } - rb->Width = swImage->Base.Width; - rb->Height = swImage->Base.Height; - rb->InternalFormat = swImage->Base.InternalFormat; - rb->_BaseFormat = _mesa_get_format_base_format(format); - /* Want to store linear values, not sRGB */ rb->Format = _mesa_get_srgb_format_linear(format); - - /* Set the gl_renderbuffer::Buffer field so that mapping the buffer - * succeeds. - */ - if (att->Texture->Target == GL_TEXTURE_3D || - att->Texture->Target == GL_TEXTURE_2D_ARRAY_EXT) { - srb->Buffer = swImage->Buffer + - swImage->ImageOffsets[zOffset] * _mesa_get_format_bytes(format); - } - else { - srb->Buffer = swImage->Buffer; - } + + srb->Buffer = swImage->ImageSlices[zOffset]; } @@ -126,23 +80,24 @@ _swrast_render_texture(struct gl_context *ctx, struct gl_framebuffer *fb, struct gl_renderbuffer_attachment *att) { + struct gl_renderbuffer *rb = att->Renderbuffer; (void) fb; - if (!att->Renderbuffer) { - wrap_texture(ctx, att); - } + /* plug in our texture_renderbuffer-specific functions */ + rb->Delete = delete_texture_wrapper; + update_wrapper(ctx, att); } void _swrast_finish_render_texture(struct gl_context *ctx, - struct gl_renderbuffer_attachment *att) + struct gl_renderbuffer *rb) { /* do nothing */ /* The renderbuffer texture wrapper will get deleted by the * normal mechanism for deleting renderbuffers. */ (void) ctx; - (void) att; + (void) rb; } diff --git a/mesalib/src/mesa/swrast/s_texture.c b/mesalib/src/mesa/swrast/s_texture.c index 8ae3d5bd0..27803c553 100644 --- a/mesalib/src/mesa/swrast/s_texture.c +++ b/mesalib/src/mesa/swrast/s_texture.c @@ -16,9 +16,10 @@ * 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 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. + * 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. */ /** @@ -58,6 +59,26 @@ _swrast_delete_texture_image(struct gl_context *ctx, _mesa_delete_texture_image(ctx, texImage); } +static unsigned int +texture_slices(struct gl_texture_image *texImage) +{ + if (texImage->TexObject->Target == GL_TEXTURE_1D_ARRAY) + return texImage->Height; + else + return texImage->Depth; +} + +unsigned int +_swrast_teximage_slice_height(struct gl_texture_image *texImage) +{ + /* For 1D array textures, the slices are all 1 pixel high, and Height is + * the number of slices. + */ + if (texImage->TexObject->Target == GL_TEXTURE_1D_ARRAY) + return 1; + else + return texImage->Height; +} /** * Called via ctx->Driver.AllocTextureImageBuffer() @@ -67,31 +88,28 @@ _swrast_alloc_texture_image_buffer(struct gl_context *ctx, struct gl_texture_image *texImage) { struct swrast_texture_image *swImg = swrast_texture_image(texImage); - GLuint bytes = _mesa_format_image_size(texImage->TexFormat, texImage->Width, - texImage->Height, texImage->Depth); + GLuint bytesPerSlice; + GLuint slices = texture_slices(texImage); GLuint i; - assert(!swImg->Buffer); - swImg->Buffer = _mesa_align_malloc(bytes, 512); - if (!swImg->Buffer) + if (!_swrast_init_texture_image(texImage)) return GL_FALSE; - /* RowStride and ImageOffsets[] describe how to address texels in 'Data' */ - swImg->RowStride = texImage->Width; + bytesPerSlice = _mesa_format_image_size(texImage->TexFormat, texImage->Width, + _swrast_teximage_slice_height(texImage), 1); - /* Allocate the ImageOffsets array and initialize to typical values. - * We allocate the array for 1D/2D textures too in order to avoid special- - * case code in the texstore routines. - */ - swImg->ImageOffsets = malloc(texImage->Depth * sizeof(GLuint)); - if (!swImg->ImageOffsets) + assert(!swImg->Buffer); + swImg->Buffer = _mesa_align_malloc(bytesPerSlice * slices, 512); + if (!swImg->Buffer) return GL_FALSE; - for (i = 0; i < texImage->Depth; i++) { - swImg->ImageOffsets[i] = i * texImage->Width * texImage->Height; - } + /* RowStride and ImageSlices[] describe how to address texels in 'Data' */ + swImg->RowStride = _mesa_format_row_stride(texImage->TexFormat, + texImage->Width); - _swrast_init_texture_image(texImage); + for (i = 0; i < slices; i++) { + swImg->ImageSlices[i] = swImg->Buffer + bytesPerSlice * i; + } return GL_TRUE; } @@ -100,11 +118,11 @@ _swrast_alloc_texture_image_buffer(struct gl_context *ctx, /** * Code that overrides ctx->Driver.AllocTextureImageBuffer may use this to * initialize the fields of swrast_texture_image without allocating the image - * buffer or initializing ImageOffsets or RowStride. + * buffer or initializing RowStride or the contents of ImageSlices. * * Returns GL_TRUE on success, GL_FALSE on memory allocation failure. */ -void +GLboolean _swrast_init_texture_image(struct gl_texture_image *texImage) { struct swrast_texture_image *swImg = swrast_texture_image(texImage); @@ -128,6 +146,13 @@ _swrast_init_texture_image(struct gl_texture_image *texImage) swImg->HeightScale = (GLfloat) texImage->Height; swImg->DepthScale = (GLfloat) texImage->Depth; } + + assert(!swImg->ImageSlices); + swImg->ImageSlices = calloc(texture_slices(texImage), sizeof(void *)); + if (!swImg->ImageSlices) + return GL_FALSE; + + return GL_TRUE; } @@ -144,8 +169,8 @@ _swrast_free_texture_image_buffer(struct gl_context *ctx, swImage->Buffer = NULL; } - free(swImage->ImageOffsets); - swImage->ImageOffsets = NULL; + free(swImage->ImageSlices); + swImage->ImageSlices = NULL; } @@ -206,25 +231,15 @@ _swrast_map_teximage(struct gl_context *ctx, *mapOut = NULL; return; } - - map = swImage->Buffer; - - if (texImage->TexObject->Target == GL_TEXTURE_3D || - texImage->TexObject->Target == GL_TEXTURE_2D_ARRAY) { - GLuint sliceSize = _mesa_format_image_size(texImage->TexFormat, - texImage->Width, - texImage->Height, - 1); - assert(slice < texImage->Depth); - map += slice * sliceSize; - } else if (texImage->TexObject->Target == GL_TEXTURE_1D_ARRAY) { - GLuint sliceSize = _mesa_format_image_size(texImage->TexFormat, - texImage->Width, - 1, - 1); - assert(slice < texImage->Height); - map += slice * sliceSize; - } + + /* This function can only be used with a swrast-allocated buffer, in which + * case ImageSlices is populated with pointers into Buffer. + */ + assert(swImage->Buffer); + assert(swImage->Buffer == swImage->ImageSlices[0]); + + assert(slice < texture_slices(texImage)); + map = swImage->ImageSlices[slice]; /* apply x/y offset to map address */ map += stride * (y / bh) + texelSize * (x / bw); @@ -251,12 +266,42 @@ _swrast_map_texture(struct gl_context *ctx, struct gl_texture_object *texObj) for (face = 0; face < faces; face++) { for (level = texObj->BaseLevel; level < MAX_TEXTURE_LEVELS; level++) { struct gl_texture_image *texImage = texObj->Image[face][level]; - if (texImage) { - struct swrast_texture_image *swImage = - swrast_texture_image(texImage); + struct swrast_texture_image *swImage = swrast_texture_image(texImage); + unsigned int i; + + if (!texImage) + continue; + + /* In the case of a swrast-allocated texture buffer, the ImageSlices + * and RowStride are always available. + */ + if (swImage->Buffer) { + assert(swImage->ImageSlices[0] == swImage->Buffer); + continue; + } - /* XXX we'll eventually call _swrast_map_teximage() here */ - swImage->Map = swImage->Buffer; + for (i = 0; i < texture_slices(texImage); i++) { + GLubyte *map; + GLint rowStride; + + if (swImage->ImageSlices[i]) + continue; + + ctx->Driver.MapTextureImage(ctx, texImage, i, + 0, 0, + texImage->Width, texImage->Height, + GL_MAP_READ_BIT | GL_MAP_WRITE_BIT, + &map, &rowStride); + + swImage->ImageSlices[i] = map; + /* A swrast-using driver has to return the same rowstride for + * every slice of the same texture, since we don't track them + * separately. + */ + if (i == 0) + swImage->RowStride = rowStride; + else + assert(swImage->RowStride == rowStride); } } } @@ -272,12 +317,20 @@ _swrast_unmap_texture(struct gl_context *ctx, struct gl_texture_object *texObj) for (face = 0; face < faces; face++) { for (level = texObj->BaseLevel; level < MAX_TEXTURE_LEVELS; level++) { struct gl_texture_image *texImage = texObj->Image[face][level]; - if (texImage) { - struct swrast_texture_image *swImage - = swrast_texture_image(texImage); + struct swrast_texture_image *swImage = swrast_texture_image(texImage); + unsigned int i; + + if (!texImage) + continue; - /* XXX we'll eventually call _swrast_unmap_teximage() here */ - swImage->Map = NULL; + if (swImage->Buffer) + return; + + for (i = 0; i < texture_slices(texImage); i++) { + if (swImage->ImageSlices[i]) { + ctx->Driver.UnmapTextureImage(ctx, texImage, i); + swImage->ImageSlices[i] = NULL; + } } } } @@ -322,30 +375,3 @@ _swrast_unmap_textures(struct gl_context *ctx) enabledUnits &= ~(1 << unit); } } - - -/** - * Called via ctx->Driver.AllocTextureStorage() - * Just have to allocate memory for the texture images. - */ -GLboolean -_swrast_AllocTextureStorage(struct gl_context *ctx, - struct gl_texture_object *texObj, - GLsizei levels, GLsizei width, - GLsizei height, GLsizei depth) -{ - const GLint numFaces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1; - GLint face, level; - - for (face = 0; face < numFaces; face++) { - for (level = 0; level < levels; level++) { - struct gl_texture_image *texImage = texObj->Image[face][level]; - if (!_swrast_alloc_texture_image_buffer(ctx, texImage)) { - return GL_FALSE; - } - } - } - - return GL_TRUE; -} - diff --git a/mesalib/src/mesa/swrast/s_triangle.c b/mesalib/src/mesa/swrast/s_triangle.c index f0b1d383d..ffe99832b 100644 --- a/mesalib/src/mesa/swrast/s_triangle.c +++ b/mesalib/src/mesa/swrast/s_triangle.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -133,7 +134,7 @@ _swrast_culltriangle( struct gl_context *ctx, const GLfloat twidth = (GLfloat) texImg->Width; \ const GLfloat theight = (GLfloat) texImg->Height; \ const GLint twidth_log2 = texImg->WidthLog2; \ - const GLubyte *texture = (const GLubyte *) swImg->Map; \ + const GLubyte *texture = (const GLubyte *) swImg->ImageSlices[0]; \ const GLint smask = texImg->Width - 1; \ const GLint tmask = texImg->Height - 1; \ ASSERT(texImg->TexFormat == MESA_FORMAT_RGB888); \ @@ -191,7 +192,7 @@ _swrast_culltriangle( struct gl_context *ctx, const GLfloat twidth = (GLfloat) texImg->Width; \ const GLfloat theight = (GLfloat) texImg->Height; \ const GLint twidth_log2 = texImg->WidthLog2; \ - const GLubyte *texture = (const GLubyte *) swImg->Map; \ + const GLubyte *texture = (const GLubyte *) swImg->ImageSlices[0]; \ const GLint smask = texImg->Width - 1; \ const GLint tmask = texImg->Height - 1; \ ASSERT(texImg->TexFormat == MESA_FORMAT_RGB888); \ @@ -547,7 +548,7 @@ affine_span(struct gl_context *ctx, SWspan *span, swrast_texture_image_const(texImg); \ const GLfloat twidth = (GLfloat) texImg->Width; \ const GLfloat theight = (GLfloat) texImg->Height; \ - info.texture = (const GLchan *) swImg->Map; \ + info.texture = (const GLchan *) swImg->ImageSlices[0]; \ info.twidth_log2 = texImg->WidthLog2; \ info.smask = texImg->Width - 1; \ info.tmask = texImg->Height - 1; \ @@ -814,7 +815,7 @@ fast_persp_span(struct gl_context *ctx, SWspan *span, obj->Image[0][obj->BaseLevel]; \ const struct swrast_texture_image *swImg = \ swrast_texture_image_const(texImg); \ - info.texture = (const GLchan *) swImg->Map; \ + info.texture = (const GLchan *) swImg->ImageSlices[0]; \ info.twidth_log2 = texImg->WidthLog2; \ info.smask = texImg->Width - 1; \ info.tmask = texImg->Height - 1; \ @@ -1078,7 +1079,8 @@ _swrast_choose_triangle( struct gl_context *ctx ) && texObj2D->_Swizzle == SWIZZLE_NOOP && swImg->_IsPowerOfTwo && texImg->Border == 0 - && texImg->Width == swImg->RowStride + && (_mesa_format_row_stride(format, texImg->Width) == + swImg->RowStride) && (format == MESA_FORMAT_RGB888 || format == MESA_FORMAT_RGBA8888) && minFilter == magFilter && ctx->Light.Model.ColorControl == GL_SINGLE_COLOR diff --git a/mesalib/src/mesa/swrast/s_triangle.h b/mesalib/src/mesa/swrast/s_triangle.h index 46e23d420..c0cbb3927 100644 --- a/mesalib/src/mesa/swrast/s_triangle.h +++ b/mesalib/src/mesa/swrast/s_triangle.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/swrast/s_tritemp.h b/mesalib/src/mesa/swrast/s_tritemp.h index 797afc41a..f96ddd45b 100644 --- a/mesalib/src/mesa/swrast/s_tritemp.h +++ b/mesalib/src/mesa/swrast/s_tritemp.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/swrast/s_zoom.c b/mesalib/src/mesa/swrast/s_zoom.c index 3b309a251..01276f4e9 100644 --- a/mesalib/src/mesa/swrast/s_zoom.c +++ b/mesalib/src/mesa/swrast/s_zoom.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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 "main/glheader.h" diff --git a/mesalib/src/mesa/swrast/s_zoom.h b/mesalib/src/mesa/swrast/s_zoom.h index 1955e7e88..a1441e81e 100644 --- a/mesalib/src/mesa/swrast/s_zoom.h +++ b/mesalib/src/mesa/swrast/s_zoom.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ #ifndef S_ZOOM_H diff --git a/mesalib/src/mesa/swrast/swrast.h b/mesalib/src/mesa/swrast/swrast.h index 82555ae6a..359a985fd 100644 --- a/mesalib/src/mesa/swrast/swrast.h +++ b/mesalib/src/mesa/swrast/swrast.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. * */ @@ -217,7 +218,7 @@ extern GLboolean _swrast_alloc_texture_image_buffer(struct gl_context *ctx, struct gl_texture_image *texImage); -extern void +extern GLboolean _swrast_init_texture_image(struct gl_texture_image *texImage); extern void @@ -269,15 +270,7 @@ _swrast_render_texture(struct gl_context *ctx, extern void _swrast_finish_render_texture(struct gl_context *ctx, - struct gl_renderbuffer_attachment *att); - - - -extern GLboolean -_swrast_AllocTextureStorage(struct gl_context *ctx, - struct gl_texture_object *texObj, - GLsizei levels, GLsizei width, - GLsizei height, GLsizei depth); + struct gl_renderbuffer *rb); /** diff --git a/mesalib/src/mesa/swrast_setup/ss_context.c b/mesalib/src/mesa/swrast_setup/ss_context.c index 5847a7682..0c40683a5 100644 --- a/mesalib/src/mesa/swrast_setup/ss_context.c +++ b/mesalib/src/mesa/swrast_setup/ss_context.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> diff --git a/mesalib/src/mesa/swrast_setup/ss_context.h b/mesalib/src/mesa/swrast_setup/ss_context.h index ecc1f5fd6..29de33232 100644 --- a/mesalib/src/mesa/swrast_setup/ss_context.h +++ b/mesalib/src/mesa/swrast_setup/ss_context.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> diff --git a/mesalib/src/mesa/swrast_setup/ss_triangle.c b/mesalib/src/mesa/swrast_setup/ss_triangle.c index 5f4a997ee..c8378fc8b 100644 --- a/mesalib/src/mesa/swrast_setup/ss_triangle.c +++ b/mesalib/src/mesa/swrast_setup/ss_triangle.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> diff --git a/mesalib/src/mesa/swrast_setup/ss_triangle.h b/mesalib/src/mesa/swrast_setup/ss_triangle.h index a027f4826..2fcc6d4dc 100644 --- a/mesalib/src/mesa/swrast_setup/ss_triangle.h +++ b/mesalib/src/mesa/swrast_setup/ss_triangle.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> diff --git a/mesalib/src/mesa/swrast_setup/ss_tritmp.h b/mesalib/src/mesa/swrast_setup/ss_tritmp.h index 11742067f..a44fb24f2 100644 --- a/mesalib/src/mesa/swrast_setup/ss_tritmp.h +++ b/mesalib/src/mesa/swrast_setup/ss_tritmp.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> diff --git a/mesalib/src/mesa/swrast_setup/ss_vb.h b/mesalib/src/mesa/swrast_setup/ss_vb.h index 05e665b5c..72c077b92 100644 --- a/mesalib/src/mesa/swrast_setup/ss_vb.h +++ b/mesalib/src/mesa/swrast_setup/ss_vb.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> diff --git a/mesalib/src/mesa/swrast_setup/swrast_setup.h b/mesalib/src/mesa/swrast_setup/swrast_setup.h index 1d87ec108..e453e56ae 100644 --- a/mesalib/src/mesa/swrast_setup/swrast_setup.h +++ b/mesalib/src/mesa/swrast_setup/swrast_setup.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> diff --git a/mesalib/src/mesa/tnl/t_context.c b/mesalib/src/mesa/tnl/t_context.c index ed31b9c45..77f1c1bce 100644 --- a/mesalib/src/mesa/tnl/t_context.c +++ b/mesalib/src/mesa/tnl/t_context.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> diff --git a/mesalib/src/mesa/tnl/t_context.h b/mesalib/src/mesa/tnl/t_context.h index c9ff1246d..4ebc31261 100644 --- a/mesalib/src/mesa/tnl/t_context.h +++ b/mesalib/src/mesa/tnl/t_context.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** diff --git a/mesalib/src/mesa/tnl/t_draw.c b/mesalib/src/mesa/tnl/t_draw.c index 0631eb183..08cd1d1ea 100644 --- a/mesalib/src/mesa/tnl/t_draw.c +++ b/mesalib/src/mesa/tnl/t_draw.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> diff --git a/mesalib/src/mesa/tnl/t_pipeline.c b/mesalib/src/mesa/tnl/t_pipeline.c index 806d9ca6e..7f09af7f1 100644 --- a/mesalib/src/mesa/tnl/t_pipeline.c +++ b/mesalib/src/mesa/tnl/t_pipeline.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> diff --git a/mesalib/src/mesa/tnl/t_pipeline.h b/mesalib/src/mesa/tnl/t_pipeline.h index 0eb03395c..35cd0afe3 100644 --- a/mesalib/src/mesa/tnl/t_pipeline.h +++ b/mesalib/src/mesa/tnl/t_pipeline.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> diff --git a/mesalib/src/mesa/tnl/t_rasterpos.c b/mesalib/src/mesa/tnl/t_rasterpos.c index 1673b81ef..269a7162e 100644 --- a/mesalib/src/mesa/tnl/t_rasterpos.c +++ b/mesalib/src/mesa/tnl/t_rasterpos.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/tnl/t_vb_cliptmp.h b/mesalib/src/mesa/tnl/t_vb_cliptmp.h index 0b45bc534..4dc3320c6 100644 --- a/mesalib/src/mesa/tnl/t_vb_cliptmp.h +++ b/mesalib/src/mesa/tnl/t_vb_cliptmp.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> diff --git a/mesalib/src/mesa/tnl/t_vb_fog.c b/mesalib/src/mesa/tnl/t_vb_fog.c index 134cae1c7..c011ae785 100644 --- a/mesalib/src/mesa/tnl/t_vb_fog.c +++ b/mesalib/src/mesa/tnl/t_vb_fog.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> diff --git a/mesalib/src/mesa/tnl/t_vb_light.c b/mesalib/src/mesa/tnl/t_vb_light.c index 39ba49685..133894853 100644 --- a/mesalib/src/mesa/tnl/t_vb_light.c +++ b/mesalib/src/mesa/tnl/t_vb_light.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/tnl/t_vb_lighttmp.h b/mesalib/src/mesa/tnl/t_vb_lighttmp.h index 1944e5ddc..5679640c9 100644 --- a/mesalib/src/mesa/tnl/t_vb_lighttmp.h +++ b/mesalib/src/mesa/tnl/t_vb_lighttmp.h @@ -17,14 +17,14 @@ * 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 - * BRIAN PAUL 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. + * 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: - * Brian Paul - * Keith Whitwell <keith@tungstengraphics.com> + * Brian Paul Keith Whitwell <keith@tungstengraphics.com> */ diff --git a/mesalib/src/mesa/tnl/t_vb_normals.c b/mesalib/src/mesa/tnl/t_vb_normals.c index c19b48e51..519c90d8e 100644 --- a/mesalib/src/mesa/tnl/t_vb_normals.c +++ b/mesalib/src/mesa/tnl/t_vb_normals.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> diff --git a/mesalib/src/mesa/tnl/t_vb_points.c b/mesalib/src/mesa/tnl/t_vb_points.c index 0e33b691e..932194d75 100644 --- a/mesalib/src/mesa/tnl/t_vb_points.c +++ b/mesalib/src/mesa/tnl/t_vb_points.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Brian Paul diff --git a/mesalib/src/mesa/tnl/t_vb_program.c b/mesalib/src/mesa/tnl/t_vb_program.c index 452285f6b..5ade54343 100644 --- a/mesalib/src/mesa/tnl/t_vb_program.c +++ b/mesalib/src/mesa/tnl/t_vb_program.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ @@ -259,7 +260,7 @@ map_textures(struct gl_context *ctx, const struct gl_vertex_program *vp) { GLuint u; - for (u = 0; u < ctx->Const.MaxVertexTextureImageUnits; u++) { + for (u = 0; u < ctx->Const.VertexProgram.MaxTextureImageUnits; u++) { if (vp->Base.TexturesUsed[u]) { /* Note: _Current *should* correspond to the target indicated * in TexturesUsed[u]. @@ -278,7 +279,7 @@ unmap_textures(struct gl_context *ctx, const struct gl_vertex_program *vp) { GLuint u; - for (u = 0; u < ctx->Const.MaxVertexTextureImageUnits; u++) { + for (u = 0; u < ctx->Const.VertexProgram.MaxTextureImageUnits; u++) { if (vp->Base.TexturesUsed[u]) { /* Note: _Current *should* correspond to the target indicated * in TexturesUsed[u]. diff --git a/mesalib/src/mesa/tnl/t_vb_render.c b/mesalib/src/mesa/tnl/t_vb_render.c index cb3192132..4d42bcd3e 100644 --- a/mesalib/src/mesa/tnl/t_vb_render.c +++ b/mesalib/src/mesa/tnl/t_vb_render.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> diff --git a/mesalib/src/mesa/tnl/t_vb_rendertmp.h b/mesalib/src/mesa/tnl/t_vb_rendertmp.h index 4ed485a7b..1c6470cea 100644 --- a/mesalib/src/mesa/tnl/t_vb_rendertmp.h +++ b/mesalib/src/mesa/tnl/t_vb_rendertmp.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> diff --git a/mesalib/src/mesa/tnl/t_vb_texgen.c b/mesalib/src/mesa/tnl/t_vb_texgen.c index 8ba67f3c0..881710858 100644 --- a/mesalib/src/mesa/tnl/t_vb_texgen.c +++ b/mesalib/src/mesa/tnl/t_vb_texgen.c @@ -17,13 +17,13 @@ * 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 - * BRIAN PAUL 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. + * 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: - * Brian Paul - * Keith Whitwell <keith@tungstengraphics.com> + * Brian Paul Keith Whitwell <keith@tungstengraphics.com> */ /* diff --git a/mesalib/src/mesa/tnl/t_vb_texmat.c b/mesalib/src/mesa/tnl/t_vb_texmat.c index 91bb0f797..f3e317b33 100644 --- a/mesalib/src/mesa/tnl/t_vb_texmat.c +++ b/mesalib/src/mesa/tnl/t_vb_texmat.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> diff --git a/mesalib/src/mesa/tnl/t_vb_vertex.c b/mesalib/src/mesa/tnl/t_vb_vertex.c index 8f296f54b..4cb8c06b2 100644 --- a/mesalib/src/mesa/tnl/t_vb_vertex.c +++ b/mesalib/src/mesa/tnl/t_vb_vertex.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> diff --git a/mesalib/src/mesa/tnl/t_vertex.c b/mesalib/src/mesa/tnl/t_vertex.c index ce3e32165..c7a745ed7 100644 --- a/mesalib/src/mesa/tnl/t_vertex.c +++ b/mesalib/src/mesa/tnl/t_vertex.c @@ -156,9 +156,11 @@ static void choose_interp_func( struct gl_context *ctx, GLboolean force_boundary ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL || + ctx->Polygon.BackMode != GL_FILL); + GLboolean twosided = ctx->Light.Enabled && ctx->Light.Model.TwoSide; - if (vtx->need_extras && - (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) { + if (vtx->need_extras && (twosided || unfilled)) { vtx->interp = _tnl_generic_interp_extras; } else { vtx->interp = _tnl_generic_interp; @@ -171,9 +173,12 @@ static void choose_interp_func( struct gl_context *ctx, static void choose_copy_pv_func( struct gl_context *ctx, GLuint edst, GLuint esrc ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL || + ctx->Polygon.BackMode != GL_FILL); - if (vtx->need_extras && - (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) { + GLboolean twosided = ctx->Light.Enabled && ctx->Light.Model.TwoSide; + + if (vtx->need_extras && (twosided || unfilled)) { vtx->copy_pv = _tnl_generic_copy_pv_extras; } else { vtx->copy_pv = _tnl_generic_copy_pv; diff --git a/mesalib/src/mesa/tnl/tnl.h b/mesalib/src/mesa/tnl/tnl.h index 958322887..d67a3a71d 100644 --- a/mesalib/src/mesa/tnl/tnl.h +++ b/mesalib/src/mesa/tnl/tnl.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> diff --git a/mesalib/src/mesa/vbo/vbo.h b/mesalib/src/mesa/vbo/vbo.h index 49dab2314..08c67d67d 100644 --- a/mesalib/src/mesa/vbo/vbo.h +++ b/mesalib/src/mesa/vbo/vbo.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** @@ -32,6 +33,7 @@ #ifndef _VBO_H #define _VBO_H +#include <stdbool.h> #include "main/glheader.h" struct gl_client_array; @@ -72,6 +74,15 @@ void _vbo_DestroyContext( struct gl_context *ctx ); void _vbo_InvalidateState( struct gl_context *ctx, GLuint new_state ); +void +vbo_initialize_exec_dispatch(const struct gl_context *ctx, + struct _glapi_table *exec); + +void +vbo_initialize_save_dispatch(const struct gl_context *ctx, + struct _glapi_table *exec); + + typedef void (*vbo_draw_func)( struct gl_context *ctx, const struct _mesa_prim *prims, GLuint nr_prims, @@ -160,6 +171,15 @@ vbo_count_tessellated_primitives(GLenum mode, GLuint count, GLuint num_instances); void +vbo_try_prim_conversion(struct _mesa_prim *p); + +bool +vbo_can_merge_prims(const struct _mesa_prim *p0, const struct _mesa_prim *p1); + +void +vbo_merge_prims(struct _mesa_prim *p0, const struct _mesa_prim *p1); + +void vbo_sw_primitive_restart(struct gl_context *ctx, const struct _mesa_prim *prim, GLuint nr_prims, diff --git a/mesalib/src/mesa/vbo/vbo_context.c b/mesalib/src/mesa/vbo/vbo_context.c index 7eda31e8f..4c3c9c090 100644 --- a/mesalib/src/mesa/vbo/vbo_context.c +++ b/mesalib/src/mesa/vbo/vbo_context.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> diff --git a/mesalib/src/mesa/vbo/vbo_context.h b/mesalib/src/mesa/vbo/vbo_context.h index 1ff6ec000..ced742033 100644 --- a/mesalib/src/mesa/vbo/vbo_context.h +++ b/mesalib/src/mesa/vbo/vbo_context.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** @@ -51,7 +52,6 @@ #ifndef _VBO_CONTEXT_H #define _VBO_CONTEXT_H -#include "main/mfeatures.h" #include "vbo.h" #include "vbo_attrib.h" #include "vbo_exec.h" diff --git a/mesalib/src/mesa/vbo/vbo_exec.c b/mesalib/src/mesa/vbo/vbo_exec.c index 5827f90c3..c56a14212 100644 --- a/mesalib/src/mesa/vbo/vbo_exec.c +++ b/mesalib/src/mesa/vbo/vbo_exec.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> @@ -47,7 +48,6 @@ void vbo_exec_init( struct gl_context *ctx ) return; vbo_exec_vtx_init( exec ); - vbo_exec_array_init( exec ); ctx->Driver.NeedFlush = 0; ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END; @@ -68,7 +68,6 @@ void vbo_exec_destroy( struct gl_context *ctx ) } vbo_exec_vtx_destroy( exec ); - vbo_exec_array_destroy( exec ); } @@ -79,10 +78,26 @@ void vbo_exec_destroy( struct gl_context *ctx ) */ void vbo_exec_invalidate_state( struct gl_context *ctx, GLuint new_state ) { - struct vbo_exec_context *exec = &vbo_context(ctx)->exec; + struct vbo_context *vbo = vbo_context(ctx); + struct vbo_exec_context *exec = &vbo->exec; - if (new_state & (_NEW_PROGRAM|_NEW_ARRAY)) { + if (!exec->validating && new_state & (_NEW_PROGRAM|_NEW_ARRAY)) { exec->array.recalculate_inputs = GL_TRUE; + + /* If we ended up here because a VAO was deleted, the _DrawArrays + * pointer which pointed to the VAO might be invalid now, so set it + * to NULL. This prevents crashes in driver functions like Clear + * where driver state validation might occur, but the vbo module is + * still in an invalid state. + * + * Drivers should skip vertex array state validation if _DrawArrays + * is NULL. It also has no effect on performance, because attrib + * bindings will be recalculated anyway. + */ + if (vbo->last_draw_method == DRAW_ARRAYS) { + ctx->Array._DrawArrays = NULL; + vbo->last_draw_method = DRAW_NONE; + } } if (new_state & _NEW_EVAL) @@ -142,3 +157,102 @@ vbo_count_tessellated_primitives(GLenum mode, GLuint count, } return num_primitives * num_instances; } + + + +/** + * In some degenarate cases we can improve our ability to merge + * consecutive primitives. For example: + * glBegin(GL_LINE_STRIP); + * glVertex(1); + * glVertex(1); + * glEnd(); + * glBegin(GL_LINE_STRIP); + * glVertex(1); + * glVertex(1); + * glEnd(); + * Can be merged as a GL_LINES prim with four vertices. + * + * This function converts 2-vertex line strips/loops into GL_LINES, etc. + */ +void +vbo_try_prim_conversion(struct _mesa_prim *p) +{ + if (p->mode == GL_LINE_STRIP && p->count == 2) { + /* convert 2-vertex line strip to a separate line */ + p->mode = GL_LINES; + } + else if ((p->mode == GL_TRIANGLE_STRIP || p->mode == GL_TRIANGLE_FAN) + && p->count == 3) { + /* convert 3-vertex tri strip or fan to a separate triangle */ + p->mode = GL_TRIANGLES; + } + + /* Note: we can't convert a 4-vertex quad strip to a separate quad + * because the vertex ordering is different. We'd have to muck + * around in the vertex data to make it work. + */ +} + + +/** + * Helper function for determining if two subsequent glBegin/glEnd + * primitives can be combined. This is only possible for GL_POINTS, + * GL_LINES, GL_TRIANGLES and GL_QUADS. + * If we return true, it means that we can concatenate p1 onto p0 (and + * discard p1). + */ +bool +vbo_can_merge_prims(const struct _mesa_prim *p0, const struct _mesa_prim *p1) +{ + if (!p0->begin || + !p1->begin || + !p0->end || + !p1->end) + return false; + + /* The prim mode must match (ex: both GL_TRIANGLES) */ + if (p0->mode != p1->mode) + return false; + + /* p1's vertices must come right after p0 */ + if (p0->start + p0->count != p1->start) + return false; + + if (p0->basevertex != p1->basevertex || + p0->num_instances != p1->num_instances || + p0->base_instance != p1->base_instance) + return false; + + /* can always merge subsequent GL_POINTS primitives */ + if (p0->mode == GL_POINTS) + return true; + + /* independent lines with no extra vertices */ + if (p0->mode == GL_LINES && p0->count % 2 == 0 && p1->count % 2 == 0) + return true; + + /* independent tris */ + if (p0->mode == GL_TRIANGLES && p0->count % 3 == 0 && p1->count % 3 == 0) + return true; + + /* independent quads */ + if (p0->mode == GL_QUADS && p0->count % 4 == 0 && p1->count % 4 == 0) + return true; + + return false; +} + + +/** + * If we've determined that p0 and p1 can be merged, this function + * concatenates p1 onto p0. + */ +void +vbo_merge_prims(struct _mesa_prim *p0, const struct _mesa_prim *p1) +{ + assert(vbo_can_merge_prims(p0, p1)); + + p0->count += p1->count; + p0->end = p1->end; +} diff --git a/mesalib/src/mesa/vbo/vbo_exec.h b/mesalib/src/mesa/vbo/vbo_exec.h index 96cf4c82b..01e2856f2 100644 --- a/mesalib/src/mesa/vbo/vbo_exec.h +++ b/mesalib/src/mesa/vbo/vbo_exec.h @@ -34,7 +34,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef __VBO_EXEC_H__ #define __VBO_EXEC_H__ -#include "main/mfeatures.h" #include "main/mtypes.h" #include "vbo.h" #include "vbo_attrib.h" @@ -82,6 +81,7 @@ struct vbo_exec_context struct gl_context *ctx; GLvertexformat vtxfmt; GLvertexformat vtxfmt_noop; + GLboolean validating; /**< if we're in the middle of state validation */ struct { struct gl_buffer_object *bufferobj; @@ -152,9 +152,6 @@ void vbo_exec_FlushVertices( struct gl_context *ctx, GLuint flags ); /* Internal functions: */ -void vbo_exec_array_init( struct vbo_exec_context *exec ); -void vbo_exec_array_destroy( struct vbo_exec_context *exec ); - void vbo_exec_vtx_init( struct vbo_exec_context *exec ); void vbo_exec_vtx_destroy( struct vbo_exec_context *exec ); diff --git a/mesalib/src/mesa/vbo/vbo_exec_api.c b/mesalib/src/mesa/vbo/vbo_exec_api.c index 353f8cfde..600398c58 100644 --- a/mesalib/src/mesa/vbo/vbo_exec_api.c +++ b/mesalib/src/mesa/vbo/vbo_exec_api.c @@ -34,7 +34,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/bufferobj.h" #include "main/context.h" #include "main/macros.h" -#include "main/mfeatures.h" #include "main/vtxfmt.h" #include "main/dlist.h" #include "main/eval.h" @@ -75,7 +74,7 @@ static void vbo_exec_wrap_buffers( struct vbo_exec_context *exec ) GLuint last_begin = exec->vtx.prim[exec->vtx.prim_count-1].begin; GLuint last_count; - if (exec->ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { + if (_mesa_inside_begin_end(exec->ctx)) { GLint i = exec->vtx.prim_count - 1; assert(i >= 0); exec->vtx.prim[i].count = (exec->vtx.vert_count - @@ -97,7 +96,7 @@ static void vbo_exec_wrap_buffers( struct vbo_exec_context *exec ) */ assert(exec->vtx.prim_count == 0); - if (exec->ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { + if (_mesa_inside_begin_end(exec->ctx)) { exec->vtx.prim[0].mode = exec->ctx->Driver.CurrentExecPrimitive; exec->vtx.prim[0].start = 0; exec->vtx.prim[0].count = 0; @@ -270,7 +269,7 @@ vbo_exec_wrap_upgrade_vertex(struct vbo_exec_context *exec, /* Heuristic: Attempt to isolate attributes received outside * begin/end so that they don't bloat the vertices. */ - if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END && + if (!_mesa_inside_begin_end(ctx) && !oldSize && lastcount > 8 && exec->vtx.vertex_size) { vbo_exec_copy_to_current( exec ); reset_attrfv( exec ); @@ -655,132 +654,6 @@ static void GLAPIENTRY vbo_exec_EvalPoint2( GLint i, GLint j ) } -static void GLAPIENTRY -vbo_exec_EvalMesh1(GLenum mode, GLint i1, GLint i2) -{ - GET_CURRENT_CONTEXT(ctx); - GLint i; - GLfloat u, du; - GLenum prim; - - switch (mode) { - case GL_POINT: - prim = GL_POINTS; - break; - case GL_LINE: - prim = GL_LINE_STRIP; - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glEvalMesh1(mode)" ); - return; - } - - /* No effect if vertex maps disabled. - */ - if (!ctx->Eval.Map1Vertex4 && - !ctx->Eval.Map1Vertex3) - return; - - du = ctx->Eval.MapGrid1du; - u = ctx->Eval.MapGrid1u1 + i1 * du; - - CALL_Begin(GET_DISPATCH(), (prim)); - for (i=i1;i<=i2;i++,u+=du) { - CALL_EvalCoord1f(GET_DISPATCH(), (u)); - } - CALL_End(GET_DISPATCH(), ()); -} - - -static void GLAPIENTRY -vbo_exec_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) -{ - GET_CURRENT_CONTEXT(ctx); - GLfloat u, du, v, dv, v1, u1; - GLint i, j; - - switch (mode) { - case GL_POINT: - case GL_LINE: - case GL_FILL: - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glEvalMesh2(mode)" ); - return; - } - - /* No effect if vertex maps disabled. - */ - if (!ctx->Eval.Map2Vertex4 && - !ctx->Eval.Map2Vertex3) - return; - - du = ctx->Eval.MapGrid2du; - dv = ctx->Eval.MapGrid2dv; - v1 = ctx->Eval.MapGrid2v1 + j1 * dv; - u1 = ctx->Eval.MapGrid2u1 + i1 * du; - - switch (mode) { - case GL_POINT: - CALL_Begin(GET_DISPATCH(), (GL_POINTS)); - for (v=v1,j=j1;j<=j2;j++,v+=dv) { - for (u=u1,i=i1;i<=i2;i++,u+=du) { - CALL_EvalCoord2f(GET_DISPATCH(), (u, v)); - } - } - CALL_End(GET_DISPATCH(), ()); - break; - case GL_LINE: - for (v=v1,j=j1;j<=j2;j++,v+=dv) { - CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP)); - for (u=u1,i=i1;i<=i2;i++,u+=du) { - CALL_EvalCoord2f(GET_DISPATCH(), (u, v)); - } - CALL_End(GET_DISPATCH(), ()); - } - for (u=u1,i=i1;i<=i2;i++,u+=du) { - CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP)); - for (v=v1,j=j1;j<=j2;j++,v+=dv) { - CALL_EvalCoord2f(GET_DISPATCH(), (u, v)); - } - CALL_End(GET_DISPATCH(), ()); - } - break; - case GL_FILL: - for (v=v1,j=j1;j<j2;j++,v+=dv) { - CALL_Begin(GET_DISPATCH(), (GL_TRIANGLE_STRIP)); - for (u=u1,i=i1;i<=i2;i++,u+=du) { - CALL_EvalCoord2f(GET_DISPATCH(), (u, v)); - CALL_EvalCoord2f(GET_DISPATCH(), (u, v+dv)); - } - CALL_End(GET_DISPATCH(), ()); - } - break; - } -} - - -/** - * Execute a glRectf() function. This is not suitable for GL_COMPILE - * modes (as the test for outside begin/end is not compiled), - * but may be useful for drivers in circumstances which exclude - * display list interactions. - * - * (None of the functions in this file are suitable for GL_COMPILE - * modes). - */ -static void GLAPIENTRY -vbo_exec_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) -{ - CALL_Begin(GET_DISPATCH(), (GL_QUADS)); - CALL_Vertex2f(GET_DISPATCH(), (x1, y1)); - CALL_Vertex2f(GET_DISPATCH(), (x2, y1)); - CALL_Vertex2f(GET_DISPATCH(), (x2, y2)); - CALL_Vertex2f(GET_DISPATCH(), (x1, y2)); - CALL_End(GET_DISPATCH(), ()); -} - - /** * Called via glBegin. */ @@ -790,7 +663,7 @@ static void GLAPIENTRY vbo_exec_Begin( GLenum mode ) struct vbo_exec_context *exec = &vbo_context(ctx)->exec; int i; - if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { + if (_mesa_inside_begin_end(ctx)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBegin"); return; } @@ -846,6 +719,34 @@ static void GLAPIENTRY vbo_exec_Begin( GLenum mode ) /** + * Try to merge / concatenate the two most recent VBO primitives. + */ +static void +try_vbo_merge(struct vbo_exec_context *exec) +{ + struct _mesa_prim *cur = &exec->vtx.prim[exec->vtx.prim_count - 1]; + + assert(exec->vtx.prim_count >= 1); + + vbo_try_prim_conversion(cur); + + if (exec->vtx.prim_count >= 2) { + struct _mesa_prim *prev = &exec->vtx.prim[exec->vtx.prim_count - 2]; + assert(prev == cur - 1); + + if (vbo_can_merge_prims(prev, cur)) { + assert(cur->begin); + assert(cur->end); + assert(prev->begin); + assert(prev->end); + vbo_merge_prims(prev, cur); + exec->vtx.prim_count--; /* drop the last primitive */ + } + } +} + + +/** * Called via glEnd. */ static void GLAPIENTRY vbo_exec_End( void ) @@ -853,7 +754,7 @@ static void GLAPIENTRY vbo_exec_End( void ) GET_CURRENT_CONTEXT( ctx ); struct vbo_exec_context *exec = &vbo_context(ctx)->exec; - if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END) { + if (!_mesa_inside_begin_end(ctx)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glEnd"); return; } @@ -871,6 +772,8 @@ static void GLAPIENTRY vbo_exec_End( void ) exec->vtx.prim[i].end = 1; exec->vtx.prim[i].count = idx - exec->vtx.prim[i].start; + + try_vbo_merge(exec); } ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END; @@ -911,16 +814,21 @@ static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec ) struct gl_context *ctx = exec->ctx; GLvertexformat *vfmt = &exec->vtxfmt; - _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_); + vfmt->ArrayElement = _ae_ArrayElement; vfmt->Begin = vbo_exec_Begin; vfmt->End = vbo_exec_End; vfmt->PrimitiveRestartNV = vbo_exec_PrimitiveRestartNV; - _MESA_INIT_DLIST_VTXFMT(vfmt, _mesa_); - _MESA_INIT_EVAL_VTXFMT(vfmt, vbo_exec_); + vfmt->CallList = _mesa_CallList; + vfmt->CallLists = _mesa_CallLists; - vfmt->Rectf = vbo_exec_Rectf; + vfmt->EvalCoord1f = vbo_exec_EvalCoord1f; + vfmt->EvalCoord1fv = vbo_exec_EvalCoord1fv; + vfmt->EvalCoord2f = vbo_exec_EvalCoord2f; + vfmt->EvalCoord2fv = vbo_exec_EvalCoord2fv; + vfmt->EvalPoint1 = vbo_exec_EvalPoint1; + vfmt->EvalPoint2 = vbo_exec_EvalPoint2; /* from attrib_tmp.h: */ @@ -1243,7 +1151,7 @@ void vbo_exec_FlushVertices( struct gl_context *ctx, GLuint flags ) assert(exec->flush_call_depth == 1); #endif - if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { + if (_mesa_inside_begin_end(ctx)) { /* We've had glBegin but not glEnd! */ #ifdef DEBUG exec->flush_call_depth--; diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c index 7e61f7b31..9dadd0421 100644 --- a/mesalib/src/mesa/vbo/vbo_exec_array.c +++ b/mesalib/src/mesa/vbo/vbo_exec_array.c @@ -30,6 +30,7 @@ #include "main/context.h" #include "main/state.h" #include "main/api_validate.h" +#include "main/dispatch.h" #include "main/varray.h" #include "main/bufferobj.h" #include "main/enums.h" @@ -91,7 +92,7 @@ vbo_get_minmax_index(struct gl_context *ctx, const GLuint count) { const GLboolean restart = ctx->Array._PrimitiveRestart; - const GLuint restartIndex = ctx->Array._RestartIndex; + const GLuint restartIndex = _mesa_primitive_restart_index(ctx, ib->type); const int index_size = vbo_sizeof_ib_type(ib->type); const char *indices; GLuint i; @@ -501,6 +502,7 @@ vbo_bind_arrays(struct gl_context *ctx) if (exec->array.recalculate_inputs) { recalculate_input_bindings(ctx); + exec->array.recalculate_inputs = GL_FALSE; /* Again... because we may have changed the bitmask of per-vertex varying * attributes. If we regenerate the fixed-function vertex program now @@ -508,10 +510,13 @@ vbo_bind_arrays(struct gl_context *ctx) * need in the shader. */ if (ctx->NewState) { + /* Setting "validating" to TRUE prevents _mesa_update_state from + * invalidating what we just did. + */ + exec->validating = GL_TRUE; _mesa_update_state(ctx); + exec->validating = GL_FALSE; } - - exec->array.recalculate_inputs = GL_FALSE; } } @@ -572,10 +577,10 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start, prim[0].base_instance = baseInstance; /* Implement the primitive restart index */ - if (ctx->Array._PrimitiveRestart && ctx->Array._RestartIndex < count) { + if (ctx->Array.PrimitiveRestart && ctx->Array.RestartIndex < count) { GLuint primCount = 0; - if (ctx->Array._RestartIndex == start) { + if (ctx->Array.RestartIndex == start) { /* special case: RestartIndex at beginning */ if (count > 1) { prim[0].start = start + 1; @@ -583,7 +588,7 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start, primCount = 1; } } - else if (ctx->Array._RestartIndex == start + count - 1) { + else if (ctx->Array.RestartIndex == start + count - 1) { /* special case: RestartIndex at end */ if (count > 1) { prim[0].start = start; @@ -594,10 +599,10 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start, else { /* general case: RestartIndex in middle, split into two prims */ prim[0].start = start; - prim[0].count = ctx->Array._RestartIndex - start; + prim[0].count = ctx->Array.RestartIndex - start; prim[1] = prim[0]; - prim[1].start = ctx->Array._RestartIndex + 1; + prim[1].start = ctx->Array.RestartIndex + 1; prim[1].count = count - prim[1].start; primCount = 2; @@ -627,6 +632,128 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start, } +/** + * Execute a glRectf() function. + */ +static void GLAPIENTRY +vbo_exec_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + CALL_Begin(GET_DISPATCH(), (GL_QUADS)); + CALL_Vertex2f(GET_DISPATCH(), (x1, y1)); + CALL_Vertex2f(GET_DISPATCH(), (x2, y1)); + CALL_Vertex2f(GET_DISPATCH(), (x2, y2)); + CALL_Vertex2f(GET_DISPATCH(), (x1, y2)); + CALL_End(GET_DISPATCH(), ()); +} + + +static void GLAPIENTRY +vbo_exec_EvalMesh1(GLenum mode, GLint i1, GLint i2) +{ + GET_CURRENT_CONTEXT(ctx); + GLint i; + GLfloat u, du; + GLenum prim; + + switch (mode) { + case GL_POINT: + prim = GL_POINTS; + break; + case GL_LINE: + prim = GL_LINE_STRIP; + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glEvalMesh1(mode)" ); + return; + } + + /* No effect if vertex maps disabled. + */ + if (!ctx->Eval.Map1Vertex4 && + !ctx->Eval.Map1Vertex3) + return; + + du = ctx->Eval.MapGrid1du; + u = ctx->Eval.MapGrid1u1 + i1 * du; + + CALL_Begin(GET_DISPATCH(), (prim)); + for (i=i1;i<=i2;i++,u+=du) { + CALL_EvalCoord1f(GET_DISPATCH(), (u)); + } + CALL_End(GET_DISPATCH(), ()); +} + + +static void GLAPIENTRY +vbo_exec_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat u, du, v, dv, v1, u1; + GLint i, j; + + switch (mode) { + case GL_POINT: + case GL_LINE: + case GL_FILL: + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glEvalMesh2(mode)" ); + return; + } + + /* No effect if vertex maps disabled. + */ + if (!ctx->Eval.Map2Vertex4 && + !ctx->Eval.Map2Vertex3) + return; + + du = ctx->Eval.MapGrid2du; + dv = ctx->Eval.MapGrid2dv; + v1 = ctx->Eval.MapGrid2v1 + j1 * dv; + u1 = ctx->Eval.MapGrid2u1 + i1 * du; + + switch (mode) { + case GL_POINT: + CALL_Begin(GET_DISPATCH(), (GL_POINTS)); + for (v=v1,j=j1;j<=j2;j++,v+=dv) { + for (u=u1,i=i1;i<=i2;i++,u+=du) { + CALL_EvalCoord2f(GET_DISPATCH(), (u, v)); + } + } + CALL_End(GET_DISPATCH(), ()); + break; + case GL_LINE: + for (v=v1,j=j1;j<=j2;j++,v+=dv) { + CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP)); + for (u=u1,i=i1;i<=i2;i++,u+=du) { + CALL_EvalCoord2f(GET_DISPATCH(), (u, v)); + } + CALL_End(GET_DISPATCH(), ()); + } + for (u=u1,i=i1;i<=i2;i++,u+=du) { + CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP)); + for (v=v1,j=j1;j<=j2;j++,v+=dv) { + CALL_EvalCoord2f(GET_DISPATCH(), (u, v)); + } + CALL_End(GET_DISPATCH(), ()); + } + break; + case GL_FILL: + for (v=v1,j=j1;j<j2;j++,v+=dv) { + CALL_Begin(GET_DISPATCH(), (GL_TRIANGLE_STRIP)); + for (u=u1,i=i1;i<=i2;i++,u+=du) { + CALL_EvalCoord2f(GET_DISPATCH(), (u, v)); + CALL_EvalCoord2f(GET_DISPATCH(), (u, v+dv)); + } + CALL_End(GET_DISPATCH(), ()); + } + break; + } +} + /** * Called from glDrawArrays when in immediate mode (not display list mode). @@ -859,6 +986,7 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, { static GLuint warnCount = 0; GLboolean index_bounds_valid = GL_TRUE; + GLuint max_element; GET_CURRENT_CONTEXT(ctx); if (MESA_VERBOSE & VERBOSE_DRAW) @@ -871,8 +999,27 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, type, indices, basevertex )) return; + if (ctx->Const.CheckArrayBounds) { + /* _MaxElement was computed, so we can use it. + * This path is used for drivers which need strict bounds checking. + */ + max_element = ctx->Array.ArrayObj->_MaxElement; + } + else { + /* Generally, hardware drivers don't need to know the buffer bounds + * if all vertex attributes are in VBOs. + * However, if none of vertex attributes are in VBOs, _MaxElement + * is always set to some random big number anyway, so bounds checking + * is mostly useless. + * + * This is only useful to catch invalid values in the "end" parameter + * like ~0. + */ + max_element = 2 * 1000 * 1000 * 1000; /* just a big number */ + } + if ((int) end + basevertex < 0 || - start + basevertex >= ctx->Array.ArrayObj->_MaxElement) { + start + basevertex >= max_element) { /* The application requested we draw using a range of indices that's * outside the bounds of the current VBO. This is invalid and appears * to give undefined results. The safest thing to do is to simply @@ -886,7 +1033,7 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, "\trange is outside VBO bounds (max=%u); ignoring.\n" "\tThis should be fixed in the application.", start, end, basevertex, count, type, indices, - ctx->Array.ArrayObj->_MaxElement - 1); + max_element - 1); } index_bounds_valid = GL_FALSE; } @@ -917,7 +1064,7 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, } if ((int) start + basevertex < 0 || - end + basevertex >= ctx->Array.ArrayObj->_MaxElement) + end + basevertex >= max_element) index_bounds_valid = GL_FALSE; #if 0 @@ -1359,40 +1506,50 @@ vbo_exec_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name, vbo_draw_transform_feedback(ctx, mode, obj, stream, primcount); } + /** - * Plug in the immediate-mode vertex array drawing commands into the - * givven vbo_exec_context object. + * Initialize the dispatch table with the VBO functions for drawing. */ void -vbo_exec_array_init( struct vbo_exec_context *exec ) +vbo_initialize_exec_dispatch(const struct gl_context *ctx, + struct _glapi_table *exec) { - exec->vtxfmt.DrawArrays = vbo_exec_DrawArrays; - exec->vtxfmt.DrawElements = vbo_exec_DrawElements; - exec->vtxfmt.DrawRangeElements = vbo_exec_DrawRangeElements; - exec->vtxfmt.MultiDrawElementsEXT = vbo_exec_MultiDrawElements; - exec->vtxfmt.DrawElementsBaseVertex = vbo_exec_DrawElementsBaseVertex; - exec->vtxfmt.DrawRangeElementsBaseVertex = vbo_exec_DrawRangeElementsBaseVertex; - exec->vtxfmt.MultiDrawElementsBaseVertex = vbo_exec_MultiDrawElementsBaseVertex; - exec->vtxfmt.DrawArraysInstanced = vbo_exec_DrawArraysInstanced; - exec->vtxfmt.DrawArraysInstancedBaseInstance = vbo_exec_DrawArraysInstancedBaseInstance; - exec->vtxfmt.DrawElementsInstanced = vbo_exec_DrawElementsInstanced; - exec->vtxfmt.DrawElementsInstancedBaseInstance = vbo_exec_DrawElementsInstancedBaseInstance; - exec->vtxfmt.DrawElementsInstancedBaseVertex = vbo_exec_DrawElementsInstancedBaseVertex; - exec->vtxfmt.DrawElementsInstancedBaseVertexBaseInstance = vbo_exec_DrawElementsInstancedBaseVertexBaseInstance; - exec->vtxfmt.DrawTransformFeedback = vbo_exec_DrawTransformFeedback; - exec->vtxfmt.DrawTransformFeedbackStream = - vbo_exec_DrawTransformFeedbackStream; - exec->vtxfmt.DrawTransformFeedbackInstanced = - vbo_exec_DrawTransformFeedbackInstanced; - exec->vtxfmt.DrawTransformFeedbackStreamInstanced = - vbo_exec_DrawTransformFeedbackStreamInstanced; -} + SET_DrawArrays(exec, vbo_exec_DrawArrays); + SET_DrawElements(exec, vbo_exec_DrawElements); + if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) { + SET_DrawRangeElements(exec, vbo_exec_DrawRangeElements); + } -void -vbo_exec_array_destroy( struct vbo_exec_context *exec ) -{ - /* nothing to do */ + SET_MultiDrawElementsEXT(exec, vbo_exec_MultiDrawElements); + + if (ctx->API == API_OPENGL_COMPAT) { + SET_Rectf(exec, vbo_exec_Rectf); + SET_EvalMesh1(exec, vbo_exec_EvalMesh1); + SET_EvalMesh2(exec, vbo_exec_EvalMesh2); + } + + if (_mesa_is_desktop_gl(ctx)) { + SET_DrawElementsBaseVertex(exec, vbo_exec_DrawElementsBaseVertex); + SET_DrawRangeElementsBaseVertex(exec, vbo_exec_DrawRangeElementsBaseVertex); + SET_MultiDrawElementsBaseVertex(exec, vbo_exec_MultiDrawElementsBaseVertex); + SET_DrawArraysInstancedBaseInstance(exec, vbo_exec_DrawArraysInstancedBaseInstance); + SET_DrawElementsInstancedBaseInstance(exec, vbo_exec_DrawElementsInstancedBaseInstance); + SET_DrawElementsInstancedBaseVertex(exec, vbo_exec_DrawElementsInstancedBaseVertex); + SET_DrawElementsInstancedBaseVertexBaseInstance(exec, vbo_exec_DrawElementsInstancedBaseVertexBaseInstance); + } + + if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) { + SET_DrawArraysInstancedARB(exec, vbo_exec_DrawArraysInstanced); + SET_DrawElementsInstancedARB(exec, vbo_exec_DrawElementsInstanced); + } + + if (_mesa_is_desktop_gl(ctx)) { + SET_DrawTransformFeedback(exec, vbo_exec_DrawTransformFeedback); + SET_DrawTransformFeedbackStream(exec, vbo_exec_DrawTransformFeedbackStream); + SET_DrawTransformFeedbackInstanced(exec, vbo_exec_DrawTransformFeedbackInstanced); + SET_DrawTransformFeedbackStreamInstanced(exec, vbo_exec_DrawTransformFeedbackStreamInstanced); + } } diff --git a/mesalib/src/mesa/vbo/vbo_exec_draw.c b/mesalib/src/mesa/vbo/vbo_exec_draw.c index 9529ce069..6a4f2a98b 100644 --- a/mesalib/src/mesa/vbo/vbo_exec_draw.c +++ b/mesalib/src/mesa/vbo/vbo_exec_draw.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> @@ -30,7 +31,6 @@ #include "main/compiler.h" #include "main/context.h" #include "main/enums.h" -#include "main/mfeatures.h" #include "main/state.h" #include "main/vtxfmt.h" diff --git a/mesalib/src/mesa/vbo/vbo_exec_eval.c b/mesalib/src/mesa/vbo/vbo_exec_eval.c index e6c728476..103b04a01 100644 --- a/mesalib/src/mesa/vbo/vbo_exec_eval.c +++ b/mesalib/src/mesa/vbo/vbo_exec_eval.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> diff --git a/mesalib/src/mesa/vbo/vbo_noop.c b/mesalib/src/mesa/vbo/vbo_noop.c index 2f2200219..f86984589 100644 --- a/mesalib/src/mesa/vbo/vbo_noop.c +++ b/mesalib/src/mesa/vbo/vbo_noop.c @@ -17,9 +17,10 @@ * 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 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. + * 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. */ @@ -29,12 +30,10 @@ #include "main/glheader.h" -#include "main/api_arrayelt.h" #include "main/context.h" #include "main/dispatch.h" #include "main/dlist.h" #include "main/eval.h" -#include "main/mfeatures.h" #include "vbo/vbo_noop.h" static void GLAPIENTRY @@ -332,84 +331,23 @@ _mesa_noop_EvalPoint2(GLint a, GLint b) } static void GLAPIENTRY -_mesa_noop_Begin(GLenum mode) -{ -} - -static void GLAPIENTRY -_mesa_noop_End(void) -{ -} - -static void GLAPIENTRY -_mesa_noop_PrimitiveRestartNV(void) -{ -} - - -static void GLAPIENTRY -_mesa_noop_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) -{ -} - - -static void GLAPIENTRY -_mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count) -{ -} - -static void GLAPIENTRY -_mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type, - const GLvoid * indices) -{ -} - -static void GLAPIENTRY -_mesa_noop_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, - const GLvoid * indices, GLint basevertex) +_mesa_noop_ArrayElement(GLint elem) { } static void GLAPIENTRY -_mesa_noop_DrawRangeElements(GLenum mode, - GLuint start, GLuint end, - GLsizei count, GLenum type, - const GLvoid * indices) -{ -} - -static void GLAPIENTRY -_mesa_noop_MultiDrawElements(GLenum mode, const GLsizei * count, GLenum type, - const GLvoid ** indices, GLsizei primcount) -{ -} - -static void GLAPIENTRY -_mesa_noop_DrawRangeElementsBaseVertex(GLenum mode, - GLuint start, GLuint end, - GLsizei count, GLenum type, - const GLvoid * indices, - GLint basevertex) -{ -} - -static void GLAPIENTRY -_mesa_noop_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei * count, - GLenum type, - const GLvoid * const *indices, - GLsizei primcount, - const GLint * basevertex) +_mesa_noop_Begin(GLenum mode) { } static void GLAPIENTRY -_mesa_noop_EvalMesh1(GLenum mode, GLint i1, GLint i2) +_mesa_noop_End(void) { } static void GLAPIENTRY -_mesa_noop_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) +_mesa_noop_PrimitiveRestartNV(void) { } @@ -422,11 +360,12 @@ _mesa_noop_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) void _mesa_noop_vtxfmt_init(GLvertexformat * vfmt) { - _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_); + vfmt->ArrayElement = _mesa_noop_ArrayElement; vfmt->Begin = _mesa_noop_Begin; - _MESA_INIT_DLIST_VTXFMT(vfmt, _mesa_); + vfmt->CallList = _mesa_CallList; + vfmt->CallLists = _mesa_CallLists; vfmt->Color3f = _mesa_noop_Color3f; vfmt->Color3fv = _mesa_noop_Color3fv; @@ -437,7 +376,12 @@ _mesa_noop_vtxfmt_init(GLvertexformat * vfmt) vfmt->PrimitiveRestartNV = _mesa_noop_PrimitiveRestartNV; - _MESA_INIT_EVAL_VTXFMT(vfmt, _mesa_noop_); + vfmt->EvalCoord1f = _mesa_noop_EvalCoord1f; + vfmt->EvalCoord1fv = _mesa_noop_EvalCoord1fv; + vfmt->EvalCoord2f = _mesa_noop_EvalCoord2f; + vfmt->EvalCoord2fv = _mesa_noop_EvalCoord2fv; + vfmt->EvalPoint1 = _mesa_noop_EvalPoint1; + vfmt->EvalPoint2 = _mesa_noop_EvalPoint2; vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT; vfmt->FogCoordfvEXT = _mesa_noop_FogCoordfvEXT; @@ -486,16 +430,6 @@ _mesa_noop_vtxfmt_init(GLvertexformat * vfmt) vfmt->VertexAttrib3fvARB = _mesa_noop_VertexAttrib3fvARB; vfmt->VertexAttrib4fARB = _mesa_noop_VertexAttrib4fARB; vfmt->VertexAttrib4fvARB = _mesa_noop_VertexAttrib4fvARB; - - vfmt->Rectf = _mesa_noop_Rectf; - - vfmt->DrawArrays = _mesa_noop_DrawArrays; - vfmt->DrawElements = _mesa_noop_DrawElements; - vfmt->DrawRangeElements = _mesa_noop_DrawRangeElements; - vfmt->MultiDrawElementsEXT = _mesa_noop_MultiDrawElements; - vfmt->DrawElementsBaseVertex = _mesa_noop_DrawElementsBaseVertex; - vfmt->DrawRangeElementsBaseVertex = _mesa_noop_DrawRangeElementsBaseVertex; - vfmt->MultiDrawElementsBaseVertex = _mesa_noop_MultiDrawElementsBaseVertex; } diff --git a/mesalib/src/mesa/vbo/vbo_noop.h b/mesalib/src/mesa/vbo/vbo_noop.h index 044d373e8..f61cd5136 100644 --- a/mesalib/src/mesa/vbo/vbo_noop.h +++ b/mesalib/src/mesa/vbo/vbo_noop.h @@ -17,16 +17,16 @@ * 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 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. + * 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. */ #ifndef _API_NOOP_H #define _API_NOOP_H -#include "main/mfeatures.h" #include "main/mtypes.h" diff --git a/mesalib/src/mesa/vbo/vbo_primitive_restart.c b/mesalib/src/mesa/vbo/vbo_primitive_restart.c index a6a0149ca..418f8829d 100644 --- a/mesalib/src/mesa/vbo/vbo_primitive_restart.c +++ b/mesalib/src/mesa/vbo/vbo_primitive_restart.c @@ -31,6 +31,7 @@ #include "main/imports.h" #include "main/bufferobj.h" #include "main/macros.h" +#include "main/varray.h" #include "vbo.h" #include "vbo_context.h" @@ -171,7 +172,7 @@ vbo_sw_primitive_restart(struct gl_context *ctx, GLuint sub_prim_num; GLuint end_index; GLuint sub_end_index; - GLuint restart_index = ctx->Array._RestartIndex; + GLuint restart_index = _mesa_primitive_restart_index(ctx, ib->type); struct _mesa_prim temp_prim; struct vbo_context *vbo = vbo_context(ctx); vbo_draw_func draw_prims_func = vbo->draw_prims; diff --git a/mesalib/src/mesa/vbo/vbo_rebase.c b/mesalib/src/mesa/vbo/vbo_rebase.c index d0bf6c59d..65ab58bf3 100644 --- a/mesalib/src/mesa/vbo/vbo_rebase.c +++ b/mesalib/src/mesa/vbo/vbo_rebase.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> diff --git a/mesalib/src/mesa/vbo/vbo_save.c b/mesalib/src/mesa/vbo/vbo_save.c index ad11b5ddc..305256a3a 100644 --- a/mesalib/src/mesa/vbo/vbo_save.c +++ b/mesalib/src/mesa/vbo/vbo_save.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> @@ -29,7 +30,6 @@ #include "main/mtypes.h" #include "main/bufferobj.h" #include "main/imports.h" -#include "main/mfeatures.h" #include "vbo_context.h" @@ -86,7 +86,7 @@ void vbo_save_init( struct gl_context *ctx ) } } - ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; + ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END; } diff --git a/mesalib/src/mesa/vbo/vbo_save.h b/mesalib/src/mesa/vbo/vbo_save.h index 750117b12..aa075bb31 100644 --- a/mesalib/src/mesa/vbo/vbo_save.h +++ b/mesalib/src/mesa/vbo/vbo_save.h @@ -34,7 +34,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef VBO_SAVE_H #define VBO_SAVE_H -#include "main/mfeatures.h" #include "main/mtypes.h" #include "vbo.h" #include "vbo_attrib.h" @@ -127,10 +126,10 @@ struct vbo_save_context { struct gl_client_array arrays[VBO_ATTRIB_MAX]; const struct gl_client_array *inputs[VBO_ATTRIB_MAX]; - GLubyte attrsz[VBO_ATTRIB_MAX]; - GLenum attrtype[VBO_ATTRIB_MAX]; - GLubyte active_sz[VBO_ATTRIB_MAX]; - GLuint vertex_size; + GLubyte attrsz[VBO_ATTRIB_MAX]; /**< 1, 2, 3 or 4 */ + GLenum attrtype[VBO_ATTRIB_MAX]; /**< GL_FLOAT, GL_INT, etc */ + GLubyte active_sz[VBO_ATTRIB_MAX]; /**< 1, 2, 3 or 4 */ + GLuint vertex_size; /**< size in GLfloats */ GLboolean out_of_memory; /**< True if last VBO allocation failed */ diff --git a/mesalib/src/mesa/vbo/vbo_save_api.c b/mesalib/src/mesa/vbo/vbo_save_api.c index 749071753..26951bd94 100644 --- a/mesalib/src/mesa/vbo/vbo_save_api.c +++ b/mesalib/src/mesa/vbo/vbo_save_api.c @@ -74,7 +74,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/enums.h" #include "main/eval.h" #include "main/macros.h" -#include "main/mfeatures.h" #include "main/api_validate.h" #include "main/api_arrayelt.h" #include "main/vtxfmt.h" @@ -306,9 +305,9 @@ _save_reset_counters(struct gl_context *ctx) * previous prim. */ static void -vbo_merge_prims(struct gl_context *ctx, - struct _mesa_prim *prim_list, - GLuint *prim_count) +merge_prims(struct gl_context *ctx, + struct _mesa_prim *prim_list, + GLuint *prim_count) { GLuint i; struct _mesa_prim *prev_prim = prim_list; @@ -316,19 +315,13 @@ vbo_merge_prims(struct gl_context *ctx, for (i = 1; i < *prim_count; i++) { struct _mesa_prim *this_prim = prim_list + i; - if (this_prim->mode == prev_prim->mode && - this_prim->mode == GL_QUADS && - this_prim->count % 4 == 0 && - prev_prim->count % 4 == 0 && - this_prim->start == prev_prim->start + prev_prim->count && - this_prim->basevertex == prev_prim->basevertex && - this_prim->num_instances == prev_prim->num_instances && - this_prim->base_instance == prev_prim->base_instance) { + vbo_try_prim_conversion(this_prim); + + if (vbo_can_merge_prims(prev_prim, this_prim)) { /* We've found a prim that just extend the previous one. Tack it * onto the previous one, and let this primitive struct get dropped. */ - prev_prim->count += this_prim->count; - prev_prim->end = this_prim->end; + vbo_merge_prims(prev_prim, this_prim); continue; } @@ -421,7 +414,7 @@ _save_compile_vertex_list(struct gl_context *ctx) */ save->copied.nr = _save_copy_vertices(ctx, node, save->buffer); - vbo_merge_prims(ctx, node->prim, &node->prim_count); + merge_prims(ctx, node->prim, &node->prim_count); /* Deal with GL_COMPILE_AND_EXECUTE: */ @@ -476,6 +469,8 @@ _save_compile_vertex_list(struct gl_context *ctx) /** + * This is called when we fill a vertex buffer before we hit a glEnd(). + * We * TODO -- If no new vertices have been stored, don't bother saving it. */ static void @@ -584,7 +579,11 @@ _save_copy_from_current(struct gl_context *ctx) } -/* Flush existing data, set new attrib size, replay copied vertices. +/** + * Called when we increase the size of a vertex attribute. For example, + * if we've seen one or more glTexCoord2f() calls and now we get a + * glTexCoord3f() call. + * Flush existing data, set new attrib size, replay copied vertices. */ static void _save_upgrade_vertex(struct gl_context *ctx, GLuint attr, GLuint newsz) @@ -641,7 +640,7 @@ _save_upgrade_vertex(struct gl_context *ctx, GLuint attr, GLuint newsz) * and will need fixup at runtime. */ if (save->copied.nr) { - GLfloat *data = save->copied.buffer; + const GLfloat *data = save->copied.buffer; GLfloat *dest = save->buffer; GLuint j; @@ -683,6 +682,11 @@ _save_upgrade_vertex(struct gl_context *ctx, GLuint attr, GLuint newsz) } +/** + * This is called when the size of a vertex attribute changes. + * For example, after seeing one or more glTexCoord2f() calls we + * get a glTexCoord4f() or glTexCoord1f() call. + */ static void save_fixup_vertex(struct gl_context *ctx, GLuint attr, GLuint sz) { @@ -709,6 +713,11 @@ save_fixup_vertex(struct gl_context *ctx, GLuint attr, GLuint sz) } +/** + * Reset the current size of all vertex attributes to the default + * value of 0. This signals that we haven't yet seen any per-vertex + * commands such as glNormal3f() or glTexCoord2f(). + */ static void _save_reset_vertex(struct gl_context *ctx) { @@ -861,7 +870,7 @@ dlist_fallback(struct gl_context *ctx) else { _mesa_install_save_vtxfmt(ctx, &ctx->ListState.ListVtxfmt); } - ctx->Driver.SaveNeedFlush = 0; + ctx->Driver.SaveNeedFlush = GL_FALSE; } @@ -931,15 +940,16 @@ _save_CallLists(GLsizei n, GLenum type, const GLvoid * v) -/* This begin is hooked into ... Updating of - * ctx->Driver.CurrentSavePrimitive is already taken care of. +/** + * Called via ctx->Driver.NotifySaveBegin() when a glBegin is getting + * compiled into a display list. + * Updating of ctx->Driver.CurrentSavePrimitive is already taken care of. */ GLboolean vbo_save_NotifyBegin(struct gl_context *ctx, GLenum mode) { struct vbo_save_context *save = &vbo_context(ctx)->save; - - GLuint i = save->prim_count++; + const GLuint i = save->prim_count++; assert(i < save->prim_max); save->prim[i].mode = mode & VBO_SAVE_PRIM_MODE_MASK; @@ -960,7 +970,13 @@ vbo_save_NotifyBegin(struct gl_context *ctx, GLenum mode) else { _mesa_install_save_vtxfmt(ctx, &save->vtxfmt); } - ctx->Driver.SaveNeedFlush = 1; + + /* We need to call SaveFlushVertices() if there's state change */ + ctx->Driver.SaveNeedFlush = GL_TRUE; + + /* GL_TRUE means we've handled this glBegin here; don't compile a BEGIN + * opcode into the display list. + */ return GL_TRUE; } @@ -970,7 +986,7 @@ _save_End(void) { GET_CURRENT_CONTEXT(ctx); struct vbo_save_context *save = &vbo_context(ctx)->save; - GLint i = save->prim_count - 1; + const GLint i = save->prim_count - 1; ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END; save->prim[i].end = 1; @@ -994,198 +1010,6 @@ _save_End(void) } -/* These are all errors as this vtxfmt is only installed inside - * begin/end pairs. - */ -static void GLAPIENTRY -_save_DrawElements(GLenum mode, GLsizei count, GLenum type, - const GLvoid * indices) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; - (void) count; - (void) type; - (void) indices; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, "glDrawElements"); -} - - -static void GLAPIENTRY -_save_DrawRangeElements(GLenum mode, GLuint start, GLuint end, - GLsizei count, GLenum type, const GLvoid * indices) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; - (void) start; - (void) end; - (void) count; - (void) type; - (void) indices; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, "glDrawRangeElements"); -} - - -static void GLAPIENTRY -_save_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, - const GLvoid * indices, GLint basevertex) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; - (void) count; - (void) type; - (void) indices; - (void) basevertex; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, "glDrawElements"); -} - - -static void GLAPIENTRY -_save_DrawRangeElementsBaseVertex(GLenum mode, - GLuint start, - GLuint end, - GLsizei count, - GLenum type, - const GLvoid * indices, GLint basevertex) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; - (void) start; - (void) end; - (void) count; - (void) type; - (void) indices; - (void) basevertex; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, "glDrawRangeElements"); -} - - -static void GLAPIENTRY -_save_DrawArrays(GLenum mode, GLint start, GLsizei count) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; - (void) start; - (void) count; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, "glDrawArrays"); -} - - -static void GLAPIENTRY -_save_MultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, - const GLvoid **indices, GLsizei primcount) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; - (void) count; - (void) type; - (void) indices; - (void) primcount; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, "glMultiDrawElements"); -} - - -static void GLAPIENTRY -_save_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, - GLenum type, const GLvoid * const *indices, - GLsizei primcount, const GLint *basevertex) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; - (void) count; - (void) type; - (void) indices; - (void) primcount; - (void) basevertex; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, - "glMultiDrawElementsBaseVertex"); -} - - -static void GLAPIENTRY -_save_DrawTransformFeedback(GLenum mode, GLuint name) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; - (void) name; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, "glDrawTransformFeedback"); -} - - -static void GLAPIENTRY -_save_DrawTransformFeedbackStream(GLenum mode, GLuint name, GLuint stream) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; - (void) name; - (void) stream; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, - "glDrawTransformFeedbackStream"); -} - - -static void GLAPIENTRY -_save_DrawTransformFeedbackInstanced(GLenum mode, GLuint name, - GLsizei primcount) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; - (void) name; - (void) primcount; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, - "glDrawTransformFeedbackInstanced"); -} - - -static void GLAPIENTRY -_save_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name, - GLuint stream, GLsizei primcount) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; - (void) name; - (void) stream; - (void) primcount; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, - "glDrawTransformFeedbackStreamInstanced"); -} - - -static void GLAPIENTRY -_save_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) -{ - GET_CURRENT_CONTEXT(ctx); - (void) x1; - (void) y1; - (void) x2; - (void) y2; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, "glRectf"); -} - - -static void GLAPIENTRY -_save_EvalMesh1(GLenum mode, GLint i1, GLint i2) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; - (void) i1; - (void) i2; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, "glEvalMesh1"); -} - - -static void GLAPIENTRY -_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) -{ - GET_CURRENT_CONTEXT(ctx); - (void) mode; - (void) i1; - (void) i2; - (void) j1; - (void) j2; - _mesa_compile_error(ctx, GL_INVALID_OPERATION, "glEvalMesh2"); -} - - static void GLAPIENTRY _save_Begin(GLenum mode) { @@ -1233,8 +1057,14 @@ _save_OBE_DrawArrays(GLenum mode, GLint start, GLsizei count) struct vbo_save_context *save = &vbo_context(ctx)->save; GLint i; - if (!_mesa_validate_DrawArrays(ctx, mode, start, count)) + if (!_mesa_is_valid_prim_mode(ctx, mode)) { + _mesa_compile_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)"); + return; + } + if (count < 0) { + _mesa_compile_error(ctx, GL_INVALID_VALUE, "glDrawArrays(count<0)"); return; + } if (save->out_of_memory) return; @@ -1263,8 +1093,20 @@ _save_OBE_DrawElements(GLenum mode, GLsizei count, GLenum type, struct vbo_save_context *save = &vbo_context(ctx)->save; GLint i; - if (!_mesa_validate_DrawElements(ctx, mode, count, type, indices, 0)) + if (!_mesa_is_valid_prim_mode(ctx, mode)) { + _mesa_compile_error(ctx, GL_INVALID_ENUM, "glDrawElements(mode)"); + return; + } + if (count < 0) { + _mesa_compile_error(ctx, GL_INVALID_VALUE, "glDrawElements(count<0)"); + return; + } + if (type != GL_UNSIGNED_BYTE && + type != GL_UNSIGNED_SHORT && + type != GL_UNSIGNED_INT) { + _mesa_compile_error(ctx, GL_INVALID_VALUE, "glDrawElements(count<0)"); return; + } if (save->out_of_memory) return; @@ -1310,9 +1152,26 @@ _save_OBE_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GET_CURRENT_CONTEXT(ctx); struct vbo_save_context *save = &vbo_context(ctx)->save; - if (!_mesa_validate_DrawRangeElements(ctx, mode, - start, end, count, type, indices, 0)) + if (!_mesa_is_valid_prim_mode(ctx, mode)) { + _mesa_compile_error(ctx, GL_INVALID_ENUM, "glDrawRangeElements(mode)"); + return; + } + if (count < 0) { + _mesa_compile_error(ctx, GL_INVALID_VALUE, + "glDrawRangeElements(count<0)"); return; + } + if (type != GL_UNSIGNED_BYTE && + type != GL_UNSIGNED_SHORT && + type != GL_UNSIGNED_INT) { + _mesa_compile_error(ctx, GL_INVALID_ENUM, "glDrawRangeElements(type)"); + return; + } + if (end < start) { + _mesa_compile_error(ctx, GL_INVALID_VALUE, + "glDrawRangeElements(end < start)"); + return; + } if (save->out_of_memory) return; @@ -1360,9 +1219,8 @@ _save_vtxfmt_init(struct gl_context *ctx) struct vbo_save_context *save = &vbo_context(ctx)->save; GLvertexformat *vfmt = &save->vtxfmt; - _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_); + vfmt->ArrayElement = _ae_ArrayElement; - vfmt->Begin = _save_Begin; vfmt->Color3f = _save_Color3f; vfmt->Color3fv = _save_Color3fv; vfmt->Color4f = _save_Color4f; @@ -1485,30 +1343,42 @@ _save_vtxfmt_init(struct gl_context *ctx) /* This will all require us to fallback to saving the list as opcodes: */ - _MESA_INIT_DLIST_VTXFMT(vfmt, _save_); /* inside begin/end */ + vfmt->CallList = _save_CallList; + vfmt->CallLists = _save_CallLists; - _MESA_INIT_EVAL_VTXFMT(vfmt, _save_); + vfmt->EvalCoord1f = _save_EvalCoord1f; + vfmt->EvalCoord1fv = _save_EvalCoord1fv; + vfmt->EvalCoord2f = _save_EvalCoord2f; + vfmt->EvalCoord2fv = _save_EvalCoord2fv; + vfmt->EvalPoint1 = _save_EvalPoint1; + vfmt->EvalPoint2 = _save_EvalPoint2; /* These calls all generate GL_INVALID_OPERATION since this vtxfmt is * only used when we're inside a glBegin/End pair. */ vfmt->Begin = _save_Begin; - vfmt->Rectf = _save_Rectf; - vfmt->DrawArrays = _save_DrawArrays; - vfmt->DrawElements = _save_DrawElements; - vfmt->DrawRangeElements = _save_DrawRangeElements; - vfmt->DrawElementsBaseVertex = _save_DrawElementsBaseVertex; - vfmt->DrawRangeElementsBaseVertex = _save_DrawRangeElementsBaseVertex; - vfmt->MultiDrawElementsEXT = _save_MultiDrawElements; - vfmt->MultiDrawElementsBaseVertex = _save_MultiDrawElementsBaseVertex; - vfmt->DrawTransformFeedback = _save_DrawTransformFeedback; - vfmt->DrawTransformFeedbackStream = _save_DrawTransformFeedbackStream; - vfmt->DrawTransformFeedbackInstanced = _save_DrawTransformFeedbackInstanced; - vfmt->DrawTransformFeedbackStreamInstanced = - _save_DrawTransformFeedbackStreamInstanced; } +/** + * Initialize the dispatch table with the VBO functions for display + * list compilation. + */ +void +vbo_initialize_save_dispatch(const struct gl_context *ctx, + struct _glapi_table *exec) +{ + SET_DrawArrays(exec, _save_OBE_DrawArrays); + SET_DrawElements(exec, _save_OBE_DrawElements); + SET_DrawRangeElements(exec, _save_OBE_DrawRangeElements); + SET_MultiDrawElementsEXT(exec, _save_OBE_MultiDrawElements); + SET_MultiDrawElementsBaseVertex(exec, _save_OBE_MultiDrawElementsBaseVertex); + SET_Rectf(exec, _save_OBE_Rectf); + /* Note: other glDraw functins aren't compiled into display lists */ +} + + + void vbo_save_SaveFlushVertices(struct gl_context *ctx) { @@ -1516,8 +1386,7 @@ vbo_save_SaveFlushVertices(struct gl_context *ctx) /* Noop when we are actually active: */ - if (ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM || - ctx->Driver.CurrentSavePrimitive <= GL_POLYGON) + if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) return; if (save->vert_count || save->prim_count) @@ -1526,7 +1395,7 @@ vbo_save_SaveFlushVertices(struct gl_context *ctx) _save_copy_to_current(ctx); _save_reset_vertex(ctx); _save_reset_counters(ctx); - ctx->Driver.SaveNeedFlush = 0; + ctx->Driver.SaveNeedFlush = GL_FALSE; } @@ -1548,7 +1417,7 @@ vbo_save_NewList(struct gl_context *ctx, GLuint list, GLenum mode) _save_reset_vertex(ctx); _save_reset_counters(ctx); - ctx->Driver.SaveNeedFlush = 0; + ctx->Driver.SaveNeedFlush = GL_FALSE; } @@ -1559,8 +1428,7 @@ vbo_save_EndList(struct gl_context *ctx) /* EndList called inside a (saved) Begin/End pair? */ - if (ctx->Driver.CurrentSavePrimitive != PRIM_OUTSIDE_BEGIN_END) { - + if (_mesa_inside_dlist_begin_end(ctx)) { if (save->prim_count > 0) { GLint i = save->prim_count - 1; ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END; @@ -1700,14 +1568,4 @@ vbo_save_api_init(struct vbo_save_context *save) /* These will actually get set again when binding/drawing */ for (i = 0; i < VBO_ATTRIB_MAX; i++) save->inputs[i] = &save->arrays[i]; - - /* Hook our array functions into the outside-begin-end vtxfmt in - * ctx->ListState. - */ - ctx->ListState.ListVtxfmt.Rectf = _save_OBE_Rectf; - ctx->ListState.ListVtxfmt.DrawArrays = _save_OBE_DrawArrays; - ctx->ListState.ListVtxfmt.DrawElements = _save_OBE_DrawElements; - ctx->ListState.ListVtxfmt.DrawRangeElements = _save_OBE_DrawRangeElements; - ctx->ListState.ListVtxfmt.MultiDrawElementsEXT = _save_OBE_MultiDrawElements; - ctx->ListState.ListVtxfmt.MultiDrawElementsBaseVertex = _save_OBE_MultiDrawElementsBaseVertex; } diff --git a/mesalib/src/mesa/vbo/vbo_save_draw.c b/mesalib/src/mesa/vbo/vbo_save_draw.c index f5b5c411d..a6ce379e2 100644 --- a/mesalib/src/mesa/vbo/vbo_save_draw.c +++ b/mesalib/src/mesa/vbo/vbo_save_draw.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* Author: @@ -30,7 +31,6 @@ #include "main/bufferobj.h" #include "main/context.h" #include "main/imports.h" -#include "main/mfeatures.h" #include "main/mtypes.h" #include "main/macros.h" #include "main/light.h" @@ -269,17 +269,12 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, void *data) if (node->prim_count > 0) { - if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END && - node->prim[0].begin) { - - /* Degenerate case: list is called inside begin/end pair and - * includes operations such as glBegin or glDrawArrays. - */ - if (0) - printf("displaylist recursive begin"); - - vbo_save_loopback_vertex_list( ctx, node ); - + if (_mesa_inside_begin_end(ctx) && node->prim[0].begin) { + /* Error: we're about to begin a new primitive but we're already + * inside a glBegin/End pair. + */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "draw operation inside glBegin/End"); goto end; } else if (save->replay_flags) { diff --git a/mesalib/src/mesa/vbo/vbo_save_loopback.c b/mesalib/src/mesa/vbo/vbo_save_loopback.c index 98772be76..31343cd67 100644 --- a/mesalib/src/mesa/vbo/vbo_save_loopback.c +++ b/mesalib/src/mesa/vbo/vbo_save_loopback.c @@ -29,7 +29,6 @@ #include "main/glheader.h" #include "main/enums.h" #include "main/imports.h" -#include "main/mfeatures.h" #include "main/mtypes.h" #include "main/dispatch.h" #include "glapi/glapi.h" @@ -178,7 +177,7 @@ void vbo_loopback_vertex_list( struct gl_context *ctx, for (i = 0 ; i < prim_count ; i++) { if ((prim[i].mode & VBO_SAVE_PRIM_WEAK) && - (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END)) + _mesa_inside_begin_end(ctx)) { loopback_weak_prim( ctx, &prim[i] ); } diff --git a/mesalib/src/mesa/vbo/vbo_split.c b/mesalib/src/mesa/vbo/vbo_split.c index c933a3f9a..e128f5bd0 100644 --- a/mesalib/src/mesa/vbo/vbo_split.c +++ b/mesalib/src/mesa/vbo/vbo_split.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> diff --git a/mesalib/src/mesa/vbo/vbo_split.h b/mesalib/src/mesa/vbo/vbo_split.h index b7f0a9c57..a4e5fa0b8 100644 --- a/mesalib/src/mesa/vbo/vbo_split.h +++ b/mesalib/src/mesa/vbo/vbo_split.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** diff --git a/mesalib/src/mesa/vbo/vbo_split_copy.c b/mesalib/src/mesa/vbo/vbo_split_copy.c index a917f39ca..9df36df78 100644 --- a/mesalib/src/mesa/vbo/vbo_split_copy.c +++ b/mesalib/src/mesa/vbo/vbo_split_copy.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> diff --git a/mesalib/src/mesa/vbo/vbo_split_inplace.c b/mesalib/src/mesa/vbo/vbo_split_inplace.c index 8a3830805..b26b00af8 100644 --- a/mesalib/src/mesa/vbo/vbo_split_inplace.c +++ b/mesalib/src/mesa/vbo/vbo_split_inplace.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Keith Whitwell <keith@tungstengraphics.com> diff --git a/mesalib/src/mesa/x86/3dnow.c b/mesalib/src/mesa/x86/3dnow.c index de2fb1e2a..f12dc2610 100644 --- a/mesalib/src/mesa/x86/3dnow.c +++ b/mesalib/src/mesa/x86/3dnow.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/x86/3dnow.h b/mesalib/src/mesa/x86/3dnow.h index 1c1fedcd4..e13f400d4 100644 --- a/mesalib/src/mesa/x86/3dnow.h +++ b/mesalib/src/mesa/x86/3dnow.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/x86/3dnow_normal.S b/mesalib/src/mesa/x86/3dnow_normal.S index 7f5f6b357..b3908f07a 100644 --- a/mesalib/src/mesa/x86/3dnow_normal.S +++ b/mesalib/src/mesa/x86/3dnow_normal.S @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/x86/3dnow_xform1.S b/mesalib/src/mesa/x86/3dnow_xform1.S index a73301a8d..004a734e1 100644 --- a/mesalib/src/mesa/x86/3dnow_xform1.S +++ b/mesalib/src/mesa/x86/3dnow_xform1.S @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ #ifdef USE_3DNOW_ASM diff --git a/mesalib/src/mesa/x86/3dnow_xform2.S b/mesalib/src/mesa/x86/3dnow_xform2.S index 2988fb7bf..333ad6342 100644 --- a/mesalib/src/mesa/x86/3dnow_xform2.S +++ b/mesalib/src/mesa/x86/3dnow_xform2.S @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ #ifdef USE_3DNOW_ASM diff --git a/mesalib/src/mesa/x86/3dnow_xform3.S b/mesalib/src/mesa/x86/3dnow_xform3.S index a356aaee7..740e07723 100644 --- a/mesalib/src/mesa/x86/3dnow_xform3.S +++ b/mesalib/src/mesa/x86/3dnow_xform3.S @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ #ifdef USE_3DNOW_ASM diff --git a/mesalib/src/mesa/x86/3dnow_xform4.S b/mesalib/src/mesa/x86/3dnow_xform4.S index b2b7c64f2..4612d368f 100644 --- a/mesalib/src/mesa/x86/3dnow_xform4.S +++ b/mesalib/src/mesa/x86/3dnow_xform4.S @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ #ifdef USE_3DNOW_ASM diff --git a/mesalib/src/mesa/x86/Makefile.am b/mesalib/src/mesa/x86/Makefile.am index 5976bb47c..21ce3607a 100644 --- a/mesalib/src/mesa/x86/Makefile.am +++ b/mesalib/src/mesa/x86/Makefile.am @@ -25,7 +25,6 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src/mesa \ -I$(top_srcdir)/src/mapi \ - $(API_DEFINES) \ $(DEFINES) noinst_PROGRAMS = gen_matypes diff --git a/mesalib/src/mesa/x86/clip_args.h b/mesalib/src/mesa/x86/clip_args.h index 796611fbf..bafa535ef 100644 --- a/mesalib/src/mesa/x86/clip_args.h +++ b/mesalib/src/mesa/x86/clip_args.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/x86/common_x86.c b/mesalib/src/mesa/x86/common_x86.c index 629950723..910828f16 100644 --- a/mesalib/src/mesa/x86/common_x86.c +++ b/mesalib/src/mesa/x86/common_x86.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** diff --git a/mesalib/src/mesa/x86/common_x86_asm.S b/mesalib/src/mesa/x86/common_x86_asm.S index ea4047a0e..230d588c4 100644 --- a/mesalib/src/mesa/x86/common_x86_asm.S +++ b/mesalib/src/mesa/x86/common_x86_asm.S @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/x86/common_x86_asm.h b/mesalib/src/mesa/x86/common_x86_asm.h index 0d39e3d23..a4b714396 100644 --- a/mesalib/src/mesa/x86/common_x86_asm.h +++ b/mesalib/src/mesa/x86/common_x86_asm.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/x86/common_x86_features.h b/mesalib/src/mesa/x86/common_x86_features.h index 676af8c1f..2069b906e 100644 --- a/mesalib/src/mesa/x86/common_x86_features.h +++ b/mesalib/src/mesa/x86/common_x86_features.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/x86/gen_matypes.c b/mesalib/src/mesa/x86/gen_matypes.c index 61f181cd9..fff6f541b 100644 --- a/mesalib/src/mesa/x86/gen_matypes.c +++ b/mesalib/src/mesa/x86/gen_matypes.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Gareth Hughes diff --git a/mesalib/src/mesa/x86/mmx.h b/mesalib/src/mesa/x86/mmx.h index 74e9979d3..0772e0f6f 100644 --- a/mesalib/src/mesa/x86/mmx.h +++ b/mesalib/src/mesa/x86/mmx.h @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ diff --git a/mesalib/src/mesa/x86/norm_args.h b/mesalib/src/mesa/x86/norm_args.h index e22f8bbd7..34a546a8b 100644 --- a/mesalib/src/mesa/x86/norm_args.h +++ b/mesalib/src/mesa/x86/norm_args.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/x86/sse.c b/mesalib/src/mesa/x86/sse.c index aef15b531..f3e93248b 100644 --- a/mesalib/src/mesa/x86/sse.c +++ b/mesalib/src/mesa/x86/sse.c @@ -17,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/x86/sse.h b/mesalib/src/mesa/x86/sse.h index e92ddc139..20a4de277 100644 --- a/mesalib/src/mesa/x86/sse.h +++ b/mesalib/src/mesa/x86/sse.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/x86/sse_normal.S b/mesalib/src/mesa/x86/sse_normal.S index a8c0d38c7..7024dd0ce 100644 --- a/mesalib/src/mesa/x86/sse_normal.S +++ b/mesalib/src/mesa/x86/sse_normal.S @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** TODO: diff --git a/mesalib/src/mesa/x86/sse_xform1.S b/mesalib/src/mesa/x86/sse_xform1.S index 4aa9de607..d165aff6d 100644 --- a/mesalib/src/mesa/x86/sse_xform1.S +++ b/mesalib/src/mesa/x86/sse_xform1.S @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** TODO: diff --git a/mesalib/src/mesa/x86/sse_xform2.S b/mesalib/src/mesa/x86/sse_xform2.S index a443dad35..bb0f75696 100644 --- a/mesalib/src/mesa/x86/sse_xform2.S +++ b/mesalib/src/mesa/x86/sse_xform2.S @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** TODO: diff --git a/mesalib/src/mesa/x86/sse_xform3.S b/mesalib/src/mesa/x86/sse_xform3.S index 4bc22d8a5..60c011094 100644 --- a/mesalib/src/mesa/x86/sse_xform3.S +++ b/mesalib/src/mesa/x86/sse_xform3.S @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** TODO: diff --git a/mesalib/src/mesa/x86/sse_xform4.S b/mesalib/src/mesa/x86/sse_xform4.S index fb1fa741c..596efd06a 100644 --- a/mesalib/src/mesa/x86/sse_xform4.S +++ b/mesalib/src/mesa/x86/sse_xform4.S @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ #ifdef USE_SSE_ASM diff --git a/mesalib/src/mesa/x86/x86_cliptest.S b/mesalib/src/mesa/x86/x86_cliptest.S index e413aee61..b8163dad9 100644 --- a/mesalib/src/mesa/x86/x86_cliptest.S +++ b/mesalib/src/mesa/x86/x86_cliptest.S @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/x86/x86_xform.c b/mesalib/src/mesa/x86/x86_xform.c index 3dcc55e16..8d1488e8b 100644 --- a/mesalib/src/mesa/x86/x86_xform.c +++ b/mesalib/src/mesa/x86/x86_xform.c @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/x86/x86_xform.h b/mesalib/src/mesa/x86/x86_xform.h index e886d9add..9052fa46a 100644 --- a/mesalib/src/mesa/x86/x86_xform.h +++ b/mesalib/src/mesa/x86/x86_xform.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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: * Gareth Hughes diff --git a/mesalib/src/mesa/x86/x86_xform2.S b/mesalib/src/mesa/x86/x86_xform2.S index 980725ef5..b66146041 100644 --- a/mesalib/src/mesa/x86/x86_xform2.S +++ b/mesalib/src/mesa/x86/x86_xform2.S @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/x86/x86_xform3.S b/mesalib/src/mesa/x86/x86_xform3.S index 1c782f1c5..017914095 100644 --- a/mesalib/src/mesa/x86/x86_xform3.S +++ b/mesalib/src/mesa/x86/x86_xform3.S @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/x86/x86_xform4.S b/mesalib/src/mesa/x86/x86_xform4.S index 97a841138..e9e9b7154 100644 --- a/mesalib/src/mesa/x86/x86_xform4.S +++ b/mesalib/src/mesa/x86/x86_xform4.S @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* diff --git a/mesalib/src/mesa/x86/xform_args.h b/mesalib/src/mesa/x86/xform_args.h index b773f5198..d2cf6f712 100644 --- a/mesalib/src/mesa/x86/xform_args.h +++ b/mesalib/src/mesa/x86/xform_args.h @@ -18,9 +18,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /* |