diff options
Diffstat (limited to 'mesalib/src')
33 files changed, 425 insertions, 281 deletions
diff --git a/mesalib/src/gallium/auxiliary/Makefile.sources b/mesalib/src/gallium/auxiliary/Makefile.sources index 2807c780d..6258861f0 100644 --- a/mesalib/src/gallium/auxiliary/Makefile.sources +++ b/mesalib/src/gallium/auxiliary/Makefile.sources @@ -115,6 +115,7 @@ C_SOURCES := \ util/u_handle_table.c \ util/u_hash.c \ util/u_hash_table.c \ + util/u_helpers.c \ util/u_index_modify.c \ util/u_keymap.c \ util/u_linear.c \ diff --git a/mesalib/src/gallium/auxiliary/util/u_blit.c b/mesalib/src/gallium/auxiliary/util/u_blit.c index bf1c392cd..ab1549e2d 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blit.c +++ b/mesalib/src/gallium/auxiliary/util/u_blit.c @@ -133,7 +133,7 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso) for (i = 0; i < 2; i++) { ctx->velem[i].src_offset = i * 4 * sizeof(float); ctx->velem[i].instance_divisor = 0; - ctx->velem[i].vertex_buffer_index = 0; + ctx->velem[i].vertex_buffer_index = cso_get_aux_vertex_buffer_slot(cso); ctx->velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; } @@ -665,7 +665,7 @@ util_blit_pixels(struct blit_state *ctx, cso_save_vertex_shader(ctx->cso); cso_save_geometry_shader(ctx->cso); cso_save_vertex_elements(ctx->cso); - cso_save_vertex_buffers(ctx->cso); + cso_save_aux_vertex_buffer_slot(ctx->cso); /* set misc state we care about */ if (writemask) @@ -776,7 +776,9 @@ util_blit_pixels(struct blit_state *ctx, z); if (ctx->vbuf) { - util_draw_vertex_buffer(ctx->pipe, ctx->cso, ctx->vbuf, offset, + util_draw_vertex_buffer(ctx->pipe, ctx->cso, ctx->vbuf, + cso_get_aux_vertex_buffer_slot(ctx->cso), + offset, PIPE_PRIM_TRIANGLE_FAN, 4, /* verts */ 2); /* attribs/vert */ @@ -795,7 +797,7 @@ util_blit_pixels(struct blit_state *ctx, cso_restore_vertex_shader(ctx->cso); cso_restore_geometry_shader(ctx->cso); cso_restore_vertex_elements(ctx->cso); - cso_restore_vertex_buffers(ctx->cso); + cso_restore_aux_vertex_buffer_slot(ctx->cso); cso_restore_stream_outputs(ctx->cso); pipe_sampler_view_reference(&sampler_view, NULL); @@ -869,7 +871,7 @@ util_blit_pixels_tex(struct blit_state *ctx, cso_save_vertex_shader(ctx->cso); cso_save_geometry_shader(ctx->cso); cso_save_vertex_elements(ctx->cso); - cso_save_vertex_buffers(ctx->cso); + cso_save_aux_vertex_buffer_slot(ctx->cso); /* set misc state we care about */ cso_set_blend(ctx->cso, &ctx->blend_write_color); @@ -923,8 +925,9 @@ util_blit_pixels_tex(struct blit_state *ctx, s0, t0, s1, t1, z); - util_draw_vertex_buffer(ctx->pipe, ctx->cso, - ctx->vbuf, offset, + util_draw_vertex_buffer(ctx->pipe, ctx->cso, ctx->vbuf, + cso_get_aux_vertex_buffer_slot(ctx->cso), + offset, PIPE_PRIM_TRIANGLE_FAN, 4, /* verts */ 2); /* attribs/vert */ @@ -942,6 +945,6 @@ util_blit_pixels_tex(struct blit_state *ctx, cso_restore_vertex_shader(ctx->cso); cso_restore_geometry_shader(ctx->cso); cso_restore_vertex_elements(ctx->cso); - cso_restore_vertex_buffers(ctx->cso); + cso_restore_aux_vertex_buffer_slot(ctx->cso); cso_restore_stream_outputs(ctx->cso); } diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c index f4ac4aa86..bb784d6b3 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blitter.c +++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c @@ -158,7 +158,6 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe) ctx->base.saved_fb_state.nr_cbufs = ~0; ctx->base.saved_num_sampler_views = ~0; ctx->base.saved_num_sampler_states = ~0; - ctx->base.saved_num_vertex_buffers = ~0; ctx->base.saved_num_so_targets = ~0; ctx->has_geometry_shader = @@ -241,11 +240,14 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe) ctx->rs_discard_state = pipe->create_rasterizer_state(pipe, &rs_state); } + ctx->base.vb_slot = 0; /* 0 for now */ + /* vertex elements states */ memset(&velem[0], 0, sizeof(velem[0]) * 2); for (i = 0; i < 2; i++) { velem[i].src_offset = i * 4 * sizeof(float); velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; + velem[i].vertex_buffer_index = ctx->base.vb_slot; } ctx->velem_state = pipe->create_vertex_elements_state(pipe, 2, &velem[0]); @@ -253,20 +255,25 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe) memset(&velem[0], 0, sizeof(velem[0]) * 2); velem[0].src_offset = 0; velem[0].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; + velem[0].vertex_buffer_index = ctx->base.vb_slot; velem[1].src_offset = 4 * sizeof(float); velem[1].src_format = PIPE_FORMAT_R32G32B32A32_SINT; + velem[1].vertex_buffer_index = ctx->base.vb_slot; ctx->velem_sint_state = pipe->create_vertex_elements_state(pipe, 2, &velem[0]); memset(&velem[0], 0, sizeof(velem[0]) * 2); velem[0].src_offset = 0; velem[0].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; + velem[0].vertex_buffer_index = ctx->base.vb_slot; velem[1].src_offset = 4 * sizeof(float); velem[1].src_format = PIPE_FORMAT_R32G32B32A32_UINT; + velem[1].vertex_buffer_index = ctx->base.vb_slot; ctx->velem_uint_state = pipe->create_vertex_elements_state(pipe, 2, &velem[0]); } 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]); } @@ -387,7 +394,6 @@ static void blitter_unset_running_flag(struct blitter_context_priv *ctx) static void blitter_check_saved_vertex_states(struct blitter_context_priv *ctx) { - assert(ctx->base.saved_num_vertex_buffers != ~0); assert(ctx->base.saved_velem_state != INVALID_PTR); assert(ctx->base.saved_vs != INVALID_PTR); assert(!ctx->has_geometry_shader || ctx->base.saved_gs != INVALID_PTR); @@ -400,18 +406,10 @@ static void blitter_restore_vertex_states(struct blitter_context_priv *ctx) struct pipe_context *pipe = ctx->base.pipe; unsigned i; - /* Vertex buffers. */ - pipe->set_vertex_buffers(pipe, - ctx->base.saved_num_vertex_buffers, - ctx->base.saved_vertex_buffers); - - for (i = 0; i < ctx->base.saved_num_vertex_buffers; i++) { - if (ctx->base.saved_vertex_buffers[i].buffer) { - pipe_resource_reference(&ctx->base.saved_vertex_buffers[i].buffer, - NULL); - } - } - ctx->base.saved_num_vertex_buffers = ~0; + /* Vertex buffer. */ + pipe->set_vertex_buffers(pipe, ctx->base.vb_slot, 1, + &ctx->base.saved_vertex_buffer); + pipe_resource_reference(&ctx->base.saved_vertex_buffer.buffer, NULL); /* Vertex elements. */ pipe->bind_vertex_elements_state(pipe, ctx->base.saved_velem_state); @@ -935,8 +933,8 @@ static void blitter_draw(struct blitter_context_priv *ctx, u_upload_data(ctx->upload, 0, sizeof(ctx->vertices), ctx->vertices, &offset, &buf); u_upload_unmap(ctx->upload); - util_draw_vertex_buffer(ctx->base.pipe, NULL, buf, offset, - PIPE_PRIM_TRIANGLE_FAN, 4, 2); + util_draw_vertex_buffer(ctx->base.pipe, NULL, buf, ctx->base.vb_slot, + offset, PIPE_PRIM_TRIANGLE_FAN, 4, 2); pipe_resource_reference(&buf, NULL); } @@ -1687,7 +1685,7 @@ void util_blitter_copy_buffer(struct blitter_context *blitter, vb.buffer_offset = srcx; vb.stride = 4; - pipe->set_vertex_buffers(pipe, 1, &vb); + pipe->set_vertex_buffers(pipe, ctx->base.vb_slot, 1, &vb); pipe->bind_vertex_elements_state(pipe, ctx->velem_state_readbuf); pipe->bind_vs_state(pipe, ctx->vs_pos_only); if (ctx->has_geometry_shader) diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.h b/mesalib/src/gallium/auxiliary/util/u_blitter.h index c49faaad7..b96e68e93 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blitter.h +++ b/mesalib/src/gallium/auxiliary/util/u_blitter.h @@ -104,8 +104,8 @@ struct blitter_context unsigned saved_num_sampler_views; struct pipe_sampler_view *saved_sampler_views[PIPE_MAX_SAMPLERS]; - unsigned saved_num_vertex_buffers; - struct pipe_vertex_buffer saved_vertex_buffers[PIPE_MAX_ATTRIBS]; + unsigned vb_slot; + struct pipe_vertex_buffer saved_vertex_buffer; unsigned saved_num_so_targets; struct pipe_stream_output_target *saved_so_targets[PIPE_MAX_SO_BUFFERS]; @@ -466,17 +466,13 @@ util_blitter_save_fragment_sampler_views(struct blitter_context *blitter, } static INLINE void -util_blitter_save_vertex_buffers(struct blitter_context *blitter, - unsigned num_vertex_buffers, - struct pipe_vertex_buffer *vertex_buffers) +util_blitter_save_vertex_buffer_slot(struct blitter_context *blitter, + struct pipe_vertex_buffer *vertex_buffers) { - assert(num_vertex_buffers <= Elements(blitter->saved_vertex_buffers)); - - blitter->saved_num_vertex_buffers = 0; - util_copy_vertex_buffers(blitter->saved_vertex_buffers, - (unsigned*)&blitter->saved_num_vertex_buffers, - vertex_buffers, - num_vertex_buffers); + pipe_resource_reference(&blitter->saved_vertex_buffer.buffer, + vertex_buffers[blitter->vb_slot].buffer); + memcpy(&blitter->saved_vertex_buffer, &vertex_buffers[blitter->vb_slot], + sizeof(struct pipe_vertex_buffer)); } static INLINE void diff --git a/mesalib/src/gallium/auxiliary/util/u_draw_quad.c b/mesalib/src/gallium/auxiliary/util/u_draw_quad.c index 81c4f107e..3fe324afa 100644 --- a/mesalib/src/gallium/auxiliary/util/u_draw_quad.c +++ b/mesalib/src/gallium/auxiliary/util/u_draw_quad.c @@ -42,6 +42,7 @@ void util_draw_vertex_buffer(struct pipe_context *pipe, struct cso_context *cso, struct pipe_resource *vbuf, + uint vbuf_slot, uint offset, uint prim_type, uint num_verts, @@ -60,10 +61,10 @@ util_draw_vertex_buffer(struct pipe_context *pipe, /* note: vertex elements already set by caller */ if (cso) { - cso_set_vertex_buffers(cso, 1, &vbuffer); + cso_set_vertex_buffers(cso, vbuf_slot, 1, &vbuffer); cso_draw_arrays(cso, prim_type, 0, num_verts); } else { - pipe->set_vertex_buffers(pipe, 1, &vbuffer); + pipe->set_vertex_buffers(pipe, vbuf_slot, 1, &vbuffer); util_draw_arrays(pipe, prim_type, 0, num_verts); } } @@ -86,7 +87,7 @@ util_draw_user_vertex_buffer(struct cso_context *cso, void *buffer, /* note: vertex elements already set by caller */ - cso_set_vertex_buffers(cso, 1, &vbuffer); + cso_set_vertex_buffers(cso, 0, 1, &vbuffer); cso_draw_arrays(cso, prim_type, 0, num_verts); } @@ -97,6 +98,7 @@ util_draw_user_vertex_buffer(struct cso_context *cso, void *buffer, */ void util_draw_texquad(struct pipe_context *pipe, struct cso_context *cso, + uint vbuf_slot, float x0, float y0, float x1, float y1, float z) { uint numAttribs = 2, i, j; @@ -145,7 +147,8 @@ util_draw_texquad(struct pipe_context *pipe, struct cso_context *cso, goto out; pipe_buffer_write(pipe, vbuf, 0, vertexBytes, v); - util_draw_vertex_buffer(pipe, cso, vbuf, 0, PIPE_PRIM_TRIANGLE_FAN, 4, 2); + util_draw_vertex_buffer(pipe, cso, vbuf, vbuf_slot, 0, + PIPE_PRIM_TRIANGLE_FAN, 4, 2); out: if (vbuf) diff --git a/mesalib/src/gallium/auxiliary/util/u_draw_quad.h b/mesalib/src/gallium/auxiliary/util/u_draw_quad.h index 2834a4a81..cb17f4e4c 100644 --- a/mesalib/src/gallium/auxiliary/util/u_draw_quad.h +++ b/mesalib/src/gallium/auxiliary/util/u_draw_quad.h @@ -44,8 +44,9 @@ struct cso_context; extern void util_draw_vertex_buffer(struct pipe_context *pipe, struct cso_context *cso, - struct pipe_resource *vbuf, uint offset, - uint num_attribs, uint num_verts, uint prim_type); + struct pipe_resource *vbuf, uint vbuf_slot, + uint offset, uint prim_type, uint num_attribs, + uint num_verts); void util_draw_user_vertex_buffer(struct cso_context *cso, void *buffer, @@ -53,6 +54,7 @@ util_draw_user_vertex_buffer(struct cso_context *cso, void *buffer, extern void util_draw_texquad(struct pipe_context *pipe, struct cso_context *cso, + uint vbuf_slot, float x0, float y0, float x1, float y1, float z); diff --git a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c index 4d8adb9f3..48ebdb9fa 100644 --- a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -1287,7 +1287,7 @@ util_create_gen_mipmap(struct pipe_context *pipe, for (i = 0; i < 2; i++) { ctx->velem[i].src_offset = i * 4 * sizeof(float); ctx->velem[i].instance_divisor = 0; - ctx->velem[i].vertex_buffer_index = 0; + ctx->velem[i].vertex_buffer_index = cso_get_aux_vertex_buffer_slot(cso); ctx->velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; } @@ -1565,7 +1565,7 @@ util_gen_mipmap(struct gen_mipmap_state *ctx, cso_save_geometry_shader(ctx->cso); cso_save_viewport(ctx->cso); cso_save_vertex_elements(ctx->cso); - cso_save_vertex_buffers(ctx->cso); + cso_save_aux_vertex_buffer_slot(ctx->cso); /* bind our state */ cso_set_blend(ctx->cso, is_depth ? &ctx->blend_keep_color : @@ -1673,6 +1673,7 @@ util_gen_mipmap(struct gen_mipmap_state *ctx, util_draw_vertex_buffer(ctx->pipe, ctx->cso, ctx->vbuf, + cso_get_aux_vertex_buffer_slot(ctx->cso), offset, PIPE_PRIM_TRIANGLE_FAN, 4, /* verts */ @@ -1697,5 +1698,5 @@ util_gen_mipmap(struct gen_mipmap_state *ctx, cso_restore_viewport(ctx->cso); cso_restore_vertex_elements(ctx->cso); cso_restore_stream_outputs(ctx->cso); - cso_restore_vertex_buffers(ctx->cso); + cso_restore_aux_vertex_buffer_slot(ctx->cso); } diff --git a/mesalib/src/gallium/auxiliary/util/u_helpers.c b/mesalib/src/gallium/auxiliary/util/u_helpers.c new file mode 100644 index 000000000..ac1edcdbb --- /dev/null +++ b/mesalib/src/gallium/auxiliary/util/u_helpers.c @@ -0,0 +1,90 @@ +/************************************************************************** + * + * Copyright 2012 Marek Olšák <maraeo@gmail.com> + * 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 THEIR SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#include "util/u_helpers.h" +#include "util/u_inlines.h" + +/** + * This function is used to copy an array of pipe_vertex_buffer structures, + * while properly referencing the pipe_vertex_buffer::buffer member. + * + * enabled_buffers is updated such that the bits corresponding to the indices + * of disabled buffers are set to 0 and the enabled ones are set to 1. + * + * \sa util_copy_framebuffer_state + */ +void util_set_vertex_buffers_mask(struct pipe_vertex_buffer *dst, + uint32_t *enabled_buffers, + const struct pipe_vertex_buffer *src, + unsigned start_slot, unsigned count) +{ + unsigned i; + uint32_t bitmask = 0; + + dst += start_slot; + + if (src) { + for (i = 0; i < count; i++) { + if (src[i].buffer || src[i].user_buffer) { + bitmask |= 1 << i; + } + pipe_resource_reference(&dst[i].buffer, src[i].buffer); + } + + /* Copy over the other members of pipe_vertex_buffer. */ + memcpy(dst, src, count * sizeof(struct pipe_vertex_buffer)); + + *enabled_buffers &= ~(((1ull << count) - 1) << start_slot); + *enabled_buffers |= bitmask << start_slot; + } + else { + /* Unreference the buffers. */ + for (i = 0; i < count; i++) { + pipe_resource_reference(&dst[i].buffer, NULL); + dst[i].user_buffer = NULL; + } + + *enabled_buffers &= ~(((1ull << count) - 1) << start_slot); + } +} + +/** + * Same as util_set_vertex_buffers_mask, but it only returns the number + * of bound buffers. + */ +void util_set_vertex_buffers_count(struct pipe_vertex_buffer *dst, + unsigned *dst_count, + const struct pipe_vertex_buffer *src, + unsigned start_slot, unsigned count) +{ + uint32_t enabled_buffers = (1ull << *dst_count) - 1; + + util_set_vertex_buffers_mask(dst, &enabled_buffers, src, start_slot, + count); + + *dst_count = util_last_bit(enabled_buffers); +} diff --git a/mesalib/src/gallium/auxiliary/util/u_helpers.h b/mesalib/src/gallium/auxiliary/util/u_helpers.h new file mode 100644 index 000000000..09c7116fa --- /dev/null +++ b/mesalib/src/gallium/auxiliary/util/u_helpers.h @@ -0,0 +1,51 @@ +/************************************************************************** + * + * Copyright 2012 Marek Olšák <maraeo@gmail.com> + * 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 THEIR SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef U_HELPERS_H +#define U_HELPERS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "pipe/p_state.h" + +void util_set_vertex_buffers_mask(struct pipe_vertex_buffer *dst, + uint32_t *enabled_buffers, + const struct pipe_vertex_buffer *src, + unsigned start_slot, unsigned count); + +void util_set_vertex_buffers_count(struct pipe_vertex_buffer *dst, + unsigned *dst_count, + const struct pipe_vertex_buffer *src, + unsigned start_slot, unsigned count); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/mesalib/src/gallium/auxiliary/util/u_inlines.h b/mesalib/src/gallium/auxiliary/util/u_inlines.h index 5c6e7eb32..3d68cf540 100644 --- a/mesalib/src/gallium/auxiliary/util/u_inlines.h +++ b/mesalib/src/gallium/auxiliary/util/u_inlines.h @@ -449,34 +449,6 @@ static INLINE boolean util_get_offset( } } -/** - * This function is used to copy an array of pipe_vertex_buffer structures, - * while properly referencing the pipe_vertex_buffer::buffer member. - * - * \sa util_copy_framebuffer_state - */ -static INLINE void util_copy_vertex_buffers(struct pipe_vertex_buffer *dst, - unsigned *dst_count, - const struct pipe_vertex_buffer *src, - unsigned src_count) -{ - unsigned i; - - /* Reference the buffers of 'src' in 'dst'. */ - for (i = 0; i < src_count; i++) { - pipe_resource_reference(&dst[i].buffer, src[i].buffer); - } - /* Unreference the rest of the buffers in 'dst'. */ - for (; i < *dst_count; i++) { - pipe_resource_reference(&dst[i].buffer, NULL); - } - - /* Update the size of 'dst' and copy over the other members - * of pipe_vertex_buffer. */ - *dst_count = src_count; - memcpy(dst, src, src_count * sizeof(struct pipe_vertex_buffer)); -} - static INLINE float util_get_min_point_size(const struct pipe_rasterizer_state *state) { diff --git a/mesalib/src/gallium/auxiliary/util/u_math.h b/mesalib/src/gallium/auxiliary/util/u_math.h index 4047bd9b0..607fbecb0 100644 --- a/mesalib/src/gallium/auxiliary/util/u_math.h +++ b/mesalib/src/gallium/auxiliary/util/u_math.h @@ -482,12 +482,16 @@ unsigned ffs( unsigned u ) */ static INLINE unsigned util_last_bit(unsigned u) { +#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 304) + return u == 0 ? 0 : 32 - __builtin_clz(u); +#else unsigned r = 0; while (u) { r++; u >>= 1; } return r; +#endif } diff --git a/mesalib/src/gallium/auxiliary/util/u_vbuf.c b/mesalib/src/gallium/auxiliary/util/u_vbuf.c index 1cc83c3dd..7fb492882 100644 --- a/mesalib/src/gallium/auxiliary/util/u_vbuf.c +++ b/mesalib/src/gallium/auxiliary/util/u_vbuf.c @@ -89,17 +89,17 @@ struct u_vbuf { /* This is what was set in set_vertex_buffers. * May contain user buffers. */ struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; - unsigned nr_vertex_buffers; + uint32_t enabled_vb_mask; - /* Saved vertex buffers. */ - struct pipe_vertex_buffer vertex_buffer_saved[PIPE_MAX_ATTRIBS]; - unsigned nr_vertex_buffers_saved; + /* Saved vertex buffer. */ + unsigned aux_vertex_buffer_slot; + struct pipe_vertex_buffer aux_vertex_buffer_saved; /* Vertex buffers for the driver. - * There are no user buffers. */ + * There are usually no user buffers. */ struct pipe_vertex_buffer real_vertex_buffer[PIPE_MAX_ATTRIBS]; - unsigned nr_real_vertex_buffers; - boolean vertex_buffers_dirty; + uint32_t dirty_real_vb_mask; /* which buffers are dirty since the last + call of set_vertex_buffers */ /* The index buffer. */ struct pipe_index_buffer index_buffer; @@ -174,11 +174,12 @@ void u_vbuf_get_caps(struct pipe_screen *screen, struct u_vbuf_caps *caps) struct u_vbuf * u_vbuf_create(struct pipe_context *pipe, - struct u_vbuf_caps *caps) + struct u_vbuf_caps *caps, unsigned aux_vertex_buffer_index) { struct u_vbuf *mgr = CALLOC_STRUCT(u_vbuf); mgr->caps = *caps; + mgr->aux_vertex_buffer_slot = aux_vertex_buffer_index; mgr->pipe = pipe; mgr->cso_cache = cso_cache_create(); mgr->translate_cache = translate_cache_create(); @@ -239,16 +240,20 @@ void u_vbuf_set_vertex_elements(struct u_vbuf *mgr, unsigned count, void u_vbuf_destroy(struct u_vbuf *mgr) { + struct pipe_screen *screen = mgr->pipe->screen; unsigned i; + unsigned num_vb = screen->get_shader_param(screen, PIPE_SHADER_VERTEX, + PIPE_SHADER_CAP_MAX_INPUTS); - mgr->pipe->set_vertex_buffers(mgr->pipe, 0, NULL); + mgr->pipe->set_vertex_buffers(mgr->pipe, 0, num_vb, NULL); - for (i = 0; i < mgr->nr_vertex_buffers; i++) { + for (i = 0; i < PIPE_MAX_ATTRIBS; i++) { pipe_resource_reference(&mgr->vertex_buffer[i].buffer, NULL); } - for (i = 0; i < mgr->nr_real_vertex_buffers; i++) { + for (i = 0; i < PIPE_MAX_ATTRIBS; i++) { pipe_resource_reference(&mgr->real_vertex_buffer[i].buffer, NULL); } + pipe_resource_reference(&mgr->aux_vertex_buffer_saved.buffer, NULL); translate_cache_destroy(mgr->translate_cache); u_upload_destroy(mgr->uploader); @@ -267,39 +272,42 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key, struct pipe_transfer *vb_transfer[PIPE_MAX_ATTRIBS] = {0}; struct pipe_resource *out_buffer = NULL; uint8_t *out_map; - unsigned i, out_offset; + unsigned out_offset, mask; /* Get a translate object. */ tr = translate_cache_find(mgr->translate_cache, key); /* Map buffers we want to translate. */ - for (i = 0; i < mgr->nr_vertex_buffers; i++) { - if (vb_mask & (1 << i)) { - struct pipe_vertex_buffer *vb = &mgr->vertex_buffer[i]; - unsigned offset = vb->buffer_offset + vb->stride * start_vertex; - uint8_t *map; + mask = vb_mask; + while (mask) { + struct pipe_vertex_buffer *vb; + unsigned offset; + uint8_t *map; + unsigned i = u_bit_scan(&mask); - if (vb->user_buffer) { - map = (uint8_t*)vb->user_buffer + offset; - } else { - unsigned size = vb->stride ? num_vertices * vb->stride - : sizeof(double)*4; + vb = &mgr->vertex_buffer[i]; + offset = vb->buffer_offset + vb->stride * start_vertex; - if (offset+size > vb->buffer->width0) { - size = vb->buffer->width0 - offset; - } + if (vb->user_buffer) { + map = (uint8_t*)vb->user_buffer + offset; + } else { + unsigned size = vb->stride ? num_vertices * vb->stride + : sizeof(double)*4; - map = pipe_buffer_map_range(mgr->pipe, vb->buffer, offset, size, - PIPE_TRANSFER_READ, &vb_transfer[i]); + if (offset+size > vb->buffer->width0) { + size = vb->buffer->width0 - offset; } - /* Subtract min_index so that indexing with the index buffer works. */ - if (unroll_indices) { - map -= vb->stride * min_index; - } + map = pipe_buffer_map_range(mgr->pipe, vb->buffer, offset, size, + PIPE_TRANSFER_READ, &vb_transfer[i]); + } - tr->set_buffer(tr, i, map, vb->stride, ~0); + /* Subtract min_index so that indexing with the index buffer works. */ + if (unroll_indices) { + map -= vb->stride * min_index; } + + tr->set_buffer(tr, i, map, vb->stride, ~0); } /* Translate. */ @@ -354,7 +362,10 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key, } /* Unmap all buffers. */ - for (i = 0; i < mgr->nr_vertex_buffers; i++) { + mask = vb_mask; + while (mask) { + unsigned i = u_bit_scan(&mask); + if (vb_transfer[i]) { pipe_buffer_unmap(mgr->pipe, vb_transfer[i]); } @@ -379,7 +390,7 @@ u_vbuf_translate_find_free_vb_slots(struct u_vbuf *mgr, /* Set the bit for each buffer which is incompatible, or isn't set. */ uint32_t unused_vb_mask = mgr->ve->incompatible_vb_mask_all | mgr->incompatible_vb_mask | - ~((1 << mgr->nr_vertex_buffers) - 1); + ~mgr->enabled_vb_mask; memset(fallback_vbs, ~0, sizeof(fallback_vbs)); @@ -389,20 +400,21 @@ u_vbuf_translate_find_free_vb_slots(struct u_vbuf *mgr, uint32_t index; if (!unused_vb_mask) { - /* fail, reset the number to its original value */ - mgr->nr_real_vertex_buffers = mgr->nr_vertex_buffers; return FALSE; } index = ffs(unused_vb_mask) - 1; fallback_vbs[type] = index; - if (index >= mgr->nr_real_vertex_buffers) { - mgr->nr_real_vertex_buffers = index + 1; - } /*printf("found slot=%i for type=%i\n", index, type);*/ } } + for (type = 0; type < VB_NUM; type++) { + if (mask[type]) { + mgr->dirty_real_vb_mask |= 1 << fallback_vbs[type]; + } + } + memcpy(mgr->fallback_vbs, fallback_vbs, sizeof(fallback_vbs)); return TRUE; } @@ -568,9 +580,11 @@ static void u_vbuf_translate_end(struct u_vbuf *mgr) if (vb != ~0) { pipe_resource_reference(&mgr->real_vertex_buffer[vb].buffer, NULL); mgr->fallback_vbs[i] = ~0; + + /* This will cause the buffer to be unbound in the driver later. */ + mgr->dirty_real_vb_mask |= 1 << vb; } } - mgr->nr_real_vertex_buffers = mgr->nr_vertex_buffers; } #define FORMAT_REPLACE(what, withwhat) \ @@ -700,45 +714,77 @@ static void u_vbuf_delete_vertex_elements(struct u_vbuf *mgr, void *cso) FREE(ve); } -void u_vbuf_set_vertex_buffers(struct u_vbuf *mgr, unsigned count, +void u_vbuf_set_vertex_buffers(struct u_vbuf *mgr, + unsigned start_slot, unsigned count, const struct pipe_vertex_buffer *bufs) { unsigned i; + /* which buffers are enabled */ + uint32_t enabled_vb_mask = 0; + /* which buffers are in user memory */ + uint32_t user_vb_mask = 0; + /* which buffers are incompatible with the driver */ + uint32_t incompatible_vb_mask = 0; + /* which buffers have a non-zero stride */ + uint32_t nonzero_stride_vb_mask = 0; + uint32_t mask = ~(((1ull << count) - 1) << start_slot); + + /* Zero out the bits we are going to rewrite completely. */ + mgr->user_vb_mask &= mask; + mgr->incompatible_vb_mask &= mask; + mgr->nonzero_stride_vb_mask &= mask; + mgr->enabled_vb_mask &= mask; + + if (!bufs) { + struct pipe_context *pipe = mgr->pipe; + /* Unbind. */ + mgr->dirty_real_vb_mask &= mask; - mgr->user_vb_mask = 0; - mgr->incompatible_vb_mask = 0; - mgr->nonzero_stride_vb_mask = 0; + for (i = 0; i < count; i++) { + unsigned dst_index = start_slot + i; + + pipe_resource_reference(&mgr->vertex_buffer[dst_index].buffer, NULL); + pipe_resource_reference(&mgr->real_vertex_buffer[dst_index].buffer, + NULL); + } + + pipe->set_vertex_buffers(pipe, start_slot, count, NULL); + return; + } for (i = 0; i < count; i++) { + unsigned dst_index = start_slot + i; const struct pipe_vertex_buffer *vb = &bufs[i]; - struct pipe_vertex_buffer *orig_vb = &mgr->vertex_buffer[i]; - struct pipe_vertex_buffer *real_vb = &mgr->real_vertex_buffer[i]; + struct pipe_vertex_buffer *orig_vb = &mgr->vertex_buffer[dst_index]; + struct pipe_vertex_buffer *real_vb = &mgr->real_vertex_buffer[dst_index]; + + if (!vb->buffer && !vb->user_buffer) { + pipe_resource_reference(&orig_vb->buffer, NULL); + pipe_resource_reference(&real_vb->buffer, NULL); + real_vb->user_buffer = NULL; + continue; + } pipe_resource_reference(&orig_vb->buffer, vb->buffer); orig_vb->user_buffer = vb->user_buffer; real_vb->buffer_offset = orig_vb->buffer_offset = vb->buffer_offset; real_vb->stride = orig_vb->stride = vb->stride; - real_vb->user_buffer = NULL; if (vb->stride) { - mgr->nonzero_stride_vb_mask |= 1 << i; - } - - if (!vb->buffer && !vb->user_buffer) { - pipe_resource_reference(&real_vb->buffer, NULL); - continue; + nonzero_stride_vb_mask |= 1 << dst_index; } + enabled_vb_mask |= 1 << dst_index; if ((!mgr->caps.buffer_offset_unaligned && vb->buffer_offset % 4 != 0) || (!mgr->caps.buffer_stride_unaligned && vb->stride % 4 != 0)) { - mgr->incompatible_vb_mask |= 1 << i; + incompatible_vb_mask |= 1 << dst_index; pipe_resource_reference(&real_vb->buffer, NULL); continue; } if (!mgr->caps.user_vertex_buffers && vb->user_buffer) { - mgr->user_vb_mask |= 1 << i; + user_vb_mask |= 1 << dst_index; pipe_resource_reference(&real_vb->buffer, NULL); continue; } @@ -747,16 +793,14 @@ void u_vbuf_set_vertex_buffers(struct u_vbuf *mgr, unsigned count, real_vb->user_buffer = vb->user_buffer; } - for (i = count; i < mgr->nr_vertex_buffers; i++) { - pipe_resource_reference(&mgr->vertex_buffer[i].buffer, NULL); - } - for (i = count; i < mgr->nr_real_vertex_buffers; i++) { - pipe_resource_reference(&mgr->real_vertex_buffer[i].buffer, NULL); - } + mgr->user_vb_mask |= user_vb_mask; + mgr->incompatible_vb_mask |= incompatible_vb_mask; + mgr->nonzero_stride_vb_mask |= nonzero_stride_vb_mask; + mgr->enabled_vb_mask |= enabled_vb_mask; - mgr->nr_vertex_buffers = count; - mgr->nr_real_vertex_buffers = count; - mgr->vertex_buffers_dirty = TRUE; + /* All changed buffers are marked as dirty, even the NULL ones, + * which will cause the NULL buffers to be unbound in the driver later. */ + mgr->dirty_real_vb_mask |= ~mask; } void u_vbuf_set_index_buffer(struct u_vbuf *mgr, @@ -782,7 +826,7 @@ u_vbuf_upload_buffers(struct u_vbuf *mgr, { unsigned i; unsigned nr_velems = mgr->ve->count; - unsigned nr_vbufs = mgr->nr_vertex_buffers; + unsigned nr_vbufs = util_last_bit(mgr->enabled_vb_mask); struct pipe_vertex_element *velems = mgr->using_translate ? mgr->fallback_velems : mgr->ve->ve; unsigned start_offset[PIPE_MAX_ATTRIBS]; @@ -978,6 +1022,19 @@ static void u_vbuf_get_minmax_index(struct pipe_context *pipe, } } +static void u_vbuf_set_driver_vertex_buffers(struct u_vbuf *mgr) +{ + struct pipe_context *pipe = mgr->pipe; + unsigned start_slot, count; + + start_slot = ffs(mgr->dirty_real_vb_mask) - 1; + count = util_last_bit(mgr->dirty_real_vb_mask >> start_slot); + + pipe->set_vertex_buffers(pipe, start_slot, count, + mgr->real_vertex_buffer + start_slot); + mgr->dirty_real_vb_mask = 0; +} + void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct pipe_draw_info *info) { struct pipe_context *pipe = mgr->pipe; @@ -990,11 +1047,10 @@ void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct pipe_draw_info *info) if (!mgr->incompatible_vb_mask && !mgr->ve->incompatible_elem_mask && !user_vb_mask) { + /* Set vertex buffers if needed. */ - if (mgr->vertex_buffers_dirty) { - pipe->set_vertex_buffers(pipe, mgr->nr_real_vertex_buffers, - mgr->real_vertex_buffer); - mgr->vertex_buffers_dirty = FALSE; + if (mgr->dirty_real_vb_mask) { + u_vbuf_set_driver_vertex_buffers(mgr); } pipe->draw_vbo(pipe, info); @@ -1062,6 +1118,7 @@ void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct pipe_draw_info *info) if (user_vb_mask) { u_vbuf_upload_buffers(mgr, start_vertex, num_vertices, info->start_instance, info->instance_count); + mgr->dirty_real_vb_mask |= user_vb_mask; } /* @@ -1086,8 +1143,7 @@ void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct pipe_draw_info *info) */ u_upload_unmap(mgr->uploader); - pipe->set_vertex_buffers(pipe, mgr->nr_real_vertex_buffers, - mgr->real_vertex_buffer); + u_vbuf_set_driver_vertex_buffers(mgr); if (unlikely(unroll_indices)) { struct pipe_draw_info new_info = *info; @@ -1105,7 +1161,6 @@ void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct pipe_draw_info *info) if (mgr->using_translate) { u_vbuf_translate_end(mgr); } - mgr->vertex_buffers_dirty = TRUE; } void u_vbuf_save_vertex_elements(struct u_vbuf *mgr) @@ -1126,22 +1181,18 @@ void u_vbuf_restore_vertex_elements(struct u_vbuf *mgr) mgr->ve_saved = NULL; } -void u_vbuf_save_vertex_buffers(struct u_vbuf *mgr) +void u_vbuf_save_aux_vertex_buffer_slot(struct u_vbuf *mgr) { - util_copy_vertex_buffers(mgr->vertex_buffer_saved, - &mgr->nr_vertex_buffers_saved, - mgr->vertex_buffer, - mgr->nr_vertex_buffers); + struct pipe_vertex_buffer *vb = + &mgr->vertex_buffer[mgr->aux_vertex_buffer_slot]; + + pipe_resource_reference(&mgr->aux_vertex_buffer_saved.buffer, vb->buffer); + memcpy(&mgr->aux_vertex_buffer_saved, vb, sizeof(*vb)); } -void u_vbuf_restore_vertex_buffers(struct u_vbuf *mgr) +void u_vbuf_restore_aux_vertex_buffer_slot(struct u_vbuf *mgr) { - unsigned i; - - u_vbuf_set_vertex_buffers(mgr, mgr->nr_vertex_buffers_saved, - mgr->vertex_buffer_saved); - for (i = 0; i < mgr->nr_vertex_buffers_saved; i++) { - pipe_resource_reference(&mgr->vertex_buffer_saved[i].buffer, NULL); - } - mgr->nr_vertex_buffers_saved = 0; + u_vbuf_set_vertex_buffers(mgr, mgr->aux_vertex_buffer_slot, 1, + &mgr->aux_vertex_buffer_saved); + pipe_resource_reference(&mgr->aux_vertex_buffer_saved.buffer, NULL); } diff --git a/mesalib/src/gallium/auxiliary/util/u_vbuf.h b/mesalib/src/gallium/auxiliary/util/u_vbuf.h index 59eb59a11..0f8227164 100644 --- a/mesalib/src/gallium/auxiliary/util/u_vbuf.h +++ b/mesalib/src/gallium/auxiliary/util/u_vbuf.h @@ -64,14 +64,15 @@ void u_vbuf_get_caps(struct pipe_screen *screen, struct u_vbuf_caps *caps); struct u_vbuf * u_vbuf_create(struct pipe_context *pipe, - struct u_vbuf_caps *caps); + struct u_vbuf_caps *caps, unsigned aux_vertex_buffer_index); void u_vbuf_destroy(struct u_vbuf *mgr); /* State and draw functions. */ void u_vbuf_set_vertex_elements(struct u_vbuf *mgr, unsigned count, const struct pipe_vertex_element *states); -void u_vbuf_set_vertex_buffers(struct u_vbuf *mgr, unsigned count, +void u_vbuf_set_vertex_buffers(struct u_vbuf *mgr, + unsigned start_slot, unsigned count, const struct pipe_vertex_buffer *bufs); void u_vbuf_set_index_buffer(struct u_vbuf *mgr, const struct pipe_index_buffer *ib); @@ -80,7 +81,7 @@ void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct pipe_draw_info *info); /* Save/restore functionality. */ void u_vbuf_save_vertex_elements(struct u_vbuf *mgr); void u_vbuf_restore_vertex_elements(struct u_vbuf *mgr); -void u_vbuf_save_vertex_buffers(struct u_vbuf *mgr); -void u_vbuf_restore_vertex_buffers(struct u_vbuf *mgr); +void u_vbuf_save_aux_vertex_buffer_slot(struct u_vbuf *mgr); +void u_vbuf_restore_aux_vertex_buffer_slot(struct u_vbuf *mgr); #endif diff --git a/mesalib/src/glsl/standalone_scaffolding.cpp b/mesalib/src/glsl/standalone_scaffolding.cpp index 679714e38..7e37be578 100644 --- a/mesalib/src/glsl/standalone_scaffolding.cpp +++ b/mesalib/src/glsl/standalone_scaffolding.cpp @@ -80,6 +80,7 @@ void initialize_context_to_defaults(struct gl_context *ctx, gl_api api) ctx->Extensions.EXT_texture3D = true; ctx->Extensions.OES_EGL_image_external = true; ctx->Extensions.ARB_shader_bit_encoding = true; + ctx->Extensions.OES_standard_derivatives = true; ctx->Const.GLSLVersion = 120; diff --git a/mesalib/src/mapi/glapi/gen/gl_API.xml b/mesalib/src/mapi/glapi/gen/gl_API.xml index a92853e58..2f6cf195f 100644 --- a/mesalib/src/mapi/glapi/gen/gl_API.xml +++ b/mesalib/src/mapi/glapi/gen/gl_API.xml @@ -8075,7 +8075,13 @@ </function> </category> -<!-- ARB extensions #110...#116 --> +<!-- ARB extensions #110...#112 --> + +<category name="GL_ARB_map_buffer_alignment" number="113"> + <enum name="MIN_MAP_BUFFER_ALIGNMENT" value="0x90BC" /> +</category> + +<!-- ARB extensions #114...#116 --> <xi:include href="ARB_base_instance.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c index ffeda5161..f6c6133e3 100644 --- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c +++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c @@ -653,12 +653,8 @@ swrast_init_driver_functions(struct dd_function_table *driver) static const char *es2_extensions[] = { /* Used by mesa internally (cf all_mesa_extensions in ../common/utils.c) */ - "GL_ARB_transpose_matrix", - "GL_ARB_window_pos", "GL_EXT_blend_func_separate", - "GL_EXT_compiled_vertex_array", "GL_EXT_framebuffer_blit", - "GL_IBM_multimode_draw_arrays", "GL_MESA_window_pos", /* Required by GLES2 */ diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c index e60a05a9e..e704f2f2d 100644 --- a/mesalib/src/mesa/main/enable.c +++ b/mesalib/src/mesa/main/enable.c @@ -803,7 +803,6 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) case GL_RASTER_POSITION_UNCLIPPED_IBM: if (ctx->API != API_OPENGL) goto invalid_enum_error; - CHECK_EXTENSION(IBM_rasterpos_clip, cap); if (ctx->Transform.RasterPositionUnclipped == state) return; FLUSH_VERTICES(ctx, _NEW_TRANSFORM); @@ -1450,7 +1449,6 @@ _mesa_IsEnabled( GLenum cap ) case GL_RASTER_POSITION_UNCLIPPED_IBM: if (ctx->API != API_OPENGL) goto invalid_enum_error; - CHECK_EXTENSION(IBM_rasterpos_clip); return ctx->Transform.RasterPositionUnclipped; /* GL_NV_point_sprite */ diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index edee5967d..f8688cdb9 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -83,7 +83,7 @@ static const struct extension extension_table[] = { { "GL_ARB_base_instance", o(ARB_base_instance), GL, 2011 }, { "GL_ARB_blend_func_extended", o(ARB_blend_func_extended), GL, 2009 }, { "GL_ARB_color_buffer_float", o(ARB_color_buffer_float), GL, 2004 }, - { "GL_ARB_copy_buffer", o(ARB_copy_buffer), GL, 2008 }, + { "GL_ARB_copy_buffer", o(dummy_true), GL, 2008 }, { "GL_ARB_conservative_depth", o(ARB_conservative_depth), GL, 2011 }, { "GL_ARB_debug_output", o(dummy_true), GL, 2009 }, { "GL_ARB_depth_buffer_float", o(ARB_depth_buffer_float), GL, 2008 }, @@ -104,6 +104,7 @@ static const struct extension extension_table[] = { { "GL_ARB_half_float_vertex", o(ARB_half_float_vertex), GL, 2008 }, { "GL_ARB_instanced_arrays", o(ARB_instanced_arrays), GL, 2008 }, { "GL_ARB_invalidate_subdata", o(dummy_true), GL, 2012 }, + { "GL_ARB_map_buffer_alignment", o(ARB_map_buffer_alignment), GL, 2011 }, { "GL_ARB_map_buffer_range", o(ARB_map_buffer_range), GL, 2008 }, { "GL_ARB_multisample", o(dummy_true), GLL, 1994 }, { "GL_ARB_multitexture", o(dummy_true), GLL, 1998 }, @@ -145,7 +146,7 @@ static const struct extension extension_table[] = { { "GL_ARB_transform_feedback2", o(ARB_transform_feedback2), GL, 2010 }, { "GL_ARB_transform_feedback3", o(ARB_transform_feedback3), GL, 2010 }, { "GL_ARB_transform_feedback_instanced", o(ARB_transform_feedback_instanced), GL, 2011 }, - { "GL_ARB_transpose_matrix", o(ARB_transpose_matrix), GLL, 1999 }, + { "GL_ARB_transpose_matrix", o(dummy_true), GLL, 1999 }, { "GL_ARB_uniform_buffer_object", o(ARB_uniform_buffer_object), GL, 2009 }, { "GL_ARB_vertex_array_bgra", o(EXT_vertex_array_bgra), GL, 2008 }, { "GL_ARB_vertex_array_object", o(dummy_true), GL, 2006 }, @@ -153,7 +154,7 @@ static const struct extension extension_table[] = { { "GL_ARB_vertex_program", o(ARB_vertex_program), GLL, 2002 }, { "GL_ARB_vertex_shader", o(ARB_vertex_shader), GL, 2002 }, { "GL_ARB_vertex_type_2_10_10_10_rev", o(ARB_vertex_type_2_10_10_10_rev), GL, 2009 }, - { "GL_ARB_window_pos", o(ARB_window_pos), GLL, 2001 }, + { "GL_ARB_window_pos", o(dummy_true), GLL, 2001 }, /* EXT extensions */ { "GL_EXT_abgr", o(dummy_true), GL, 1995 }, { "GL_EXT_bgra", o(dummy_true), GLL, 1995 }, @@ -163,12 +164,12 @@ static const struct extension extension_table[] = { { "GL_EXT_blend_minmax", o(EXT_blend_minmax), GLL | ES1 | ES2, 1995 }, { "GL_EXT_blend_subtract", o(dummy_true), GLL, 1995 }, { "GL_EXT_clip_volume_hint", o(EXT_clip_volume_hint), GL, 1996 }, - { "GL_EXT_compiled_vertex_array", o(EXT_compiled_vertex_array), GLL, 1996 }, + { "GL_EXT_compiled_vertex_array", o(dummy_true), GLL, 1996 }, { "GL_EXT_copy_texture", o(dummy_true), GLL, 1995 }, { "GL_EXT_depth_bounds_test", o(EXT_depth_bounds_test), GL, 2002 }, { "GL_EXT_draw_buffers2", o(EXT_draw_buffers2), GL, 2006 }, { "GL_EXT_draw_instanced", o(ARB_draw_instanced), GL, 2006 }, - { "GL_EXT_draw_range_elements", o(EXT_draw_range_elements), GLL, 1997 }, + { "GL_EXT_draw_range_elements", o(dummy_true), GLL, 1997 }, { "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 }, @@ -180,15 +181,15 @@ static const struct extension extension_table[] = { { "GL_EXT_multi_draw_arrays", o(dummy_true), GLL | ES1 | ES2, 1999 }, { "GL_EXT_packed_depth_stencil", o(EXT_packed_depth_stencil), GL, 2005 }, { "GL_EXT_packed_float", o(EXT_packed_float), GL, 2004 }, - { "GL_EXT_packed_pixels", o(EXT_packed_pixels), GLL, 1997 }, + { "GL_EXT_packed_pixels", o(dummy_true), GLL, 1997 }, { "GL_EXT_pixel_buffer_object", o(EXT_pixel_buffer_object), GL, 2004 }, { "GL_EXT_point_parameters", o(EXT_point_parameters), GLL, 1997 }, { "GL_EXT_polygon_offset", o(dummy_true), GLL, 1995 }, { "GL_EXT_provoking_vertex", o(EXT_provoking_vertex), GL, 2009 }, - { "GL_EXT_rescale_normal", o(EXT_rescale_normal), GLL, 1997 }, + { "GL_EXT_rescale_normal", o(dummy_true), GLL, 1997 }, { "GL_EXT_secondary_color", o(EXT_secondary_color), GLL, 1999 }, { "GL_EXT_separate_shader_objects", o(EXT_separate_shader_objects), GLL, 2008 }, - { "GL_EXT_separate_specular_color", o(EXT_separate_specular_color), GLL, 1997 }, + { "GL_EXT_separate_specular_color", o(dummy_true), GLL, 1997 }, { "GL_EXT_shadow_funcs", o(EXT_shadow_funcs), GLL, 2002 }, { "GL_EXT_stencil_two_side", o(EXT_stencil_two_side), GLL, 2001 }, { "GL_EXT_stencil_wrap", o(dummy_true), GLL, 2002 }, @@ -274,7 +275,7 @@ static const struct extension extension_table[] = { { "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_APPLE_object_purgeable", o(APPLE_object_purgeable), GL, 2006 }, - { "GL_APPLE_packed_pixels", o(APPLE_packed_pixels), GLL, 2002 }, + { "GL_APPLE_packed_pixels", o(dummy_true), GLL, 2002 }, { "GL_APPLE_texture_max_level", o(dummy_true), ES1 | ES2, 2009 }, { "GL_APPLE_vertex_array_object", o(dummy_true), GLL, 2002 }, { "GL_ATI_blend_equation_separate", o(EXT_blend_equation_separate), GL, 2003 }, @@ -286,15 +287,15 @@ static const struct extension extension_table[] = { { "GL_ATI_texture_env_combine3", o(ATI_texture_env_combine3), GLL, 2002 }, { "GL_ATI_texture_float", o(ARB_texture_float), GL, 2002 }, { "GL_ATI_texture_mirror_once", o(ATI_texture_mirror_once), GL, 2006 }, - { "GL_IBM_multimode_draw_arrays", o(IBM_multimode_draw_arrays), GL, 1998 }, - { "GL_IBM_rasterpos_clip", o(IBM_rasterpos_clip), GL, 1996 }, + { "GL_IBM_multimode_draw_arrays", o(dummy_true), GL, 1998 }, + { "GL_IBM_rasterpos_clip", o(dummy_true), GL, 1996 }, { "GL_IBM_texture_mirrored_repeat", o(dummy_true), GLL, 1998 }, { "GL_INGR_blend_func_separate", o(EXT_blend_func_separate), GLL, 1999 }, { "GL_MESA_pack_invert", o(MESA_pack_invert), GL, 2002 }, { "GL_MESA_resize_buffers", o(MESA_resize_buffers), GL, 1999 }, { "GL_MESA_texture_array", o(MESA_texture_array), GLL, 2007 }, { "GL_MESA_texture_signed_rgba", o(EXT_texture_snorm), GL, 2009 }, - { "GL_MESA_window_pos", o(ARB_window_pos), GLL, 2000 }, + { "GL_MESA_window_pos", o(dummy_true), GLL, 2000 }, { "GL_MESA_ycbcr_texture", o(MESA_ycbcr_texture), GL, 2002 }, { "GL_NV_blend_square", o(NV_blend_square), GLL, 1999 }, { "GL_NV_conditional_render", o(NV_conditional_render), GL, 2008 }, @@ -303,12 +304,12 @@ static const struct extension extension_table[] = { { "GL_NV_fbo_color_attachments", o(EXT_framebuffer_object), ES2, 2010 }, { "GL_NV_fog_distance", o(NV_fog_distance), GLL, 2001 }, { "GL_NV_fragment_program_option", o(NV_fragment_program_option), GLL, 2005 }, - { "GL_NV_light_max_exponent", o(NV_light_max_exponent), GLL, 1999 }, + { "GL_NV_light_max_exponent", o(dummy_true), GLL, 1999 }, { "GL_NV_packed_depth_stencil", o(EXT_packed_depth_stencil), GL, 2000 }, { "GL_NV_point_sprite", o(NV_point_sprite), GL, 2001 }, { "GL_NV_primitive_restart", o(NV_primitive_restart), GL, 2002 }, { "GL_NV_read_buffer", o(dummy_true), ES2, 2011 }, - { "GL_NV_texgen_reflection", o(NV_texgen_reflection), GLL, 1999 }, + { "GL_NV_texgen_reflection", o(dummy_true), GLL, 1999 }, { "GL_NV_texture_barrier", o(NV_texture_barrier), GL, 2009 }, { "GL_NV_texture_env_combine4", o(NV_texture_env_combine4), GLL, 1999 }, { "GL_NV_texture_rectangle", o(NV_texture_rectangle), GLL, 2000 }, @@ -316,7 +317,7 @@ static const struct extension extension_table[] = { { "GL_SGIS_generate_mipmap", o(dummy_true), GLL, 1997 }, { "GL_SGIS_texture_border_clamp", o(ARB_texture_border_clamp), GLL, 1997 }, { "GL_SGIS_texture_edge_clamp", o(dummy_true), GLL, 1997 }, - { "GL_SGIS_texture_lod", o(SGIS_texture_lod), GLL, 1997 }, + { "GL_SGIS_texture_lod", o(dummy_true), GLL, 1997 }, { "GL_SUN_multi_draw_arrays", o(dummy_true), GLL, 1999 }, { 0, 0, 0, 0 }, @@ -349,46 +350,12 @@ name_to_offset(const char* name) /** - * \brief Extensions enabled by default. - * - * These extensions are enabled by _mesa_init_extensions(). - * - * XXX: Should these defaults also apply to GLES? - */ -static const size_t default_extensions[] = { - o(ARB_copy_buffer), - o(ARB_transpose_matrix), - o(ARB_window_pos), - - o(EXT_compiled_vertex_array), - o(EXT_draw_range_elements), - o(EXT_packed_pixels), - o(EXT_rescale_normal), - o(EXT_separate_specular_color), - o(EXT_texture3D), - - o(OES_standard_derivatives), - - /* Vendor Extensions */ - o(APPLE_packed_pixels), - o(IBM_multimode_draw_arrays), - o(IBM_rasterpos_clip), - o(NV_light_max_exponent), - o(NV_texgen_reflection), - o(SGIS_texture_lod), - - 0, -}; - - -/** * Enable all extensions suitable for a software-only renderer. * This is a convenience function used by the XMesa, OSMesa, GGI drivers, etc. */ void _mesa_enable_sw_extensions(struct gl_context *ctx) { - /*ctx->Extensions.ARB_copy_buffer = GL_TRUE;*/ ctx->Extensions.ARB_depth_clamp = GL_TRUE; ctx->Extensions.ARB_depth_texture = GL_TRUE; ctx->Extensions.ARB_draw_elements_base_vertex = GL_TRUE; @@ -461,20 +428,18 @@ _mesa_enable_sw_extensions(struct gl_context *ctx) ctx->Extensions.EXT_texture_swizzle = GL_TRUE; /*ctx->Extensions.EXT_transform_feedback = GL_TRUE;*/ ctx->Extensions.EXT_vertex_array_bgra = GL_TRUE; - /*ctx->Extensions.IBM_multimode_draw_arrays = GL_TRUE;*/ ctx->Extensions.MESA_pack_invert = GL_TRUE; ctx->Extensions.MESA_resize_buffers = GL_TRUE; ctx->Extensions.MESA_texture_array = GL_TRUE; ctx->Extensions.MESA_ycbcr_texture = GL_TRUE; ctx->Extensions.NV_blend_square = GL_TRUE; ctx->Extensions.NV_conditional_render = GL_TRUE; - /*ctx->Extensions.NV_light_max_exponent = GL_TRUE;*/ ctx->Extensions.NV_point_sprite = GL_TRUE; ctx->Extensions.NV_texture_env_combine4 = GL_TRUE; ctx->Extensions.NV_texture_rectangle = GL_TRUE; - /*ctx->Extensions.NV_texgen_reflection = GL_TRUE;*/ ctx->Extensions.NV_fragment_program_option = GL_TRUE; ctx->Extensions.EXT_gpu_program_parameters = GL_TRUE; + ctx->Extensions.OES_standard_derivatives = GL_TRUE; _mesa_enable_extension(ctx, "GL_3DFX_texture_compression_FXT1"); if (ctx->Mesa_DXTn) { ctx->Extensions.ANGLE_texture_compression_dxt = GL_TRUE; @@ -495,7 +460,6 @@ _mesa_enable_1_3_extensions(struct gl_context *ctx) ctx->Extensions.ARB_texture_cube_map = GL_TRUE; ctx->Extensions.ARB_texture_env_combine = GL_TRUE; ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE; - /*ctx->Extensions.ARB_transpose_matrix = GL_TRUE;*/ } @@ -510,7 +474,6 @@ _mesa_enable_1_4_extensions(struct gl_context *ctx) ctx->Extensions.ARB_depth_texture = GL_TRUE; ctx->Extensions.ARB_shadow = GL_TRUE; ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE; - ctx->Extensions.ARB_window_pos = GL_TRUE; ctx->Extensions.EXT_blend_color = GL_TRUE; ctx->Extensions.EXT_blend_func_separate = GL_TRUE; ctx->Extensions.EXT_blend_minmax = GL_TRUE; @@ -717,7 +680,6 @@ _mesa_init_extensions( struct gl_context *ctx ) GLboolean *base = (GLboolean *) &ctx->Extensions; GLboolean *sentinel = base + o(extension_sentinel); GLboolean *i; - const size_t *j; /* First, turn all extensions off. */ for (i = base; i != sentinel; ++i) @@ -725,8 +687,7 @@ _mesa_init_extensions( struct gl_context *ctx ) /* Then, selectively turn default extensions on. */ ctx->Extensions.dummy_true = GL_TRUE; - for (j = default_extensions; *j != 0; ++j) - base[*j] = GL_TRUE; + ctx->Extensions.EXT_texture3D = GL_TRUE; } diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c index 805f0f978..c34d873f2 100644 --- a/mesalib/src/mesa/main/get.c +++ b/mesalib/src/mesa/main/get.c @@ -303,11 +303,9 @@ EXTRA_EXT(EXT_secondary_color); EXTRA_EXT(EXT_fog_coord); EXTRA_EXT(NV_fog_distance); EXTRA_EXT(EXT_texture_filter_anisotropic); -EXTRA_EXT(IBM_rasterpos_clip); EXTRA_EXT(NV_point_sprite); EXTRA_EXT(NV_texture_rectangle); EXTRA_EXT(EXT_stencil_two_side); -EXTRA_EXT(NV_light_max_exponent); EXTRA_EXT(EXT_depth_bounds_test); EXTRA_EXT(ARB_depth_clamp); EXTRA_EXT(ATI_fragment_shader); @@ -319,7 +317,6 @@ EXTRA_EXT(ARB_fragment_program); EXTRA_EXT2(ARB_framebuffer_object, EXT_framebuffer_multisample); EXTRA_EXT(EXT_framebuffer_object); EXTRA_EXT(ARB_seamless_cube_map); -EXTRA_EXT(EXT_compiled_vertex_array); EXTRA_EXT(ARB_sync); EXTRA_EXT(ARB_vertex_shader); EXTRA_EXT(EXT_transform_feedback); @@ -331,13 +328,13 @@ EXTRA_EXT2(NV_point_sprite, ARB_point_sprite); EXTRA_EXT2(ARB_vertex_program, ARB_fragment_program); EXTRA_EXT(ARB_geometry_shader4); EXTRA_EXT(ARB_color_buffer_float); -EXTRA_EXT(ARB_copy_buffer); EXTRA_EXT(EXT_framebuffer_sRGB); EXTRA_EXT(ARB_texture_buffer_object); EXTRA_EXT(OES_EGL_image_external); EXTRA_EXT(ARB_blend_func_extended); EXTRA_EXT(ARB_uniform_buffer_object); EXTRA_EXT(ARB_timer_query); +EXTRA_EXT(ARB_map_buffer_alignment); static const int extra_NV_primitive_restart[] = { @@ -360,7 +357,7 @@ extra_ARB_vertex_program_api_es2[] = { * GLES2 if the NV_read_buffer extension is available. */ static const int extra_NV_read_buffer_api_gl[] = { - EXT(NV_read_buffer), + EXTRA_API_ES2, EXTRA_API_GL, EXTRA_END }; diff --git a/mesalib/src/mesa/main/get_hash_params.py b/mesalib/src/mesa/main/get_hash_params.py index 7a25cb10c..376df09ee 100644 --- a/mesalib/src/mesa/main/get_hash_params.py +++ b/mesalib/src/mesa/main/get_hash_params.py @@ -99,8 +99,8 @@ descriptor=[ [ "CLAMP_READ_COLOR", "CONTEXT_ENUM(Color.ClampReadColor), extra_ARB_color_buffer_float" ], # GL_ARB_copy_buffer - [ "COPY_READ_BUFFER", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_copy_buffer" ], - [ "COPY_WRITE_BUFFER", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_copy_buffer" ], + [ "COPY_READ_BUFFER", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ], + [ "COPY_WRITE_BUFFER", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ], # GL_OES_read_format [ "IMPLEMENTATION_COLOR_READ_TYPE_OES", "LOC_CUSTOM, TYPE_INT, 0, extra_new_buffers" ], @@ -480,8 +480,8 @@ descriptor=[ [ "TEXTURE_COMPRESSION_HINT_ARB", "CONTEXT_INT(Hint.TextureCompression), NO_EXTRA" ], # GL_EXT_compiled_vertex_array - [ "ARRAY_ELEMENT_LOCK_FIRST_EXT", "CONTEXT_INT(Array.LockFirst), extra_EXT_compiled_vertex_array" ], - [ "ARRAY_ELEMENT_LOCK_COUNT_EXT", "CONTEXT_INT(Array.LockCount), extra_EXT_compiled_vertex_array" ], + [ "ARRAY_ELEMENT_LOCK_FIRST_EXT", "CONTEXT_INT(Array.LockFirst), NO_EXTRA" ], + [ "ARRAY_ELEMENT_LOCK_COUNT_EXT", "CONTEXT_INT(Array.LockCount), NO_EXTRA" ], # GL_ARB_transpose_matrix [ "TRANSPOSE_MODELVIEW_MATRIX_ARB", "CONTEXT_MATRIX_T(ModelviewMatrixStack), NO_EXTRA" ], @@ -507,7 +507,7 @@ descriptor=[ [ "FOG_DISTANCE_MODE_NV", "CONTEXT_ENUM(Fog.FogDistanceMode), extra_NV_fog_distance" ], # GL_IBM_rasterpos_clip - [ "RASTER_POSITION_UNCLIPPED_IBM", "CONTEXT_BOOL(Transform.RasterPositionUnclipped), extra_IBM_rasterpos_clip" ], + [ "RASTER_POSITION_UNCLIPPED_IBM", "CONTEXT_BOOL(Transform.RasterPositionUnclipped), NO_EXTRA" ], # GL_NV_point_sprite [ "POINT_SPRITE_R_MODE_NV", "CONTEXT_ENUM(Point.SpriteRMode), extra_NV_point_sprite" ], @@ -523,8 +523,8 @@ descriptor=[ [ "ACTIVE_STENCIL_FACE_EXT", "LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA" ], # GL_NV_light_max_exponent - [ "MAX_SHININESS_NV", "CONTEXT_FLOAT(Const.MaxShininess), extra_NV_light_max_exponent" ], - [ "MAX_SPOT_EXPONENT_NV", "CONTEXT_FLOAT(Const.MaxSpotExponent), extra_NV_light_max_exponent" ], + [ "MAX_SHININESS_NV", "CONTEXT_FLOAT(Const.MaxShininess), NO_EXTRA" ], + [ "MAX_SPOT_EXPONENT_NV", "CONTEXT_FLOAT(Const.MaxSpotExponent), NO_EXTRA" ], # GL_NV_primitive_restart [ "PRIMITIVE_RESTART_NV", "CONTEXT_BOOL(Array.PrimitiveRestart), extra_NV_primitive_restart" ], @@ -685,6 +685,9 @@ descriptor=[ # GL_ARB_timer_query [ "TIMESTAMP", "LOC_CUSTOM, TYPE_INT64, 0, extra_ARB_timer_query" ], + +# GL_ARB_map_buffer_alignment + [ "MIN_MAP_BUFFER_ALIGNMENT", "CONTEXT_INT(Const.MinMapBufferAlignment), extra_ARB_map_buffer_alignment" ], ]} ] diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index 7f2adc773..c8f2ca325 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -2919,6 +2919,9 @@ struct gl_constants * Force software support for primitive restart in the VBO module. */ GLboolean PrimitiveRestartInSoftware; + + /** GL_ARB_map_buffer_alignment */ + GLuint MinMapBufferAlignment; }; @@ -2937,7 +2940,6 @@ struct gl_extensions GLboolean ARB_blend_func_extended; GLboolean ARB_color_buffer_float; GLboolean ARB_conservative_depth; - GLboolean ARB_copy_buffer; GLboolean ARB_depth_buffer_float; GLboolean ARB_depth_clamp; GLboolean ARB_depth_texture; @@ -2954,6 +2956,7 @@ struct gl_extensions GLboolean ARB_half_float_pixel; GLboolean ARB_half_float_vertex; GLboolean ARB_instanced_arrays; + GLboolean ARB_map_buffer_alignment; GLboolean ARB_map_buffer_range; GLboolean ARB_occlusion_query; GLboolean ARB_occlusion_query2; @@ -2983,21 +2986,17 @@ struct gl_extensions GLboolean ARB_transform_feedback2; GLboolean ARB_transform_feedback3; GLboolean ARB_transform_feedback_instanced; - GLboolean ARB_transpose_matrix; GLboolean ARB_uniform_buffer_object; GLboolean ARB_vertex_program; GLboolean ARB_vertex_shader; GLboolean ARB_vertex_type_2_10_10_10_rev; - GLboolean ARB_window_pos; GLboolean EXT_blend_color; GLboolean EXT_blend_equation_separate; GLboolean EXT_blend_func_separate; GLboolean EXT_blend_minmax; GLboolean EXT_clip_volume_hint; - GLboolean EXT_compiled_vertex_array; GLboolean EXT_depth_bounds_test; GLboolean EXT_draw_buffers2; - GLboolean EXT_draw_range_elements; GLboolean EXT_fog_coord; GLboolean EXT_framebuffer_blit; GLboolean EXT_framebuffer_multisample; @@ -3007,15 +3006,12 @@ struct gl_extensions GLboolean EXT_gpu_shader4; GLboolean EXT_packed_depth_stencil; GLboolean EXT_packed_float; - GLboolean EXT_packed_pixels; GLboolean EXT_pixel_buffer_object; GLboolean EXT_point_parameters; GLboolean EXT_provoking_vertex; - GLboolean EXT_rescale_normal; GLboolean EXT_shadow_funcs; GLboolean EXT_secondary_color; GLboolean EXT_separate_shader_objects; - GLboolean EXT_separate_specular_color; GLboolean EXT_stencil_two_side; GLboolean EXT_texture3D; GLboolean EXT_texture_array; @@ -3036,7 +3032,6 @@ struct gl_extensions GLboolean OES_standard_derivatives; /* vendor extensions */ GLboolean AMD_seamless_cubemap_per_texture; - GLboolean APPLE_packed_pixels; GLboolean APPLE_object_purgeable; GLboolean ATI_envmap_bumpmap; GLboolean ATI_texture_compression_3dc; @@ -3044,8 +3039,6 @@ struct gl_extensions GLboolean ATI_texture_env_combine3; GLboolean ATI_fragment_shader; GLboolean ATI_separate_stencil; - GLboolean IBM_rasterpos_clip; - GLboolean IBM_multimode_draw_arrays; GLboolean MESA_pack_invert; GLboolean MESA_resize_buffers; GLboolean MESA_ycbcr_texture; @@ -3054,15 +3047,11 @@ struct gl_extensions GLboolean NV_conditional_render; GLboolean NV_fog_distance; GLboolean NV_fragment_program_option; - GLboolean NV_light_max_exponent; GLboolean NV_point_sprite; GLboolean NV_primitive_restart; - GLboolean NV_read_buffer; GLboolean NV_texture_barrier; - GLboolean NV_texgen_reflection; GLboolean NV_texture_env_combine4; GLboolean NV_texture_rectangle; - GLboolean SGIS_texture_lod; GLboolean TDFX_texture_compression_FXT1; GLboolean S3_s3tc; GLboolean OES_EGL_image; diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c index 8d69c3a05..334e6e80b 100644 --- a/mesalib/src/mesa/main/version.c +++ b/mesalib/src/mesa/main/version.c @@ -161,7 +161,6 @@ compute_version(struct gl_context *ctx) ctx->Extensions.ARB_depth_texture && ctx->Extensions.ARB_shadow && ctx->Extensions.ARB_texture_env_crossbar && - ctx->Extensions.ARB_window_pos && ctx->Extensions.EXT_blend_color && ctx->Extensions.EXT_blend_func_separate && ctx->Extensions.EXT_blend_minmax && @@ -213,7 +212,6 @@ compute_version(struct gl_context *ctx) ctx->Extensions.NV_conditional_render); const GLboolean ver_3_1 = (ver_3_0 && ctx->Const.GLSLVersion >= 140 && - ctx->Extensions.ARB_copy_buffer && ctx->Extensions.ARB_draw_instanced && ctx->Extensions.ARB_texture_buffer_object && ctx->Extensions.ARB_uniform_buffer_object && diff --git a/mesalib/src/mesa/state_tracker/st_atom_array.c b/mesalib/src/mesa/state_tracker/st_atom_array.c index ab46f1188..15f5d1c95 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_array.c +++ b/mesalib/src/mesa/state_tracker/st_atom_array.c @@ -574,7 +574,13 @@ static void update_array(struct st_context *st) num_velements = vpv->num_inputs; } - cso_set_vertex_buffers(st->cso_context, num_vbuffers, vbuffer); + cso_set_vertex_buffers(st->cso_context, 0, num_vbuffers, vbuffer); + if (st->last_num_vbuffers > num_vbuffers) { + /* Unbind remaining buffers, if any. */ + cso_set_vertex_buffers(st->cso_context, num_vbuffers, + st->last_num_vbuffers - num_vbuffers, NULL); + } + st->last_num_vbuffers = num_vbuffers; cso_set_vertex_elements(st->cso_context, num_velements, velements); } @@ -582,7 +588,7 @@ static void update_array(struct st_context *st) const struct st_tracked_state st_update_array = { "st_update_array", /* name */ { /* dirty */ - (_NEW_PROGRAM | _NEW_BUFFER_OBJECT), /* mesa */ + _NEW_BUFFER_OBJECT, /* mesa */ ST_NEW_VERTEX_ARRAYS | ST_NEW_VERTEX_PROGRAM, /* st */ }, update_array /* update */ diff --git a/mesalib/src/mesa/state_tracker/st_atom_clip.c b/mesalib/src/mesa/state_tracker/st_atom_clip.c index a1a7e003a..8558d768f 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_clip.c +++ b/mesalib/src/mesa/state_tracker/st_atom_clip.c @@ -67,8 +67,8 @@ static void update_clip( struct st_context *st ) const struct st_tracked_state st_update_clip = { "st_update_clip", /* name */ { /* dirty */ - (_NEW_TRANSFORM | _NEW_PROGRAM), /* mesa */ - 0, /* st */ + _NEW_TRANSFORM, /* mesa */ + ST_NEW_VERTEX_PROGRAM, /* st */ }, update_clip /* update */ }; diff --git a/mesalib/src/mesa/state_tracker/st_atom_constbuf.c b/mesalib/src/mesa/state_tracker/st_atom_constbuf.c index fd9228583..580393e60 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_constbuf.c +++ b/mesalib/src/mesa/state_tracker/st_atom_constbuf.c @@ -125,7 +125,7 @@ static void update_vs_constants(struct st_context *st ) const struct st_tracked_state st_update_vs_constants = { "st_update_vs_constants", /* name */ { /* dirty */ - (_NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS), /* mesa */ + _NEW_PROGRAM_CONSTANTS, /* mesa */ ST_NEW_VERTEX_PROGRAM, /* st */ }, update_vs_constants /* update */ @@ -148,7 +148,7 @@ static void update_fs_constants(struct st_context *st ) const struct st_tracked_state st_update_fs_constants = { "st_update_fs_constants", /* name */ { /* dirty */ - (_NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS), /* mesa */ + _NEW_PROGRAM_CONSTANTS, /* mesa */ ST_NEW_FRAGMENT_PROGRAM, /* st */ }, update_fs_constants /* update */ @@ -170,7 +170,7 @@ static void update_gs_constants(struct st_context *st ) const struct st_tracked_state st_update_gs_constants = { "st_update_gs_constants", /* name */ { /* dirty */ - (_NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS), /* mesa */ + _NEW_PROGRAM_CONSTANTS, /* mesa */ ST_NEW_GEOMETRY_PROGRAM, /* st */ }, update_gs_constants /* update */ diff --git a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c index b024ef0db..843dc5be3 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c +++ b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c @@ -457,7 +457,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, cso_save_vertex_shader(cso); cso_save_geometry_shader(cso); cso_save_vertex_elements(cso); - cso_save_vertex_buffers(cso); + cso_save_aux_vertex_buffer_slot(cso); /* rasterizer state: just scissor */ st->bitmap.rasterizer.scissor = ctx->Scissor.Enabled; @@ -526,7 +526,9 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, x, y, width, height, z, color, &vbuf, &offset); if (vbuf) { - util_draw_vertex_buffer(pipe, st->cso_context, vbuf, offset, + util_draw_vertex_buffer(pipe, st->cso_context, vbuf, + cso_get_aux_vertex_buffer_slot(st->cso_context), + offset, PIPE_PRIM_TRIANGLE_FAN, 4, /* verts */ 3); /* attribs/vert */ @@ -541,7 +543,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, cso_restore_vertex_shader(cso); cso_restore_geometry_shader(cso); cso_restore_vertex_elements(cso); - cso_restore_vertex_buffers(cso); + cso_restore_aux_vertex_buffer_slot(cso); cso_restore_stream_outputs(cso); pipe_resource_reference(&vbuf, NULL); diff --git a/mesalib/src/mesa/state_tracker/st_cb_clear.c b/mesalib/src/mesa/state_tracker/st_cb_clear.c index 90eb0af4f..4aa0bc18f 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_clear.c +++ b/mesalib/src/mesa/state_tracker/st_cb_clear.c @@ -176,7 +176,9 @@ draw_quad(struct st_context *st, /* draw */ util_draw_vertex_buffer(pipe, st->cso_context, - vbuf, offset, + vbuf, + cso_get_aux_vertex_buffer_slot(st->cso_context), + offset, PIPE_PRIM_TRIANGLE_FAN, 4, /* verts */ 2); /* attribs/vert */ @@ -225,7 +227,7 @@ clear_with_quad(struct gl_context *ctx, cso_save_vertex_shader(st->cso_context); cso_save_geometry_shader(st->cso_context); cso_save_vertex_elements(st->cso_context); - cso_save_vertex_buffers(st->cso_context); + cso_save_aux_vertex_buffer_slot(st->cso_context); /* blend state: RGBA masking */ { @@ -325,7 +327,7 @@ clear_with_quad(struct gl_context *ctx, cso_restore_vertex_shader(st->cso_context); cso_restore_geometry_shader(st->cso_context); cso_restore_vertex_elements(st->cso_context); - cso_restore_vertex_buffers(st->cso_context); + cso_restore_aux_vertex_buffer_slot(st->cso_context); cso_restore_stream_outputs(st->cso_context); } diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c index 642011488..ff8a9dc43 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c @@ -637,7 +637,9 @@ draw_quad(struct gl_context *ctx, GLfloat x0, GLfloat y0, GLfloat z, } u_upload_unmap(st->uploader); - util_draw_vertex_buffer(pipe, st->cso_context, buf, offset, + util_draw_vertex_buffer(pipe, st->cso_context, buf, + cso_get_aux_vertex_buffer_slot(st->cso_context), + offset, PIPE_PRIM_QUADS, 4, /* verts */ 3); /* attribs/vert */ @@ -683,7 +685,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, cso_save_vertex_shader(cso); cso_save_geometry_shader(cso); cso_save_vertex_elements(cso); - cso_save_vertex_buffers(cso); + cso_save_aux_vertex_buffer_slot(cso); if (write_stencil) { cso_save_depth_stencil_alpha(cso); cso_save_blend(cso); @@ -808,7 +810,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, cso_restore_vertex_shader(cso); cso_restore_geometry_shader(cso); cso_restore_vertex_elements(cso); - cso_restore_vertex_buffers(cso); + cso_restore_aux_vertex_buffer_slot(cso); cso_restore_stream_outputs(cso); if (write_stencil) { cso_restore_depth_stencil_alpha(cso); diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawtex.c b/mesalib/src/mesa/state_tracker/st_cb_drawtex.c index e87de4406..269068da2 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawtex.c +++ b/mesalib/src/mesa/state_tracker/st_cb_drawtex.c @@ -228,7 +228,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, cso_save_vertex_shader(cso); cso_save_geometry_shader(cso); cso_save_vertex_elements(cso); - cso_save_vertex_buffers(cso); + cso_save_aux_vertex_buffer_slot(cso); { void *vs = lookup_shader(pipe, numAttribs, @@ -266,6 +266,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, util_draw_vertex_buffer(pipe, cso, vbuffer, + cso_get_aux_vertex_buffer_slot(cso), offset, /* offset */ PIPE_PRIM_TRIANGLE_FAN, 4, /* verts */ @@ -279,7 +280,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, cso_restore_vertex_shader(cso); cso_restore_geometry_shader(cso); cso_restore_vertex_elements(cso); - cso_restore_vertex_buffers(cso); + cso_restore_aux_vertex_buffer_slot(cso); cso_restore_stream_outputs(cso); } diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c index da361d887..69bd50336 100644 --- a/mesalib/src/mesa/state_tracker/st_context.c +++ b/mesalib/src/mesa/state_tracker/st_context.c @@ -173,7 +173,8 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe, memset(&st->velems_util_draw[i], 0, sizeof(struct pipe_vertex_element)); st->velems_util_draw[i].src_offset = i * 4 * sizeof(float); st->velems_util_draw[i].instance_divisor = 0; - st->velems_util_draw[i].vertex_buffer_index = 0; + st->velems_util_draw[i].vertex_buffer_index = + cso_get_aux_vertex_buffer_slot(st->cso_context); st->velems_util_draw[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; } diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h index c85d09cb5..2cc52773e 100644 --- a/mesalib/src/mesa/state_tracker/st_context.h +++ b/mesalib/src/mesa/state_tracker/st_context.h @@ -188,6 +188,9 @@ struct st_context int force_msaa; void *winsys_drawable_handle; + /* The number of vertex buffers from the last call of validate_arrays. */ + unsigned last_num_vbuffers; + /* Active render condition. */ struct pipe_query *render_condition; unsigned condition_mode; diff --git a/mesalib/src/mesa/state_tracker/st_draw_feedback.c b/mesalib/src/mesa/state_tracker/st_draw_feedback.c index a6c7d0eec..ae87fb28d 100644 --- a/mesalib/src/mesa/state_tracker/st_draw_feedback.c +++ b/mesalib/src/mesa/state_tracker/st_draw_feedback.c @@ -205,7 +205,7 @@ st_feedback_draw_vbo(struct gl_context *ctx, #endif } - draw_set_vertex_buffers(draw, vp->num_inputs, vbuffers); + draw_set_vertex_buffers(draw, 0, vp->num_inputs, vbuffers); draw_set_vertex_elements(draw, vp->num_inputs, velements); memset(&ibuffer, 0, sizeof(ibuffer)); @@ -264,5 +264,5 @@ st_feedback_draw_vbo(struct gl_context *ctx, draw_set_mapped_vertex_buffer(draw, attr, NULL); pipe_resource_reference(&vbuffers[attr].buffer, NULL); } - draw_set_vertex_buffers(draw, 0, 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 0560f3a8a..887700568 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -377,6 +377,8 @@ void st_init_extensions(struct st_context *st) /* GL_NV_point_sprite is not supported by gallium because we don't * support the GL_POINT_SPRITE_R_MODE_NV option. */ { o(MESA_texture_array), PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS }, + + { o(OES_standard_derivatives), PIPE_CAP_SM3 } }; /* Required: render target and sampler support */ @@ -479,7 +481,6 @@ void st_init_extensions(struct st_context *st) * Extensions that are supported by all Gallium drivers: */ ctx->Extensions.ARB_ES2_compatibility = GL_TRUE; - ctx->Extensions.ARB_copy_buffer = GL_TRUE; ctx->Extensions.ARB_draw_elements_base_vertex = GL_TRUE; ctx->Extensions.ARB_explicit_attrib_location = GL_TRUE; ctx->Extensions.ARB_fragment_coord_conventions = GL_TRUE; @@ -498,7 +499,6 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.ARB_texture_storage = GL_TRUE; ctx->Extensions.ARB_vertex_program = GL_TRUE; ctx->Extensions.ARB_vertex_shader = GL_TRUE; - ctx->Extensions.ARB_window_pos = GL_TRUE; ctx->Extensions.EXT_blend_color = GL_TRUE; ctx->Extensions.EXT_blend_func_separate = GL_TRUE; @@ -522,7 +522,6 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.NV_blend_square = GL_TRUE; ctx->Extensions.NV_fog_distance = GL_TRUE; - ctx->Extensions.NV_texgen_reflection = GL_TRUE; ctx->Extensions.NV_texture_env_combine4 = GL_TRUE; ctx->Extensions.NV_texture_rectangle = GL_TRUE; @@ -637,4 +636,10 @@ void st_init_extensions(struct st_context *st) } if (st->options.force_glsl_extensions_warn) ctx->Const.ForceGLSLExtensionsWarn = 1; + + ctx->Const.MinMapBufferAlignment = + screen->get_param(screen, PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT); + if (ctx->Const.MinMapBufferAlignment >= 64) { + ctx->Extensions.ARB_map_buffer_alignment = GL_TRUE; + } } |